mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-25 16:43:28 +00:00
tool/compile_gatt: support multiple instances of the same service
This commit is contained in:
parent
5b1b9b3f03
commit
29ba805bf8
@ -25,6 +25,7 @@ HFP: `ENABLE_HFP_AT_MESSAGES` lets HFP emit `HFP_SUBEVENT_AT_MESSAGE_SENT` and
|
||||
L2CAP: fix packet size check for incoming classic basic channels (regression introduced in v1.2.1)
|
||||
A2DP Source: emit codec configure event with reconfigure flag set on reconfigure
|
||||
HCI: keep `le connecting request` on command complete, fixes gap_auto_connection_stop() + gap_auto_connection_start()
|
||||
GATT Compiler: support multiple instances of the same service
|
||||
|
||||
### Changed
|
||||
HFP/GOEP Client/AVDTP/A2DP: return `SDP_SERVICE_NOT_FOUND` if no suitable SDP record is found
|
||||
|
@ -143,6 +143,7 @@ defines_for_characteristics = []
|
||||
defines_for_services = []
|
||||
include_paths = []
|
||||
database_hash_message = bytearray()
|
||||
service_counter = {}
|
||||
|
||||
handle = 1
|
||||
total_size = 0
|
||||
@ -356,10 +357,20 @@ def serviceDefinitionComplete(fout):
|
||||
global services
|
||||
if current_service_uuid_string:
|
||||
fout.write("\n")
|
||||
# print("append service %s = [%d, %d]" % (current_characteristic_uuid_string, current_service_start_handle, handle-1))
|
||||
defines_for_services.append('#define ATT_SERVICE_%s_START_HANDLE 0x%04x' % (current_service_uuid_string, current_service_start_handle))
|
||||
defines_for_services.append('#define ATT_SERVICE_%s_END_HANDLE 0x%04x' % (current_service_uuid_string, handle-1))
|
||||
services[current_service_uuid_string] = [current_service_start_handle, handle-1]
|
||||
# update num instances for this service
|
||||
count = 1
|
||||
if current_service_uuid_string in service_counter:
|
||||
count = service_counter[current_service_uuid_string] + 1
|
||||
service_counter[current_service_uuid_string] = count
|
||||
# add old defines without service counter for first instance
|
||||
if count == 1:
|
||||
defines_for_services.append('#define ATT_SERVICE_%s_START_HANDLE 0x%04x' % (current_service_uuid_string, current_service_start_handle))
|
||||
defines_for_services.append('#define ATT_SERVICE_%s_END_HANDLE 0x%04x' % (current_service_uuid_string, handle-1))
|
||||
services[current_service_uuid_string] = [current_service_start_handle, handle-1]
|
||||
# unified defines indicating instance
|
||||
defines_for_services.append('#define ATT_SERVICE_%s_%02x_START_HANDLE 0x%04x' % (current_service_uuid_string, count, current_service_start_handle))
|
||||
defines_for_services.append('#define ATT_SERVICE_%s_%02x_END_HANDLE 0x%04x' % (current_service_uuid_string, count, handle-1))
|
||||
|
||||
|
||||
def dump_flags(fout, flags):
|
||||
global security_permsission
|
||||
|
Loading…
x
Reference in New Issue
Block a user