def test_btp_GAP_DISC_GENM_1(self): """ Verify the IUT1 in General Discoverable Mode and the Undirected Connectable Mode can be discovered by a device performing the General Discovery Procedure. The IUT1 is operating in the Peripheral role. """ btp.gap_set_conn(self.iut2) btp.gap_set_gendiscov(self.iut2) uuid = os.urandom(2) btp.gap_adv_ind_on(self.iut2, ad=[(AdType.uuid16_some, uuid)]) def verify_f(args): return find_adv_by_uuid(args, btp.btp2uuid(len(uuid), uuid)) btp.gap_start_discov(self.iut1) future = btp.gap_device_found_ev(self.iut1, verify_f) wait_futures([future], timeout=EV_TIMEOUT) btp.gap_stop_discov(self.iut1) found = future.result() self.assertIsNotNone(found)
def connection_procedure(testcase, central, peripheral): btp.gap_set_conn(peripheral) btp.gap_set_gendiscov(peripheral) uuid = os.urandom(2) btp.gap_adv_ind_on(peripheral, ad=[(AdType.uuid16_some, uuid)]) def verify_f(args): return find_adv_by_uuid(args, btp.btp2uuid(len(uuid), uuid)) btp.gap_start_discov(central) future = btp.gap_device_found_ev(central, verify_f) wait_futures([future], timeout=EV_TIMEOUT) btp.gap_stop_discov(central) found = future.result() testcase.assertIsNotNone(found) peripheral.stack.gap.iut_addr_set(found.addr) def verify_central(args): return verify_address(args, found.addr) future_central = btp.gap_connected_ev(central, verify_central) future_peripheral = btp.gap_connected_ev(peripheral) btp.gap_conn(central, peripheral.stack.gap.iut_addr_get()) wait_futures([future_central, future_peripheral], timeout=EV_TIMEOUT) testcase.assertTrue(central.stack.gap.is_connected()) testcase.assertTrue(peripheral.stack.gap.is_connected()) central_addr, _ = future_peripheral.result() central.stack.gap.iut_addr_set(central_addr)
def test_Advertising_Data(self, iut, valid): def verify_f(args): return find_adv_by_addr(args, self.config.tester_addr) btp.gap_start_discov(iut) future = btp.gap_device_found_ev(iut, verify_f) try: wait_futures([future], timeout=5) btp.gap_stop_discov(iut) found = future.result() assert found except TimeoutError as e: btp.gap_stop_discov(iut) if valid: raise e
def hdl_wid_23(desc): btp.gap_start_discov() return True
def hdl_wid_204(desc): btp.gap_start_discov(type='passive', mode='observe') sleep(10) btp.gap_stop_discov() return btp.check_discov_results()
def hdl_wid_13(desc): btp.gap_start_discov(mode='limited') return True
def hdl_wid_169(desc): btp.gap_start_discov(type='active', mode='observe') return True
def hdl_wid_12(desc): btp.gap_start_discov(type='passive', mode='observe') return True
def hdl_wid_157(desc): btp.gap_start_discov(transport='le', type='active', mode='observe') sleep(10) # Give some time to discover devices btp.gap_stop_discov() return btp.check_discov_results()
def hdl_wid_157(desc): btp.gap_start_discov(transport='le', type='active', mode='observe') sleep(10) # Give some time to discover devices btp.gap_stop_discov() report, response = re.findall(r'[0-9]{62}', desc) return btp.check_scan_rep_and_rsp(report, response)
def hdl_wid_13(_: WIDParams): btp.gap_start_discov(mode='limited') return True
def hdl_wid_169(_: WIDParams): btp.gap_start_discov(discov_type='active', mode='observe') return True
def hdl_wid_157(params: WIDParams): btp.gap_start_discov(transport='le', discov_type='active', mode='observe') sleep(10) # Give some time to discover devices btp.gap_stop_discov() report, response = re.findall(r'[a-fA-F0-9]{62}', params.description) return btp.check_scan_rep_and_rsp(report, response)
def hdl_wid_23(_: WIDParams): btp.gap_start_discov() return True