return;
}
- DBG("scan_rsp=%u name=%u tx=%u min=%d max=%d app=%d manufacturer=%u",
+ DBG("scan_rsp=%u name=%u tx=%u min=%d max=%d app=%d",
cmd->set_scan_rsp, cmd->include_name, cmd->include_txpower,
- cmd->min_interval, cmd->max_interval, cmd->appearance,
- cmd->manufacturer_len);
+ cmd->min_interval, cmd->max_interval, cmd->appearance);
- /*
- * TODO
- * Currently kernel is setting all except for vendor data.
- * This should be implemented when kernel supports it.
- */
+ DBG("manufacturer=%u service_data=%u service_uuid=%u",
+ cmd->manufacturer_len, cmd->service_data_len,
+ cmd->service_uuid_len);
- if (cmd->manufacturer_len) {
- error("gatt: Manufacturer advertising data not supported");
+ /* TODO This should be implemented when kernel supports it */
+ if (cmd->manufacturer_len || cmd->service_data_len ||
+ cmd->service_uuid_len) {
+ error("gatt: Extra advertising data not supported");
status = HAL_STATUS_FAILED;
goto failed;
}
{
char buf[IPC_MTU];
struct hal_cmd_gatt_client_set_adv_data *cmd = (void *) buf;
- size_t cmd_len = sizeof(*cmd) + manufacturer_len;
+ size_t cmd_len;
+ uint8_t *data;
if (!interface_ready())
return BT_STATUS_NOT_READY;
+ cmd_len = sizeof(*cmd) + manufacturer_len + service_data_len +
+ service_uuid_len;
+
+ if (cmd_len > IPC_MTU)
+ return BT_STATUS_FAIL;
+
cmd->server_if = server_if;
cmd->set_scan_rsp = set_scan_rsp;
cmd->include_name = include_name;
cmd->max_interval = max_interval;
cmd->appearance = appearance;
cmd->manufacturer_len = manufacturer_len;
+ cmd->service_data_len = service_data_len;
+ cmd->service_uuid_len = service_uuid_len;
+
+ data = cmd->data;
+
+ if (manufacturer_data && manufacturer_len) {
+ memcpy(data, manufacturer_data, manufacturer_len);
+ data += manufacturer_len;
+ }
+
+ if (service_data && service_data_len) {
+ memcpy(data, service_data, service_data_len);
+ data += service_data_len;
+ }
- memcpy(cmd->manufacturer_data, manufacturer_data, manufacturer_len);
+ if (service_uuid && service_uuid_len) {
+ memcpy(data, service_uuid, service_uuid_len);
+ data += service_uuid_len;
+ }
return hal_ipc_cmd(HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_SET_ADV_DATA,
cmd_len, cmd, 0, NULL, NULL);
int32_t max_interval;
int32_t appearance;
uint16_t manufacturer_len;
- uint8_t manufacturer_data[0];
+ uint16_t service_data_len;
+ uint16_t service_uuid_len;
+ uint8_t data[0];
} __attribute__((packed));
#define GATT_CLIENT_TEST_CMD_ENABLE 0x01