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. 16""" 17Device Details: 18https://www.logitech.com/en-in/product/bluetooth-audio-adapter#specification-tabular 19""" 20import enum 21 22from acts.controllers.relay_lib.devices.bluetooth_relay_device import BluetoothRelayDevice 23 24PAIRING_MODE_WAIT_TIME = 5 25WAIT_TIME = 0.1 26 27 28class Buttons(enum.Enum): 29 POWER = 'Power' 30 PAIR = 'Pair' 31 32 33class LogitechAudioReceiver(BluetoothRelayDevice): 34 def __init__(self, config, relay_rig): 35 BluetoothRelayDevice.__init__(self, config, relay_rig) 36 self._ensure_config_contains_relays(button.value for button in Buttons) 37 38 def setup(self): 39 """Sets all relays to their default state (off).""" 40 BluetoothRelayDevice.setup(self) 41 42 def clean_up(self): 43 """Sets all relays to their default state (off).""" 44 BluetoothRelayDevice.clean_up(self) 45 46 def power_on(self): 47 """Power on relay.""" 48 self.relays[Buttons.POWER.value].set_nc() 49 50 def enter_pairing_mode(self): 51 """Sets relay in paring mode.""" 52 self.relays[Buttons.PAIR.value].set_nc() 53