1#!/usr/bin/env python3
2#
3#   Copyright 2018 - The Android Open Source Project
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16from acts.controllers.relay_lib.generic_relay_device import GenericRelayDevice
17from acts.controllers.relay_lib.helpers import validate_key
18
19
20class BluetoothRelayDevice(GenericRelayDevice):
21    """A base class for bluetooth devices.
22
23    This base class is similar to GenericRelayDevice, but requires a mac_address
24    to be set from within the config taken in. This helps with type checking
25    for use of relays against bluetooth utils.
26    """
27    def __init__(self, config, relay_rig):
28        GenericRelayDevice.__init__(self, config, relay_rig)
29
30        self.mac_address = validate_key('mac_address', config, str,
31                                        self.__class__.__name__)
32
33    def get_mac_address(self):
34        """Returns the mac address of this device."""
35        return self.mac_address
36
37