Skip to contentSkip to conversation

Add HDP profile support at HAL side

PATCH In review Ravi kumar Veeramally 5 participants 26 messages Mar 12, 2014 – Mar 13, 2014 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

cover Add HDP profile support at HAL side

Patch set contains HDP profile support at HAL side and initial profile registration support at daemon side.

Ravi kumar Veeramally (15):
android/hal-msg: Add HDP app registration struct android/hal-msg: Add HDP app unregistration struct android/hal-msg: Add HDP connect channel struct android/hal-msg: Add HDP destroy channel struct android/hal-msg: Add HDP app registration state event struct android/hal-msg: Add HDP app channel state event struct android/hal-health: Add hal-health file android/hal-health: Add HDP .init method android/hal-health: Add HDP .cleanup method android/hal-health: Add HDP .register_application method android/hal-health: Add HDP .unregister_application method android/hal-health: Add HDP .connect_channel method android/hal-health: Add HDP .destroy_channel method android/hal-health: Add app state and channel state event handlers android/health: Add health.c|h file with basic calls

 android/Android.mk   |   2 +
 android/Makefile.am  |   2 +
 android/hal-health.c | 243 +++++++++++++++++++++++++++++++++++++++++++++++++++
 android/hal-msg.h    |  68 ++++++++++++++
 android/hal.h        |   2 +
 android/health.c     | 115 ++++++++++++++++++++++++
 android/health.h     |  25 ++++++
 android/main.c       |  10 +++
 8 files changed, 467 insertions(+)
 create mode 100644 android/hal-health.c
 create mode 100644 android/health.c
 create mode 100644 android/health.h
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/15 android/hal-msg: Add HDP app registration struct

---
 android/hal-msg.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
android/hal-msg.h +21 -0
index 0abbbe6..b1942de 100644
@@ -383,6 +383,27 @@ struct hal_cmd_pan_disconnect {
 	uint8_t bdaddr[6];
 } __attribute__((packed));
 
+#define HAL_OP_HEALTH_REG_APP		0x01
+struct hal_cmd_health_reg_app {
+	uint8_t app_name[255];
+	uint8_t provider_name[255];
+	uint8_t service_name[255];
+	uint8_t service_descr[200];
+	uint8_t num_of_mdep;
+
+	struct {
+		uint8_t role;
+		uint8_t data_type;
+		uint8_t channel_type;
+		uint8_t descr[255];
+	} mdep_cfg[20];
+} __attribute__((packed));
+
+struct hal_rsp_health_reg_app {
+	uint16_t app_id;
+} __attribute__((packed));
+
+
 /* Handsfree HAL API */
 
 #define HAL_MODE_HANDSFREE_HSP_ONLY		0x01
Signature · 1 line
1.8.3.2
#2 lore raw

Re: [PATCH 01/15] android/hal-msg: Add HDP app registration struct

Hi Ravi,

Quoted 21 lines · Ravi kumar Veeramally
---
 android/hal-msg.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
android/hal-msg.h +9 -0
index 0abbbe6..b1942de 100644
@@ -383,6 +383,27 @@ struct hal_cmd_pan_disconnect {
        uint8_t bdaddr[6];
 } __attribute__((packed));
 
+#define HAL_OP_HEALTH_REG_APP          0x01
+struct hal_cmd_health_reg_app {
+       uint8_t app_name[255];
+       uint8_t provider_name[255];
+       uint8_t service_name[255];
+       uint8_t service_descr[200];
+       uint8_t num_of_mdep;
+
+       struct {

android/hal-msg.h struct hal_cmd_pan_disconnect { · line 404

Quoted 10 lines
android/hal-msg.h +10 -0
+               uint8_t role;
+               uint8_t data_type;
+               uint8_t channel_type;
+               uint8_t descr[255];
+       } mdep_cfg[20];
+} __attribute__((packed));
+
+struct hal_rsp_health_reg_app {
+       uint16_t app_id;
+} __attribute__((packed));

This most likely will not fit in our MTU which currently is 1024 bytes and given that you have 20 cfgs this is going to be huge. We should probably define a hal_string e.g:

struct hal_string {
    uint8_t len;
    uint8_t data[0];
};

Also we do not need to send the 20 cfgs every time so that should probably be set to 0 and we write only num_of_mdep, if that still doesn't fit in our MTU perhaps we should consider a bigger size.

Signature · 1 line
Luiz Augusto von Dentz
#3 lore raw

Re: [PATCH 01/15] android/hal-msg: Add HDP app registration struct

Hi,

Quoted 39 lines · Luiz Augusto von Dentz

Hi Ravi,

Quoted 21 lines · Ravi kumar Veeramally
---
  android/hal-msg.h | 21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)
android/hal-msg.h +9 -0
index 0abbbe6..b1942de 100644
@@ -383,6 +383,27 @@ struct hal_cmd_pan_disconnect {
         uint8_t bdaddr[6];
  } __attribute__((packed));
 
+#define HAL_OP_HEALTH_REG_APP          0x01
+struct hal_cmd_health_reg_app {
+       uint8_t app_name[255];
+       uint8_t provider_name[255];
+       uint8_t service_name[255];
+       uint8_t service_descr[200];
+       uint8_t num_of_mdep;
+
+       struct {

android/hal-msg.h struct hal_cmd_pan_disconnect { · line 404

Quoted 10 lines
android/hal-msg.h +10 -0
+               uint8_t role;
+               uint8_t data_type;
+               uint8_t channel_type;
+               uint8_t descr[255];
+       } mdep_cfg[20];
+} __attribute__((packed));
+
+struct hal_rsp_health_reg_app {
+       uint16_t app_id;
+} __attribute__((packed));

This most likely will not fit in our MTU which currently is 1024 bytes and given that you have 20 cfgs this is going to be huge. We should probably define a hal_string e.g:

Quoted 4 lines
struct hal_string {
     uint8_t len;
     uint8_t data[0];
};

Ok, I will update it.

Quoted 4 lines

Also we do not need to send the 20 cfgs every time so that should probably be set to 0 and we write only num_of_mdep, if that still doesn't fit in our MTU perhaps we should consider a bigger size.

Ok.

Thanks,
Ravi.

#4 lore raw

PATCH 2/15 android/hal-msg: Add HDP app unregistration struct

In reply to Ravi kumar Veeramally
---
 android/hal-msg.h | 4 ++++
 1 file changed, 4 insertions(+)
android/hal-msg.h +4 -0
index b1942de..cf2d353 100644
@@ -403,6 +403,10 @@ struct hal_rsp_health_reg_app {
 	uint16_t app_id;
 } __attribute__((packed));
 
+#define HAL_OP_HEALTH_UNREG_APP		0x02
+struct hal_cmd_health_unreg_app {
+	uint16_t app_id;
+} __attribute__((packed));
 
 /* Handsfree HAL API */
 
Signature · 1 line
1.8.3.2
#5 lore raw

PATCH 3/15 android/hal-msg: Add HDP connect channel struct

In reply to Ravi kumar Veeramally
---
 android/hal-msg.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
android/hal-msg.h +11 -0
index cf2d353..4be4ae2 100644
@@ -408,6 +408,17 @@ struct hal_cmd_health_unreg_app {
 	uint16_t app_id;
 } __attribute__((packed));
 
+#define HAL_OP_HEALTH_CONNECT_CHANNEL	0x03
+struct hal_cmd_health_connect_channel {
+	uint16_t app_id;
+	uint8_t  bdaddr[6];
+	uint8_t  mdep_index;
+} __attribute__((packed));
+
+struct hal_rsp_health_connect_channel {
+	uint16_t  channel_id;
+} __attribute__((packed));
+
 /* Handsfree HAL API */
 
 #define HAL_MODE_HANDSFREE_HSP_ONLY		0x01
Signature · 1 line
1.8.3.2
#6 lore raw

PATCH 4/15 android/hal-msg: Add HDP destroy channel struct

In reply to Ravi kumar Veeramally
---
 android/hal-msg.h | 5 +++++
 1 file changed, 5 insertions(+)
android/hal-msg.h +5 -0
index 4be4ae2..f4e513b 100644
@@ -419,6 +419,11 @@ struct hal_rsp_health_connect_channel {
 	uint16_t  channel_id;
 } __attribute__((packed));
 
+#define HAL_OP_HEALTH_DESTROY_CHANNEL	0x04
+struct hal_cmd_health_destroy_channel {
+	uint16_t channel_id;
+} __attribute__((packed));
+
 /* Handsfree HAL API */
 
 #define HAL_MODE_HANDSFREE_HSP_ONLY		0x01
Signature · 1 line
1.8.3.2
#7 lore raw

PATCH 5/15 android/hal-msg: Add HDP app registration state event struct

In reply to Ravi kumar Veeramally
---
 android/hal-msg.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
android/hal-msg.h +11 -0
index f4e513b..694529f 100644
@@ -996,6 +996,17 @@ struct hal_ev_pan_conn_state {
 	uint8_t  remote_role;
 } __attribute__((packed));
 
+#define HAL_HEALTH_APP_REG_SUCCESS		0x00
+#define HAL_HEALTH_APP_REG_FAILED		0x01
+#define HAL_HEALTH_APP_DEREG_SUCCESS		0x02
+#define HAL_HEALTH_APP_DEREG_FAILED		0x03
+
+#define HAL_EV_HEALTH_APP_REG_STATE		0x81
+struct hal_ev_health_app_reg_state {
+	uint16_t id;
+	uint8_t  state;
+} __attribute__((packed));
+
 #define HAL_A2DP_STATE_DISCONNECTED		0x00
 #define HAL_A2DP_STATE_CONNECTING		0x01
 #define HAL_A2DP_STATE_CONNECTED		0x02
Signature · 1 line
1.8.3.2
#8 lore raw

PATCH 6/15 android/hal-msg: Add HDP app channel state event struct

In reply to Ravi kumar Veeramally
---
 android/hal-msg.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
android/hal-msg.h +16 -0
index 694529f..0139543 100644
@@ -1001,12 +1001,28 @@ struct hal_ev_pan_conn_state {
 #define HAL_HEALTH_APP_DEREG_SUCCESS		0x02
 #define HAL_HEALTH_APP_DEREG_FAILED		0x03
 
+#define HAL_HEALTH_CHANL_STATE_CONNECTING	0x00
+#define HAL_HEALTH_CHANL_STATE_CONNECTED	0x01
+#define HAL_HEALTH_CHANL_STATE_DISCONNECTING	0x02
+#define HAL_HEALTH_CHANL_STATE_DISCONNECTED	0x03
+#define HAL_HEALTH_CHANL_STATE_DESTROYED	0x04
+
 #define HAL_EV_HEALTH_APP_REG_STATE		0x81
 struct hal_ev_health_app_reg_state {
 	uint16_t id;
 	uint8_t  state;
 } __attribute__((packed));
 
+#define HAL_EV_HEALTH_CHNL_STATE		0x82
+struct hal_ev_health_chnl_state {
+	uint16_t app_id;
+	uint8_t  bdaddr[6];
+	uint8_t  mdep_index;
+	uint16_t chnl_id;
+	uint8_t  chnl_state;
+	uint32_t file_descr;
+} __attribute__((packed));
+
 #define HAL_A2DP_STATE_DISCONNECTED		0x00
 #define HAL_A2DP_STATE_CONNECTING		0x01
 #define HAL_A2DP_STATE_CONNECTED		0x02
Signature · 1 line
1.8.3.2
#9 lore raw

Re: [PATCH 06/15] android/hal-msg: Add HDP app channel state event struct

Hi Ravi,

Quoted 15 lines · Ravi kumar Veeramally
---
 android/hal-msg.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
android/hal-msg.h +3 -0
index 694529f..0139543 100644
@@ -1001,12 +1001,28 @@ struct hal_ev_pan_conn_state {
 #define HAL_HEALTH_APP_DEREG_SUCCESS           0x02
 #define HAL_HEALTH_APP_DEREG_FAILED            0x03
 
+#define HAL_HEALTH_CHANL_STATE_CONNECTING      0x00
+#define HAL_HEALTH_CHANL_STATE_CONNECTED       0x01
+#define HAL_HEALTH_CHANL_STATE_DISCONNECTING   0x02

android/hal-msg.h struct hal_ev_pan_conn_state { · line 1016

Quoted 10 lines
android/hal-msg.h +4 -0
+#define HAL_HEALTH_CHANL_STATE_DISCONNECTED    0x03
+#define HAL_HEALTH_CHANL_STATE_DESTROYED       0x04
+
 #define HAL_EV_HEALTH_APP_REG_STATE            0x81
 struct hal_ev_health_app_reg_state {
        uint16_t id;
        uint8_t  state;
 } __attribute__((packed));
 
+#define HAL_EV_HEALTH_CHNL_STATE               0x82

You have CHNL here and CHANL in states definitions - better have them consistent. I guess either CHAN or CHANNEL would be actually better.

android/hal-msg.h struct hal_ev_pan_conn_state { · line 1022

Quoted 6 lines
android/hal-msg.h +6 -0
+struct hal_ev_health_chnl_state {
+       uint16_t app_id;
+       uint8_t  bdaddr[6];
+       uint8_t  mdep_index;
+       uint16_t chnl_id;
+       uint8_t  chnl_state;

Same here - chan or channel.

android/hal-msg.h struct hal_ev_pan_conn_state { · line 1023

Quoted 1 line
android/hal-msg.h +1 -0
+       uint32_t file_descr;

fd shall be passed as auxiliary data - there's parameter for this in IPC calls. Now you just pass plain int value which is useless as fd.

BR,
Andrzej

#10 lore raw

Re: [PATCH 06/15] android/hal-msg: Add HDP app channel state event struct

Hi,

Quoted 28 lines · Andrzej Kaczmarek

Hi Ravi,

Quoted 24 lines · Ravi kumar Veeramally
---
  android/hal-msg.h | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)
android/hal-msg.h +6 -0
index 694529f..0139543 100644
@@ -1001,12 +1001,28 @@ struct hal_ev_pan_conn_state {
  #define HAL_HEALTH_APP_DEREG_SUCCESS           0x02
  #define HAL_HEALTH_APP_DEREG_FAILED            0x03
 
+#define HAL_HEALTH_CHANL_STATE_CONNECTING      0x00
+#define HAL_HEALTH_CHANL_STATE_CONNECTED       0x01
+#define HAL_HEALTH_CHANL_STATE_DISCONNECTING   0x02
+#define HAL_HEALTH_CHANL_STATE_DISCONNECTED    0x03
+#define HAL_HEALTH_CHANL_STATE_DESTROYED       0x04
+
  #define HAL_EV_HEALTH_APP_REG_STATE            0x81
  struct hal_ev_health_app_reg_state {
         uint16_t id;
         uint8_t  state;
  } __attribute__((packed));
 
Quoted 3 lines

android/hal-msg.h struct hal_ev_pan_conn_state { · line 1016

Quoted 1 line
android/hal-msg.h +1 -0
+#define HAL_EV_HEALTH_CHNL_STATE               0x82

You have CHNL here and CHANL in states definitions - better have them consistent. I guess either CHAN or CHANNEL would be actually better.

Ok, I will fix.

Quoted 11 lines

android/hal-msg.h struct hal_ev_pan_conn_state { · line 1022

Quoted 6 lines
android/hal-msg.h +6 -0
+struct hal_ev_health_chnl_state {
+       uint16_t app_id;
+       uint8_t  bdaddr[6];
+       uint8_t  mdep_index;
+       uint16_t chnl_id;
+       uint8_t  chnl_state;

Same here - chan or channel.

android/hal-msg.h struct hal_ev_pan_conn_state { · line 1023

Quoted 1 line
android/hal-msg.h +1 -0
+       uint32_t file_descr;

fd shall be passed as auxiliary data - there's parameter for this in IPC calls. Now you just pass plain int value which is useless as fd.

OK.

Thanks,
Ravi.

#11 lore raw

PATCH 7/15 android/hal-health: Add hal-health file

In reply to Ravi kumar Veeramally

Add hal-health.c and initial get interface method.

---
 android/Android.mk   |  1 +
 android/Makefile.am  |  1 +
 android/hal-health.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 android/hal.h        |  2 ++
 4 files changed, 46 insertions(+)
 create mode 100644 android/hal-health.c
android/Android.mk +1 -0
index 49bf108..0352beb 100644
@@ -121,6 +121,7 @@ LOCAL_SRC_FILES := \
 	bluez/android/hal-handsfree.c \
 	bluez/android/hal-gatt.c \
 	bluez/android/hal-utils.c \
+	bluez/android/hal-health.c \
 
 LOCAL_C_INCLUDES += \
 	$(call include-path-for, system-core) \
android/Makefile.am +1 -0
index bbd3d2f..d2cfed6 100644
@@ -52,6 +52,7 @@ plugin_LTLIBRARIES += android/bluetooth.default.la
 android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
 					android/hal-socket.c \
 					android/hal-hidhost.c \
+					android/hal-health.c \
 					android/hal-pan.c \
 					android/hal-a2dp.c \
 					android/hal-avrcp.c \
android/hal-health.c new file +42 -0

42 lines not on this page · raw message

android/hal.h +2 -0
index b1c0216..6998e9a 100644
@@ -25,6 +25,7 @@
 #include <hardware/bt_gatt.h>
 #include <hardware/bt_gatt_client.h>
 #include <hardware/bt_gatt_server.h>
+#include <hardware/bt_hl.h>
 
 btsock_interface_t *bt_get_socket_interface(void);
 bthh_interface_t *bt_get_hidhost_interface(void);
@@ -33,6 +34,7 @@ btav_interface_t *bt_get_a2dp_interface(void);
 btrc_interface_t *bt_get_avrcp_interface(void);
 bthf_interface_t *bt_get_handsfree_interface(void);
 btgatt_interface_t *bt_get_gatt_interface(void);
+bthl_interface_t *bt_get_health_interface(void);
 
 void bt_thread_associate(void);
 void bt_thread_disassociate(void);
Signature · 1 line
1.8.3.2
#12 lore raw

Re: [PATCH 07/15] android/hal-health: Add hal-health file

Hi Ravi,

Quoted 39 lines · On Wednesday 12 March 2014 17:10:50 Ravi kumar Veeramally wrote:

Add hal-health.c and initial get interface method.

---
 android/Android.mk   |  1 +
 android/Makefile.am  |  1 +
 android/hal-health.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 android/hal.h        |  2 ++
 4 files changed, 46 insertions(+)
 create mode 100644 android/hal-health.c
android/Android.mk +1 -0
index 49bf108..0352beb 100644
@@ -121,6 +121,7 @@ LOCAL_SRC_FILES := \
 	bluez/android/hal-handsfree.c \
 	bluez/android/hal-gatt.c \
 	bluez/android/hal-utils.c \
+	bluez/android/hal-health.c \
 
 LOCAL_C_INCLUDES += \
 	$(call include-path-for, system-core) \
android/Makefile.am +1 -0
index bbd3d2f..d2cfed6 100644
@@ -52,6 +52,7 @@ plugin_LTLIBRARIES += android/bluetooth.default.la
 android_bluetooth_default_la_SOURCES = android/hal.h
 android/hal-bluetooth.c \ android/hal-socket.c \
 					android/hal-hidhost.c \
+					android/hal-health.c \
 					android/hal-pan.c \
 					android/hal-a2dp.c \
 					android/hal-avrcp.c \
android/hal-health.c new file +0 -0
new file mode 100644
index 0000000..55db7f6

android/hal-health.c line 2

Quoted 2 lines
android/hal-health.c new file +2 -0
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2013 Intel Corporation

Shouldn't that be 2014?

Quoted 53 lines
android/hal-health.c new file +11 -0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and + *

limitations under the License.
+ *
+ */

android/hal-health.c new file +26 -0
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "hal-log.h"
+#include "hal.h"
+#include "hal-msg.h"
+#include "ipc-common.h"
+#include "hal-ipc.h"
+
+static bthl_interface_t health_if = {
+	.size = sizeof(health_if),
+	.init = NULL,
+	.register_application = NULL,
+	.unregister_application = NULL,
+	.connect_channel = NULL,
+	.destroy_channel = NULL,
+	.cleanup = NULL
+};
+
+bthl_interface_t *bt_get_health_interface(void)
+{
+	return &health_if;
+}
android/hal.h +1 -0
index b1c0216..6998e9a 100644
@@ -25,6 +25,7 @@
 #include <hardware/bt_gatt.h>
 #include <hardware/bt_gatt_client.h>
 #include <hardware/bt_gatt_server.h>
+#include <hardware/bt_hl.h>
 
 btsock_interface_t *bt_get_socket_interface(void);
 bthh_interface_t *bt_get_hidhost_interface(void);

android/hal.h btav_interface_t *bt_get_a2dp_interface(void); · line 38

Quoted 5 lines
android/hal.h +1 -0
@@ -33,6 +34,7 @@ btav_interface_t *bt_get_a2dp_interface(void);
 btrc_interface_t *bt_get_avrcp_interface(void);
 bthf_interface_t *bt_get_handsfree_interface(void);
 btgatt_interface_t *bt_get_gatt_interface(void);
+bthl_interface_t *bt_get_health_interface(void);
 

This should be called from get_profile_interface() in hal-bluetooth.c

Quoted 2 lines
android/hal.h +0 -0
 void bt_thread_associate(void);
 void bt_thread_disassociate(void);
Signature · 2 lines
Szymon K. Janc
[email protected]
#13 lore raw

PATCH 8/15 android/hal-health: Add HDP .init method

In reply to Ravi kumar Veeramally
---
 android/hal-health.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
android/hal-health.c +42 -1
index 55db7f6..649661e 100644
@@ -26,9 +26,50 @@
 #include "ipc-common.h"
 #include "hal-ipc.h"
 
+static const bthl_callbacks_t *cbacks;
+
+static bool interface_ready(void)
+{
+	return cbacks != NULL;
+}
+
+/* handlers will be called from notification thread context,
+ * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */
+static const struct hal_ipc_handler ev_handlers[] = {
+};
+
+static bt_status_t init(bthl_callbacks_t *callbacks)
+{
+	struct hal_cmd_register_module cmd;
+	int ret;
+
+	DBG("");
+
+	if (interface_ready())
+		return BT_STATUS_DONE;
+
+	/* store reference to user callbacks */
+	cbacks = callbacks;
+
+	hal_ipc_register(HAL_SERVICE_ID_HEALTH, ev_handlers,
+				sizeof(ev_handlers)/sizeof(ev_handlers[0]));
+
+	cmd.service_id = HAL_SERVICE_ID_HEALTH;
+
+	ret = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
+					sizeof(cmd), &cmd, 0, NULL, NULL);
+
+	if (ret != BT_STATUS_SUCCESS) {
+		cbacks = NULL;
+		hal_ipc_unregister(HAL_SERVICE_ID_HEALTH);
+	}
+
+	return ret;
+}
+
 static bthl_interface_t health_if = {
 	.size = sizeof(health_if),
-	.init = NULL,
+	.init = init,
 	.register_application = NULL,
 	.unregister_application = NULL,
 	.connect_channel = NULL,
Signature · 1 line
1.8.3.2
#14 lore raw

Re: [PATCH 08/15] android/hal-health: Add HDP .init method

Hi Ravi,

android/hal-health.c line 29

Quoted 13 lines · On Wednesday 12 March 2014 17:10:51 Ravi kumar Veeramally wrote:
---
 android/hal-health.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
android/hal-health.c +1 -0
index 55db7f6..649661e 100644
@@ -26,9 +26,50 @@
 #include "ipc-common.h"
 #include "hal-ipc.h"
 
+static const bthl_callbacks_t *cbacks;

Please explicitly initialize it to NULL.

Quoted 47 lines
android/hal-health.c +41 -1
+
+static bool interface_ready(void)
+{
+	return cbacks != NULL;
+}
+
+/* handlers will be called from notification thread context,
+ * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */
+static const struct hal_ipc_handler ev_handlers[] = {
+};
+
+static bt_status_t init(bthl_callbacks_t *callbacks)
+{
+	struct hal_cmd_register_module cmd;
+	int ret;
+
+	DBG("");
+
+	if (interface_ready())
+		return BT_STATUS_DONE;
+
+	/* store reference to user callbacks */
+	cbacks = callbacks;
+
+	hal_ipc_register(HAL_SERVICE_ID_HEALTH, ev_handlers,
+				sizeof(ev_handlers)/sizeof(ev_handlers[0]));
+
+	cmd.service_id = HAL_SERVICE_ID_HEALTH;
+
+	ret = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
+					sizeof(cmd), &cmd, 0, NULL, NULL);
+
+	if (ret != BT_STATUS_SUCCESS) {
+		cbacks = NULL;
+		hal_ipc_unregister(HAL_SERVICE_ID_HEALTH);
+	}
+
+	return ret;
+}
+
 static bthl_interface_t health_if = {
 	.size = sizeof(health_if),
-	.init = NULL,
+	.init = init,
 	.register_application = NULL,
 	.unregister_application = NULL,
 	.connect_channel = NULL,
Signature · 2 lines
Szymon K. Janc
[email protected]
#15 lore raw

PATCH 9/15 android/hal-health: Add HDP .cleanup method

In reply to Ravi kumar Veeramally
---
 android/hal-health.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
android/hal-health.c +20 -1
index 649661e..50adcc9 100644
@@ -67,6 +67,25 @@ static bt_status_t init(bthl_callbacks_t *callbacks)
 	return ret;
 }
 
+static void cleanup(void)
+{
+	struct hal_cmd_unregister_module cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return;
+
+	cbacks = NULL;
+
+	cmd.service_id = HAL_SERVICE_ID_HEALTH;
+
+	hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
+					sizeof(cmd), &cmd, 0, NULL, NULL);
+
+	hal_ipc_unregister(HAL_SERVICE_ID_HEALTH);
+}
+
 static bthl_interface_t health_if = {
 	.size = sizeof(health_if),
 	.init = init,
@@ -74,7 +93,7 @@ static bthl_interface_t health_if = {
 	.unregister_application = NULL,
 	.connect_channel = NULL,
 	.destroy_channel = NULL,
-	.cleanup = NULL
+	.cleanup = cleanup
 };
 
 bthl_interface_t *bt_get_health_interface(void)
Signature · 1 line
1.8.3.2
#16 lore raw

PATCH 10/15 android/hal-health: Add HDP .register_application method

In reply to Ravi kumar Veeramally
---
 android/hal-health.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 54 insertions(+), 1 deletion(-)
android/hal-health.c +54 -1
index 50adcc9..8a610a2 100644
@@ -38,6 +38,59 @@ static bool interface_ready(void)
 static const struct hal_ipc_handler ev_handlers[] = {
 };
 
+static bt_status_t register_application(bthl_reg_param_t *reg, int *app_id)
+{
+	struct hal_cmd_health_reg_app cmd;
+	struct hal_rsp_health_reg_app rsp;
+	size_t len = sizeof(rsp);
+	bt_status_t status;
+	uint8_t i;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	memset(&cmd, 0, sizeof(cmd));
+
+	if (reg->application_name)
+		memcpy(cmd.app_name, reg->application_name,
+						strlen(reg->application_name));
+
+	if (reg->provider_name)
+		memcpy(cmd.provider_name, reg->provider_name,
+						strlen(reg->provider_name));
+
+	if (reg->srv_name)
+		memcpy(cmd.service_name, reg->srv_name,
+						strlen(reg->srv_name));
+
+	if (reg->srv_desp)
+		memcpy(cmd.service_descr, reg->srv_desp,
+						strlen(reg->srv_desp));
+
+	cmd.num_of_mdep = reg->number_of_mdeps;
+
+	if (reg->mdep_cfg && reg->number_of_mdeps > 0) {
+		for (i = 0; i < reg->number_of_mdeps; i++) {
+			cmd.mdep_cfg[i].role = reg->mdep_cfg[i].mdep_role;
+			cmd.mdep_cfg[i].data_type = reg->mdep_cfg[i].data_type;
+			cmd.mdep_cfg[i].channel_type =
+						reg->mdep_cfg[i].channel_type;
+			memcpy(cmd.mdep_cfg[i].descr,
+				reg->mdep_cfg[i].mdep_description,
+				strlen(reg->mdep_cfg[i].mdep_description));
+		}
+	}
+
+	status = hal_ipc_cmd(HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_REG_APP,
+					sizeof(cmd), &cmd, &len, &rsp, NULL);
+
+	*app_id = rsp.app_id;
+
+	return status;
+}
+
 static bt_status_t init(bthl_callbacks_t *callbacks)
 {
 	struct hal_cmd_register_module cmd;
@@ -89,7 +142,7 @@ static void cleanup(void)
 static bthl_interface_t health_if = {
 	.size = sizeof(health_if),
 	.init = init,
-	.register_application = NULL,
+	.register_application = register_application,
 	.unregister_application = NULL,
 	.connect_channel = NULL,
 	.destroy_channel = NULL,
Signature · 1 line
1.8.3.2
#17 lore raw

PATCH 11/15 android/hal-health: Add HDP .unregister_application method

In reply to Ravi kumar Veeramally
---
 android/hal-health.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
android/hal-health.c +16 -1
index 8a610a2..007a37a 100644
@@ -91,6 +91,21 @@ static bt_status_t register_application(bthl_reg_param_t *reg, int *app_id)
 	return status;
 }
 
+static bt_status_t unregister_application(int app_id)
+{
+	struct hal_cmd_health_unreg_app cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	cmd.app_id = app_id;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_UNREG_APP,
+					sizeof(cmd), &cmd, 0, NULL, NULL);
+}
+
 static bt_status_t init(bthl_callbacks_t *callbacks)
 {
 	struct hal_cmd_register_module cmd;
@@ -143,7 +158,7 @@ static bthl_interface_t health_if = {
 	.size = sizeof(health_if),
 	.init = init,
 	.register_application = register_application,
-	.unregister_application = NULL,
+	.unregister_application = unregister_application,
 	.connect_channel = NULL,
 	.destroy_channel = NULL,
 	.cleanup = cleanup
Signature · 1 line
1.8.3.2
#18 lore raw

PATCH 12/15 android/hal-health: Add HDP .connect_channel method

In reply to Ravi kumar Veeramally
---
 android/hal-health.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
android/hal-health.c +30 -1
index 007a37a..0d10d98 100644
@@ -106,6 +106,35 @@ static bt_status_t unregister_application(int app_id)
 					sizeof(cmd), &cmd, 0, NULL, NULL);
 }
 
+static bt_status_t connect_channel(int app_id, bt_bdaddr_t *bd_addr,
+					int mdep_cfg_index, int *channel_id)
+{
+	struct hal_cmd_health_connect_channel cmd;
+	struct hal_rsp_health_connect_channel rsp;
+	size_t len = sizeof(rsp);
+	bt_status_t status;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	if (!bd_addr)
+		return BT_STATUS_PARM_INVALID;
+
+	cmd.app_id = app_id;
+	cmd.mdep_index = mdep_cfg_index;
+	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+	status = hal_ipc_cmd(HAL_SERVICE_ID_HEALTH,
+					HAL_OP_HEALTH_CONNECT_CHANNEL,
+					sizeof(cmd), &cmd, &len, &rsp, NULL);
+
+	*channel_id = rsp.channel_id;
+
+	return status;
+}
+
 static bt_status_t init(bthl_callbacks_t *callbacks)
 {
 	struct hal_cmd_register_module cmd;
@@ -159,7 +188,7 @@ static bthl_interface_t health_if = {
 	.init = init,
 	.register_application = register_application,
 	.unregister_application = unregister_application,
-	.connect_channel = NULL,
+	.connect_channel = connect_channel,
 	.destroy_channel = NULL,
 	.cleanup = cleanup
 };
Signature · 1 line
1.8.3.2
#19 lore raw

Re: [PATCH 12/15] android/hal-health: Add HDP .connect_channel method

Hi Ravi,

Quoted 17 lines · On Wednesday 12 March 2014 17:10:55 Ravi kumar Veeramally wrote:
---
 android/hal-health.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
android/hal-health.c +5 -0
index 007a37a..0d10d98 100644
@@ -106,6 +106,35 @@ static bt_status_t unregister_application(int app_id)
 					sizeof(cmd), &cmd, 0, NULL, NULL);
 }
 
+static bt_status_t connect_channel(int app_id, bt_bdaddr_t *bd_addr,
+					int mdep_cfg_index, int *channel_id)
+{
+	struct hal_cmd_health_connect_channel cmd;
+	struct hal_rsp_health_connect_channel rsp;

android/hal-health.c static bt_status_t unregister_application(int app_id) · line 123

Quoted 10 lines
android/hal-health.c +10 -0
+	size_t len = sizeof(rsp);
+	bt_status_t status;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	if (!bd_addr)
+		return BT_STATUS_PARM_INVALID;

Verify channel_id pointer as well here.

android/hal-health.c static bt_status_t unregister_application(int app_id) · line 133

Quoted 10 lines
android/hal-health.c +10 -0
+
+	cmd.app_id = app_id;
+	cmd.mdep_index = mdep_cfg_index;
+	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+	status = hal_ipc_cmd(HAL_SERVICE_ID_HEALTH,
+					HAL_OP_HEALTH_CONNECT_CHANNEL,
+					sizeof(cmd), &cmd, &len, &rsp, NULL);
+
+	*channel_id = rsp.channel_id;

if (status == HAL_STATUS_SUCCESS)

    *channel_id = rsp.channel_id;

Otherwise you might assign garbage.

Quoted 16 lines
android/hal-health.c +5 -1
+
+	return status;
+}
+
 static bt_status_t init(bthl_callbacks_t *callbacks)
 {
 	struct hal_cmd_register_module cmd;
@@ -159,7 +188,7 @@ static bthl_interface_t health_if = {
 	.init = init,
 	.register_application = register_application,
 	.unregister_application = unregister_application,
-	.connect_channel = NULL,
+	.connect_channel = connect_channel,
 	.destroy_channel = NULL,
 	.cleanup = cleanup
 };
Signature · 2 lines
Szymon K. Janc
[email protected]
#20 lore raw

Re: [PATCH 12/15] android/hal-health: Add HDP .connect_channel method

Hi Szymon,

Quoted 43 lines · Szymon Janc

Hi Ravi,

Quoted 17 lines · On Wednesday 12 March 2014 17:10:55 Ravi kumar Veeramally wrote:
---
  android/hal-health.c | 31 ++++++++++++++++++++++++++++++-
  1 file changed, 30 insertions(+), 1 deletion(-)
android/hal-health.c +5 -0
index 007a37a..0d10d98 100644
@@ -106,6 +106,35 @@ static bt_status_t unregister_application(int app_id)
  					sizeof(cmd), &cmd, 0, NULL, NULL);
  }
 
+static bt_status_t connect_channel(int app_id, bt_bdaddr_t *bd_addr,
+					int mdep_cfg_index, int *channel_id)
+{
+	struct hal_cmd_health_connect_channel cmd;
+	struct hal_rsp_health_connect_channel rsp;

android/hal-health.c static bt_status_t unregister_application(int app_id) · line 123

Quoted 10 lines
android/hal-health.c +10 -0
+	size_t len = sizeof(rsp);
+	bt_status_t status;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	if (!bd_addr)
+		return BT_STATUS_PARM_INVALID;

Verify channel_id pointer as well here.

android/hal-health.c static bt_status_t unregister_application(int app_id) · line 133

Quoted 10 lines
android/hal-health.c +10 -0
+
+	cmd.app_id = app_id;
+	cmd.mdep_index = mdep_cfg_index;
+	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+	status = hal_ipc_cmd(HAL_SERVICE_ID_HEALTH,
+					HAL_OP_HEALTH_CONNECT_CHANNEL,
+					sizeof(cmd), &cmd, &len, &rsp, NULL);
+
+	*channel_id = rsp.channel_id;

if (status == HAL_STATUS_SUCCESS)

Quoted 3 lines
     *channel_id = rsp.channel_id;

Otherwise you might assign garbage.

Ok, I will fix all your comments.

Quoted 8 lines
Quoted 8 lines
android/hal-health.c +4 -0
+
+	return status;
+}
+
  static bt_status_t init(bthl_callbacks_t *callbacks)
  {
  	struct hal_cmd_register_module cmd;
@@ -159,7 +188,7 @@ static bthl_interface_t health_if = {
Quoted 8 lines

android/hal-health.c static bthl_interface_t health_if = { · line 194

Quoted 8 lines
android/hal-health.c +1 -1
  	.init = init,
  	.register_application = register_application,
  	.unregister_application = unregister_application,
-	.connect_channel = NULL,
+	.connect_channel = connect_channel,
  	.destroy_channel = NULL,
  	.cleanup = cleanup
  };

Thanks,
Ravi.

#21 lore raw

PATCH 13/15 android/hal-health: Add HDP .destroy_channel method

In reply to Ravi kumar Veeramally
---
 android/hal-health.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
android/hal-health.c +16 -1
index 0d10d98..479fd94 100644
@@ -135,6 +135,21 @@ static bt_status_t connect_channel(int app_id, bt_bdaddr_t *bd_addr,
 	return status;
 }
 
+static bt_status_t destroy_channel(int channel_id)
+{
+	struct hal_cmd_health_destroy_channel cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	cmd.channel_id = channel_id;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_DESTROY_CHANNEL,
+					sizeof(cmd), &cmd, 0, NULL, NULL);
+}
+
 static bt_status_t init(bthl_callbacks_t *callbacks)
 {
 	struct hal_cmd_register_module cmd;
@@ -189,7 +204,7 @@ static bthl_interface_t health_if = {
 	.register_application = register_application,
 	.unregister_application = unregister_application,
 	.connect_channel = connect_channel,
-	.destroy_channel = NULL,
+	.destroy_channel = destroy_channel,
 	.cleanup = cleanup
 };
 
Signature · 1 line
1.8.3.2
#22 lore raw

PATCH 14/15 android/hal-health: Add app state and channel state event handlers

In reply to Ravi kumar Veeramally
---
 android/hal-health.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
android/hal-health.c +29 -0
index 479fd94..a9ea8cb 100644
@@ -33,9 +33,38 @@ static bool interface_ready(void)
 	return cbacks != NULL;
 }
 
+static void handle_app_registration_state(void *buf, uint16_t len)
+{
+	struct hal_ev_health_app_reg_state *ev = buf;
+
+	if (cbacks->app_reg_state_cb)
+		cbacks->app_reg_state_cb(ev->id, ev->state);
+}
+
+static void handle_channel_state(void *buf, uint16_t len)
+{
+	struct hal_ev_health_chnl_state *ev = buf;
+
+	if (cbacks->channel_state_cb)
+		cbacks->channel_state_cb(ev->app_id,
+					(bt_bdaddr_t *) ev->bdaddr,
+					ev->mdep_index, ev->chnl_id,
+					ev->chnl_state, ev->file_descr);
+}
+
 /* handlers will be called from notification thread context,
  * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */
 static const struct hal_ipc_handler ev_handlers[] = {
+	{ /* HAL_EV_HEALTH_APP_REG_STATE */
+		.handler = handle_app_registration_state,
+		.var_len = false,
+		.data_len = sizeof(struct hal_ev_health_app_reg_state)
+	},
+	{ /* HAL_EV_HEALTH_CHNL_STATE */
+		.handler = handle_channel_state,
+		.var_len = false,
+		.data_len = sizeof(struct hal_ev_health_chnl_state)
+	},
 };
 
 static bt_status_t register_application(bthl_reg_param_t *reg, int *app_id)
Signature · 1 line
1.8.3.2
#23 lore raw

PATCH 15/15 android/health: Add health.c|h file with basic calls

In reply to Ravi kumar Veeramally

Add health.c|h with basic calls for register and unregister profile.

---
 android/Android.mk  |   1 +
 android/Makefile.am |   1 +
 android/health.c    | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 android/health.h    |  25 ++++++++++++
 android/main.c      |  10 +++++
 5 files changed, 152 insertions(+)
 create mode 100644 android/health.c
 create mode 100644 android/health.h
android/Android.mk +1 -0
index 0352beb..34e21ea 100644
@@ -43,6 +43,7 @@ LOCAL_SRC_FILES := \
 	bluez/android/pan.c \
 	bluez/android/handsfree.c \
 	bluez/android/gatt.c \
+	bluez/android/health.c \
 	bluez/src/log.c \
 	bluez/src/shared/mgmt.c \
 	bluez/src/shared/util.c \
android/Makefile.am +1 -0
index d2cfed6..adfb14c 100644
@@ -41,6 +41,7 @@ android_bluetoothd_SOURCES = android/main.c \
 				android/pan.h android/pan.c \
 				android/handsfree.h android/handsfree.c \
 				android/gatt.h android/gatt.c \
+				android/health.h android/health.c \
 				btio/btio.h btio/btio.c \
 				src/sdp-client.h src/sdp-client.c \
 				profiles/network/bnep.h profiles/network/bnep.c
android/health.c new file +115 -0

115 lines not on this page · raw message

android/health.h new file +25 -0
new file mode 100644
index 0000000..38a58c0
@@ -0,0 +1,25 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013-2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+bool bt_health_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode);
+void bt_health_unregister(void);
android/main.c +10 -0
index a34f885..9423619 100644
@@ -59,6 +59,7 @@
 #include "avrcp.h"
 #include "handsfree.h"
 #include "gatt.h"
+#include "health.h"
 
 #define STARTUP_GRACE_SECONDS 5
 #define SHUTDOWN_GRACE_SECONDS 10
@@ -133,6 +134,12 @@ static void service_register(const void *buf, uint16_t len)
 			goto failed;
 		}
 
+	case HAL_SERVICE_ID_HEALTH:
+		if (!bt_health_register(hal_ipc, &adapter_bdaddr, m->mode)) {
+			status = HAL_STATUS_FAILED;
+			goto failed;
+		}
+
 		break;
 	default:
 		DBG("service %u not supported", m->service_id);
@@ -186,6 +193,9 @@ static void service_unregister(const void *buf, uint16_t len)
 	case HAL_SERVICE_ID_GATT:
 		bt_gatt_unregister();
 		break;
+	case HAL_SERVICE_ID_HEALTH:
+		bt_health_unregister();
+		break;
 	default:
 		/* This would indicate bug in HAL, as unregister should not be
 		 * called in init failed */
Signature · 1 line
1.8.3.2
#24 lore raw

Re: [PATCH 15/15] android/health: Add health.c|h file with basic calls

Quoted 200 lines · Ravi kumar Veeramally

Add health.c|h with basic calls for register and unregister profile.

---
 android/Android.mk  |   1 +
 android/Makefile.am |   1 +
 android/health.c    | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 android/health.h    |  25 ++++++++++++
 android/main.c      |  10 +++++
 5 files changed, 152 insertions(+)
 create mode 100644 android/health.c
 create mode 100644 android/health.h
android/Android.mk +1 -0
index 0352beb..34e21ea 100644
@@ -43,6 +43,7 @@ LOCAL_SRC_FILES := \
        bluez/android/pan.c \
        bluez/android/handsfree.c \
        bluez/android/gatt.c \
+       bluez/android/health.c \
        bluez/src/log.c \
        bluez/src/shared/mgmt.c \
        bluez/src/shared/util.c \
android/Makefile.am +1 -0
index d2cfed6..adfb14c 100644
@@ -41,6 +41,7 @@ android_bluetoothd_SOURCES = android/main.c \
                                android/pan.h android/pan.c \
                                android/handsfree.h android/handsfree.c \
                                android/gatt.h android/gatt.c \
+                               android/health.h android/health.c \
                                btio/btio.h btio/btio.c \
                                src/sdp-client.h src/sdp-client.c \
                                profiles/network/bnep.h profiles/network/bnep.c
android/health.c new file +115 -0
new file mode 100644
index 0000000..6359b11
@@ -0,0 +1,115 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013-2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <unistd.h>
+#include <glib.h>
+
+#include "lib/bluetooth.h"
+#include "lib/sdp.h"
+#include "lib/sdp_lib.h"
+#include "src/log.h"
+
+#include "hal-msg.h"
+#include "ipc-common.h"
+#include "ipc.h"
+#include "utils.h"
+#include "bluetooth.h"
+#include "health.h"
+
+static bdaddr_t adapter_addr;
+static struct ipc *hal_ipc = NULL;
+
+static void bt_health_register_app(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_REG_APP,
+                                                       HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_unregister_app(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_UNREG_APP,
+                                                       HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_connect_channel(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH,
+                       HAL_OP_HEALTH_CONNECT_CHANNEL, HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_destroy_channel(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH,
+                       HAL_OP_HEALTH_DESTROY_CHANNEL, HAL_STATUS_UNSUPPORTED);
+}
+
+static const struct ipc_handler cmd_handlers[] = {
+       /* HAL_OP_HEALTH_REG_APP */
+       { bt_health_register_app, false,
+                               sizeof(struct hal_cmd_health_reg_app) },
+       /* HAL_OP_HEALTH_UNREG_APP */
+       { bt_health_unregister_app, false,
+                               sizeof(struct hal_cmd_health_unreg_app) },
+       /* HAL_OP_HEALTH_CONNECT_CHANNEL */
+       { bt_health_connect_channel, false,
+                               sizeof(struct hal_cmd_health_connect_channel) },
+       /* HAL_OP_HEALTH_DESTROY_CHANNEL */
+       { bt_health_destroy_channel, false,
+                               sizeof(struct hal_cmd_health_destroy_channel) },
+};
+
+bool bt_health_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode)
+{
+       DBG("");
+
+       bacpy(&adapter_addr, addr);
+
+       hal_ipc = ipc;
+       ipc_register(hal_ipc, HAL_SERVICE_ID_HEALTH, cmd_handlers,
+                                               G_N_ELEMENTS(cmd_handlers));
+
+       return true;
+}
+
+void bt_health_unregister(void)
+{
+       DBG("");
+
+       ipc_unregister(hal_ipc, HAL_SERVICE_ID_HEALTH);
+       hal_ipc = NULL;
+}
android/health.h new file +25 -0
new file mode 100644
index 0000000..38a58c0
@@ -0,0 +1,25 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013-2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+bool bt_health_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode);
+void bt_health_unregister(void);
android/main.c +1 -0
index a34f885..9423619 100644
@@ -59,6 +59,7 @@
 #include "avrcp.h"
 #include "handsfree.h"
 #include "gatt.h"
+#include "health.h"
 
 #define STARTUP_GRACE_SECONDS 5
 #define SHUTDOWN_GRACE_SECONDS 10

android/main.c static void service_register(const void *buf, uint16_t len) · line 135

Quoted 2 lines
android/main.c +0 -0
@@ -133,6 +134,12 @@ static void service_register(const void *buf, uint16_t len)
                        goto failed;
                }

Missing brake here.

Quoted 23 lines
android/main.c +9 -1
+       case HAL_SERVICE_ID_HEALTH:
+               if (!bt_health_register(hal_ipc, &adapter_bdaddr, m->mode)) {
+                       status = HAL_STATUS_FAILED;
+                       goto failed;
+               }
+
                break;
        default:
                DBG("service %u not supported", m->service_id);
@@ -186,6 +193,9 @@ static void service_unregister(const void *buf, uint16_t len)
        case HAL_SERVICE_ID_GATT:
                bt_gatt_unregister();
                break;
+       case HAL_SERVICE_ID_HEALTH:
+               bt_health_unregister();
+               break;
        default:
                /* This would indicate bug in HAL, as unregister should not be
                 * called in init failed */
--

1.8.3.2

Quoted 4 lines

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

Best regards,
Grzegorz Kolodziejczyk

Quoted 229 lines · Ravi kumar Veeramally

Add health.c|h with basic calls for register and unregister profile.

---
 android/Android.mk  |   1 +
 android/Makefile.am |   1 +
 android/health.c    | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 android/health.h    |  25 ++++++++++++
 android/main.c      |  10 +++++
 5 files changed, 152 insertions(+)
 create mode 100644 android/health.c
 create mode 100644 android/health.h
android/Android.mk +1 -0
index 0352beb..34e21ea 100644
@@ -43,6 +43,7 @@ LOCAL_SRC_FILES := \
        bluez/android/pan.c \
        bluez/android/handsfree.c \
        bluez/android/gatt.c \
+       bluez/android/health.c \
        bluez/src/log.c \
        bluez/src/shared/mgmt.c \
        bluez/src/shared/util.c \
android/Makefile.am +1 -0
index d2cfed6..adfb14c 100644
@@ -41,6 +41,7 @@ android_bluetoothd_SOURCES = android/main.c \
                                android/pan.h android/pan.c \
                                android/handsfree.h android/handsfree.c \
                                android/gatt.h android/gatt.c \
+                               android/health.h android/health.c \
                                btio/btio.h btio/btio.c \
                                src/sdp-client.h src/sdp-client.c \
                                profiles/network/bnep.h profiles/network/bnep.c
android/health.c new file +115 -0
new file mode 100644
index 0000000..6359b11
@@ -0,0 +1,115 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013-2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <unistd.h>
+#include <glib.h>
+
+#include "lib/bluetooth.h"
+#include "lib/sdp.h"
+#include "lib/sdp_lib.h"
+#include "src/log.h"
+
+#include "hal-msg.h"
+#include "ipc-common.h"
+#include "ipc.h"
+#include "utils.h"
+#include "bluetooth.h"
+#include "health.h"
+
+static bdaddr_t adapter_addr;
+static struct ipc *hal_ipc = NULL;
+
+static void bt_health_register_app(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_REG_APP,
+                                                       HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_unregister_app(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_UNREG_APP,
+                                                       HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_connect_channel(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH,
+                       HAL_OP_HEALTH_CONNECT_CHANNEL, HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_destroy_channel(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH,
+                       HAL_OP_HEALTH_DESTROY_CHANNEL, HAL_STATUS_UNSUPPORTED);
+}
+
+static const struct ipc_handler cmd_handlers[] = {
+       /* HAL_OP_HEALTH_REG_APP */
+       { bt_health_register_app, false,
+                               sizeof(struct hal_cmd_health_reg_app) },
+       /* HAL_OP_HEALTH_UNREG_APP */
+       { bt_health_unregister_app, false,
+                               sizeof(struct hal_cmd_health_unreg_app) },
+       /* HAL_OP_HEALTH_CONNECT_CHANNEL */
+       { bt_health_connect_channel, false,
+                               sizeof(struct hal_cmd_health_connect_channel) },
+       /* HAL_OP_HEALTH_DESTROY_CHANNEL */
+       { bt_health_destroy_channel, false,
+                               sizeof(struct hal_cmd_health_destroy_channel) },
+};
+
+bool bt_health_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode)
+{
+       DBG("");
+
+       bacpy(&adapter_addr, addr);
+
+       hal_ipc = ipc;
+       ipc_register(hal_ipc, HAL_SERVICE_ID_HEALTH, cmd_handlers,
+                                               G_N_ELEMENTS(cmd_handlers));
+
+       return true;
+}
+
+void bt_health_unregister(void)
+{
+       DBG("");
+
+       ipc_unregister(hal_ipc, HAL_SERVICE_ID_HEALTH);
+       hal_ipc = NULL;
+}
android/health.h new file +25 -0
new file mode 100644
index 0000000..38a58c0
@@ -0,0 +1,25 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013-2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+bool bt_health_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode);
+void bt_health_unregister(void);
android/main.c +10 -1
index a34f885..9423619 100644
@@ -59,6 +59,7 @@
 #include "avrcp.h"
 #include "handsfree.h"
 #include "gatt.h"
+#include "health.h"
 
 #define STARTUP_GRACE_SECONDS 5
 #define SHUTDOWN_GRACE_SECONDS 10
@@ -133,6 +134,12 @@ static void service_register(const void *buf, uint16_t len)
                        goto failed;
                }
 
+       case HAL_SERVICE_ID_HEALTH:
+               if (!bt_health_register(hal_ipc, &adapter_bdaddr, m->mode)) {
+                       status = HAL_STATUS_FAILED;
+                       goto failed;
+               }
+
                break;
        default:
                DBG("service %u not supported", m->service_id);
@@ -186,6 +193,9 @@ static void service_unregister(const void *buf, uint16_t len)
        case HAL_SERVICE_ID_GATT:
                bt_gatt_unregister();
                break;
+       case HAL_SERVICE_ID_HEALTH:
+               bt_health_unregister();
+               break;
        default:
                /* This would indicate bug in HAL, as unregister should not be
                 * called in init failed */
--

1.8.3.2

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

#25 lore raw

Re: [PATCH 15/15] android/health: Add health.c|h file with basic calls

Hi,

Quoted 199 lines · Grzegorz Kolodziejczyk
Quoted 197 lines · Ravi kumar Veeramally

Add health.c|h with basic calls for register and unregister profile.

---
  android/Android.mk  |   1 +
  android/Makefile.am |   1 +
  android/health.c    | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  android/health.h    |  25 ++++++++++++
  android/main.c      |  10 +++++
  5 files changed, 152 insertions(+)

create mode 100644 android/health.c
create mode 100644 android/health.h

android/Android.mk +1 -0
index 0352beb..34e21ea 100644
@@ -43,6 +43,7 @@ LOCAL_SRC_FILES := \
         bluez/android/pan.c \
         bluez/android/handsfree.c \
         bluez/android/gatt.c \
+       bluez/android/health.c \
         bluez/src/log.c \
         bluez/src/shared/mgmt.c \
         bluez/src/shared/util.c \
android/Makefile.am +1 -0
index d2cfed6..adfb14c 100644
@@ -41,6 +41,7 @@ android_bluetoothd_SOURCES = android/main.c \
                                 android/pan.h android/pan.c \
                                 android/handsfree.h android/handsfree.c \
                                 android/gatt.h android/gatt.c \
+                               android/health.h android/health.c \
                                 btio/btio.h btio/btio.c \
                                 src/sdp-client.h src/sdp-client.c \
                                 profiles/network/bnep.h profiles/network/bnep.c
android/health.c new file +115 -0
new file mode 100644
index 0000000..6359b11
@@ -0,0 +1,115 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013-2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <unistd.h>
+#include <glib.h>
+
+#include "lib/bluetooth.h"
+#include "lib/sdp.h"
+#include "lib/sdp_lib.h"
+#include "src/log.h"
+
+#include "hal-msg.h"
+#include "ipc-common.h"
+#include "ipc.h"
+#include "utils.h"
+#include "bluetooth.h"
+#include "health.h"
+
+static bdaddr_t adapter_addr;
+static struct ipc *hal_ipc = NULL;
+
+static void bt_health_register_app(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_REG_APP,
+                                                       HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_unregister_app(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_UNREG_APP,
+                                                       HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_connect_channel(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH,
+                       HAL_OP_HEALTH_CONNECT_CHANNEL, HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_destroy_channel(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH,
+                       HAL_OP_HEALTH_DESTROY_CHANNEL, HAL_STATUS_UNSUPPORTED);
+}
+
+static const struct ipc_handler cmd_handlers[] = {
+       /* HAL_OP_HEALTH_REG_APP */
+       { bt_health_register_app, false,
+                               sizeof(struct hal_cmd_health_reg_app) },
+       /* HAL_OP_HEALTH_UNREG_APP */
+       { bt_health_unregister_app, false,
+                               sizeof(struct hal_cmd_health_unreg_app) },
+       /* HAL_OP_HEALTH_CONNECT_CHANNEL */
+       { bt_health_connect_channel, false,
+                               sizeof(struct hal_cmd_health_connect_channel) },
+       /* HAL_OP_HEALTH_DESTROY_CHANNEL */
+       { bt_health_destroy_channel, false,
+                               sizeof(struct hal_cmd_health_destroy_channel) },
+};
+
+bool bt_health_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode)
+{
+       DBG("");
+
+       bacpy(&adapter_addr, addr);
+
+       hal_ipc = ipc;
+       ipc_register(hal_ipc, HAL_SERVICE_ID_HEALTH, cmd_handlers,
+                                               G_N_ELEMENTS(cmd_handlers));
+
+       return true;
+}
+
+void bt_health_unregister(void)
+{
+       DBG("");
+
+       ipc_unregister(hal_ipc, HAL_SERVICE_ID_HEALTH);
+       hal_ipc = NULL;
+}
android/health.h new file +25 -0
new file mode 100644
index 0000000..38a58c0
@@ -0,0 +1,25 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013-2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+bool bt_health_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode);
+void bt_health_unregister(void);
android/main.c +1 -0
index a34f885..9423619 100644
@@ -59,6 +59,7 @@
  #include "avrcp.h"
  #include "handsfree.h"
  #include "gatt.h"
+#include "health.h"
 
Quoted 6 lines

android/main.c static void service_register(const void *buf, uint16_t len) · line 135

Quoted 5 lines
android/main.c +0 -0
  #define STARTUP_GRACE_SECONDS 5
  #define SHUTDOWN_GRACE_SECONDS 10
@@ -133,6 +134,12 @@ static void service_register(const void *buf, uint16_t len)
                         goto failed;
                 }

Missing brake here.

Ok, I will fix it.

Thanks,
Ravi.

Quoted 260 lines
Quoted 22 lines
android/main.c +9 -1
+       case HAL_SERVICE_ID_HEALTH:
+               if (!bt_health_register(hal_ipc, &adapter_bdaddr, m->mode)) {
+                       status = HAL_STATUS_FAILED;
+                       goto failed;
+               }
+
                 break;
         default:
                 DBG("service %u not supported", m->service_id);
@@ -186,6 +193,9 @@ static void service_unregister(const void *buf, uint16_t len)
         case HAL_SERVICE_ID_GATT:
                 bt_gatt_unregister();
                 break;
+       case HAL_SERVICE_ID_HEALTH:
+               bt_health_unregister();
+               break;
         default:
                 /* This would indicate bug in HAL, as unregister should not be
                  * called in init failed */
--

1.8.3.2

Quoted 4 lines

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

Best regards,
Grzegorz Kolodziejczyk

Quoted 229 lines · Ravi kumar Veeramally

Add health.c|h with basic calls for register and unregister profile.

---
  android/Android.mk  |   1 +
  android/Makefile.am |   1 +
  android/health.c    | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  android/health.h    |  25 ++++++++++++
  android/main.c      |  10 +++++
  5 files changed, 152 insertions(+)

create mode 100644 android/health.c
create mode 100644 android/health.h

android/Android.mk +1 -0
index 0352beb..34e21ea 100644
@@ -43,6 +43,7 @@ LOCAL_SRC_FILES := \
         bluez/android/pan.c \
         bluez/android/handsfree.c \
         bluez/android/gatt.c \
+       bluez/android/health.c \
         bluez/src/log.c \
         bluez/src/shared/mgmt.c \
         bluez/src/shared/util.c \
android/Makefile.am +1 -0
index d2cfed6..adfb14c 100644
@@ -41,6 +41,7 @@ android_bluetoothd_SOURCES = android/main.c \
                                 android/pan.h android/pan.c \
                                 android/handsfree.h android/handsfree.c \
                                 android/gatt.h android/gatt.c \
+                               android/health.h android/health.c \
                                 btio/btio.h btio/btio.c \
                                 src/sdp-client.h src/sdp-client.c \
                                 profiles/network/bnep.h profiles/network/bnep.c
android/health.c new file +115 -0
new file mode 100644
index 0000000..6359b11
@@ -0,0 +1,115 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013-2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <unistd.h>
+#include <glib.h>
+
+#include "lib/bluetooth.h"
+#include "lib/sdp.h"
+#include "lib/sdp_lib.h"
+#include "src/log.h"
+
+#include "hal-msg.h"
+#include "ipc-common.h"
+#include "ipc.h"
+#include "utils.h"
+#include "bluetooth.h"
+#include "health.h"
+
+static bdaddr_t adapter_addr;
+static struct ipc *hal_ipc = NULL;
+
+static void bt_health_register_app(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_REG_APP,
+                                                       HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_unregister_app(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_UNREG_APP,
+                                                       HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_connect_channel(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH,
+                       HAL_OP_HEALTH_CONNECT_CHANNEL, HAL_STATUS_UNSUPPORTED);
+}
+
+static void bt_health_destroy_channel(const void *buf, uint16_t len)
+{
+       DBG("Not implemented");
+
+       ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH,
+                       HAL_OP_HEALTH_DESTROY_CHANNEL, HAL_STATUS_UNSUPPORTED);
+}
+
+static const struct ipc_handler cmd_handlers[] = {
+       /* HAL_OP_HEALTH_REG_APP */
+       { bt_health_register_app, false,
+                               sizeof(struct hal_cmd_health_reg_app) },
+       /* HAL_OP_HEALTH_UNREG_APP */
+       { bt_health_unregister_app, false,
+                               sizeof(struct hal_cmd_health_unreg_app) },
+       /* HAL_OP_HEALTH_CONNECT_CHANNEL */
+       { bt_health_connect_channel, false,
+                               sizeof(struct hal_cmd_health_connect_channel) },
+       /* HAL_OP_HEALTH_DESTROY_CHANNEL */
+       { bt_health_destroy_channel, false,
+                               sizeof(struct hal_cmd_health_destroy_channel) },
+};
+
+bool bt_health_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode)
+{
+       DBG("");
+
+       bacpy(&adapter_addr, addr);
+
+       hal_ipc = ipc;
+       ipc_register(hal_ipc, HAL_SERVICE_ID_HEALTH, cmd_handlers,
+                                               G_N_ELEMENTS(cmd_handlers));
+
+       return true;
+}
+
+void bt_health_unregister(void)
+{
+       DBG("");
+
+       ipc_unregister(hal_ipc, HAL_SERVICE_ID_HEALTH);
+       hal_ipc = NULL;
+}
android/health.h new file +25 -0
new file mode 100644
index 0000000..38a58c0
@@ -0,0 +1,25 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013-2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+bool bt_health_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode);
+void bt_health_unregister(void);
android/main.c +10 -1
index a34f885..9423619 100644
@@ -59,6 +59,7 @@
  #include "avrcp.h"
  #include "handsfree.h"
  #include "gatt.h"
+#include "health.h"
 
  #define STARTUP_GRACE_SECONDS 5
  #define SHUTDOWN_GRACE_SECONDS 10
@@ -133,6 +134,12 @@ static void service_register(const void *buf, uint16_t len)
                         goto failed;
                 }
 
+       case HAL_SERVICE_ID_HEALTH:
+               if (!bt_health_register(hal_ipc, &adapter_bdaddr, m->mode)) {
+                       status = HAL_STATUS_FAILED;
+                       goto failed;
+               }
+
                 break;
         default:
                 DBG("service %u not supported", m->service_id);
@@ -186,6 +193,9 @@ static void service_unregister(const void *buf, uint16_t len)
         case HAL_SERVICE_ID_GATT:
                 bt_gatt_unregister();
                 break;
+       case HAL_SERVICE_ID_HEALTH:
+               bt_health_unregister();
+               break;
         default:
                 /* This would indicate bug in HAL, as unregister should not be
                  * called in init failed */
--

1.8.3.2

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