Bluetooth: GATT: Add support to discover Secondary services
This adds support to BT_GATT_DISCOVER_SECONDARY to bt_gatt_discover using Read by Group Type request as following: Change-Id: I2c3907dcc18ad077c3161fda9ad94fe3b5e4fd45 Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
331a3d8016
commit
ab573232f2
1 changed files with 15 additions and 5 deletions
|
@ -596,8 +596,14 @@ static void att_find_type_rsp(struct bt_conn *conn, uint8_t err,
|
||||||
value.end_handle = end_handle;
|
value.end_handle = end_handle;
|
||||||
value.uuid = params->uuid;
|
value.uuid = params->uuid;
|
||||||
|
|
||||||
attr = (&(struct bt_gatt_attr)
|
if (params->type == BT_GATT_DISCOVER_PRIMARY) {
|
||||||
BT_GATT_PRIMARY_SERVICE(start_handle, &value));
|
attr = (&(struct bt_gatt_attr)
|
||||||
|
BT_GATT_PRIMARY_SERVICE(start_handle, &value));
|
||||||
|
} else {
|
||||||
|
attr = (&(struct bt_gatt_attr)
|
||||||
|
BT_GATT_SECONDARY_SERVICE(start_handle,
|
||||||
|
&value));
|
||||||
|
}
|
||||||
|
|
||||||
if (params->func(attr, params) == BT_GATT_ITER_STOP) {
|
if (params->func(attr, params) == BT_GATT_ITER_STOP) {
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -641,7 +647,12 @@ static int att_find_type(struct bt_conn *conn,
|
||||||
req = bt_buf_add(buf, sizeof(*req));
|
req = bt_buf_add(buf, sizeof(*req));
|
||||||
req->start_handle = sys_cpu_to_le16(params->start_handle);
|
req->start_handle = sys_cpu_to_le16(params->start_handle);
|
||||||
req->end_handle = sys_cpu_to_le16(params->end_handle);
|
req->end_handle = sys_cpu_to_le16(params->end_handle);
|
||||||
req->type = sys_cpu_to_le16(BT_UUID_GATT_PRIMARY);
|
|
||||||
|
if (params->type == BT_GATT_DISCOVER_PRIMARY) {
|
||||||
|
req->type = sys_cpu_to_le16(BT_UUID_GATT_PRIMARY);
|
||||||
|
} else {
|
||||||
|
req->type = sys_cpu_to_le16(BT_UUID_GATT_SECONDARY);
|
||||||
|
}
|
||||||
|
|
||||||
BT_DBG("uuid 0x%04x start_handle 0x%04x end_handle 0x%04x\n",
|
BT_DBG("uuid 0x%04x start_handle 0x%04x end_handle 0x%04x\n",
|
||||||
params->uuid->u16, params->start_handle, params->end_handle);
|
params->uuid->u16, params->start_handle, params->end_handle);
|
||||||
|
@ -1025,8 +1036,7 @@ int bt_gatt_discover(struct bt_conn *conn,
|
||||||
case BT_GATT_DISCOVER_PRIMARY:
|
case BT_GATT_DISCOVER_PRIMARY:
|
||||||
return att_find_type(conn, params);
|
return att_find_type(conn, params);
|
||||||
case BT_GATT_DISCOVER_SECONDARY:
|
case BT_GATT_DISCOVER_SECONDARY:
|
||||||
/* TODO */
|
return att_find_type(conn, params);
|
||||||
break;
|
|
||||||
case BT_GATT_DISCOVER_INCLUDE:
|
case BT_GATT_DISCOVER_INCLUDE:
|
||||||
return att_read_type(conn, params);
|
return att_read_type(conn, params);
|
||||||
case BT_GATT_DISCOVER_CHARACTERISTIC:
|
case BT_GATT_DISCOVER_CHARACTERISTIC:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue