diff --git a/android/gatt.c b/android/gatt.c
index 9d0b2a2..f9ba870 100644
--- a/android/gatt.c
+++ b/android/gatt.c
DBG("");
- if ((len != sizeof(*cmd) + cmd->number * sizeof(cmd->gatt_id[0])) ||
- (cmd->number != 1 && cmd->number != 2)) {
+ if (len != sizeof(*cmd) +
+ (cmd->continuation ? sizeof(cmd->descr_id[0]) : 0)) {
error("gatt: Invalid get descr command (%u bytes), terminating",
len);
primary = cmd->srvc_id.is_primary;
hal_srvc_id_to_element_id(&cmd->srvc_id, &srvc_id);
- hal_gatt_id_to_element_id(&cmd->gatt_id[0], &char_id);
+ hal_gatt_id_to_element_id(&cmd->char_id, &char_id);
if (!find_service(conn_id, &srvc_id, &dev, &srvc)) {
error("gatt: Get descr. could not find service");
status = HAL_STATUS_SUCCESS;
/* Send from cache */
- if (cmd->number > 1)
+ if (cmd->continuation)
descr = queue_find(ch->descriptors,
match_descr_by_higher_inst_id,
- INT_TO_PTR(cmd->gatt_id[1].inst_id));
+ INT_TO_PTR(cmd->descr_id[0].inst_id));
else
descr = queue_peek_head(ch->descriptors);
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index c5ea9da..bcbeb54 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
cmd->conn_id = conn_id;
srvc_id_to_hal(&cmd->srvc_id, srvc_id);
-
- gatt_id_to_hal(&cmd->gatt_id[0], char_id);
- len += sizeof(cmd->gatt_id[0]);
- cmd->number = 1;
+ gatt_id_to_hal(&cmd->char_id, char_id);
+ cmd->continuation = 0;
if (start_descr_id) {
- gatt_id_to_hal(&cmd->gatt_id[1], start_descr_id);
- len += sizeof(cmd->gatt_id[1]);
- cmd->number++;
+ gatt_id_to_hal(&cmd->descr_id[0], start_descr_id);
+ len += sizeof(cmd->descr_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 7a20f56..fa6552e 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
Command parameters: Connection ID (4 octets)
GATT Service ID (18 octets)
- Number of GATT ID Elements (1 octet)
- GATT ID # UUID (16 octets)
- GATT ID # Instance ID (1 octet)
+ GATT Characteristic ID (17 octets)
+ Continuation (1 octet)
+ GATT Descriptor ID (17 octets)
...
Response parameters: <none>
Instance ID (1 octet)
Is Primary (1 octet)
- Valid Number of GATT ID Elements: 0x01
- 0x02
+ Valid GATT Characteristic ID: UUID (16 octets)
+ Instance ID (1 octet)
+
+ Valid GATT Descriptor ID: UUID (16 octets)
+ Instance ID (1 octet)
+
+ GATT Descriptor 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 9fec81b..6b4b2f5 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
struct hal_cmd_gatt_client_get_descriptor {
int32_t conn_id;
struct hal_gatt_srvc_id srvc_id;
- uint8_t number;
- struct hal_gatt_gatt_id gatt_id[0];
+ struct hal_gatt_gatt_id char_id;
+ uint8_t continuation;
+ struct hal_gatt_gatt_id descr_id[0];
} __attribute__((packed));
#define HAL_OP_GATT_CLIENT_READ_CHARACTERISTIC 0x0c