From fb07ec06d8ee813d62cc84914064fcca66ec713b Mon Sep 17 00:00:00 2001 From: Piotr Narajowski Date: Wed, 16 Oct 2024 10:56:34 +0200 Subject: [PATCH] btp: Apply proper naming convention for btp commands and events This commit changes naming convention of variables that are opcodes for btp commands and events. This is needed for socat log parser, but will also enhance clarity in files like defs.py, especially for services like GAP for which many service related variables share the same value. For now changes applied only for following svcs: Core, Gap, Gatt, GattCL, L2CAP. --- autopts/client.py | 2 +- autopts/ptsprojects/bluez/iutctl.py | 2 +- autopts/ptsprojects/mynewt/iutctl.py | 2 +- autopts/ptsprojects/stack/layers/core.py | 6 +- autopts/ptsprojects/zephyr/iutctl.py | 6 +- autopts/pybtp/btp/btp.py | 84 +++---- autopts/pybtp/btp/core.py | 4 +- autopts/pybtp/btp/gap.py | 146 +++++------ autopts/pybtp/btp/gatt.py | 112 ++++----- autopts/pybtp/btp/gatt_cl.py | 76 +++--- autopts/pybtp/btp/l2cap.py | 36 +-- autopts/pybtp/defs.py | 301 ++++++++++++----------- tools/btpclient.py | 4 +- tools/generate_profile.py | 2 +- 14 files changed, 392 insertions(+), 391 deletions(-) diff --git a/autopts/client.py b/autopts/client.py index 4f537b9754..ad97c2ab80 100755 --- a/autopts/client.py +++ b/autopts/client.py @@ -1540,7 +1540,7 @@ def run_recovery(args, ptses): # mynewt project has not been refactored yet to reduce the number of # IUT board resets. if stack_inst.core: - stack_inst.core.event_received(defs.CORE_EV_IUT_READY, True) + stack_inst.core.event_received(defs.BTP_EV_CORE_IUT_READY, True) log('Recovery finished') diff --git a/autopts/ptsprojects/bluez/iutctl.py b/autopts/ptsprojects/bluez/iutctl.py index 1b28f08099..67aaed3df9 100644 --- a/autopts/ptsprojects/bluez/iutctl.py +++ b/autopts/ptsprojects/bluez/iutctl.py @@ -83,7 +83,7 @@ def wait_iut_ready_event(self): try: if (tuple_hdr.svc_id != defs.BTP_SERVICE_ID_CORE or - tuple_hdr.op != defs.CORE_EV_IUT_READY): + tuple_hdr.op != defs.BTP_EV_CORE_IUT_READY): raise BTPError("Failed to get ready event") except BTPError as err: log("Unexpected event received (%s), expected IUT ready!", err) diff --git a/autopts/ptsprojects/mynewt/iutctl.py b/autopts/ptsprojects/mynewt/iutctl.py index eff69fd6e6..be0968729d 100644 --- a/autopts/ptsprojects/mynewt/iutctl.py +++ b/autopts/ptsprojects/mynewt/iutctl.py @@ -165,7 +165,7 @@ def wait_iut_ready_event(self): try: if (tuple_hdr.svc_id != defs.BTP_SERVICE_ID_CORE or - tuple_hdr.op != defs.CORE_EV_IUT_READY): + tuple_hdr.op != defs.BTP_EV_CORE_IUT_READY): raise BTPError("Failed to get ready event") except BTPError as err: log("Unexpected event received (%s), expected IUT ready!", err) diff --git a/autopts/ptsprojects/stack/layers/core.py b/autopts/ptsprojects/stack/layers/core.py index b9be622cb4..809779f980 100644 --- a/autopts/ptsprojects/stack/layers/core.py +++ b/autopts/ptsprojects/stack/layers/core.py @@ -20,7 +20,7 @@ class CORE: def __init__(self): self.event_queues = { - defs.CORE_EV_IUT_READY: [], + defs.BTP_EV_CORE_IUT_READY: [], } def event_received(self, event_type, event_data_tuple): @@ -28,13 +28,13 @@ def event_received(self, event_type, event_data_tuple): def wait_iut_ready_ev(self, timeout, remove=True): return wait_for_queue_event( - self.event_queues[defs.CORE_EV_IUT_READY], + self.event_queues[defs.BTP_EV_CORE_IUT_READY], lambda *_: True, timeout, remove) def cleanup(self): for key in self.event_queues: - if key == defs.CORE_EV_IUT_READY: + if key == defs.BTP_EV_CORE_IUT_READY: # To pass IUT ready event between test cases continue diff --git a/autopts/ptsprojects/zephyr/iutctl.py b/autopts/ptsprojects/zephyr/iutctl.py index 5e6130f0c8..66905b9cbc 100644 --- a/autopts/ptsprojects/zephyr/iutctl.py +++ b/autopts/ptsprojects/zephyr/iutctl.py @@ -223,7 +223,7 @@ def wait_iut_ready_event(self, reset=True): ev = stack.core.wait_iut_ready_ev(30) # If the board has reset unexpectedly in the middle of a test case, # two IUT events may be received because of cleanup. - stack.core.event_queues[defs.CORE_EV_IUT_READY].clear() + stack.core.event_queues[defs.BTP_EV_CORE_IUT_READY].clear() if not ev: self.stop() raise Exception('IUT ready event NOT received!') @@ -241,7 +241,7 @@ def hw_reset(self): # test case, to avoid double reset let's use 'hw_reset' # only if it was not received, e.g. at the beginning of # the first test case. - if len(stack.core.event_queues[defs.CORE_EV_IUT_READY]) == 0: + if len(stack.core.event_queues[defs.BTP_EV_CORE_IUT_READY]) == 0: self.board.reset() def stop(self): @@ -258,7 +258,7 @@ def stop(self): if not self.gdb and self.board and \ stack.core and not get_global_end(): - stack.core.event_queues[defs.CORE_EV_IUT_READY].clear() + stack.core.event_queues[defs.BTP_EV_CORE_IUT_READY].clear() self.board.reset() # We have to wait for IUT ready event before we close socket diff --git a/autopts/pybtp/btp/btp.py b/autopts/pybtp/btp/btp.py index fa7db4d78f..f6a544ea03 100644 --- a/autopts/pybtp/btp/btp.py +++ b/autopts/pybtp/btp/btp.py @@ -53,7 +53,7 @@ def read_supp_svcs(): tuple_hdr, tuple_data = iutctl.btp_socket.read() btp_hdr_check(tuple_hdr, defs.BTP_SERVICE_ID_CORE, - defs.CORE_READ_SUPPORTED_SERVICES) + defs.BTP_CMD_CORE_READ_SUPPORTED_SERVICES) logging.debug("%s received %r %r", read_supp_svcs.__name__, tuple_hdr, tuple_data) @@ -61,84 +61,84 @@ def read_supp_svcs(): CORE = { - "gap_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "gap_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_GAP), - "gap_unreg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_UNREGISTER_SERVICE, + "gap_unreg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_UNREGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_GAP), - "gatt_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "gatt_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_GATT), - "gatt_unreg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_UNREGISTER_SERVICE, + "gatt_unreg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_UNREGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_GATT), - "l2cap_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "l2cap_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_L2CAP), - "l2cap_unreg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_UNREGISTER_SERVICE, + "l2cap_unreg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_UNREGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_L2CAP), - "mesh_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "mesh_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_MESH), - "mesh_unreg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_UNREGISTER_SERVICE, + "mesh_unreg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_UNREGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_MESH), - "mmdl_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "mmdl_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_MMDL), - "mmdl_unreg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_UNREGISTER_SERVICE, + "mmdl_unreg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_UNREGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_MMDL), - "gatt_cl_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "gatt_cl_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_GATTC), - "gatt_cl_unreg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_UNREGISTER_SERVICE, + "gatt_cl_unreg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_UNREGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_GATTC), - "vcs_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "vcs_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_VCS), - "vocs_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "vocs_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_VOCS), - "aics_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "aics_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_AICS), - "ias_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "ias_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_IAS), - "pacs_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "pacs_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_PACS), - "ascs_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "ascs_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_ASCS), - "bap_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "bap_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_BAP), - "has_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "has_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_HAS), - "csis_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "csis_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_CSIS), - "micp_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "micp_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_MICP), - "mics_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "mics_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_MICS), - "ccp_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "ccp_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_CCP), - "vcp_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "vcp_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_VCP), - "cas_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "cas_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_CAS), - "mcp_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "mcp_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_MCP), - "gmcs_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "gmcs_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_GMCS), - "hap_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "hap_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_HAP), - "cap_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "cap_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_CAP), - "csip_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "csip_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_CSIP), - "tbs_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "tbs_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_TBS), - "tmap_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "tmap_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_TMAP), - "ots_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "ots_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_OTS), - "pbp_reg": (defs.BTP_SERVICE_ID_CORE, defs.CORE_REGISTER_SERVICE, + "pbp_reg": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, defs.BTP_SERVICE_ID_PBP), # GENERATOR append 4 "read_supp_cmds": (defs.BTP_SERVICE_ID_CORE, - defs.CORE_READ_SUPPORTED_COMMANDS, + defs.BTP_CMD_CORE_READ_SUPPORTED_COMMANDS, defs.BTP_INDEX_NONE, ""), "read_supp_svcs": (defs.BTP_SERVICE_ID_CORE, - defs.CORE_READ_SUPPORTED_SERVICES, + defs.BTP_CMD_CORE_READ_SUPPORTED_SERVICES, defs.BTP_INDEX_NONE, ""), - "log_message": (defs.BTP_SERVICE_ID_CORE, defs.CORE_LOG_MESSAGE, + "log_message": (defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_LOG_MESSAGE, defs.BTP_INDEX_NONE), } @@ -720,7 +720,7 @@ def core_reg_svc_rsp_succ(): iutctl = get_iut() expected_frame = ((defs.BTP_SERVICE_ID_CORE, - defs.CORE_REGISTER_SERVICE, + defs.BTP_CMD_CORE_REGISTER_SERVICE, defs.BTP_INDEX_NONE, 0), (b'',)) @@ -741,7 +741,7 @@ def core_unreg_svc_rsp_succ(): iutctl = get_iut() expected_frame = ((defs.BTP_SERVICE_ID_CORE, - defs.CORE_UNREGISTER_SERVICE, + defs.BTP_CMD_CORE_UNREGISTER_SERVICE, defs.BTP_INDEX_NONE, 0), (b'',)) @@ -768,7 +768,7 @@ def core_log_message(message): tuple_hdr, tuple_data = iutctl.btp_socket.read() logging.debug("received %r %r", tuple_hdr, tuple_data) - btp_hdr_check(tuple_hdr, defs.BTP_SERVICE_ID_CORE, defs.CORE_LOG_MESSAGE) + btp_hdr_check(tuple_hdr, defs.BTP_SERVICE_ID_CORE, defs.BTP_CMD_CORE_LOG_MESSAGE) def btp2uuid(uuid_len, uu): diff --git a/autopts/pybtp/btp/core.py b/autopts/pybtp/btp/core.py index 02cac2a694..645c46f501 100644 --- a/autopts/pybtp/btp/core.py +++ b/autopts/pybtp/btp/core.py @@ -27,9 +27,9 @@ def core_iut_ready_ev(core, data, data_len): logging.debug("%s", core_iut_ready_ev.__name__) - core.event_received(defs.CORE_EV_IUT_READY, True) + core.event_received(defs.BTP_EV_CORE_IUT_READY, True) CORE_EV = { - defs.CORE_EV_IUT_READY: core_iut_ready_ev, + defs.BTP_EV_CORE_IUT_READY: core_iut_ready_ev, } diff --git a/autopts/pybtp/btp/gap.py b/autopts/pybtp/btp/gap.py index c16e679234..c38f5bcb0f 100644 --- a/autopts/pybtp/btp/gap.py +++ b/autopts/pybtp/btp/gap.py @@ -29,108 +29,108 @@ set_lt3_addr GAP = { - "start_adv": (defs.BTP_SERVICE_ID_GAP, defs.GAP_START_ADVERTISING, + "start_adv": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_START_ADVERTISING, CONTROLLER_INDEX), - "stop_adv": (defs.BTP_SERVICE_ID_GAP, defs.GAP_STOP_ADVERTISING, + "stop_adv": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_STOP_ADVERTISING, CONTROLLER_INDEX, ""), - "conn": (defs.BTP_SERVICE_ID_GAP, defs.GAP_CONNECT, CONTROLLER_INDEX), - "pair": (defs.BTP_SERVICE_ID_GAP, defs.GAP_PAIR, CONTROLLER_INDEX), - "unpair": (defs.BTP_SERVICE_ID_GAP, defs.GAP_UNPAIR, CONTROLLER_INDEX), - "disconn": (defs.BTP_SERVICE_ID_GAP, defs.GAP_DISCONNECT, + "conn": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_CONNECT, CONTROLLER_INDEX), + "pair": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_PAIR, CONTROLLER_INDEX), + "unpair": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_UNPAIR, CONTROLLER_INDEX), + "disconn": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_DISCONNECT, CONTROLLER_INDEX), - "set_io_cap": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_IO_CAP, + "set_io_cap": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_IO_CAP, CONTROLLER_INDEX), - "set_conn": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_CONNECTABLE, + "set_conn": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_CONNECTABLE, CONTROLLER_INDEX, 1), - "set_nonconn": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_CONNECTABLE, + "set_nonconn": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_CONNECTABLE, CONTROLLER_INDEX, 0), - "set_nondiscov": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_DISCOVERABLE, + "set_nondiscov": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_DISCOVERABLE, CONTROLLER_INDEX, defs.GAP_NON_DISCOVERABLE), - "set_gendiscov": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_DISCOVERABLE, + "set_gendiscov": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_DISCOVERABLE, CONTROLLER_INDEX, defs.GAP_GENERAL_DISCOVERABLE), - "set_limdiscov": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_DISCOVERABLE, + "set_limdiscov": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_DISCOVERABLE, CONTROLLER_INDEX, defs.GAP_LIMITED_DISCOVERABLE), - "set_powered_on": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_POWERED, + "set_powered_on": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_POWERED, CONTROLLER_INDEX, 1), - "set_powered_off": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_POWERED, + "set_powered_off": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_POWERED, CONTROLLER_INDEX, 0), - "set_bondable_on": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_BONDABLE, + "set_bondable_on": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_BONDABLE, CONTROLLER_INDEX, 1), - "set_bondable_off": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_BONDABLE, + "set_bondable_off": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_BONDABLE, CONTROLLER_INDEX, 0), "start_discov": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_START_DISCOVERY, CONTROLLER_INDEX), - "stop_discov": (defs.BTP_SERVICE_ID_GAP, defs.GAP_STOP_DISCOVERY, + defs.BTP_CMD_GAP_START_DISCOVERY, CONTROLLER_INDEX), + "stop_discov": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_STOP_DISCOVERY, CONTROLLER_INDEX, ""), "read_ctrl_info": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_READ_CONTROLLER_INFO, + defs.BTP_CMD_GAP_READ_CONTROLLER_INFO, CONTROLLER_INDEX, ""), "passkey_entry_rsp": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PASSKEY_ENTRY, + defs.BTP_CMD_GAP_PASSKEY_ENTRY, CONTROLLER_INDEX), "passkey_confirm_rsp": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PASSKEY_CONFIRM, + defs.BTP_CMD_GAP_PASSKEY_CONFIRM, CONTROLLER_INDEX), - "start_direct_adv": (defs.BTP_SERVICE_ID_GAP, defs.GAP_START_DIRECT_ADV, + "start_direct_adv": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_START_DIRECT_ADV, CONTROLLER_INDEX), "conn_param_update": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_CONN_PARAM_UPDATE, + defs.BTP_CMD_GAP_CONN_PARAM_UPDATE, CONTROLLER_INDEX), "pairing_consent_rsp": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PAIRING_CONSENT_RSP, + defs.BTP_CMD_GAP_PAIRING_CONSENT_RSP, CONTROLLER_INDEX), "oob_legacy_set_data": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_OOB_LEGACY_SET_DATA, + defs.BTP_CMD_GAP_OOB_LEGACY_SET_DATA, CONTROLLER_INDEX), "oob_sc_get_local_data": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_OOB_SC_GET_LOCAL_DATA, + defs.BTP_CMD_GAP_OOB_SC_GET_LOCAL_DATA, CONTROLLER_INDEX), "oob_sc_set_remote_data": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_OOB_SC_SET_REMOTE_DATA, + defs.BTP_CMD_GAP_OOB_SC_SET_REMOTE_DATA, CONTROLLER_INDEX), - "set_mitm_on": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_MITM, + "set_mitm_on": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_MITM, CONTROLLER_INDEX, 1), - "set_mitm_off": (defs.BTP_SERVICE_ID_GAP, defs.GAP_SET_MITM, + "set_mitm_off": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_SET_MITM, CONTROLLER_INDEX, 0), - "reset": (defs.BTP_SERVICE_ID_GAP, defs.GAP_RESET, CONTROLLER_INDEX, ""), + "reset": (defs.BTP_SERVICE_ID_GAP, defs.BTP_CMD_GAP_RESET, CONTROLLER_INDEX, ""), "set_filter_accept_list": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_SET_FILTER_ACCEPT_LIST, CONTROLLER_INDEX), + defs.BTP_CMD_GAP_SET_FILTER_ACCEPT_LIST, CONTROLLER_INDEX), "set_privacy_on": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_SET_PRIVACY, CONTROLLER_INDEX, 1), + defs.BTP_CMD_GAP_SET_PRIVACY, CONTROLLER_INDEX, 1), "set_privacy_off": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_SET_PRIVACY, CONTROLLER_INDEX, 0), + defs.BTP_CMD_GAP_SET_PRIVACY, CONTROLLER_INDEX, 0), "set_sc_only_on": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_SET_SC_ONLY, CONTROLLER_INDEX, 1), + defs.BTP_CMD_GAP_SET_SC_ONLY, CONTROLLER_INDEX, 1), "set_sc_only_off": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_SET_SC_ONLY, CONTROLLER_INDEX, 0), + defs.BTP_CMD_GAP_SET_SC_ONLY, CONTROLLER_INDEX, 0), "set_sc_on": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_SET_SC, CONTROLLER_INDEX, 1), + defs.BTP_CMD_GAP_SET_SC, CONTROLLER_INDEX, 1), "set_sc_off": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_SET_SC, CONTROLLER_INDEX, 0), + defs.BTP_CMD_GAP_SET_SC, CONTROLLER_INDEX, 0), "set_min_enc_key_size": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_SET_MIN_ENC_KEY_SIZE, CONTROLLER_INDEX), + defs.BTP_CMD_GAP_SET_MIN_ENC_KEY_SIZE, CONTROLLER_INDEX), "set_extend_advertising_on": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_SET_EXTENDED_ADVERTISING, CONTROLLER_INDEX, 1), + defs.BTP_CMD_GAP_SET_EXTENDED_ADVERTISING, CONTROLLER_INDEX, 1), "set_extend_advertising_off": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_SET_EXTENDED_ADVERTISING, CONTROLLER_INDEX, 0), + defs.BTP_CMD_GAP_SET_EXTENDED_ADVERTISING, CONTROLLER_INDEX, 0), "padv_configure": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PADV_CONFIGURE, CONTROLLER_INDEX), + defs.BTP_CMD_GAP_PADV_CONFIGURE, CONTROLLER_INDEX), "padv_start": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PADV_START, CONTROLLER_INDEX), + defs.BTP_CMD_GAP_PADV_START, CONTROLLER_INDEX), "padv_stop": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PADV_STOP, CONTROLLER_INDEX, ""), + defs.BTP_CMD_GAP_PADV_STOP, CONTROLLER_INDEX, ""), "padv_set_data": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PADV_SET_DATA, CONTROLLER_INDEX), + defs.BTP_CMD_GAP_PADV_SET_DATA, CONTROLLER_INDEX), "padv_create_sync": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PADV_CREATE_SYNC, CONTROLLER_INDEX), + defs.BTP_CMD_GAP_PADV_CREATE_SYNC, CONTROLLER_INDEX), "padv_sync_transfer_set_info": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PADV_SYNC_TRANSFER_SET_INFO, + defs.BTP_CMD_GAP_PADV_SYNC_TRANSFER_SET_INFO, CONTROLLER_INDEX), "padv_sync_transfer_start": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PADV_SYNC_TRANSFER_START, + defs.BTP_CMD_GAP_PADV_SYNC_TRANSFER_START, CONTROLLER_INDEX), "padv_sync_transfer_recv": (defs.BTP_SERVICE_ID_GAP, - defs.GAP_PADV_SYNC_TRANSFER_RECV, + defs.BTP_CMD_GAP_PADV_SYNC_TRANSFER_RECV, CONTROLLER_INDEX), } @@ -376,23 +376,23 @@ def gap_passkey_entry_req_ev_(gap, data, data_len): GAP_EV = { - defs.GAP_EV_NEW_SETTINGS: gap_new_settings_ev_, - defs.GAP_EV_DEVICE_FOUND: gap_device_found_ev_, - defs.GAP_EV_DEVICE_CONNECTED: gap_connected_ev_, - defs.GAP_EV_DEVICE_DISCONNECTED: gap_disconnected_ev_, - defs.GAP_EV_PASSKEY_DISPLAY: gap_passkey_disp_ev_, - defs.GAP_EV_PASSKEY_ENTRY_REQ: gap_passkey_entry_req_ev_, - defs.GAP_EV_PASSKEY_CONFIRM_REQ: gap_passkey_confirm_req_ev_, - defs.GAP_EV_IDENTITY_RESOLVED: gap_identity_resolved_ev_, - defs.GAP_EV_CONN_PARAM_UPDATE: gap_conn_param_update_ev_, - defs.GAP_EV_SEC_LEVEL_CHANGED: gap_sec_level_changed_ev_, - defs.GAP_EV_PAIRING_CONSENT_REQ: gap_pairing_consent_ev_, - defs.GAP_EV_PAIRING_FAILED: gap_pairing_failed_ev_, - defs.GAP_EV_BOND_LOST: gap_bond_lost_ev_, - defs.GAP_EV_PERIODIC_SYNC_ESTABLISHED: gap_padv_sync_established_ev_, - defs.GAP_EV_PERIODIC_SYNC_LOST: gap_padv_sync_lost_ev_, - defs.GAP_EV_PERIODIC_REPORT: gap_padv_report_ev_, - defs.GAP_EV_PERIODIC_TRANSFER_RECEIVED: gap_padv_transfer_received_ev_ + defs.BTP_EV_GAP_NEW_SETTINGS: gap_new_settings_ev_, + defs.BTP_EV_GAP_DEVICE_FOUND: gap_device_found_ev_, + defs.BTP_EV_GAP_DEVICE_CONNECTED: gap_connected_ev_, + defs.BTP_EV_GAP_DEVICE_DISCONNECTED: gap_disconnected_ev_, + defs.BTP_EV_GAP_PASSKEY_DISPLAY: gap_passkey_disp_ev_, + defs.BTP_EV_GAP_PASSKEY_ENTRY_REQ: gap_passkey_entry_req_ev_, + defs.BTP_EV_GAP_PASSKEY_CONFIRM_REQ: gap_passkey_confirm_req_ev_, + defs.BTP_EV_GAP_IDENTITY_RESOLVED: gap_identity_resolved_ev_, + defs.BTP_EV_GAP_CONN_PARAM_UPDATE: gap_conn_param_update_ev_, + defs.BTP_EV_GAP_SEC_LEVEL_CHANGED: gap_sec_level_changed_ev_, + defs.BTP_EV_GAP_PAIRING_CONSENT_REQ: gap_pairing_consent_ev_, + defs.BTP_EV_GAP_PAIRING_FAILED: gap_pairing_failed_ev_, + defs.BTP_EV_GAP_BOND_LOST: gap_bond_lost_ev_, + defs.BTP_EV_GAP_PERIODIC_SYNC_ESTABLISHED: gap_padv_sync_established_ev_, + defs.BTP_EV_GAP_PERIODIC_SYNC_LOST: gap_padv_sync_lost_ev_, + defs.BTP_EV_GAP_PERIODIC_REPORT: gap_padv_report_ev_, + defs.BTP_EV_GAP_PERIODIC_TRANSFER_RECEIVED: gap_padv_transfer_received_ev_ } @@ -505,7 +505,7 @@ def gap_adv_ind_on(ad=None, sd=None, duration=AdDuration.forever, own_addr_type= iutctl.btp_socket.send(*GAP['start_adv'], data=data_ba) - tuple_data = gap_command_rsp_succ(defs.GAP_START_ADVERTISING) + tuple_data = gap_command_rsp_succ(defs.BTP_CMD_GAP_START_ADVERTISING) __gap_current_settings_update(tuple_data) @@ -522,7 +522,7 @@ def gap_adv_off(): iutctl.btp_socket.send(*GAP['stop_adv']) - tuple_data = gap_command_rsp_succ(defs.GAP_STOP_ADVERTISING) + tuple_data = gap_command_rsp_succ(defs.BTP_CMD_GAP_STOP_ADVERTISING) __gap_current_settings_update(tuple_data) @@ -553,7 +553,7 @@ def gap_direct_adv_on(addr, addr_type, high_duty=0, peer_rpa=0): iutctl.btp_socket.send(*GAP['start_direct_adv'], data=data_ba) - tuple_data = gap_command_rsp_succ(defs.GAP_START_DIRECT_ADV) + tuple_data = gap_command_rsp_succ(defs.BTP_CMD_GAP_START_DIRECT_ADV) __gap_current_settings_update(tuple_data) @@ -697,7 +697,7 @@ def gap_unpair(bd_addr=None, bd_addr_type=None): iutctl.btp_socket.send(*GAP['unpair'], data=data_ba) # Expected result - gap_command_rsp_succ(defs.GAP_UNPAIR) + gap_command_rsp_succ(defs.BTP_CMD_GAP_UNPAIR) def gap_passkey_entry_rsp(bd_addr, bd_addr_type, passkey): @@ -944,7 +944,7 @@ def gap_read_ctrl_info(): logging.debug("received %r %r", tuple_hdr, tuple_data) btp_hdr_check(tuple_hdr, defs.BTP_SERVICE_ID_GAP, - defs.GAP_READ_CONTROLLER_INFO) + defs.BTP_CMD_GAP_READ_CONTROLLER_INFO) fmt = '<6sII3s249s11s' if len(tuple_data[0]) < struct.calcsize(fmt): @@ -1034,7 +1034,7 @@ def gap_oob_sc_get_local_data(): tuple_hdr, tuple_data) btp_hdr_check(tuple_hdr, defs.BTP_SERVICE_ID_GAP, - defs.GAP_OOB_SC_GET_LOCAL_DATA) + defs.BTP_CMD_GAP_OOB_SC_GET_LOCAL_DATA) hdr = '<16s16s' r, c = struct.unpack_from(hdr, tuple_data[0]) @@ -1322,7 +1322,7 @@ def gap_padv_configure(include_tx_power, intvl_min, intvl_max): iutctl.btp_socket.send(*GAP['padv_configure'], data=data_ba) - tuple_data = gap_command_rsp_succ(defs.GAP_PADV_CONFIGURE) + tuple_data = gap_command_rsp_succ(defs.BTP_CMD_GAP_PADV_CONFIGURE) __gap_current_settings_update(tuple_data) @@ -1334,7 +1334,7 @@ def gap_padv_start(flags=0): iutctl.btp_socket.send(*GAP['padv_start'], data=data_ba) - tuple_data = gap_command_rsp_succ(defs.GAP_PADV_START) + tuple_data = gap_command_rsp_succ(defs.BTP_CMD_GAP_PADV_START) __gap_current_settings_update(tuple_data) diff --git a/autopts/pybtp/btp/gatt.py b/autopts/pybtp/btp/gatt.py index ba5de26eba..aed616e3c4 100644 --- a/autopts/pybtp/btp/gatt.py +++ b/autopts/pybtp/btp/gatt.py @@ -31,68 +31,68 @@ GATT_SVCS = None GATTS = { - "add_svc": (defs.BTP_SERVICE_ID_GATT, defs.GATT_ADD_SERVICE, + "add_svc": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_ADD_SERVICE, CONTROLLER_INDEX), - "start_server": (defs.BTP_SERVICE_ID_GATT, defs.GATT_START_SERVER, + "start_server": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_START_SERVER, CONTROLLER_INDEX, ""), "add_inc_svc": (defs.BTP_SERVICE_ID_GATT, - defs.GATT_ADD_INCLUDED_SERVICE, CONTROLLER_INDEX), - "add_char": (defs.BTP_SERVICE_ID_GATT, defs.GATT_ADD_CHARACTERISTIC, + defs.BTP_CMD_GATT_ADD_INCLUDED_SERVICE, CONTROLLER_INDEX), + "add_char": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_ADD_CHARACTERISTIC, CONTROLLER_INDEX), - "set_val": (defs.BTP_SERVICE_ID_GATT, defs.GATT_SET_VALUE, + "set_val": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_SET_VALUE, CONTROLLER_INDEX), - "add_desc": (defs.BTP_SERVICE_ID_GATT, defs.GATT_ADD_DESCRIPTOR, + "add_desc": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_ADD_DESCRIPTOR, CONTROLLER_INDEX), "set_enc_key_size": (defs.BTP_SERVICE_ID_GATT, - defs.GATT_SET_ENC_KEY_SIZE, CONTROLLER_INDEX), - "get_attrs": (defs.BTP_SERVICE_ID_GATT, defs.GATT_GET_ATTRIBUTES, + defs.BTP_CMD_GATT_SET_ENC_KEY_SIZE, CONTROLLER_INDEX), + "get_attrs": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_GET_ATTRIBUTES, CONTROLLER_INDEX), "get_attr_val": (defs.BTP_SERVICE_ID_GATT, - defs.GATT_GET_ATTRIBUTE_VALUE, CONTROLLER_INDEX), + defs.BTP_CMD_GATT_GET_ATTRIBUTES, CONTROLLER_INDEX), "change_database": (defs.BTP_SERVICE_ID_GATT, - defs.GATT_CHANGE_DATABASE, CONTROLLER_INDEX), + defs.BTP_CMD_GATT_CHANGE_DATABASE, CONTROLLER_INDEX), "notify_mult": (defs.BTP_SERVICE_ID_GATT, - defs.GATT_NOTIFY_MULTIPLE, CONTROLLER_INDEX), + defs.BTP_CMD_GATT_NOTIFY_MULTIPLE, CONTROLLER_INDEX), } GATTC = { - "exchange_mtu": (defs.BTP_SERVICE_ID_GATT, defs.GATT_EXCHANGE_MTU, + "exchange_mtu": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_EXCHANGE_MTU, CONTROLLER_INDEX), - "disc_all_prim": (defs.BTP_SERVICE_ID_GATT, defs.GATT_DISC_ALL_PRIM, + "disc_all_prim": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_DISC_ALL_PRIM, CONTROLLER_INDEX), - "disc_prim_uuid": (defs.BTP_SERVICE_ID_GATT, defs.GATT_DISC_PRIM_UUID, + "disc_prim_uuid": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_DISC_PRIM_UUID, CONTROLLER_INDEX), - "find_included": (defs.BTP_SERVICE_ID_GATT, defs.GATT_FIND_INCLUDED, + "find_included": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_FIND_INCLUDED, CONTROLLER_INDEX), - "disc_all_chrc": (defs.BTP_SERVICE_ID_GATT, defs.GATT_DISC_ALL_CHRC, + "disc_all_chrc": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_DISC_ALL_CHRC, CONTROLLER_INDEX), - "disc_chrc_uuid": (defs.BTP_SERVICE_ID_GATT, defs.GATT_DISC_CHRC_UUID, + "disc_chrc_uuid": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_DISC_CHRC_UUID, CONTROLLER_INDEX), - "disc_all_desc": (defs.BTP_SERVICE_ID_GATT, defs.GATT_DISC_ALL_DESC, + "disc_all_desc": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_DISC_ALL_DESC, CONTROLLER_INDEX), - "read": (defs.BTP_SERVICE_ID_GATT, defs.GATT_READ, CONTROLLER_INDEX), - "read_uuid": (defs.BTP_SERVICE_ID_GATT, defs.GATT_READ_UUID, + "read": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_READ, CONTROLLER_INDEX), + "read_uuid": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_READ_UUID, CONTROLLER_INDEX), - "read_long": (defs.BTP_SERVICE_ID_GATT, defs.GATT_READ_LONG, + "read_long": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_READ_LONG, CONTROLLER_INDEX), - "read_multiple": (defs.BTP_SERVICE_ID_GATT, defs.GATT_READ_MULTIPLE, + "read_multiple": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_READ_MULTIPLE, CONTROLLER_INDEX), - "read_multiple_var": (defs.BTP_SERVICE_ID_GATT, defs.GATT_READ_MULTIPLE_VAR, + "read_multiple_var": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_READ_MULTIPLE_VAR, CONTROLLER_INDEX), "write_without_rsp": (defs.BTP_SERVICE_ID_GATT, - defs.GATT_WRITE_WITHOUT_RSP, CONTROLLER_INDEX), + defs.BTP_CMD_GATT_WRITE_WITHOUT_RSP, CONTROLLER_INDEX), "signed_write": (defs.BTP_SERVICE_ID_GATT, - defs.GATT_SIGNED_WRITE_WITHOUT_RSP, CONTROLLER_INDEX), - "write": (defs.BTP_SERVICE_ID_GATT, defs.GATT_WRITE, CONTROLLER_INDEX), - "write_long": (defs.BTP_SERVICE_ID_GATT, defs.GATT_WRITE_LONG, + defs.BTP_CMD_GATT_SIGNED_WRITE_WITHOUT_RSP, CONTROLLER_INDEX), + "write": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_WRITE, CONTROLLER_INDEX), + "write_long": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_WRITE_LONG, CONTROLLER_INDEX), - "write_reliable": (defs.BTP_SERVICE_ID_GATT, defs.GATT_WRITE_RELIABLE, + "write_reliable": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_WRITE_RELIABLE, CONTROLLER_INDEX), - "cfg_notify": (defs.BTP_SERVICE_ID_GATT, defs.GATT_CFG_NOTIFY, + "cfg_notify": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_CFG_NOTIFY, CONTROLLER_INDEX), - "cfg_indicate": (defs.BTP_SERVICE_ID_GATT, defs.GATT_CFG_INDICATE, + "cfg_indicate": (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_CFG_INDICATE, CONTROLLER_INDEX), - 'eatt_connect': (defs.BTP_SERVICE_ID_GATT, defs.GATT_EATT_CONNECT, + 'eatt_connect': (defs.BTP_SERVICE_ID_GATT, defs.BTP_CMD_GATT_EATT_CONNECT, CONTROLLER_INDEX), } @@ -115,8 +115,8 @@ def gatt_notification_ev_(gatt, data, data_len): GATT_EV = { - defs.GATT_EV_ATTR_VALUE_CHANGED: gatt_attr_value_changed_ev_, - defs.GATT_EV_NOTIFICATION: gatt_notification_ev_, + defs.BTP_GATT_EV_ATTR_VALUE_CHANGED: gatt_attr_value_changed_ev_, + defs.BTP_EV_GATT_NOTIFICATION: gatt_notification_ev_, } @@ -354,7 +354,7 @@ def gatts_attr_value_changed_ev(): (tuple_hdr, tuple_data) = iutctl.btp_socket.read() btp_hdr_check(tuple_hdr, defs.BTP_SERVICE_ID_GATT, - defs.GATT_EV_ATTR_VALUE_CHANGED) + defs.BTP_GATT_EV_ATTR_VALUE_CHANGED) (handle, data) = gatts_dec_attr_value_changed_ev_data(tuple_data[0]) logging.debug("%s %r %r", gatts_attr_value_changed_ev.__name__, @@ -434,7 +434,7 @@ def gatts_get_attrs(start_handle=0x0001, end_handle=0xffff, type_uuid=None): logging.debug("received %r %r", tuple_hdr, tuple_data) btp_hdr_check(tuple_hdr, defs.BTP_SERVICE_ID_GATT, - defs.GATT_GET_ATTRIBUTES) + defs.BTP_CMD_GATT_GET_ATTRIBUTES) return dec_gatts_get_attrs_rp(tuple_data[0], tuple_hdr.data_len) @@ -462,7 +462,7 @@ def gatts_get_attr_val(bd_addr_type, bd_addr, handle): logging.debug("received %r %r", tuple_hdr, tuple_data) btp_hdr_check(tuple_hdr, defs.BTP_SERVICE_ID_GATT, - defs.GATT_GET_ATTRIBUTE_VALUE) + defs.BTP_CMD_GATT_GET_ATTRIBUTES) hdr = '