Diff between c75e5374f7b1be3671ae93a3134550e3dda9ecee and dfb5e49ee07d2abbac803aee78e2ec6c30b44631

Changed Files

File Additions Deletions Status
android/gatt.c +30 -2 modified

Full Patch

diff --git a/android/gatt.c b/android/gatt.c
index 283bb6d..3a9ac13 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -3242,10 +3242,38 @@ static void handle_client_get_device_type(const void *buf, uint16_t len)
 
 static void handle_client_set_adv_data(const void *buf, uint16_t len)
 {
-	DBG("");
+	const struct hal_cmd_gatt_client_set_adv_data *cmd = buf;
+	uint8_t status;
+
+	if (len != sizeof(*cmd) + cmd->manufacturer_len) {
+		error("Invalid set adv data command (%u bytes), terminating",
+									len);
+		raise(SIGTERM);
+		return;
+	}
+
+	DBG("scan_rsp=%u name=%u tx=%u min=%d max=%d app=%d manufacturer=%u",
+		cmd->set_scan_rsp, cmd->include_name, cmd->include_txpower,
+		cmd->min_interval, cmd->max_interval, cmd->appearance,
+		cmd->manufacturer_len);
+
+	/*
+	 * TODO
+	 * Currently kernel is setting all except for vendor data.
+	 * This should be implemented when kernel supports it.
+	 */
 
+	if (cmd->manufacturer_len) {
+		error("gatt: Manufacturer advertising data not supported");
+		status = HAL_STATUS_FAILED;
+		goto failed;
+	}
+
+	status = HAL_STATUS_SUCCESS;
+
+failed:
 	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
-			HAL_OP_GATT_CLIENT_SET_ADV_DATA, HAL_STATUS_FAILED);
+				HAL_OP_GATT_CLIENT_SET_ADV_DATA, status);
 }
 
 static void handle_client_test_command(const void *buf, uint16_t len)