Ejemplo n.º 1
0
    def test_btp_GATT_CL_GAD_3(self):
        """
        Verify that a Generic Attribute Profile client can find include service
        declarations within a specified service definition on a server.
        """

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

        btp.gattc_disc_prim_svcs(self.iut1, self.iut2.stack.gap.iut_addr_get())

        db = GattDB()
        btp.gattc_disc_prim_svcs_rsp(self.iut1, db)

        for svc in db.get_services():
            start_hdl, end_hdl = svc.handle, svc.end_hdl

            btp.gattc_find_included(self.iut1,
                                    self.iut2.stack.gap.iut_addr_get(),
                                    start_hdl, end_hdl)

            btp.gattc_find_included_rsp(self.iut1, db)

        db.print_db()

        self.assertIsNotNone(db.find_inc_svc_by_uuid(PTS_DB.INC_SVC))

        disconnection_procedure(self, central=self.iut1, peripheral=self.iut2)
Ejemplo n.º 2
0
    def test_ATT_Client_Discover_Characteristic_Descriptors(self, iut, valid):
        btp.gap_conn(iut, self.config.tester_addr)
        btp.gap_wait_for_connection(iut)

        db = GattDB()
        btp.gattc_disc_prim_svcs(iut, self.config.tester_addr)
        btp.gattc_disc_prim_svcs_rsp(iut, db)

        for svc in db.get_services():
            start, end = svc.handle, svc.end_hdl

            btp.gattc_disc_all_chrc(iut, self.config.tester_addr, start, end)
            btp.gattc_disc_all_chrc_rsp(iut, db)

        for char in db.get_characteristics():
            start_hdl = char.value_handle + 1
            end_hdl = db.find_characteristic_end(char.handle)
            if not end_hdl:
                # There are no descriptors there so continue
                continue

            # Defensics expects to receive a Request with start handle == end handle
            if end_hdl == 0xffff:
                end_hdl = start_hdl

            btp.gattc_disc_all_desc(iut, self.config.tester_addr, start_hdl,
                                    end_hdl)
            tuple_hdr, tuple_data = iut.btp_worker.read()
            try:
                btp.btp_hdr_check(tuple_hdr, defs.BTP_SERVICE_ID_GATT,
                                  defs.GATT_DISC_ALL_DESC)
            except BTPErrorInvalidStatus:
                pass