diff --git a/android/gatt.c b/android/gatt.c
index f52cb36..a4a1048 100644
--- a/android/gatt.c
+++ b/android/gatt.c
DBG("");
- if (len != sizeof(*cmd) + (cmd->number * sizeof(cmd->srvc_id[0]))) {
+ if (len != sizeof(*cmd) +
+ (cmd->continuation ? sizeof(cmd->incl_srvc_id[0]) : 0)) {
error("Invalid get incl services size (%u bytes), terminating",
len);
raise(SIGTERM);
return;
}
- hal_srvc_id_to_element_id(&cmd->srvc_id[0], &match_id);
+ hal_srvc_id_to_element_id(&cmd->srvc_id, &match_id);
if (!find_service(cmd->conn_id, &match_id, &device, &prim_service)) {
status = HAL_STATUS_FAILED;
goto reply;
}
/* Try to use cache here */
- if (cmd->number == 1) {
+ if (!cmd->continuation) {
incl_service = queue_peek_head(prim_service->included);
} else {
- uint8_t inst_id = cmd->srvc_id[1].inst_id;
+ uint8_t inst_id = cmd->incl_srvc_id[0].inst_id;
incl_service = queue_find(prim_service->included,
match_srvc_by_higher_inst_id,
INT_TO_PTR(inst_id));
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 0229fc8..b1ba977 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
cmd->conn_id = conn_id;
- srvc_id_to_hal(&cmd->srvc_id[0], srvc_id);
- len += sizeof(cmd->srvc_id[0]);
- cmd->number = 1;
+ srvc_id_to_hal(&cmd->srvc_id, srvc_id);
+ cmd->continuation = 0;
if (start_incl_srvc_id) {
- srvc_id_to_hal(&cmd->srvc_id[1], start_incl_srvc_id);
- len += sizeof(cmd->srvc_id[1]);
- cmd->number++;
+ srvc_id_to_hal(&cmd->incl_srvc_id[0], start_incl_srvc_id);
+ len += sizeof(cmd->incl_srvc_id[0]);
+ cmd->continuation = 1;
}
return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 67da4ec..906cfc7 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
Opcode 0x09 - Get Included Service command/response
Command parameters: Connection ID (4 octets)
- Number of GATT Service ID Elements (1 octet)
- GATT Service ID # UUID (16 octets)
- GATT Service ID # Instance ID (1 octet)
- GATT Service ID # Is Primary (1 octet)
+ GATT Service ID (18 octets)
+ Continuation (1 octet)
+ GATT Included Service ID (18 octets)
...
Response parameters: <none>
- Valid Number of GATT Service ID Elements: 0x01
- 0x02
+ Valid GATT Service ID: UUID (16 octets)
+ Instance ID (1 octet)
+ Is Primary (1 octet)
+
+ Valid GATT Included Service ID: UUID (16 octets)
+ Instance ID (1 octet)
+ Is Primary (1 octet)
+
+ GATT Included Service ID shall only be present when Continuation is non-zero.
In case of an error, the error response will be returned.
diff --git a/android/hal-msg.h b/android/hal-msg.h
index caf6ad9..7a49244 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
struct hal_cmd_gatt_client_get_included_service {
int32_t conn_id;
- uint8_t number;
- struct hal_gatt_srvc_id srvc_id[0];
+ struct hal_gatt_srvc_id srvc_id;
+ uint8_t continuation;
+ struct hal_gatt_srvc_id incl_srvc_id[0];
} __attribute__((packed));
#define HAL_OP_GATT_CLIENT_GET_CHARACTERISTIC 0x0a