Example #1
0
def gattc_wid_hdl_multiple_indications(wid, description, test_case_name):
    global indication_subbed_already
    if wid == 99:
        log("%s, %r, %r, %s", gatt_wid_hdl.__name__, wid, description,
            test_case_name)
        pattern = re.compile("'([0-9a-fA-F]+)'")
        params = pattern.findall(description)
        if not params:
            logging.error("parsing error")
            return False

        handle = params[0]

        btp.gattc_cfg_indicate(btp.pts_addr_type_get(), btp.pts_addr_get(), 1,
                               handle)

        if not indication_subbed_already:
            indication_subbed_already = True
        else:
            btp.gattc_notification_ev(btp.pts_addr_get(),
                                      btp.pts_addr_type_get(), 2)
            btp.gattc_notification_ev(btp.pts_addr_get(),
                                      btp.pts_addr_type_get(), 2)
        return True

    module = sys.modules[__name__]

    try:
        handler = getattr(module, "hdl_wid_%d" % wid)
        return handler(WIDParams(wid, description, test_case_name))
    except AttributeError:
        return gatt_wid_hdl(wid, description, test_case_name)
Example #2
0
def hdl_wid_99(desc):
    pattern = re.compile("'([0-9a-fA-F]+)'")
    params = pattern.findall(desc)
    if not params:
        logging.error("parsing error")
        return False

    handle = params[0]

    btp.gattc_cfg_indicate(btp.pts_addr_type_get(), btp.pts_addr_get(), 1,
                           handle)

    btp.gattc_notification_ev(btp.pts_addr_get(), btp.pts_addr_type_get(), 2)

    return True
Example #3
0
    def test_btp_GATT_CL_GAI_1(self):
        """
        Verify that a Generic Attribute Profile client can receive
        a Characteristic Value Notification and report that to the Upper Tester.
        """

        connection_procedure(self, central=self.iut1, peripheral=self.iut2)

        db = GattDB()
        btp.gattc_disc_chrc_uuid(self.iut1, self.iut2.stack.gap.iut_addr_get(),
                                 0x0001, 0xffff, PTS_DB.CHR_NOTIFY)
        btp.gattc_disc_chrc_uuid_rsp(self.iut1, db)
        db.print_db()

        chr = db.find_chr_by_uuid(PTS_DB.CHR_NOTIFY)
        self.assertIsNotNone(chr)
        end_hdl = db.find_characteristic_end(chr.handle)
        self.assertIsNotNone(end_hdl)

        btp.gattc_disc_all_desc(self.iut1, self.iut2.stack.gap.iut_addr_get(),
                                chr.value_handle + 1, end_hdl)
        btp.gattc_disc_all_desc_rsp(self.iut1, db)
        db.print_db()

        dsc = db.find_dsc_by_uuid(UUID.CCC)
        self.assertIsNotNone(dsc)

        future_iut1 = btp.gattc_notification_ev(self.iut1)

        btp.gattc_cfg_indicate(self.iut1, self.iut2.stack.gap.iut_addr_get(),
                               1, dsc.handle)

        wait_futures([future_iut1], timeout=EV_TIMEOUT)
        result = future_iut1.result()

        self.assertTrue(
            verify_notification_ev(result, self.iut2.stack.gap.iut_addr_get(),
                                   0x02, chr.value_handle))

        disconnection_procedure(self, central=self.iut1, peripheral=self.iut2)
Example #4
0
def hdl_wid_90(desc):
    btp.gattc_notification_ev(btp.pts_addr_get(), btp.pts_addr_type_get(), 1)
    return True