All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks
@ 2014-11-17 22:27 Szymon Janc
  2014-11-17 22:27 ` [PATCH 02/16] android/hal-gatt: Implement client scan_filter_param_setup Szymon Janc
                   ` (15 more replies)
  0 siblings, 16 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds IPC handlers for new GATT notifications and implementes
requiured callbacks.
---
 android/hal-gatt.c | 193 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 android/hal-msg.h  | 113 +++++++++++++++++++++++++++++++
 2 files changed, 305 insertions(+), 1 deletion(-)

diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 50364f5..15ab357 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -470,6 +470,147 @@ static void handle_response_confirmation(void *buf, uint16_t len, int fd)
 		cbs->server->response_confirmation_cb(ev->status, ev->handle);
 }
 
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+static void handle_configure_mtu(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_configure_mtu *ev = buf;
+
+	if (cbs->client->configure_mtu_cb)
+		cbs->client->configure_mtu_cb(ev->conn_id, ev->status, ev->mtu);
+}
+
+static void handle_filter_config(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_filter_config *ev = buf;
+
+	if (cbs->client->scan_filter_cfg_cb)
+		cbs->client->scan_filter_cfg_cb(ev->action, ev->client_if,
+						ev->status, ev->type,
+						ev->space);
+}
+
+static void handle_filter_params(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_filter_params *ev = buf;
+
+	if (cbs->client->scan_filter_param_cb)
+		cbs->client->scan_filter_param_cb(ev->action, ev->client_if,
+							ev->status, ev->space);
+}
+
+static void handle_filter_status(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_filter_status *ev = buf;
+
+	if (cbs->client->scan_filter_status_cb)
+		cbs->client->scan_filter_status_cb(ev->enable, ev->client_if,
+								ev->status);
+}
+
+static void handle__multi_adv_enable(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_multi_adv_enable *ev = buf;
+
+	if (cbs->client->multi_adv_enable_cb)
+		cbs->client->multi_adv_enable_cb(ev->client_if, ev->status);
+}
+
+static void handle_multi_adv_update(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_multi_adv_update *ev = buf;
+
+	if (cbs->client->multi_adv_update_cb)
+		cbs->client->multi_adv_update_cb(ev->client_if, ev->status);
+}
+
+static void handle_multi_adv_data(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_multi_adv_data *ev = buf;
+
+	if (cbs->client->multi_adv_data_cb)
+		cbs->client->multi_adv_data_cb(ev->client_if, ev->status);
+}
+
+static void handle_multi_adv_disable(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_multi_adv_disable *ev = buf;
+
+	if (cbs->client->multi_adv_disable_cb)
+		cbs->client->multi_adv_disable_cb(ev->client_if, ev->status);
+}
+
+static void handle_client_congestion(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_congestion *ev = buf;
+
+	if (cbs->client->congestion_cb)
+		cbs->client->congestion_cb(ev->conn_id, ev->congested);
+}
+
+static void handle_config_batchscan(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_config_batchscan *ev = buf;
+
+	if (cbs->client->batchscan_cfg_storage_cb)
+		cbs->client->batchscan_cfg_storage_cb(ev->client_if,
+								ev->status);
+}
+
+static void handle_enable_batchscan(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_enable_batchscan *ev = buf;
+
+	if (cbs->client->batchscan_enb_disable_cb)
+		cbs->client->batchscan_enb_disable_cb(ev->action, ev->client_if,
+								ev->status);
+}
+
+static void handle_client_batchscan_reports(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_batchscan_reports *ev = buf;
+
+	if (cbs->client->batchscan_reports_cb)
+		cbs->client->batchscan_reports_cb(ev->client_if, ev->status,
+							ev->format, ev->num,
+							ev->data_len, ev->data);
+}
+
+static void handle_batchscan_threshold(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_batchscan_threshold *ev = buf;
+
+	if (cbs->client->batchscan_threshold_cb)
+		cbs->client->batchscan_threshold_cb(ev->client_if);
+}
+
+static void handle_track_adv(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_client_track_adv *ev = buf;
+
+	if (cbs->client->track_adv_event_cb)
+		cbs->client->track_adv_event_cb(ev->client_if, ev->filetr_index,
+						ev->address_type,
+						(bt_bdaddr_t *) ev->address,
+						ev->state);
+}
+
+static void handle_indication_send(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_server_indication_sent *ev = buf;
+
+	if (cbs->server->indication_sent_cb)
+		cbs->server->indication_sent_cb(ev->conn_id, ev->status);
+}
+
+static void handle_server_congestion(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_gatt_server_congestion *ev = buf;
+
+	if (cbs->server->congestion_cb)
+		cbs->server->congestion_cb(ev->conn_id, ev->congested);
+}
+#endif
+
 /*
  * handlers will be called from notification thread context,
  * index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -565,7 +706,57 @@ static const struct hal_ipc_handler ev_handlers[] = {
 	/* HAL_EV_GATT_SERVER_RSP_CONFIRMATION */
 	{ handle_response_confirmation, false,
 		sizeof(struct hal_ev_gatt_server_rsp_confirmation) },
-};
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+	/* HAL_EV_GATT_CLIENT_CONFIGURE_MTU */
+	{ handle_configure_mtu, false,
+		sizeof(struct hal_ev_gatt_client_configure_mtu) },
+	/* HAL_EV_GATT_CLIENT_FILTER_CONFIG */
+	{ handle_filter_config, false,
+		sizeof(struct hal_ev_gatt_client_filter_config) },
+	/* HAL_EV_GATT_CLIENT_FILTER_PARAMS */
+	{ handle_filter_params, false,
+		sizeof(struct hal_ev_gatt_client_filter_params) },
+	/* HAL_EV_GATT_CLIENT_FILTER_STATUS */
+	{ handle_filter_status, false,
+		sizeof(struct hal_ev_gatt_client_filter_status) },
+	/* HAL_EV_GATT_CLIENT_MULTI_ADV_ENABLE */
+	{ handle__multi_adv_enable, false,
+		sizeof(struct hal_ev_gatt_client_multi_adv_enable) },
+	/* HAL_EV_GATT_CLIENT_MULTI_ADV_UPDATE */
+	{ handle_multi_adv_update, false,
+		sizeof(struct hal_ev_gatt_client_multi_adv_update) },
+	/* HAL_EV_GATT_CLIENT_MULTI_ADV_DATA */
+	{ handle_multi_adv_data, false,
+		sizeof(struct hal_ev_gatt_client_multi_adv_data) },
+	/* HAL_EV_GATT_CLIENT_MULTI_ADV_DISABLE */
+	{ handle_multi_adv_disable, false,
+		sizeof(struct hal_ev_gatt_client_multi_adv_disable) },
+	/* HAL_EV_GATT_CLIENT_CONGESTION */
+	{ handle_client_congestion, false,
+		sizeof(struct hal_ev_gatt_client_congestion) },
+	/* HAL_EV_GATT_CLIENT_CONFIG_BATCHSCAN */
+	{ handle_config_batchscan, false,
+		sizeof(struct hal_ev_gatt_client_config_batchscan) },
+	/* HAL_EV_GATT_CLIENT_ENABLE_BATCHSCAN */
+	{ handle_enable_batchscan, false,
+		sizeof(struct hal_ev_gatt_client_enable_batchscan) },
+	/* HAL_EV_GATT_CLIENT_BATCHSCAN_REPORTS */
+	{ handle_client_batchscan_reports, true,
+		sizeof(struct hal_ev_gatt_client_batchscan_reports) },
+	/* HAL_EV_GATT_CLIENT_BATCHSCAN_THRESHOLD */
+	{ handle_batchscan_threshold, false,
+		sizeof(struct hal_ev_gatt_client_batchscan_threshold) },
+	/* HAL_EV_GATT_CLIENT_TRACK_ADV */
+	{ handle_track_adv, false,
+		sizeof(struct hal_ev_gatt_client_track_adv) },
+	/* HAL_EV_GATT_SERVER_INDICATION_SENT */
+	{ handle_indication_send, false,
+		sizeof(struct hal_ev_gatt_server_indication_sent) },
+	/* HAL_EV_GATT_SERVER_CONGESTION */
+	{ handle_server_congestion, false,
+		sizeof(struct hal_ev_gatt_server_congestion) },
+#endif
+	};
 
 /* Client API */
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index c86b0a6..438fa7b 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1782,6 +1782,119 @@ struct hal_ev_gatt_server_rsp_confirmation {
 	int32_t handle;
 } __attribute__((packed));
 
+#define HAL_EV_GATT_CLIENT_CONFIGURE_MTU	0xa0
+struct hal_ev_gatt_client_configure_mtu {
+	int32_t conn_id;
+	int32_t status;
+	int32_t mtu;
+} __attribute__((packed));
+
+#define HAL_EV_GATT_CLIENT_FILTER_CONFIG	0xa1
+struct hal_ev_gatt_client_filter_config {
+	int32_t action;
+	int32_t client_if;
+	int32_t status;
+	int32_t type;
+	int32_t space;
+}  __attribute__((packed));
+
+#define HAL_EV_GATT_CLIENT_FILTER_PARAMS	0xa2
+struct hal_ev_gatt_client_filter_params {
+	int32_t action;
+	int32_t client_if;
+	int32_t status;
+	int32_t space;
+}  __attribute__((packed));
+
+#define HAL_EV_GATT_CLIENT_FILTER_STATUS	0xa3
+struct hal_ev_gatt_client_filter_status {
+	int32_t enable;
+	int32_t client_if;
+	int32_t status;
+}  __attribute__((packed));
+
+#define HAL_EV_GATT_CLIENT_MULTI_ADV_ENABLE	0xa4
+struct hal_ev_gatt_client_multi_adv_enable {
+	int32_t client_if;
+	int32_t status;
+} __attribute__((packed));
+
+
+#define HAL_EV_GATT_CLIENT_MULTI_ADV_UPDATE	0xa5
+struct hal_ev_gatt_client_multi_adv_update {
+	int32_t client_if;
+	int32_t status;
+} __attribute__((packed));
+
+
+#define HAL_EV_GATT_CLIENT_MULTI_ADV_DATA	0xa6
+struct hal_ev_gatt_client_multi_adv_data {
+	int32_t client_if;
+	int32_t status;
+} __attribute__((packed));
+
+
+#define HAL_EV_GATT_CLIENT_MULTI_ADV_DISABLE	0xa7
+struct hal_ev_gatt_client_multi_adv_disable {
+	int32_t client_if;
+	int32_t status;
+} __attribute__((packed));
+
+#define HAL_EV_GATT_CLIENT_CONGESTION		0xa8
+struct hal_ev_gatt_client_congestion {
+	int32_t conn_id;
+	uint8_t congested;
+} __attribute__((packed));
+
+#define HAL_EV_GATT_CLIENT_CONFIG_BATCHSCAN	0xa9
+struct hal_ev_gatt_client_config_batchscan {
+	int32_t client_if;
+	int32_t status;
+} __attribute__((packed));
+
+#define HAL_EV_GATT_CLIENT_ENABLE_BATCHSCAN	0xaa
+struct hal_ev_gatt_client_enable_batchscan {
+	int32_t action;
+	int32_t client_if;
+	int32_t status;
+} __attribute__((packed));
+
+#define HAL_EV_GATT_CLIENT_BATCHSCAN_REPORTS	0xab
+struct hal_ev_gatt_client_batchscan_reports {
+	int32_t client_if;
+	int32_t status;
+	int32_t format;
+	int32_t num;
+	int32_t data_len;
+	uint8_t data[0];
+} __attribute__((packed));
+
+#define HAL_EV_GATT_CLIENT_BATCHSCAN_THRESHOLD	0xac
+struct hal_ev_gatt_client_batchscan_threshold {
+	int32_t client_if;
+} __attribute__((packed));
+
+#define HAL_EV_GATT_CLIENT_TRACK_ADV		0xad
+struct hal_ev_gatt_client_track_adv {
+	int32_t client_if;
+	int32_t filetr_index;
+	int32_t address_type;
+	uint8_t address[6];
+	int32_t state;
+} __attribute__((packed));
+
+#define HAL_EV_GATT_SERVER_INDICATION_SENT	0xae
+struct hal_ev_gatt_server_indication_sent {
+	int32_t conn_id;
+	int32_t status;
+} __attribute__((packed));
+
+#define HAL_EV_GATT_SERVER_CONGESTION		0xaf
+struct hal_ev_gatt_server_congestion {
+	int32_t conn_id;
+	uint8_t congested;
+} __attribute__((packed));
+
 #define HAL_GATT_PERMISSION_READ			0x0001
 #define HAL_GATT_PERMISSION_READ_ENCRYPTED		0x0002
 #define HAL_GATT_PERMISSION_READ_ENCRYPTED_MITM		0x0004
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 02/16] android/hal-gatt: Implement client scan_filter_param_setup
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
@ 2014-11-17 22:27 ` Szymon Janc
  2014-11-17 22:27 ` [PATCH 03/16] android/hal-gatt: Implement client scan_filter_add_remove Szymon Janc
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 22 +++++++++++++++++++---
 android/hal-msg.h  | 16 ++++++++++++++++
 3 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 5169468..a441e4f 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5540,6 +5540,19 @@ reply:
 			HAL_OP_GATT_SERVER_SEND_RESPONSE, status);
 }
 
+static void handle_client_scan_filter_setup(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_scan_filter_setup *cmd = buf;
+
+	DBG("client_if %u", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SCAN_FILTER_SETUP,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5646,6 +5659,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_SERVER_SEND_RESPONSE */
 	{ handle_server_send_response, true,
 		sizeof(struct hal_cmd_gatt_server_send_response) },
+	/* HAL_OP_GATT_CLIENT_SCAN_FILTER_SETUP */
+	{ handle_client_scan_filter_setup, false,
+		sizeof(struct hal_cmd_gatt_client_scan_filter_setup) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 15ab357..f4c3d31 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1311,11 +1311,27 @@ static bt_status_t scan_filter_param_setup(int client_if, int action,
 						int lost_timeout,
 						int found_timeout_cnt)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_scan_filter_setup cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.client_if = client_if;
+	cmd.action = action;
+	cmd.filter_index = filt_index;
+	cmd.features = feat_seln;
+	cmd.list_type = list_logic_type;
+	cmd.filter_type = filt_logic_type;
+	cmd.rssi_hi = rssi_high_thres;
+	cmd.rssi_lo = rssi_low_thres;
+	cmd.delivery_mode = dely_mode;
+	cmd.found_timeout = found_timeout;
+	cmd.lost_timeout = lost_timeout;
+	cmd.found_timeout_cnt = found_timeout_cnt;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SCAN_FILTER_SETUP,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t scan_filter_add_remove(int client_if, int action,
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 438fa7b..c74c76b 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1028,6 +1028,22 @@ struct hal_cmd_gatt_server_send_response {
 	uint8_t data[0];
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_SCAN_FILTER_SETUP	0x024
+struct hal_cmd_gatt_client_scan_filter_setup {
+	int32_t client_if;
+	int32_t action;
+	int32_t filter_index;
+	int32_t features;
+	int32_t list_type;
+	int32_t filter_type;
+	int32_t rssi_hi;
+	int32_t rssi_lo;
+	int32_t delivery_mode;
+	int32_t found_timeout;
+	int32_t lost_timeout;
+	int32_t found_timeout_cnt;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 03/16] android/hal-gatt: Implement client scan_filter_add_remove
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
  2014-11-17 22:27 ` [PATCH 02/16] android/hal-gatt: Implement client scan_filter_param_setup Szymon Janc
@ 2014-11-17 22:27 ` Szymon Janc
  2014-11-18 10:43   ` Lukasz Rymanowski
  2014-11-17 22:27 ` [PATCH 04/16] android/hal-gatt: Implement client scan_filter_clear Szymon Janc
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 35 ++++++++++++++++++++++++++++++++---
 android/hal-msg.h  | 17 +++++++++++++++++
 3 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index a441e4f..f104a2c 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5553,6 +5553,19 @@ static void handle_client_scan_filter_setup(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_scan_filter_add_remove(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_scan_filter_add_remove *cmd = buf;
+
+	DBG("client_if %u", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+				HAL_OP_GATT_CLIENT_SCAN_FILTER_ADD_REMOVE,
+				HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5662,6 +5675,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_SCAN_FILTER_SETUP */
 	{ handle_client_scan_filter_setup, false,
 		sizeof(struct hal_cmd_gatt_client_scan_filter_setup) },
+	/* HAL_OP_GATT_CLIENT_SCAN_FILTER_ADD_REMOVE */
+	{ handle_client_scan_filter_add_remove, true,
+		sizeof(struct hal_cmd_gatt_client_scan_filter_add_remove) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index f4c3d31..3291d47 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1345,11 +1345,40 @@ static bt_status_t scan_filter_add_remove(int client_if, int action,
 						int data_len, char *p_data,
 						int mask_len, char *p_mask)
 {
-	DBG("");
+	char buf[IPC_MTU];
+	struct hal_cmd_gatt_client_scan_filter_add_remove *cmd = (void *) buf;
+	size_t cmd_len;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	if (!p_uuid || !p_uuid_mask || !bd_addr)
+		return BT_STATUS_PARM_INVALID;
+
+	cmd_len = sizeof(*cmd) + data_len + mask_len;
+	if (cmd_len > IPC_MTU)
+		return BT_STATUS_FAIL;
+
+	cmd->client_if = client_if;
+	cmd->action = action;
+	cmd->filter_type = filt_type;
+	cmd->filter_index = filt_index;
+	cmd->company_id = company_id;
+	cmd->company_id_mask = company_id_mask;
+	memcpy(cmd->uuid, p_uuid, sizeof(*p_uuid));
+	memcpy(cmd->uuid_mask, p_uuid_mask, sizeof(*p_uuid_mask));
+	memcpy(cmd->address, bd_addr, sizeof(*bd_addr));
+	cmd->address_type = addr_type;
+
+	cmd->data_len = data_len;
+	memcpy(cmd->data_mask, p_data, data_len);
+
+	cmd->mask_len = mask_len;
+	memcpy(cmd->data_mask + data_len, p_mask, mask_len);
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+				HAL_OP_GATT_CLIENT_SCAN_FILTER_ADD_REMOVE,
+				cmd_len, cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t scan_filter_clear(int client_if, int filt_index)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index c74c76b..94d0069 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1044,6 +1044,23 @@ struct hal_cmd_gatt_client_scan_filter_setup {
 	int32_t found_timeout_cnt;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_SCAN_FILTER_ADD_REMOVE	0x025
+struct hal_cmd_gatt_client_scan_filter_add_remove {
+	int32_t client_if;
+	int32_t action;
+	int32_t filter_type;
+	int32_t filter_index;
+	int32_t company_id;
+	int32_t company_id_mask;
+	uint8_t uuid[16];
+	uint8_t uuid_mask[16];
+	uint8_t address[6];
+	uint8_t address_type;
+	int32_t data_len;
+	int32_t mask_len;
+	uint8_t data_mask[0];
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 04/16] android/hal-gatt: Implement client scan_filter_clear
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
  2014-11-17 22:27 ` [PATCH 02/16] android/hal-gatt: Implement client scan_filter_param_setup Szymon Janc
  2014-11-17 22:27 ` [PATCH 03/16] android/hal-gatt: Implement client scan_filter_add_remove Szymon Janc
@ 2014-11-17 22:27 ` Szymon Janc
  2014-11-17 22:27 ` [PATCH 05/16] android/hal-gatt: Implement client scan_filter_enable Szymon Janc
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 13 +++++++++----
 android/hal-msg.h  |  6 ++++++
 3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index f104a2c..319841a 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5566,6 +5566,19 @@ static void handle_client_scan_filter_add_remove(const void *buf, uint16_t len)
 				HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_scan_filter_clear(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_scan_filter_clear *cmd = buf;
+
+	DBG("client_if %u", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SCAN_FILTER_CLEAR,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5678,6 +5691,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_SCAN_FILTER_ADD_REMOVE */
 	{ handle_client_scan_filter_add_remove, true,
 		sizeof(struct hal_cmd_gatt_client_scan_filter_add_remove) },
+	/* HAL_OP_GATT_CLIENT_SCAN_FILTER_CLEAR */
+	{ handle_client_scan_filter_clear, false,
+		sizeof(struct hal_cmd_gatt_client_scan_filter_clear) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 3291d47..d82bbca 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1383,13 +1383,18 @@ static bt_status_t scan_filter_add_remove(int client_if, int action,
 
 static bt_status_t scan_filter_clear(int client_if, int filt_index)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_scan_filter_clear cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
-}
+	cmd.client_if = client_if;
+	cmd.index = filt_index;
 
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SCAN_FILTER_CLEAR,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
 
 static bt_status_t scan_filter_enable(int client_if, bool enable)
 {
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 94d0069..c269843 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1061,6 +1061,12 @@ struct hal_cmd_gatt_client_scan_filter_add_remove {
 	uint8_t data_mask[0];
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_SCAN_FILTER_CLEAR		0x26
+struct hal_cmd_gatt_client_scan_filter_clear {
+	int32_t client_if;
+	int32_t index;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 05/16] android/hal-gatt: Implement client scan_filter_enable
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (2 preceding siblings ...)
  2014-11-17 22:27 ` [PATCH 04/16] android/hal-gatt: Implement client scan_filter_clear Szymon Janc
@ 2014-11-17 22:27 ` Szymon Janc
  2014-11-17 22:27 ` [PATCH 06/16] android/hal-gatt: Implement client configure_mtu Szymon Janc
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 12 +++++++++---
 android/hal-msg.h  |  6 ++++++
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 319841a..9db24e7 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5579,6 +5579,19 @@ static void handle_client_scan_filter_clear(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_scan_filter_enable(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_scan_filter_enable *cmd = buf;
+
+	DBG("client_if %u", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SCAN_FILTER_ENABLE,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5694,6 +5707,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_SCAN_FILTER_CLEAR */
 	{ handle_client_scan_filter_clear, false,
 		sizeof(struct hal_cmd_gatt_client_scan_filter_clear) },
+	/* HAL_OP_GATT_CLIENT_SCAN_FILTER_ENABLE */
+	{ handle_client_scan_filter_enable, false,
+		sizeof(struct hal_cmd_gatt_client_scan_filter_enable) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index d82bbca..0d90608 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1398,11 +1398,17 @@ static bt_status_t scan_filter_clear(int client_if, int filt_index)
 
 static bt_status_t scan_filter_enable(int client_if, bool enable)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_scan_filter_enable cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.client_if = client_if;
+	cmd.enable = enable;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SCAN_FILTER_ENABLE,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t configure_mtu(int conn_id, int mtu)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index c269843..def94a1 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1067,6 +1067,12 @@ struct hal_cmd_gatt_client_scan_filter_clear {
 	int32_t index;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_SCAN_FILTER_ENABLE		0x27
+struct hal_cmd_gatt_client_scan_filter_enable {
+	int32_t client_if;
+	uint8_t enable;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 06/16] android/hal-gatt: Implement client configure_mtu
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (3 preceding siblings ...)
  2014-11-17 22:27 ` [PATCH 05/16] android/hal-gatt: Implement client scan_filter_enable Szymon Janc
@ 2014-11-17 22:27 ` Szymon Janc
  2014-11-17 22:27 ` [PATCH 07/16] android/hal-gatt: Implement client conn_parameter_update Szymon Janc
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 12 +++++++++---
 android/hal-msg.h  |  6 ++++++
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 9db24e7..93859cf 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5592,6 +5592,19 @@ static void handle_client_scan_filter_enable(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_configure_mtu(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_configure_mtu *cmd = buf;
+
+	DBG("conn_id %u", cmd->conn_id);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_CONFIGURE_MTU,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5710,6 +5723,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_SCAN_FILTER_ENABLE */
 	{ handle_client_scan_filter_enable, false,
 		sizeof(struct hal_cmd_gatt_client_scan_filter_enable) },
+	/* HAL_OP_GATT_CLIENT_CONFIGURE_MTU */
+	{ handle_client_configure_mtu, false,
+		sizeof(struct hal_cmd_gatt_client_configure_mtu) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 0d90608..f4a16bf 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1413,11 +1413,17 @@ static bt_status_t scan_filter_enable(int client_if, bool enable)
 
 static bt_status_t configure_mtu(int conn_id, int mtu)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_configure_mtu cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.conn_id = conn_id;
+	cmd.mtu = mtu;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_CONFIGURE_MTU,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t conn_parameter_update(const bt_bdaddr_t *bd_addr,
diff --git a/android/hal-msg.h b/android/hal-msg.h
index def94a1..efdb9e1 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1073,6 +1073,12 @@ struct hal_cmd_gatt_client_scan_filter_enable {
 	uint8_t enable;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_CONFIGURE_MTU		0x28
+struct hal_cmd_gatt_client_configure_mtu {
+	int32_t conn_id;
+	int32_t mtu;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 07/16] android/hal-gatt: Implement client conn_parameter_update
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (4 preceding siblings ...)
  2014-11-17 22:27 ` [PATCH 06/16] android/hal-gatt: Implement client configure_mtu Szymon Janc
@ 2014-11-17 22:27 ` Szymon Janc
  2014-11-17 22:28 ` [PATCH 08/16] android/hal-gatt: Implement client set_scan_parameters Szymon Janc
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 21 +++++++++++++++++++++
 android/hal-gatt.c | 18 +++++++++++++++---
 android/hal-msg.h  |  9 +++++++++
 3 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 93859cf..6f3b4ee 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5605,6 +5605,24 @@ static void handle_client_configure_mtu(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_conn_param_update(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_conn_param_update *cmd = buf;
+	char address[18];
+	bdaddr_t bdaddr;
+
+	android2bdaddr(cmd->address, &bdaddr);
+	ba2str(&bdaddr, address);
+
+	DBG("%s", address);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_CONN_PARAM_UPDATE,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5726,6 +5744,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_CONFIGURE_MTU */
 	{ handle_client_configure_mtu, false,
 		sizeof(struct hal_cmd_gatt_client_configure_mtu) },
+	/* HAL_OP_GATT_CLIENT_CONN_PARAM_UPDATE */
+	{ handle_client_conn_param_update, false,
+		sizeof(struct hal_cmd_gatt_client_conn_param_update) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index f4a16bf..276268b 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1431,11 +1431,23 @@ static bt_status_t conn_parameter_update(const bt_bdaddr_t *bd_addr,
 						int max_interval, int latency,
 						int timeout)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_conn_param_update cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	if (!bd_addr)
+		return BT_STATUS_PARM_INVALID;
+
+	memcpy(cmd.address, bd_addr, sizeof(*bd_addr));
+	cmd.min_interval = min_interval;
+	cmd.max_interval = max_interval;
+	cmd.latency = latency;
+	cmd.timeout = timeout;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_CONN_PARAM_UPDATE,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t set_scan_parameters(int scan_interval, int scan_window)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index efdb9e1..8b62de2 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1079,6 +1079,15 @@ struct hal_cmd_gatt_client_configure_mtu {
 	int32_t mtu;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_CONN_PARAM_UPDATE		0x29
+struct hal_cmd_gatt_client_conn_param_update {
+	uint8_t address[6];
+	int32_t min_interval;
+	int32_t max_interval;
+	int32_t latency;
+	int32_t timeout;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 08/16] android/hal-gatt: Implement client set_scan_parameters
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (5 preceding siblings ...)
  2014-11-17 22:27 ` [PATCH 07/16] android/hal-gatt: Implement client conn_parameter_update Szymon Janc
@ 2014-11-17 22:28 ` Szymon Janc
  2014-11-17 22:28 ` [PATCH 09/16] android/hal-gatt: Implement client multi_adv_enable Szymon Janc
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 12 +++++++++---
 android/hal-msg.h  |  6 ++++++
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 6f3b4ee..77f6dc7 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5623,6 +5623,19 @@ static void handle_client_conn_param_update(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_set_scan_param(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_set_scan_param *cmd = buf;
+
+	DBG("interval %d window %d", cmd->interval, cmd->window);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SET_SCAN_PARAM,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5747,6 +5760,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_CONN_PARAM_UPDATE */
 	{ handle_client_conn_param_update, false,
 		sizeof(struct hal_cmd_gatt_client_conn_param_update) },
+	/* HAL_OP_GATT_CLIENT_SET_SCAN_PARAM */
+	{ handle_client_set_scan_param, false,
+		sizeof(struct hal_cmd_gatt_client_set_scan_param) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 276268b..78ac8f0 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1452,11 +1452,17 @@ static bt_status_t conn_parameter_update(const bt_bdaddr_t *bd_addr,
 
 static bt_status_t set_scan_parameters(int scan_interval, int scan_window)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_set_scan_param cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.interval = scan_interval;
+	cmd.window = scan_window;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SET_SCAN_PARAM,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t multi_adv_enable(int client_if, int min_interval,
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 8b62de2..8f81274 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1088,6 +1088,12 @@ struct hal_cmd_gatt_client_conn_param_update {
 	int32_t timeout;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_SET_SCAN_PARAM		0x2a
+struct hal_cmd_gatt_client_set_scan_param {
+	int32_t interval;
+	int32_t window;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 09/16] android/hal-gatt: Implement client multi_adv_enable
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (6 preceding siblings ...)
  2014-11-17 22:28 ` [PATCH 08/16] android/hal-gatt: Implement client set_scan_parameters Szymon Janc
@ 2014-11-17 22:28 ` Szymon Janc
  2014-11-17 22:28 ` [PATCH 10/16] android/hal-gatt: Implement client handle_client_update_multi_adv Szymon Janc
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 17 ++++++++++++++---
 android/hal-msg.h  | 11 +++++++++++
 3 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 77f6dc7..6144a55 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5636,6 +5636,19 @@ static void handle_client_set_scan_param(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_setup_multi_adv(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_setup_multi_adv *cmd = buf;
+
+	DBG("client_if %d", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5763,6 +5776,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_SET_SCAN_PARAM */
 	{ handle_client_set_scan_param, false,
 		sizeof(struct hal_cmd_gatt_client_set_scan_param) },
+	/* HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV */
+	{ handle_client_setup_multi_adv, false,
+		sizeof(struct hal_cmd_gatt_client_setup_multi_adv) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 78ac8f0..2692e9c 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1470,11 +1470,22 @@ static bt_status_t multi_adv_enable(int client_if, int min_interval,
 					int chnl_map, int tx_power,
 					int timeout_s)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_setup_multi_adv cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.client_if = client_if;
+	cmd.min_interval = min_interval;
+	cmd.max_interval = max_interval;
+	cmd.type = adv_type;
+	cmd.channel_map = chnl_map;
+	cmd.tx_power = tx_power;
+	cmd.timeout = timeout_s;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t multi_adv_update(int client_if, int min_interval,
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 8f81274..e59a322 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1094,6 +1094,17 @@ struct hal_cmd_gatt_client_set_scan_param {
 	int32_t window;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV		0x2b
+struct hal_cmd_gatt_client_setup_multi_adv {
+	int32_t client_if;
+	int32_t min_interval;
+	int32_t max_interval;
+	int32_t type;
+	int32_t channel_map;
+	int32_t tx_power;
+	int32_t timeout;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 10/16] android/hal-gatt: Implement client handle_client_update_multi_adv
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (7 preceding siblings ...)
  2014-11-17 22:28 ` [PATCH 09/16] android/hal-gatt: Implement client multi_adv_enable Szymon Janc
@ 2014-11-17 22:28 ` Szymon Janc
  2014-11-17 22:28 ` [PATCH 11/16] android/hal-gatt: Implement client multi_adv_set_inst_data Szymon Janc
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 17 ++++++++++++++---
 android/hal-msg.h  | 11 +++++++++++
 3 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 6144a55..6d1f2c7 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5649,6 +5649,19 @@ static void handle_client_setup_multi_adv(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_update_multi_adv(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_update_multi_adv *cmd = buf;
+
+	DBG("client_if %d", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_UPDATE_MULTI_ADV,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5779,6 +5792,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV */
 	{ handle_client_setup_multi_adv, false,
 		sizeof(struct hal_cmd_gatt_client_setup_multi_adv) },
+	/* HAL_OP_GATT_CLIENT_UPDATE_MULTI_ADV */
+	{ handle_client_update_multi_adv, false,
+		sizeof(struct hal_cmd_gatt_client_update_multi_adv) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 2692e9c..0a1d823 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1493,11 +1493,22 @@ static bt_status_t multi_adv_update(int client_if, int min_interval,
 					int chnl_map, int tx_power,
 					int timeout_s)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_update_multi_adv cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.client_if = client_if;
+	cmd.min_interval = min_interval;
+	cmd.max_interval = max_interval;
+	cmd.type = adv_type;
+	cmd.channel_map = chnl_map;
+	cmd.tx_power = tx_power;
+	cmd.timeout = timeout_s;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_UPDATE_MULTI_ADV,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t multi_adv_set_inst_data(int client_if, bool set_scan_rsp,
diff --git a/android/hal-msg.h b/android/hal-msg.h
index e59a322..096d610 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1105,6 +1105,17 @@ struct hal_cmd_gatt_client_setup_multi_adv {
 	int32_t timeout;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_UPDATE_MULTI_ADV		0x2c
+struct hal_cmd_gatt_client_update_multi_adv {
+	int32_t client_if;
+	int32_t min_interval;
+	int32_t max_interval;
+	int32_t type;
+	int32_t channel_map;
+	int32_t tx_power;
+	int32_t timeout;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 11/16] android/hal-gatt: Implement client multi_adv_set_inst_data
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (8 preceding siblings ...)
  2014-11-17 22:28 ` [PATCH 10/16] android/hal-gatt: Implement client handle_client_update_multi_adv Szymon Janc
@ 2014-11-17 22:28 ` Szymon Janc
  2014-11-18 10:58   ` Lukasz Rymanowski
  2014-11-17 22:28 ` [PATCH 12/16] android/hal-gatt: Implement client multi_adv_disable Szymon Janc
                   ` (5 subsequent siblings)
  15 siblings, 1 reply; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 android/hal-msg.h  | 13 +++++++++++++
 3 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 6d1f2c7..1ba06f7 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5662,6 +5662,19 @@ static void handle_client_update_multi_adv(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_setup_multi_adv_inst(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_setup_multi_adv_inst *cmd = buf;
+
+	DBG("client_if %d", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV_INST,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5795,6 +5808,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_UPDATE_MULTI_ADV */
 	{ handle_client_update_multi_adv, false,
 		sizeof(struct hal_cmd_gatt_client_update_multi_adv) },
+	/* HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV_INST */
+	{ handle_client_setup_multi_adv_inst, false,
+		sizeof(struct hal_cmd_gatt_client_setup_multi_adv_inst) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 0a1d823..bf1e3e7 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1522,11 +1522,59 @@ static bt_status_t multi_adv_set_inst_data(int client_if, bool set_scan_rsp,
 						int service_uuid_len,
 						char *service_uuid)
 {
-	DBG("");
+	char buf[IPC_MTU];
+	struct hal_cmd_gatt_client_setup_multi_adv_inst *cmd = (void *) buf;
+	int off = 0;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	if (manufacturer_len > 0 && !manufacturer_data)
+			return BT_STATUS_PARM_INVALID;
+
+	if (service_data_len > 0 && !service_data)
+			return BT_STATUS_PARM_INVALID;
+
+	if (service_uuid_len > 0 && !service_uuid)
+		return BT_STATUS_PARM_INVALID;
+
+	if (sizeof(*cmd) + manufacturer_len + service_data_len
+						+ service_uuid_len > IPC_MTU)
+		return BT_STATUS_FAIL;
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	cmd->client_if = client_if;
+	cmd->set_scan_rsp = set_scan_rsp;
+	cmd->include_name = include_name;
+	cmd->include_tx_power = incl_txpower;
+	cmd->appearance = appearance;
+	cmd->manufacturer_data_len = manufacturer_len;
+	cmd->service_data_len = service_data_len;
+	cmd->service_uuid_len = service_uuid_len;
+
+	if (manufacturer_len > 0) {
+		memcpy(cmd->data_service_uuid, manufacturer_data,
+							manufacturer_len);
+		off += manufacturer_len;
+	}
+
+	if (service_data_len > 0) {
+		memcpy(cmd->data_service_uuid + off, service_data,
+							service_data_len);
+		off += service_data_len;
+	}
+
+	if (service_uuid_len > 0) {
+		memcpy(cmd->data_service_uuid + off, service_uuid,
+							service_uuid_len);
+		off += service_uuid_len;
+	}
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+				HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV_INST,
+				sizeof(*cmd) + off, cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t multi_adv_disable(int client_if)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 096d610..7d26140 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1116,6 +1116,19 @@ struct hal_cmd_gatt_client_update_multi_adv {
 	int32_t timeout;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV_INST		0x2d
+struct hal_cmd_gatt_client_setup_multi_adv_inst {
+	int32_t client_if;
+	uint8_t set_scan_rsp;
+	uint8_t include_name;
+	uint8_t include_tx_power;
+	int32_t appearance;
+	int32_t manufacturer_data_len;
+	int32_t service_data_len;
+	int32_t service_uuid_len;
+	uint8_t data_service_uuid[0];
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 12/16] android/hal-gatt: Implement client multi_adv_disable
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (9 preceding siblings ...)
  2014-11-17 22:28 ` [PATCH 11/16] android/hal-gatt: Implement client multi_adv_set_inst_data Szymon Janc
@ 2014-11-17 22:28 ` Szymon Janc
  2014-11-17 22:28 ` [PATCH 13/16] android/hal-gatt: Implement client batchscan_cfg_storage Szymon Janc
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 11 ++++++++---
 android/hal-msg.h  |  5 +++++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 1ba06f7..5115762 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5675,6 +5675,19 @@ static void handle_client_setup_multi_adv_inst(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_disable_multi_adv_inst(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_disable_multi_adv_inst *cmd = buf;
+
+	DBG("client_if %d", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+				HAL_OP_GATT_CLIENT_DISABLE_MULTI_ADV_INST,
+				HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5811,6 +5824,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV_INST */
 	{ handle_client_setup_multi_adv_inst, false,
 		sizeof(struct hal_cmd_gatt_client_setup_multi_adv_inst) },
+	/* HAL_OP_GATT_CLIENT_DISABLE_MULTI_ADV_INST */
+	{ handle_client_disable_multi_adv_inst, false,
+		sizeof(struct hal_cmd_gatt_client_disable_multi_adv_inst) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index bf1e3e7..f248d33 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1579,11 +1579,16 @@ static bt_status_t multi_adv_set_inst_data(int client_if, bool set_scan_rsp,
 
 static bt_status_t multi_adv_disable(int client_if)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_disable_multi_adv_inst cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.client_if = client_if;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+				HAL_OP_GATT_CLIENT_DISABLE_MULTI_ADV_INST,
+				sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t batchscan_cfg_storage(int client_if, int batch_scan_full_max,
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 7d26140..1d6f1e3 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1129,6 +1129,11 @@ struct hal_cmd_gatt_client_setup_multi_adv_inst {
 	uint8_t data_service_uuid[0];
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_DISABLE_MULTI_ADV_INST	0x2e
+struct hal_cmd_gatt_client_disable_multi_adv_inst {
+	int32_t client_if;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 13/16] android/hal-gatt: Implement client batchscan_cfg_storage
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (10 preceding siblings ...)
  2014-11-17 22:28 ` [PATCH 12/16] android/hal-gatt: Implement client multi_adv_disable Szymon Janc
@ 2014-11-17 22:28 ` Szymon Janc
  2014-11-17 22:28 ` [PATCH 14/16] android/hal-gatt: Implement client batchscan_enb_batch_scan Szymon Janc
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 14 +++++++++++---
 android/hal-msg.h  |  8 ++++++++
 3 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 5115762..dcdcdb2 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5688,6 +5688,19 @@ static void handle_client_disable_multi_adv_inst(const void *buf, uint16_t len)
 				HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_configure_batchscan(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_configure_batchscan *cmd = buf;
+
+	DBG("client_if %d", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_CONFIGURE_BATCHSCAN,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5827,6 +5840,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_DISABLE_MULTI_ADV_INST */
 	{ handle_client_disable_multi_adv_inst, false,
 		sizeof(struct hal_cmd_gatt_client_disable_multi_adv_inst) },
+	/* HAL_OP_GATT_CLIENT_CONFIGURE_BATCHSCAN */
+	{ handle_client_configure_batchscan, false,
+		sizeof(struct hal_cmd_gatt_client_configure_batchscan) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index f248d33..9e58879 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1595,11 +1595,19 @@ static bt_status_t batchscan_cfg_storage(int client_if, int batch_scan_full_max,
 						int batch_scan_trunc_max,
 						int batch_scan_notify_threshold)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_configure_batchscan cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.client_if = client_if;
+	cmd.full_max = batch_scan_full_max;
+	cmd.trunc_max = batch_scan_trunc_max;
+	cmd.notify_threshold = batch_scan_notify_threshold;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_CONFIGURE_BATCHSCAN,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t batchscan_enb_batch_scan(int client_if, int scan_mode,
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 1d6f1e3..bff6509 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1134,6 +1134,14 @@ struct hal_cmd_gatt_client_disable_multi_adv_inst {
 	int32_t client_if;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_CONFIGURE_BATCHSCAN		0x2f
+struct hal_cmd_gatt_client_configure_batchscan {
+	int32_t client_if;
+	int32_t full_max;
+	int32_t trunc_max;
+	int32_t notify_threshold;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 14/16] android/hal-gatt: Implement client batchscan_enb_batch_scan
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (11 preceding siblings ...)
  2014-11-17 22:28 ` [PATCH 13/16] android/hal-gatt: Implement client batchscan_cfg_storage Szymon Janc
@ 2014-11-17 22:28 ` Szymon Janc
  2014-11-17 22:28 ` [PATCH 15/16] android/hal-gatt: Implement client batchscan_dis_batch_scan Szymon Janc
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 16 +++++++++++++---
 android/hal-msg.h  | 10 ++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index dcdcdb2..dbe749f 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5701,6 +5701,19 @@ static void handle_client_configure_batchscan(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_enable_batchscan(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_enable_batchscan *cmd = buf;
+
+	DBG("client_if %d", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_ENABLE_BATCHSCAN,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5843,6 +5856,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_CONFIGURE_BATCHSCAN */
 	{ handle_client_configure_batchscan, false,
 		sizeof(struct hal_cmd_gatt_client_configure_batchscan) },
+	/* HAL_OP_GATT_CLIENT_ENABLE_BATCHSCAN */
+	{ handle_client_enable_batchscan, false,
+		sizeof(struct hal_cmd_gatt_client_enable_batchscan) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 9e58879..0fc89ac 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1615,11 +1615,21 @@ static bt_status_t batchscan_enb_batch_scan(int client_if, int scan_mode,
 						int scan_window, int addr_type,
 						int discard_rule)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_enable_batchscan cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.client_if = client_if;
+	cmd.mode = scan_mode;
+	cmd.interval = scan_interval;
+	cmd.window = scan_window;
+	cmd.address_type = addr_type;
+	cmd.discard_rule = discard_rule;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_ENABLE_BATCHSCAN,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t batchscan_dis_batch_scan(int client_if)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index bff6509..ca2cf9a 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1142,6 +1142,16 @@ struct hal_cmd_gatt_client_configure_batchscan {
 	int32_t notify_threshold;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_ENABLE_BATCHSCAN		0x30
+struct hal_cmd_gatt_client_enable_batchscan {
+	int32_t client_if;
+	int32_t mode;
+	int32_t interval;
+	int32_t window;
+	int32_t address_type;
+	int32_t discard_rule;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 15/16] android/hal-gatt: Implement client batchscan_dis_batch_scan
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (12 preceding siblings ...)
  2014-11-17 22:28 ` [PATCH 14/16] android/hal-gatt: Implement client batchscan_enb_batch_scan Szymon Janc
@ 2014-11-17 22:28 ` Szymon Janc
  2014-11-17 22:28 ` [PATCH 16/16] android/hal-gatt: Implement client batchscan_read_reports Szymon Janc
  2014-11-19 12:14 ` [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 11 ++++++++---
 android/hal-msg.h  |  5 +++++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index dbe749f..24b2af1 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5714,6 +5714,19 @@ static void handle_client_enable_batchscan(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_disable_batchscan(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_disable_batchscan *cmd = buf;
+
+	DBG("client_if %d", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_DISABLE_BATCHSCAN,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5859,6 +5872,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_ENABLE_BATCHSCAN */
 	{ handle_client_enable_batchscan, false,
 		sizeof(struct hal_cmd_gatt_client_enable_batchscan) },
+	/* HAL_OP_GATT_CLIENT_DISABLE_BATCHSCAN */
+	{ handle_client_disable_batchscan, false,
+		sizeof(struct hal_cmd_gatt_client_disable_batchscan) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 0fc89ac..a97095f 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1634,11 +1634,16 @@ static bt_status_t batchscan_enb_batch_scan(int client_if, int scan_mode,
 
 static bt_status_t batchscan_dis_batch_scan(int client_if)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_disable_batchscan cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.client_if = client_if;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_DISABLE_BATCHSCAN,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
 static bt_status_t batchscan_read_reports(int client_if, int scan_mode)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index ca2cf9a..696972a 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1152,6 +1152,11 @@ struct hal_cmd_gatt_client_enable_batchscan {
 	int32_t discard_rule;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_DISABLE_BATCHSCAN		0x31
+struct hal_cmd_gatt_client_disable_batchscan {
+	int32_t client_if;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 16/16] android/hal-gatt: Implement client batchscan_read_reports
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (13 preceding siblings ...)
  2014-11-17 22:28 ` [PATCH 15/16] android/hal-gatt: Implement client batchscan_dis_batch_scan Szymon Janc
@ 2014-11-17 22:28 ` Szymon Janc
  2014-11-19 12:14 ` [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-17 22:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This adds required IPC message, HAL implementation and daemon stub
handler.
---
 android/gatt.c     | 16 ++++++++++++++++
 android/hal-gatt.c | 12 +++++++++---
 android/hal-msg.h  |  6 ++++++
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 24b2af1..71eab14 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5727,6 +5727,19 @@ static void handle_client_disable_batchscan(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_client_read_batchscan_reports(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_gatt_client_read_batchscan_reports *cmd = buf;
+
+	DBG("client_if %d", cmd->client_if);
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+				HAL_OP_GATT_CLIENT_READ_BATCHSCAN_REPORTS,
+				HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_REGISTER */
 	{ handle_client_register, false,
@@ -5875,6 +5888,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GATT_CLIENT_DISABLE_BATCHSCAN */
 	{ handle_client_disable_batchscan, false,
 		sizeof(struct hal_cmd_gatt_client_disable_batchscan) },
+	/* HAL_OP_GATT_CLIENT_READ_BATCHSCAN_REPORTS */
+	{ handle_client_read_batchscan_reports, false,
+		sizeof(struct hal_cmd_gatt_client_read_batchscan_reports) },
 };
 
 static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index a97095f..4dd40cd 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
@@ -1648,11 +1648,17 @@ static bt_status_t batchscan_dis_batch_scan(int client_if)
 
 static bt_status_t batchscan_read_reports(int client_if, int scan_mode)
 {
-	DBG("");
+	struct hal_cmd_gatt_client_read_batchscan_reports cmd;
 
-	/* TODO */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	cmd.client_if = client_if;
+	cmd.scan_mode = scan_mode;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
+				HAL_OP_GATT_CLIENT_READ_BATCHSCAN_REPORTS,
+				sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 #endif
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 696972a..ecb7255 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1157,6 +1157,12 @@ struct hal_cmd_gatt_client_disable_batchscan {
 	int32_t client_if;
 } __attribute__((packed));
 
+#define HAL_OP_GATT_CLIENT_READ_BATCHSCAN_REPORTS	0x32
+struct hal_cmd_gatt_client_read_batchscan_reports {
+	int32_t client_if;
+	int32_t scan_mode;
+} __attribute__((packed));
+
 /* Handsfree client HAL API */
 
 #define HAL_OP_HF_CLIENT_CONNECT		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 03/16] android/hal-gatt: Implement client scan_filter_add_remove
  2014-11-17 22:27 ` [PATCH 03/16] android/hal-gatt: Implement client scan_filter_add_remove Szymon Janc
@ 2014-11-18 10:43   ` Lukasz Rymanowski
  0 siblings, 0 replies; 19+ messages in thread
From: Lukasz Rymanowski @ 2014-11-18 10:43 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On Mon, Nov 17, 2014 at 11:27 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> This adds required IPC message, HAL implementation and daemon stub
> handler
> ---
>  android/gatt.c     | 16 ++++++++++++++++
>  android/hal-gatt.c | 35 ++++++++++++++++++++++++++++++++---
>  android/hal-msg.h  | 17 +++++++++++++++++
>  3 files changed, 65 insertions(+), 3 deletions(-)
>
> diff --git a/android/gatt.c b/android/gatt.c
> index a441e4f..f104a2c 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -5553,6 +5553,19 @@ static void handle_client_scan_filter_setup(const void *buf, uint16_t len)
>                                         HAL_STATUS_UNSUPPORTED);
>  }
>
> +static void handle_client_scan_filter_add_remove(const void *buf, uint16_t len)
> +{
> +       const struct hal_cmd_gatt_client_scan_filter_add_remove *cmd = buf;
> +
> +       DBG("client_if %u", cmd->client_if);
> +
> +       /* TODO */
> +
> +       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +                               HAL_OP_GATT_CLIENT_SCAN_FILTER_ADD_REMOVE,
> +                               HAL_STATUS_UNSUPPORTED);
> +}
> +
>  static const struct ipc_handler cmd_handlers[] = {
>         /* HAL_OP_GATT_CLIENT_REGISTER */
>         { handle_client_register, false,
> @@ -5662,6 +5675,9 @@ static const struct ipc_handler cmd_handlers[] = {
>         /* HAL_OP_GATT_CLIENT_SCAN_FILTER_SETUP */
>         { handle_client_scan_filter_setup, false,
>                 sizeof(struct hal_cmd_gatt_client_scan_filter_setup) },
> +       /* HAL_OP_GATT_CLIENT_SCAN_FILTER_ADD_REMOVE */
> +       { handle_client_scan_filter_add_remove, true,
> +               sizeof(struct hal_cmd_gatt_client_scan_filter_add_remove) },
>  };
>
>  static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
> diff --git a/android/hal-gatt.c b/android/hal-gatt.c
> index f4c3d31..3291d47 100644
> --- a/android/hal-gatt.c
> +++ b/android/hal-gatt.c
> @@ -1345,11 +1345,40 @@ static bt_status_t scan_filter_add_remove(int client_if, int action,
>                                                 int data_len, char *p_data,
>                                                 int mask_len, char *p_mask)
>  {
> -       DBG("");
> +       char buf[IPC_MTU];
> +       struct hal_cmd_gatt_client_scan_filter_add_remove *cmd = (void *) buf;
> +       size_t cmd_len;
>
> -       /* TODO */
> +       if (!interface_ready())
> +               return BT_STATUS_NOT_READY;
>
> -       return BT_STATUS_UNSUPPORTED;
> +       if (!p_uuid || !p_uuid_mask || !bd_addr)
> +               return BT_STATUS_PARM_INVALID;
> +
> +       cmd_len = sizeof(*cmd) + data_len + mask_len;
> +       if (cmd_len > IPC_MTU)
> +               return BT_STATUS_FAIL;
> +
> +       cmd->client_if = client_if;
> +       cmd->action = action;
> +       cmd->filter_type = filt_type;
> +       cmd->filter_index = filt_index;
> +       cmd->company_id = company_id;
> +       cmd->company_id_mask = company_id_mask;
> +       memcpy(cmd->uuid, p_uuid, sizeof(*p_uuid));
> +       memcpy(cmd->uuid_mask, p_uuid_mask, sizeof(*p_uuid_mask));
> +       memcpy(cmd->address, bd_addr, sizeof(*bd_addr));
> +       cmd->address_type = addr_type;
> +
> +       cmd->data_len = data_len;
> +       memcpy(cmd->data_mask, p_data, data_len);
> +
> +       cmd->mask_len = mask_len;
> +       memcpy(cmd->data_mask + data_len, p_mask, mask_len);
> +
> +       return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
> +                               HAL_OP_GATT_CLIENT_SCAN_FILTER_ADD_REMOVE,
> +                               cmd_len, cmd, NULL, NULL, NULL);
>  }
>
>  static bt_status_t scan_filter_clear(int client_if, int filt_index)
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index c74c76b..94d0069 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -1044,6 +1044,23 @@ struct hal_cmd_gatt_client_scan_filter_setup {
>         int32_t found_timeout_cnt;
>  } __attribute__((packed));
>
> +#define HAL_OP_GATT_CLIENT_SCAN_FILTER_ADD_REMOVE      0x025
> +struct hal_cmd_gatt_client_scan_filter_add_remove {
> +       int32_t client_if;
> +       int32_t action;
> +       int32_t filter_type;
> +       int32_t filter_index;
> +       int32_t company_id;
> +       int32_t company_id_mask;
> +       uint8_t uuid[16];
> +       uint8_t uuid_mask[16];
> +       uint8_t address[6];
> +       uint8_t address_type;
> +       int32_t data_len;
> +       int32_t mask_len;
> +       uint8_t data_mask[0];

Maybe comment here would be good saying  that first data_len bytes of
data_mask[] is for data and so on?
Or maybe some tlv could be used here?

> +} __attribute__((packed));
> +
>  /* Handsfree client HAL API */
>
>  #define HAL_OP_HF_CLIENT_CONNECT               0x01
> --
> 1.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

\Łukasz

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 11/16] android/hal-gatt: Implement client multi_adv_set_inst_data
  2014-11-17 22:28 ` [PATCH 11/16] android/hal-gatt: Implement client multi_adv_set_inst_data Szymon Janc
@ 2014-11-18 10:58   ` Lukasz Rymanowski
  0 siblings, 0 replies; 19+ messages in thread
From: Lukasz Rymanowski @ 2014-11-18 10:58 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On Mon, Nov 17, 2014 at 11:28 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> This adds required IPC message, HAL implementation and daemon stub
> handler.
> ---
>  android/gatt.c     | 16 ++++++++++++++++
>  android/hal-gatt.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++---
>  android/hal-msg.h  | 13 +++++++++++++
>  3 files changed, 80 insertions(+), 3 deletions(-)
>
> diff --git a/android/gatt.c b/android/gatt.c
> index 6d1f2c7..1ba06f7 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -5662,6 +5662,19 @@ static void handle_client_update_multi_adv(const void *buf, uint16_t len)
>                                         HAL_STATUS_UNSUPPORTED);
>  }
>
> +static void handle_client_setup_multi_adv_inst(const void *buf, uint16_t len)
> +{
> +       const struct hal_cmd_gatt_client_setup_multi_adv_inst *cmd = buf;
> +
> +       DBG("client_if %d", cmd->client_if);
> +
> +       /* TODO */
> +
> +       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +                                       HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV_INST,
> +                                       HAL_STATUS_UNSUPPORTED);
> +}
> +
>  static const struct ipc_handler cmd_handlers[] = {
>         /* HAL_OP_GATT_CLIENT_REGISTER */
>         { handle_client_register, false,
> @@ -5795,6 +5808,9 @@ static const struct ipc_handler cmd_handlers[] = {
>         /* HAL_OP_GATT_CLIENT_UPDATE_MULTI_ADV */
>         { handle_client_update_multi_adv, false,
>                 sizeof(struct hal_cmd_gatt_client_update_multi_adv) },
> +       /* HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV_INST */
> +       { handle_client_setup_multi_adv_inst, false,
> +               sizeof(struct hal_cmd_gatt_client_setup_multi_adv_inst) },
>  };
>
>  static uint8_t read_by_group_type(const uint8_t *cmd, uint16_t cmd_len,
> diff --git a/android/hal-gatt.c b/android/hal-gatt.c
> index 0a1d823..bf1e3e7 100644
> --- a/android/hal-gatt.c
> +++ b/android/hal-gatt.c
> @@ -1522,11 +1522,59 @@ static bt_status_t multi_adv_set_inst_data(int client_if, bool set_scan_rsp,
>                                                 int service_uuid_len,
>                                                 char *service_uuid)
>  {
> -       DBG("");
> +       char buf[IPC_MTU];
> +       struct hal_cmd_gatt_client_setup_multi_adv_inst *cmd = (void *) buf;
> +       int off = 0;
>
> -       /* TODO */
> +       if (!interface_ready())
> +               return BT_STATUS_NOT_READY;
>
> -       return BT_STATUS_UNSUPPORTED;
> +       if (manufacturer_len > 0 && !manufacturer_data)
> +                       return BT_STATUS_PARM_INVALID;
> +
> +       if (service_data_len > 0 && !service_data)
> +                       return BT_STATUS_PARM_INVALID;
> +
> +       if (service_uuid_len > 0 && !service_uuid)
> +               return BT_STATUS_PARM_INVALID;
> +
> +       if (sizeof(*cmd) + manufacturer_len + service_data_len
> +                                               + service_uuid_len > IPC_MTU)
> +               return BT_STATUS_FAIL;
> +
> +       if (!interface_ready())
> +               return BT_STATUS_NOT_READY;

This is not needed. It is already checked couple lines above.
> +
> +       cmd->client_if = client_if;
> +       cmd->set_scan_rsp = set_scan_rsp;
> +       cmd->include_name = include_name;
> +       cmd->include_tx_power = incl_txpower;
> +       cmd->appearance = appearance;
> +       cmd->manufacturer_data_len = manufacturer_len;
> +       cmd->service_data_len = service_data_len;
> +       cmd->service_uuid_len = service_uuid_len;
> +
> +       if (manufacturer_len > 0) {
> +               memcpy(cmd->data_service_uuid, manufacturer_data,
> +                                                       manufacturer_len);
> +               off += manufacturer_len;
> +       }
> +
> +       if (service_data_len > 0) {
> +               memcpy(cmd->data_service_uuid + off, service_data,
> +                                                       service_data_len);
> +               off += service_data_len;
> +       }
> +
> +       if (service_uuid_len > 0) {
> +               memcpy(cmd->data_service_uuid + off, service_uuid,
> +                                                       service_uuid_len);
> +               off += service_uuid_len;
> +       }
> +
> +       return hal_ipc_cmd(HAL_SERVICE_ID_GATT,
> +                               HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV_INST,
> +                               sizeof(*cmd) + off, cmd, NULL, NULL, NULL);
>  }
>
>  static bt_status_t multi_adv_disable(int client_if)
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index 096d610..7d26140 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -1116,6 +1116,19 @@ struct hal_cmd_gatt_client_update_multi_adv {
>         int32_t timeout;
>  } __attribute__((packed));
>
> +#define HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV_INST                0x2d
> +struct hal_cmd_gatt_client_setup_multi_adv_inst {
> +       int32_t client_if;
> +       uint8_t set_scan_rsp;
> +       uint8_t include_name;
> +       uint8_t include_tx_power;
> +       int32_t appearance;
> +       int32_t manufacturer_data_len;
> +       int32_t service_data_len;
> +       int32_t service_uuid_len;
> +       uint8_t data_service_uuid[0];
> +} __attribute__((packed));
> +
>  /* Handsfree client HAL API */
>
>  #define HAL_OP_HF_CLIENT_CONNECT               0x01
> --
> 1.9.3

\Łukasz

>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks
  2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
                   ` (14 preceding siblings ...)
  2014-11-17 22:28 ` [PATCH 16/16] android/hal-gatt: Implement client batchscan_read_reports Szymon Janc
@ 2014-11-19 12:14 ` Szymon Janc
  15 siblings, 0 replies; 19+ messages in thread
From: Szymon Janc @ 2014-11-19 12:14 UTC (permalink / raw)
  To: linux-bluetooth

On Monday 17 of November 2014 23:27:53 Szymon Janc wrote:
> This adds IPC handlers for new GATT notifications and implementes
> requiured callbacks.
> ---
>  android/hal-gatt.c | 193 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  android/hal-msg.h  | 113 +++++++++++++++++++++++++++++++
>  2 files changed, 305 insertions(+), 1 deletion(-)
> 

Pushed (with comments from Łukasz fixed).



-- 
Best regards, 
Szymon Janc

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-11-19 12:14 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-17 22:27 [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc
2014-11-17 22:27 ` [PATCH 02/16] android/hal-gatt: Implement client scan_filter_param_setup Szymon Janc
2014-11-17 22:27 ` [PATCH 03/16] android/hal-gatt: Implement client scan_filter_add_remove Szymon Janc
2014-11-18 10:43   ` Lukasz Rymanowski
2014-11-17 22:27 ` [PATCH 04/16] android/hal-gatt: Implement client scan_filter_clear Szymon Janc
2014-11-17 22:27 ` [PATCH 05/16] android/hal-gatt: Implement client scan_filter_enable Szymon Janc
2014-11-17 22:27 ` [PATCH 06/16] android/hal-gatt: Implement client configure_mtu Szymon Janc
2014-11-17 22:27 ` [PATCH 07/16] android/hal-gatt: Implement client conn_parameter_update Szymon Janc
2014-11-17 22:28 ` [PATCH 08/16] android/hal-gatt: Implement client set_scan_parameters Szymon Janc
2014-11-17 22:28 ` [PATCH 09/16] android/hal-gatt: Implement client multi_adv_enable Szymon Janc
2014-11-17 22:28 ` [PATCH 10/16] android/hal-gatt: Implement client handle_client_update_multi_adv Szymon Janc
2014-11-17 22:28 ` [PATCH 11/16] android/hal-gatt: Implement client multi_adv_set_inst_data Szymon Janc
2014-11-18 10:58   ` Lukasz Rymanowski
2014-11-17 22:28 ` [PATCH 12/16] android/hal-gatt: Implement client multi_adv_disable Szymon Janc
2014-11-17 22:28 ` [PATCH 13/16] android/hal-gatt: Implement client batchscan_cfg_storage Szymon Janc
2014-11-17 22:28 ` [PATCH 14/16] android/hal-gatt: Implement client batchscan_enb_batch_scan Szymon Janc
2014-11-17 22:28 ` [PATCH 15/16] android/hal-gatt: Implement client batchscan_dis_batch_scan Szymon Janc
2014-11-17 22:28 ` [PATCH 16/16] android/hal-gatt: Implement client batchscan_read_reports Szymon Janc
2014-11-19 12:14 ` [PATCH 01/16] android/hal-gatt: Implement Android 5 callbacks Szymon Janc

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.