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)
示例#2
0
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)
示例#3
0
    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
示例#4
0
def hdl_wid_14(desc):
    btp.gap_stop_discov()
    return btp.check_discov_results(discovered=True)
示例#5
0
def hdl_wid_204(desc):
    btp.gap_start_discov(type='passive', mode='observe')
    sleep(10)
    btp.gap_stop_discov()
    return btp.check_discov_results()
示例#6
0
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()
示例#7
0
def hdl_wid_11(desc):
    btp.gap_stop_discov()
    return btp.check_discov_results(discovered=False)
示例#8
0
def hdl_wid_4(desc):
    sleep(10)  # Give some time to discover devices
    btp.gap_stop_discov()
    return btp.check_discov_results()
示例#9
0
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)
示例#10
0
def hdl_wid_14(_: WIDParams):
    btp.gap_stop_discov()
    return btp.check_discov_results(discovered=True)
示例#11
0
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)