Esempio n. 1
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)
Esempio n. 2
0
def hdl_wid_115(desc):
    stack = get_stack()

    btp.gap_set_conn()
    btp.gap_set_gendiscov()
    btp.gap_adv_ind_on(ad=stack.gap.ad)
    return True
    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)
Esempio n. 4
0
def hdl_wid_115(_: WIDParams):
    stack = get_stack()

    btp.gap_set_conn()
    btp.gap_set_gendiscov()
    btp.gap_adv_ind_on(ad=stack.gap.ad, sd=stack.gap.sd)
    return True
Esempio n. 5
0
def hdl_wid_9(desc):
    stack = get_stack()

    btp.gap_set_conn()

    btp.gap_adv_ind_on(ad=stack.gap.ad, sd=stack.gap.sd)
    return True
Esempio n. 6
0
def hdl_wid_91(_: WIDParams):
    stack = get_stack()

    btp.gap_set_conn()

    btp.gap_adv_ind_on(ad=stack.gap.ad)

    return True
Esempio n. 7
0
def hdl_wid_60(desc):
    btp.gap_set_conn()
    btp.gap_set_gendiscov()

    bd_addr = btp.pts_addr_get()
    bd_addr_type = btp.pts_addr_type_get()

    btp.gap_direct_adv_on(bd_addr, bd_addr_type)

    return True
Esempio n. 8
0
def hdl_wid_50(desc):
    stack = get_stack()

    btp.gap_adv_off()
    btp.gap_set_limdiscov()
    btp.gap_set_conn()

    btp.gap_adv_ind_on(ad=stack.gap.ad)

    return True
Esempio n. 9
0
def hdl_wid_15(_: WIDParams):
    """
    Implements: TSC_MMI_tester_enable_connection
    description: Action: Place the IUT in connectable mode.
    """
    stack = btp.get_stack()
    btp.gap_set_conn()
    btp.gap_set_gendiscov()
    btp.gap_adv_ind_on(ad=stack.gap.ad)

    return True
Esempio n. 10
0
def hdl_wid_15(desc):
    """
    Implements: TSC_MMI_tester_enable_connection
    :param desc: Action: Place the IUT in connectable mode.
    :return:
    """
    btp.gap_set_conn()
    btp.gap_set_gendiscov()
    btp.gap_adv_ind_on()

    return True
Esempio n. 11
0
def hdl_wid_56(desc):
    """
    Implements: TSC_MMI_tester_enable_connection
    :param desc: Action: Place the IUT in connectable mode.
    :return:
    """
    stack = btp.get_stack()
    btp.gap_set_conn()
    btp.gap_set_gendiscov()
    btp.gap_adv_ind_on(ad=stack.gap.ad)

    return True
Esempio n. 12
0
    def test_SMP_Server_SC_Passkey_Entry(self, iut, valid):
        btp.gap_set_io_cap(iut, IOCap.keyboard_display)
        btp.gap_set_conn(iut)
        btp.gap_set_gendiscov(iut)
        btp.gap_adv_ind_on(iut)

        future = btp.gap_passkey_entry_req_ev(iut)
        try:
            wait_futures([future], timeout=EV_TIMEOUT)
            btp.gap_passkey_entry_rsp(iut, self.config.tester_addr,
                                      self.config.tester_passkey)
        except (TimeoutError, BTPErrorInvalidStatus) as e:
            if valid:
                raise e
Esempio n. 13
0
    def test_SMP_Server_SC_Numeric_Comparison(self, iut, valid):
        btp.gap_set_io_cap(iut, IOCap.keyboard_display)
        btp.gap_set_conn(iut)
        btp.gap_set_gendiscov(iut)
        btp.gap_adv_ind_on(iut)

        future = btp.gap_passkey_confirm_req_ev(iut)
        try:
            wait_futures([future], timeout=EV_TIMEOUT)
            results = future.result()
            pk_iut = results[1]
            assert (pk_iut is not None)
            btp.gap_passkey_confirm(iut, self.config.tester_addr, 1)
        except (TimeoutError, BTPErrorInvalidStatus) as e:
            if valid:
                raise e
Esempio n. 14
0
def hdl_wid_91(desc):
    stack = get_stack()

    ad = []
    sd = []

    btp.gap_set_conn()

    if stack.gap.name:
        ad.append((AdType.name_short, hexlify(stack.gap.name)))

    if stack.gap.manufacturer_data:
        sd.append((AdType.manufacturer_data, stack.gap.manufacturer_data))

    btp.gap_adv_ind_on(ad=ad, sd=sd)
    return True
Esempio n. 15
0
def hdl_wid_90(desc):
    stack = get_stack()

    ad = []
    sd = []

    if stack.gap.name:
        ad.append((AdType.name_short, hexlify(stack.gap.name)))

    if stack.gap.manufacturer_data:
        sd.append((AdType.manufacturer_data, stack.gap.manufacturer_data))

    btp.gap_adv_off()
    btp.gap_read_ctrl_info()
    btp.gap_set_conn()
    btp.gap_set_gendiscov()
    btp.gap_adv_ind_on(ad=ad, sd=sd)
    return True
Esempio n. 16
0
def hdl_wid_20001(_: WIDParams):
    stack = btp.get_stack()
    btp.gap_set_conn()
    btp.gap_set_gendiscov()
    btp.gap_adv_ind_on(ad=stack.gap.ad)
    return True
Esempio n. 17
0
 def test_SMP_Server_SC_Just_Works(self, iut, valid):
     btp.gap_set_io_cap(iut, IOCap.keyboard_display)
     btp.gap_set_conn(iut)
     btp.gap_set_gendiscov(iut)
     btp.gap_adv_ind_on(iut)
def hdl_wid_1(desc):
    btp.gap_set_conn()
    btp.gap_set_gendiscov()
    btp.gap_adv_ind_on()
    return True
Esempio n. 19
0
 def test_ATT_Server(self, iut, valid):
     btp.gap_set_conn(iut)
     btp.gap_set_gendiscov(iut)
     btp.gap_adv_ind_on(iut)
Esempio n. 20
0
def hdl_wid_20001(desc):
    btp.gap_set_conn()
    btp.gap_adv_ind_on()
    return True
def test_ATT_Server(iut, valid):
    test_case_setup(iut)
    btp.gap_set_conn(iut)
    btp.gap_set_gendiscov(iut)
    btp.gap_adv_ind_on(iut)