1#!/usr/bin/env python3 2# 3# Copyright 2021 - 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 17import logging 18 19from cert.closable import Closable 20from cert.closable import safeClose 21from cert.py_le_iso import PyLeIso 22import bluetooth_packets_python3 as bt_packets 23from bluetooth_packets_python3 import l2cap_packets 24 25 26class CertLeIso(Closable): 27 28 def __init__(self, device): 29 self._device = device 30 self._le_iso = PyLeIso(device) 31 32 def close(self): 33 logging.info("DUT: close") 34 self._le_iso.close() 35 36 def le_set_cig_parameters(self, cig_id, sdu_interval_m_to_s, sdu_interval_s_to_m, peripherals_clock_accuracy, 37 packing, framing, max_transport_latency_m_to_s, max_transport_latency_s_to_m, cis_id, 38 max_sdu_m_to_s, max_sdu_s_to_m, phy_m_to_s, phy_s_to_m, rtn_m_to_s, rtn_s_to_m): 39 return self._le_iso.le_set_cig_parameters( 40 cig_id, sdu_interval_m_to_s, sdu_interval_s_to_m, peripherals_clock_accuracy, packing, framing, 41 max_transport_latency_m_to_s, max_transport_latency_s_to_m, cis_id, max_sdu_m_to_s, max_sdu_s_to_m, 42 phy_m_to_s, phy_s_to_m, rtn_m_to_s, rtn_s_to_m) 43 44 def le_set_cig_parameters_test(self, cig_id, sdu_interval_m_to_s, sdu_interval_s_to_m, ft_m_to_s, ft_s_to_m, 45 iso_interval, peripherals_clock_accuracy, packing, framing, 46 max_transport_latency_m_to_s, max_transport_latency_s_to_m, cis_configs): 47 return self._le_iso.le_set_cig_parameters_test(cig_id, sdu_interval_m_to_s, sdu_interval_s_to_m, ft_m_to_s, 48 ft_s_to_m, iso_interval, peripherals_clock_accuracy, packing, 49 framing, max_transport_latency_m_to_s, 50 max_transport_latency_s_to_m, cis_configs) 51 52 def wait_le_set_cig_parameters_complete(self): 53 return self._le_iso.wait_le_set_cig_parameters_complete() 54 55 def le_cretate_cis(self, cis_and_acl_handle_array): 56 self._le_iso.le_create_cis(cis_and_acl_handle_array) 57 58 def wait_le_cis_established(self): 59 return self._le_iso.wait_le_cis_established() 60