2014-04-22 12:05:59

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 00/11] Add health profile support for haltest

v1: Patch set contains fixes and health profile support for
haltest.

Ravi kumar Veeramally (11):
android/hal-health: Use correct enums
android/hal-health: Fix copying empty string
android/hal-msg: Add mdep role and channel type defines
android/health: Fix wrong boolean value for command handler
android/health: Add initial function for HAL_OP_HEALTH_MDEP command
android/client: Add initial support for health profile
android/client: Add register_application support to haltest
android/client: Add unregister_application support to haltest
android/client: Add connect_channel support to haltest
android/client: Add destroy_channel support to haltest
android/client: Add health callbacks support for haltest

android/Makefile.am | 1 +
android/client/haltest.c | 1 +
android/client/if-bt.c | 3 +-
android/client/if-hl.c | 301 +++++++++++++++++++++++++++++++++++++++++++++++
android/client/if-main.h | 2 +
android/hal-health.c | 14 ++-
android/hal-msg.h | 7 ++
android/health.c | 13 +-
8 files changed, 334 insertions(+), 8 deletions(-)
create mode 100644 android/client/if-hl.c

--
1.8.3.2



2014-04-24 08:03:43

by Ravi kumar Veeramally

[permalink] [raw]
Subject: Re: [PATCH 00/11] Add health profile support for haltest

Hi Szymon,

On 04/23/2014 11:02 PM, Szymon Janc wrote:
> android/hal-health.c | 14 ++-
> android/hal-msg.h | 7 ++
> android/health.c | 13 +-
> 8 files changed, 334 insertions(+), 8 deletions(-)
> create mode 100644 android/client/if-hl.c
> I've pushed all patches, thanks. But I had to fix compilation for Android
> and some bugs in register application (which I also simplified a bit).
>
Changes looks simpler, thanks.

- Ravi.

2014-04-23 20:02:27

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 00/11] Add health profile support for haltest

Hi Ravi,

On Tuesday 22 of April 2014 15:05:59 Ravi kumar Veeramally wrote:
> v1: Patch set contains fixes and health profile support for
> haltest.
>
> Ravi kumar Veeramally (11):
> android/hal-health: Use correct enums
> android/hal-health: Fix copying empty string
> android/hal-msg: Add mdep role and channel type defines
> android/health: Fix wrong boolean value for command handler
> android/health: Add initial function for HAL_OP_HEALTH_MDEP command
> android/client: Add initial support for health profile
> android/client: Add register_application support to haltest
> android/client: Add unregister_application support to haltest
> android/client: Add connect_channel support to haltest
> android/client: Add destroy_channel support to haltest
> android/client: Add health callbacks support for haltest
>
> android/Makefile.am | 1 +
> android/client/haltest.c | 1 +
> android/client/if-bt.c | 3 +-
> android/client/if-hl.c | 301
> +++++++++++++++++++++++++++++++++++++++++++++++ android/client/if-main.h |
> 2 +
> android/hal-health.c | 14 ++-
> android/hal-msg.h | 7 ++
> android/health.c | 13 +-
> 8 files changed, 334 insertions(+), 8 deletions(-)
> create mode 100644 android/client/if-hl.c

I've pushed all patches, thanks. But I had to fix compilation for Android
and some bugs in register application (which I also simplified a bit).

--
BR
Szymon Janc

2014-04-22 12:06:10

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 11/11] android/client: Add health callbacks support for haltest

---
android/client/if-hl.c | 37 +++++++++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/android/client/if-hl.c b/android/client/if-hl.c
index 6b3e341..b9cf374 100644
--- a/android/client/if-hl.c
+++ b/android/client/if-hl.c
@@ -36,12 +36,45 @@ SINTMAP(bthl_channel_type_t, -1, "(unknown)")
DELEMENT(BTHL_CHANNEL_TYPE_ANY),
ENDMAP

+SINTMAP(bthl_app_reg_state_t, -1, "(unknown)")
+ DELEMENT(BTHL_APP_REG_STATE_REG_SUCCESS),
+ DELEMENT(BTHL_APP_REG_STATE_REG_FAILED),
+ DELEMENT(BTHL_APP_REG_STATE_DEREG_SUCCESS),
+ DELEMENT(BTHL_APP_REG_STATE_DEREG_FAILED),
+ENDMAP
+
+SINTMAP(bthl_channel_state_t, -1, "(unknown)")
+ DELEMENT(BTHL_CONN_STATE_CONNECTING),
+ DELEMENT(BTHL_CONN_STATE_CONNECTED),
+ DELEMENT(BTHL_CONN_STATE_DISCONNECTING),
+ DELEMENT(BTHL_CONN_STATE_DISCONNECTED),
+ DELEMENT(BTHL_CONN_STATE_DESTROYED),
+ENDMAP
+
const bthl_interface_t *if_hl = NULL;

+static void app_reg_state_cb(int app_id, bthl_app_reg_state_t state)
+{
+ haltest_info("%s: app_id=%d app_reg_state=%s\n", __func__,
+ app_id, bthl_app_reg_state_t2str(state));
+}
+
+static void channel_state_cb(int app_id, bt_bdaddr_t *bd_addr,
+ int mdep_cfg_index, int channel_id,
+ bthl_channel_state_t state, int fd)
+{
+ char addr[MAX_ADDR_STR_LEN];
+
+ haltest_info("%s: app_id=%d bd_addr=%s mdep_cfg_index=%d\n"
+ "channel_id=%d channel_state=%s fd=%d\n", __func__,
+ app_id, bt_bdaddr_t2str(bd_addr, addr), mdep_cfg_index,
+ channel_id, bthl_channel_state_t2str(state), fd);
+}
+
static bthl_callbacks_t hl_cbacks = {
.size = sizeof(hl_cbacks),
- .app_reg_state_cb = NULL,
- .channel_state_cb = NULL,
+ .app_reg_state_cb = app_reg_state_cb,
+ .channel_state_cb = channel_state_cb,
};

/* init */
--
1.8.3.2


2014-04-22 12:06:09

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 10/11] android/client: Add destroy_channel support to haltest

---
android/client/if-hl.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/android/client/if-hl.c b/android/client/if-hl.c
index 16a3d16..6b3e341 100644
--- a/android/client/if-hl.c
+++ b/android/client/if-hl.c
@@ -220,6 +220,24 @@ static void connect_channel_p(int argc, const char **argv)
&channel_id);
}

+/* destroy_channel */
+
+static void destroy_channel_p(int argc, const char **argv)
+{
+ uint32_t channel_id;
+
+ RETURN_IF_NULL(if_hl);
+
+ if (argc <= 2) {
+ haltest_error("No channel id is specified");
+ return;
+ }
+
+ channel_id = (uint32_t) atoi(argv[2]);
+
+ EXEC(if_hl->destroy_channel, channel_id);
+}
+
/* cleanup */

static void cleanup_p(int argc, const char **argv)
@@ -239,6 +257,7 @@ static struct method methods[] = {
"[<mdep_role> <data_type> <channel_type> <mdep_descr>] ..."),
STD_METHODH(unregister_application, "<app_id>"),
STD_METHODH(connect_channel, "<app_id> <bd_addr> <mdep_cfg_index>"),
+ STD_METHODH(destroy_channel, "<channel_id>"),
STD_METHOD(cleanup),
END_METHOD
};
--
1.8.3.2


2014-04-22 12:06:06

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 07/11] android/client: Add register_application support to haltest

Input parameters contains many optional strings, so treating
'-' as empty input. It makes input handling simpler.
---
android/client/if-hl.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 136 insertions(+)

diff --git a/android/client/if-hl.c b/android/client/if-hl.c
index 5ea29f8..7c15a76 100644
--- a/android/client/if-hl.c
+++ b/android/client/if-hl.c
@@ -25,6 +25,17 @@
#include "pollhandler.h"
#include "../hal-utils.h"

+SINTMAP(bthl_mdep_role_t, -1, "(unknown)")
+ DELEMENT(BTHL_MDEP_ROLE_SOURCE),
+ DELEMENT(BTHL_MDEP_ROLE_SINK),
+ENDMAP
+
+SINTMAP(bthl_channel_type_t, -1, "(unknown)")
+ DELEMENT(BTHL_CHANNEL_TYPE_RELIABLE),
+ DELEMENT(BTHL_CHANNEL_TYPE_STREAMING),
+ DELEMENT(BTHL_CHANNEL_TYPE_ANY),
+ENDMAP
+
const bthl_interface_t *if_hl = NULL;

static bthl_callbacks_t hl_cbacks = {
@@ -42,6 +53,126 @@ static void init_p(int argc, const char **argv)
EXEC(if_hl->init, &hl_cbacks);
}

+/* register_application */
+
+static void register_application_p(int argc, const char **argv)
+{
+ bthl_reg_param_t *reg;
+ char *app_name, *provider_name, *srv_name, *srv_descr, *descr;
+ uint16_t len, i, mdep_argc_init, mdep_argc_off;
+ int app_id = -1;
+
+ RETURN_IF_NULL(if_hl);
+
+ if (argc <= 2) {
+ haltest_error("No app name is specified\n");
+ return;
+ }
+
+ if (argc <= 3) {
+ haltest_error("No provider is specified\n");
+ return;
+ }
+
+ if (argc <= 4) {
+ haltest_error("No service name is specified\n");
+ return;
+ }
+
+ if (argc <= 5) {
+ haltest_error("No service description is specified\n");
+ return;
+ }
+
+ if (argc <= 6) {
+ haltest_error("No num of mdeps is specified\n");
+ return;
+ }
+
+
+ if (argc != ((atoi(argv[6]) * 4) + 6)) {
+ haltest_error("mdep cfg argumetns are not proper\n");
+ return;
+ }
+
+ reg = (bthl_reg_param_t *) malloc(sizeof(bthl_reg_param_t));
+
+ len = strlen(argv[2]) + 1;
+ app_name = (char *) malloc(len);
+ strcpy(app_name, argv[2]);
+ app_name[len] = '\0';
+ reg->application_name = app_name;
+
+ if (strcmp("-", argv[3])) {
+ len = strlen(argv[3]) + 1;
+ provider_name = (char *) malloc(len);
+ strcpy(provider_name, argv[3]);
+ provider_name[len] = '\0';
+ reg->provider_name = provider_name;
+ } else {
+ reg->provider_name = NULL;
+ }
+
+ if (strcmp("-", argv[4])) {
+ len = strlen(argv[4]) + 1;
+ srv_name = (char *) malloc(len);
+ strcpy(srv_name, argv[4]);
+ srv_name[len] = '\0';
+ reg->srv_name = srv_name;
+ } else {
+ reg->srv_name = NULL;
+ }
+
+ if (strcmp("-", argv[5])) {
+ len = strlen(argv[5]) + 1;
+ srv_descr = (char *) malloc(len);
+ strcpy(srv_descr, argv[5]);
+ srv_descr[len] = '\0';
+ reg->srv_desp = srv_descr;
+ } else {
+ reg->srv_desp = NULL;
+ }
+
+ reg->number_of_mdeps = atoi(argv[6]);
+
+ reg->mdep_cfg = (bthl_mdep_cfg_t *) malloc(reg->number_of_mdeps
+ * sizeof(bthl_mdep_cfg_t));
+ mdep_argc_init = 7;
+
+ for (i = 0; i < reg->number_of_mdeps; i++) {
+ mdep_argc_off = mdep_argc_init + (4 * i);
+ reg->mdep_cfg[i].mdep_role =
+ str2bthl_mdep_role_t(argv[mdep_argc_off]);
+ reg->mdep_cfg[i].data_type = atoi(argv[mdep_argc_off + 1]);
+ reg->mdep_cfg[i].channel_type =
+ str2bthl_channel_type_t(argv[mdep_argc_off + 2]);
+
+ if (strcmp("-", argv[mdep_argc_off + 3])) {
+ reg->mdep_cfg[i].mdep_description = NULL;
+ continue;
+ }
+
+ len = strlen(argv[mdep_argc_off + 3]) + 1;
+ descr = (char *) malloc(len);
+ strcpy(descr, argv[mdep_argc_off + 3]);
+ descr[len] = '\0';
+ reg->mdep_cfg[i].mdep_description = descr;
+ }
+
+ EXEC(if_hl->register_application, reg, &app_id);
+
+ /* free memory */
+ for (i = 0; i < reg->number_of_mdeps; i++)
+ free((void *) reg->mdep_cfg[i].mdep_description);
+
+ free(reg->mdep_cfg);
+ free((void *) reg->application_name);
+ free((void *) reg->provider_name);
+ free((void *) reg->srv_name);
+ free((void *) reg->srv_desp);
+ free(reg);
+}
+
/* cleanup */

static void cleanup_p(int argc, const char **argv)
@@ -54,6 +185,11 @@ static void cleanup_p(int argc, const char **argv)

static struct method methods[] = {
STD_METHOD(init),
+ STD_METHODH(register_application,
+ "[input optional string paramerts like -]\n"
+ "<app_name> <provider_name> <srv_name> <srv_descr>\n"
+ "<num_of_mdeps>\n"
+ "[<mdep_role> <data_type> <channel_type> <mdep_descr>] ..."),
STD_METHOD(cleanup),
END_METHOD
};
--
1.8.3.2


2014-04-22 12:06:08

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 09/11] android/client: Add connect_channel support to haltest

---
android/client/if-hl.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/android/client/if-hl.c b/android/client/if-hl.c
index 557d27a..16a3d16 100644
--- a/android/client/if-hl.c
+++ b/android/client/if-hl.c
@@ -191,6 +191,35 @@ static void unregister_application_p(int argc, const char **argv)
EXEC(if_hl->unregister_application, app_id);
}

+/* connect_channel */
+
+static void connect_channel_p(int argc, const char **argv)
+{
+ uint32_t app_id, mdep_cfg_index;
+ int channel_id = -1;
+ bt_bdaddr_t bd_addr;
+
+ RETURN_IF_NULL(if_hl);
+
+ if (argc <= 2) {
+ haltest_error("No app id is specified");
+ return;
+ }
+
+ VERIFY_ADDR_ARG(3, &bd_addr);
+
+ if (argc <= 4) {
+ haltest_error("No mdep cfg index is specified");
+ return;
+ }
+
+ app_id = (uint32_t) atoi(argv[2]);
+ mdep_cfg_index = (uint32_t) atoi(argv[4]);
+
+ EXEC(if_hl->connect_channel, app_id, &bd_addr, mdep_cfg_index,
+ &channel_id);
+}
+
/* cleanup */

static void cleanup_p(int argc, const char **argv)
@@ -209,6 +238,7 @@ static struct method methods[] = {
"<num_of_mdeps>\n"
"[<mdep_role> <data_type> <channel_type> <mdep_descr>] ..."),
STD_METHODH(unregister_application, "<app_id>"),
+ STD_METHODH(connect_channel, "<app_id> <bd_addr> <mdep_cfg_index>"),
STD_METHOD(cleanup),
END_METHOD
};
--
1.8.3.2


2014-04-22 12:06:07

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 08/11] android/client: Add unregister_application support to haltest

---
android/client/if-hl.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/android/client/if-hl.c b/android/client/if-hl.c
index 7c15a76..557d27a 100644
--- a/android/client/if-hl.c
+++ b/android/client/if-hl.c
@@ -173,6 +173,24 @@ static void register_application_p(int argc, const char **argv)
free(reg);
}

+/* unregister_application */
+
+static void unregister_application_p(int argc, const char **argv)
+{
+ uint32_t app_id;
+
+ RETURN_IF_NULL(if_hl);
+
+ if (argc <= 2) {
+ haltest_error("No app id is specified");
+ return;
+ }
+
+ app_id = (uint32_t) atoi(argv[2]);
+
+ EXEC(if_hl->unregister_application, app_id);
+}
+
/* cleanup */

static void cleanup_p(int argc, const char **argv)
@@ -190,6 +208,7 @@ static struct method methods[] = {
"<app_name> <provider_name> <srv_name> <srv_descr>\n"
"<num_of_mdeps>\n"
"[<mdep_role> <data_type> <channel_type> <mdep_descr>] ..."),
+ STD_METHODH(unregister_application, "<app_id>"),
STD_METHOD(cleanup),
END_METHOD
};
--
1.8.3.2


2014-04-22 12:06:05

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 06/11] android/client: Add initial support for health profile

---
android/Makefile.am | 1 +
android/client/haltest.c | 1 +
android/client/if-bt.c | 3 +--
android/client/if-hl.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++
android/client/if-main.h | 2 ++
5 files changed, 69 insertions(+), 2 deletions(-)
create mode 100644 android/client/if-hl.c

diff --git a/android/Makefile.am b/android/Makefile.am
index c51cce2..cf70fab 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -105,6 +105,7 @@ android_haltest_SOURCES = android/client/haltest.c \
android/client/if-hf.c \
android/client/if-hh.c \
android/client/if-pan.c \
+ android/client/if-hl.c \
android/client/if-sock.c \
android/client/if-audio.c \
android/hardware/hardware.c \
diff --git a/android/client/haltest.c b/android/client/haltest.c
index 114fe31..1bd84e6 100644
--- a/android/client/haltest.c
+++ b/android/client/haltest.c
@@ -41,6 +41,7 @@ const struct interface *interfaces[] = {
&hf_if,
&hh_if,
&pan_if,
+ &hl_if,
&sock_if,
NULL
};
diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 8dcffea..cef124f 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -737,7 +737,6 @@ static void get_profile_interface_p(int argc, const char **argv)
{
const char *id;
const void **pif = NULL;
- const void *dummy = NULL;

RETURN_IF_NULL(if_bluetooth);
if (argc <= 2) {
@@ -752,7 +751,7 @@ static void get_profile_interface_p(int argc, const char **argv)
else if (strcmp(BT_PROFILE_ADVANCED_AUDIO_ID, id) == 0)
pif = (const void **) &if_av;
else if (strcmp(BT_PROFILE_HEALTH_ID, id) == 0)
- pif = &dummy; /* TODO: change when if_hl is there */
+ pif = (const void **) &if_hl;
else if (strcmp(BT_PROFILE_SOCKETS_ID, id) == 0)
pif = (const void **) &if_sock;
else if (strcmp(BT_PROFILE_HIDHOST_ID, id) == 0)
diff --git a/android/client/if-hl.c b/android/client/if-hl.c
new file mode 100644
index 0000000..5ea29f8
--- /dev/null
+++ b/android/client/if-hl.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2014 Intel Corporation
+ *
+ * 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.
+ *
+ */
+
+#include<stdio.h>
+#include<ctype.h>
+
+#include<hardware/bluetooth.h>
+#include<hardware/bt_hl.h>
+
+#include "if-main.h"
+#include "pollhandler.h"
+#include "../hal-utils.h"
+
+const bthl_interface_t *if_hl = NULL;
+
+static bthl_callbacks_t hl_cbacks = {
+ .size = sizeof(hl_cbacks),
+ .app_reg_state_cb = NULL,
+ .channel_state_cb = NULL,
+};
+
+/* init */
+
+static void init_p(int argc, const char **argv)
+{
+ RETURN_IF_NULL(if_hl);
+
+ EXEC(if_hl->init, &hl_cbacks);
+}
+
+/* cleanup */
+
+static void cleanup_p(int argc, const char **argv)
+{
+ RETURN_IF_NULL(if_hl);
+
+ EXECV(if_hl->cleanup);
+ if_hl = NULL;
+}
+
+static struct method methods[] = {
+ STD_METHOD(init),
+ STD_METHOD(cleanup),
+ END_METHOD
+};
+
+const struct interface hl_if = {
+ .name = "hl",
+ .methods = methods
+};
diff --git a/android/client/if-main.h b/android/client/if-main.h
index b628464..8865ffc 100644
--- a/android/client/if-main.h
+++ b/android/client/if-main.h
@@ -52,6 +52,7 @@ extern const btrc_interface_t *if_rc;
extern const bthf_interface_t *if_hf;
extern const bthh_interface_t *if_hh;
extern const btpan_interface_t *if_pan;
+extern const bthl_interface_t *if_hl;
extern const btsock_interface_t *if_sock;
extern const btgatt_interface_t *if_gatt;
extern const btgatt_server_interface_t *if_gatt_server;
@@ -77,6 +78,7 @@ extern const struct interface pan_if;
extern const struct interface sock_if;
extern const struct interface hf_if;
extern const struct interface hh_if;
+extern const struct interface hl_if;

/* Interfaces that will show up in tool (first part of command line) */
extern const struct interface *interfaces[];
--
1.8.3.2


2014-04-22 12:06:03

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 04/11] android/health: Fix wrong boolean value for command handler

bt_health_register_app contains variable data.
---
android/health.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/health.c b/android/health.c
index e4f8cbd..0cda91a 100644
--- a/android/health.c
+++ b/android/health.c
@@ -80,7 +80,7 @@ static void bt_health_destroy_channel(const void *buf, uint16_t len)

static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HEALTH_REG_APP */
- { bt_health_register_app, false,
+ { bt_health_register_app, true,
sizeof(struct hal_cmd_health_reg_app) },
/* HAL_OP_HEALTH_UNREG_APP */
{ bt_health_unregister_app, false,
--
1.8.3.2


2014-04-22 12:06:02

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 03/11] android/hal-msg: Add mdep role and channel type defines

---
android/hal-msg.h | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/android/hal-msg.h b/android/hal-msg.h
index ed0a67a..abcdf0e 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -383,6 +383,13 @@ struct hal_cmd_pan_disconnect {
uint8_t bdaddr[6];
} __attribute__((packed));

+#define HAL_HEALTH_MDEP_ROLE_SOURCE 0x00
+#define HAL_HEALTH_MDEP_ROLE_SINK 0x01
+
+#define HAL_HEALTH_CHANNEL_TYPE_RELIABLE 0x00
+#define HAL_HEALTH_CHANNEL_TYPE_STREAMING 0x01
+#define HAL_HEALTH_CHANNEL_TYPE_ANY 0x02
+
#define HAL_OP_HEALTH_REG_APP 0x01
struct hal_cmd_health_reg_app {
uint8_t num_of_mdep;
--
1.8.3.2


2014-04-22 12:06:01

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 02/11] android/hal-health: Fix copying empty string

MDEP desciption is optional. So check before copying.
---
android/hal-health.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/android/hal-health.c b/android/hal-health.c
index 4ba6fe7..b92c881 100644
--- a/android/hal-health.c
+++ b/android/hal-health.c
@@ -101,9 +101,13 @@ static bt_status_t register_application(bthl_reg_param_t *reg, int *app_id)
mdep->role = reg->mdep_cfg[i].mdep_role;
mdep->data_type = reg->mdep_cfg[i].data_type;
mdep->channel_type = reg->mdep_cfg[i].channel_type;
- mdep->descr_len = strlen(reg->mdep_cfg[i].mdep_description) + 1;
- memcpy(mdep->descr, reg->mdep_cfg[i].mdep_description,
+
+ if (reg->mdep_cfg[i].mdep_description) {
+ mdep->descr_len =
+ strlen(reg->mdep_cfg[i].mdep_description) + 1;
+ memcpy(mdep->descr, reg->mdep_cfg[i].mdep_description,
mdep->descr_len);
+ }

status = hal_ipc_cmd(HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_MDEP,
sizeof(*mdep) + mdep->descr_len,
--
1.8.3.2


2014-04-22 12:06:04

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 05/11] android/health: Add initial function for HAL_OP_HEALTH_MDEP command

---
android/health.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/android/health.c b/android/health.c
index 0cda91a..655d9f9 100644
--- a/android/health.c
+++ b/android/health.c
@@ -54,6 +54,14 @@ static void bt_health_register_app(const void *buf, uint16_t len)
HAL_STATUS_UNSUPPORTED);
}

+static void bt_health_mdep_cfg_data(const void *buf, uint16_t len)
+{
+ DBG("Not implemented");
+
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HEALTH, HAL_OP_HEALTH_MDEP,
+ HAL_STATUS_UNSUPPORTED);
+}
+
static void bt_health_unregister_app(const void *buf, uint16_t len)
{
DBG("Not implemented");
@@ -82,6 +90,9 @@ static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HEALTH_REG_APP */
{ bt_health_register_app, true,
sizeof(struct hal_cmd_health_reg_app) },
+ /* HAL_OP_HEALTH_MDEP */
+ { bt_health_mdep_cfg_data, true,
+ sizeof(struct hal_cmd_health_mdep) },
/* HAL_OP_HEALTH_UNREG_APP */
{ bt_health_unregister_app, false,
sizeof(struct hal_cmd_health_unreg_app) },
--
1.8.3.2


2014-04-22 12:06:00

by Ravi kumar Veeramally

[permalink] [raw]
Subject: [PATCH 01/11] android/hal-health: Use correct enums

---
android/hal-health.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/android/hal-health.c b/android/hal-health.c
index 8d12107..4ba6fe7 100644
--- a/android/hal-health.c
+++ b/android/hal-health.c
@@ -93,7 +93,7 @@ static bt_status_t register_application(bthl_reg_param_t *reg, int *app_id)
sizeof(*cmd) + cmd->len, &cmd,
&rsp_len, &rsp, NULL);

- if (status != HAL_STATUS_SUCCESS)
+ if (status != BT_STATUS_SUCCESS)
return status;

for (i = 0; i < reg->number_of_mdeps; i++) {
@@ -109,7 +109,7 @@ static bt_status_t register_application(bthl_reg_param_t *reg, int *app_id)
sizeof(*mdep) + mdep->descr_len,
buf, 0, NULL, NULL);

- if (status != HAL_STATUS_SUCCESS)
+ if (status != BT_STATUS_SUCCESS)
return status;

}
@@ -158,7 +158,7 @@ static bt_status_t connect_channel(int app_id, bt_bdaddr_t *bd_addr,
HAL_OP_HEALTH_CONNECT_CHANNEL,
sizeof(cmd), &cmd, &len, &rsp, NULL);

- if (status == HAL_STATUS_SUCCESS)
+ if (status == BT_STATUS_SUCCESS)
*channel_id = rsp.channel_id;

return status;
--
1.8.3.2