2014-10-09 12:45:04

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 00/10] android/map-client: Add MAP client daemon implementation

v1.
*Add MAP client daemon implementation (skeleton, body)
*Add haltest MAP client support

Aleksander Drewnicki (4):
android/client: Add skeleton for mce calls
android/client: Add code for mce callback
android/client: Add code for mce method
android/client: Add completion for mce method

Grzegorz Kolodziejczyk (6):
android/map-client: Add initial files
android/map-client: Add stubs for MAP client commands handlers
android/map-client: Add support for get remote MAS instances
android/ipc-tester: Add missing service opcode boundries test cases
android/ipc-tester: Add case for MAP client service opcode boundries
android/ipc-tester: Add cases for MAP client msg size

android/Android.mk | 5 +-
android/Makefile.am | 2 +
android/client/haltest.c | 2 +
android/client/if-bt.c | 3 +
android/client/if-main.h | 3 +
android/client/if-mce.c | 87 +++++++++++++++++++++
android/ipc-tester.c | 32 ++++++++
android/main.c | 12 +++
android/map-client.c | 197 +++++++++++++++++++++++++++++++++++++++++++++++
android/map-client.h | 26 +++++++
10 files changed, 368 insertions(+), 1 deletion(-)
create mode 100644 android/client/if-mce.c
create mode 100644 android/map-client.c
create mode 100644 android/map-client.h

--
1.9.3



2014-10-14 09:02:56

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: Re: [PATCH 04/10] android/ipc-tester: Add missing service opcode boundries test cases

Hi Szymon,

On 13 October 2014 22:32, Szymon Janc <[email protected]> wrote:
> Hi Grzegorz,
>
> On Thursday 09 October 2014 14:45:08 Grzegorz Kolodziejczyk wrote:
>> This patch adds tests sending out of range opcode for each service.
>> ---
>> android/ipc-tester.c | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>>
>> diff --git a/android/ipc-tester.c b/android/ipc-tester.c
>> index ea71c8d..161777d 100644
>> --- a/android/ipc-tester.c
>> +++ b/android/ipc-tester.c
>> @@ -919,9 +919,23 @@ int main(int argc, char *argv[])
>> test_opcode_valid("PAN", HAL_SERVICE_ID_PAN, 0x05, 0,
>> HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);
>>
>> + test_opcode_valid("HANDSFREE", HAL_SERVICE_ID_HANDSFREE, 0x0f, 0,
>> + HAL_SERVICE_ID_BLUETOOTH,
>> + HAL_SERVICE_ID_HANDSFREE);
>> +
>> test_opcode_valid("A2DP", HAL_SERVICE_ID_A2DP, 0x03, 0,
>> HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_A2DP);
>>
>> + test_opcode_valid("HEALTH", HAL_SERVICE_ID_HEALTH, 0x06, 0,
>> + HAL_SERVICE_ID_BLUETOOTH,
>> + HAL_SERVICE_ID_HEALTH);
>> +
>> + test_opcode_valid("AVRCP", HAL_SERVICE_ID_AVRCP, 0x0b, 0,
>> + HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_AVRCP);
>> +
>> + test_opcode_valid("GATT", HAL_SERVICE_ID_GATT, 0x24, 0,
>> + HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_GATT);
>> +
>> test_opcode_valid("HF_CLIENT", HAL_SERVICE_ID_HANDSFREE_CLIENT, 0x10, 0,
>> HAL_SERVICE_ID_BLUETOOTH,
>> HAL_SERVICE_ID_HANDSFREE_CLIENT);
>
> In future please don't send unrelated patches as part of serie. This makes
> review easier and also makes no unnecessary delays in getting such patches
> merged.
>
> Applied. Thanks.
>

Ok, sorry, I must forgot to move this patch to another set.

> --
> Szymon K. Janc
> [email protected]


Best regards,
Grzegorz

2014-10-14 09:01:17

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: Re: [PATCH 03/10] android/map-client: Add support for get remote MAS instances

Hi Szymon,

On 13 October 2014 22:19, Szymon Janc <[email protected]> wrote:
> On Thursday 09 October 2014 14:45:07 Grzegorz Kolodziejczyk wrote:
>> This allows to get remote mas instances. In case of wrong sdp record
>> fail status will be returned in notification.
>> ---
>> android/map-client.c | 124
>> ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 123
>> insertions(+), 1 deletion(-)
>>
>> diff --git a/android/map-client.c b/android/map-client.c
>> index 1001b36..adeae4b 100644
>> --- a/android/map-client.c
>> +++ b/android/map-client.c
>> @@ -30,21 +30,143 @@
>> #include <stdint.h>
>> #include <glib.h>
>>
>> +#include "lib/sdp.h"
>> +#include "lib/sdp_lib.h"
>> +#include "src/sdp-client.h"
>> +
>> #include "ipc.h"
>> #include "lib/bluetooth.h"
>> #include "map-client.h"
>> #include "src/log.h"
>> #include "hal-msg.h"
>> +#include "ipc-common.h"
>> +#include "utils.h"
>> +#include "src/shared/util.h"
>>
>> static struct ipc *hal_ipc = NULL;
>> static bdaddr_t adapter_addr;
>>
>> +static int fill_mce_inst(void *buf, int32_t id, int32_t scn, int32_t
>> msg_type, + const void *name, uint8_t name_len)
>> +{
>> + struct hal_map_client_mas_instance *inst = buf;
>> +
>> + inst->id = id;
>> + inst->scn = scn;
>> + inst->msg_types = msg_type;
>> + inst->name_len = name_len;
>> +
>> + if (name_len)
>> + memcpy(inst->name, name, name_len);
>> +
>> + return sizeof(*inst) + name_len;
>> +}
>> +
>> +static void map_client_sdp_search_cb(sdp_list_t *recs, int err, gpointer
>> data) +{
>> + uint8_t buf[IPC_MTU];
>> + struct hal_ev_map_client_remote_mas_instances *ev = (void *) buf;
>> + bdaddr_t *dst = data;
>> + sdp_list_t *list, *protos;
>> + uint8_t status;
>> + int32_t id, scn, msg_type, name_len, num_instances = 0;
>> + char *name;
>> + size_t size;
>> +
>> + size = sizeof(*ev);
>> + bdaddr2android(dst, &ev->bdaddr);
>> +
>> + if (err < 0) {
>> + error("mce: Unable to get SDP record: %s", strerror(-err));
>> + status = HAL_STATUS_FAILED;
>> + goto fail;
>> + }
>> +
>> + for (list = recs; list != NULL; list = list->next) {
>> + sdp_record_t *rec = list->data;
>> + sdp_data_t *data;
>> +
>> + data = sdp_data_get(rec, SDP_ATTR_MAS_INSTANCE_ID);
>> + if (data) {
>> + id = data->val.uint8;
>> + } else {
>> + error("mce: cannot get mas instance id");
>> + status = HAL_STATUS_FAILED;
>> + goto fail;
>
> I'm not sure if we should fail here. Lets just skip record (we can leave error
> message) and continue with search.
>
> Also make it like: if (!data) {error(); continue;};
> Not need for if-else
>

Ok.

>> + }
>> +
>> + data = sdp_data_get(rec, SDP_ATTR_SVCNAME_PRIMARY);
>> + if (data) {
>> + name = data->val.str;
>> + name_len = data->unitSize;
>> + } else {
>> + error("mce: cannot get mas instance name");
>> + status = HAL_STATUS_FAILED;
>> + goto fail;
>> + }
>> +
>> + data = sdp_data_get(rec, SDP_ATTR_SUPPORTED_MESSAGE_TYPES);
>> + if (data) {
>> + msg_type = data->val.uint8;
>> + } else {
>> + error("mce: cannot get mas instance msg type");
>> + status = HAL_STATUS_FAILED;
>> + goto fail;
>> + }
>> +
>> + if (!sdp_get_access_protos(rec, &protos)) {
>> + scn = sdp_get_proto_port(protos, RFCOMM_UUID);
>> +
>> + sdp_list_foreach(protos,
>> + (sdp_list_func_t) sdp_list_free, NULL);
>> + sdp_list_free(protos, NULL);
>> + } else {
>> + error("mce: cannot get mas instance rfcomm channel");
>> + status = HAL_STATUS_FAILED;
>> + goto fail;
>> + }
>> +
>> + size += fill_mce_inst(buf + size, id, scn, msg_type, name,
>> + name_len);
>> + num_instances++;
>> + }
>> +
>> + status = HAL_STATUS_SUCCESS;
>
> Please check if we are expected to return error if no instances were found.
>

Ok, I'll check it.

>> +
>> +fail:
>> + ev->num_instances = num_instances;
>> + ev->status = status;
>> +
>> + ipc_send_notif(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT,
>> + HAL_EV_MAP_CLIENT_REMOTE_MAS_INSTANCES, size, buf);
>> +
>> + free(dst);
>> +}
>> +
>> static void handle_get_instances(const void *buf, uint16_t len)
>> {
>> + const struct hal_cmd_map_client_get_instances *cmd = buf;
>> + uint8_t status;
>> + bdaddr_t *dst;
>> + uuid_t uuid;
>> +
>> DBG("");
>>
>> + dst = new0(bdaddr_t, 1);
>
> Please check if allocation failed.
>

I forgot this check, I'll fix this.

>> + android2bdaddr(&cmd->bdaddr, dst);
>> +
>> + sdp_uuid16_create(&uuid, MAP_MSE_SVCLASS_ID);
>> +
>> + if (bt_search_service(&adapter_addr, dst, &uuid,
>> + map_client_sdp_search_cb, dst, NULL, 0)) {
>
> Just a hint: you can pass free as destroy function here instead of taking care
> of that in callback.
>
>> + error("mce: Failed to search SDP details");
>> + status = HAL_STATUS_FAILED;
>> + free(dst);
>> + }
>> +
>> + status = HAL_STATUS_SUCCESS;
>
> In case of error status is overwritten.
>

I'll re-check those statuses.

>> ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT,
>> - HAL_OP_MAP_CLIENT_GET_INSTANCES, HAL_STATUS_FAILED);
>> + HAL_OP_MAP_CLIENT_GET_INSTANCES, status);
>> }
>>
>> static const struct ipc_handler cmd_handlers[] = {
>
> --
> Szymon K. Janc
> [email protected]

Best regards,
Grzegorz

2014-10-14 08:58:55

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: Re: [PATCH 02/10] android/map-client: Add stubs for MAP client commands handlers

Hi Szymon,

On 13 October 2014 21:58, Szymon Janc <[email protected]> wrote:
> Hi Grzegorz,
>
> On Thursday 09 October 2014 14:45:06 Grzegorz Kolodziejczyk wrote:
>> Add empty handlers for MAP client IPC commands.
>> ---
>> android/map-client.c | 33 ++++++++++++++++++++++++++++++++-
>> 1 file changed, 32 insertions(+), 1 deletion(-)
>>
>> diff --git a/android/map-client.c b/android/map-client.c
>> index 4556461..1001b36 100644
>> --- a/android/map-client.c
>> +++ b/android/map-client.c
>> @@ -28,17 +28,48 @@
>> #include <stdbool.h>
>> #include <stdlib.h>
>> #include <stdint.h>
>> +#include <glib.h>
>>
>> #include "ipc.h"
>> #include "lib/bluetooth.h"
>> #include "map-client.h"
>> +#include "src/log.h"
>> +#include "hal-msg.h"
>> +
>> +static struct ipc *hal_ipc = NULL;
>> +static bdaddr_t adapter_addr;
>> +
>> +static void handle_get_instances(const void *buf, uint16_t len)
>> +{
>> + DBG("");
>> +
>> + ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT,
>> + HAL_OP_MAP_CLIENT_GET_INSTANCES, HAL_STATUS_FAILED);
>> +}
>> +
>> +static const struct ipc_handler cmd_handlers[] = {
>> + {handle_get_instances, false,
>> + sizeof(struct hal_cmd_map_client_get_instances)},
>
> Style issue: there should be spaces after { and before }.
> Also please add comment about define type just like in other handlers (I'm
> aware that there is just 1 handler here but lets be consistent).
>

Ok, I'll fix it.
>> +};
>>
>> bool bt_map_client_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t
>> mode) {
>> - return false;
>> + DBG("");
>> +
>> + bacpy(&adapter_addr, addr);
>> +
>> + hal_ipc = ipc;
>> +
>> + ipc_register(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT, cmd_handlers,
>> + G_N_ELEMENTS(cmd_handlers));
>> +
>> + return true;
>> }
>>
>> void bt_map_client_unregister(void)
>> {
>> + DBG("");
>>
>> + ipc_unregister(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT);
>> + hal_ipc = NULL;
>> }
>
> --
> Szymon K. Janc
> [email protected]


Best regards,
Grzegorz

2014-10-13 20:47:45

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 00/10] android/map-client: Add MAP client daemon implementation

Hi Grzegorz,

On Thursday 09 October 2014 14:45:04 Grzegorz Kolodziejczyk wrote:
> v1.
> *Add MAP client daemon implementation (skeleton, body)
> *Add haltest MAP client support
>
> Aleksander Drewnicki (4):
> android/client: Add skeleton for mce calls
> android/client: Add code for mce callback
> android/client: Add code for mce method
> android/client: Add completion for mce method
>
> Grzegorz Kolodziejczyk (6):
> android/map-client: Add initial files
> android/map-client: Add stubs for MAP client commands handlers
> android/map-client: Add support for get remote MAS instances
> android/ipc-tester: Add missing service opcode boundries test cases
> android/ipc-tester: Add case for MAP client service opcode boundries
> android/ipc-tester: Add cases for MAP client msg size
>
> android/Android.mk | 5 +-
> android/Makefile.am | 2 +
> android/client/haltest.c | 2 +
> android/client/if-bt.c | 3 +
> android/client/if-main.h | 3 +
> android/client/if-mce.c | 87 +++++++++++++++++++++
> android/ipc-tester.c | 32 ++++++++
> android/main.c | 12 +++
> android/map-client.c | 197
> +++++++++++++++++++++++++++++++++++++++++++++++ android/map-client.h |
> 26 +++++++
> 10 files changed, 368 insertions(+), 1 deletion(-)
> create mode 100644 android/client/if-mce.c
> create mode 100644 android/map-client.c
> create mode 100644 android/map-client.h

android/client patches are now upstream so no need to resend them. Thanks.

--
Szymon K. Janc
[email protected]

2014-10-13 20:32:46

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 04/10] android/ipc-tester: Add missing service opcode boundries test cases

Hi Grzegorz,

On Thursday 09 October 2014 14:45:08 Grzegorz Kolodziejczyk wrote:
> This patch adds tests sending out of range opcode for each service.
> ---
> android/ipc-tester.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/android/ipc-tester.c b/android/ipc-tester.c
> index ea71c8d..161777d 100644
> --- a/android/ipc-tester.c
> +++ b/android/ipc-tester.c
> @@ -919,9 +919,23 @@ int main(int argc, char *argv[])
> test_opcode_valid("PAN", HAL_SERVICE_ID_PAN, 0x05, 0,
> HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);
>
> + test_opcode_valid("HANDSFREE", HAL_SERVICE_ID_HANDSFREE, 0x0f, 0,
> + HAL_SERVICE_ID_BLUETOOTH,
> + HAL_SERVICE_ID_HANDSFREE);
> +
> test_opcode_valid("A2DP", HAL_SERVICE_ID_A2DP, 0x03, 0,
> HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_A2DP);
>
> + test_opcode_valid("HEALTH", HAL_SERVICE_ID_HEALTH, 0x06, 0,
> + HAL_SERVICE_ID_BLUETOOTH,
> + HAL_SERVICE_ID_HEALTH);
> +
> + test_opcode_valid("AVRCP", HAL_SERVICE_ID_AVRCP, 0x0b, 0,
> + HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_AVRCP);
> +
> + test_opcode_valid("GATT", HAL_SERVICE_ID_GATT, 0x24, 0,
> + HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_GATT);
> +
> test_opcode_valid("HF_CLIENT", HAL_SERVICE_ID_HANDSFREE_CLIENT, 0x10, 0,
> HAL_SERVICE_ID_BLUETOOTH,
> HAL_SERVICE_ID_HANDSFREE_CLIENT);

In future please don't send unrelated patches as part of serie. This makes
review easier and also makes no unnecessary delays in getting such patches
merged.

Applied. Thanks.

--
Szymon K. Janc
[email protected]

2014-10-13 20:19:09

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 03/10] android/map-client: Add support for get remote MAS instances

On Thursday 09 October 2014 14:45:07 Grzegorz Kolodziejczyk wrote:
> This allows to get remote mas instances. In case of wrong sdp record
> fail status will be returned in notification.
> ---
> android/map-client.c | 124
> ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 123
> insertions(+), 1 deletion(-)
>
> diff --git a/android/map-client.c b/android/map-client.c
> index 1001b36..adeae4b 100644
> --- a/android/map-client.c
> +++ b/android/map-client.c
> @@ -30,21 +30,143 @@
> #include <stdint.h>
> #include <glib.h>
>
> +#include "lib/sdp.h"
> +#include "lib/sdp_lib.h"
> +#include "src/sdp-client.h"
> +
> #include "ipc.h"
> #include "lib/bluetooth.h"
> #include "map-client.h"
> #include "src/log.h"
> #include "hal-msg.h"
> +#include "ipc-common.h"
> +#include "utils.h"
> +#include "src/shared/util.h"
>
> static struct ipc *hal_ipc = NULL;
> static bdaddr_t adapter_addr;
>
> +static int fill_mce_inst(void *buf, int32_t id, int32_t scn, int32_t
> msg_type, + const void *name, uint8_t name_len)
> +{
> + struct hal_map_client_mas_instance *inst = buf;
> +
> + inst->id = id;
> + inst->scn = scn;
> + inst->msg_types = msg_type;
> + inst->name_len = name_len;
> +
> + if (name_len)
> + memcpy(inst->name, name, name_len);
> +
> + return sizeof(*inst) + name_len;
> +}
> +
> +static void map_client_sdp_search_cb(sdp_list_t *recs, int err, gpointer
> data) +{
> + uint8_t buf[IPC_MTU];
> + struct hal_ev_map_client_remote_mas_instances *ev = (void *) buf;
> + bdaddr_t *dst = data;
> + sdp_list_t *list, *protos;
> + uint8_t status;
> + int32_t id, scn, msg_type, name_len, num_instances = 0;
> + char *name;
> + size_t size;
> +
> + size = sizeof(*ev);
> + bdaddr2android(dst, &ev->bdaddr);
> +
> + if (err < 0) {
> + error("mce: Unable to get SDP record: %s", strerror(-err));
> + status = HAL_STATUS_FAILED;
> + goto fail;
> + }
> +
> + for (list = recs; list != NULL; list = list->next) {
> + sdp_record_t *rec = list->data;
> + sdp_data_t *data;
> +
> + data = sdp_data_get(rec, SDP_ATTR_MAS_INSTANCE_ID);
> + if (data) {
> + id = data->val.uint8;
> + } else {
> + error("mce: cannot get mas instance id");
> + status = HAL_STATUS_FAILED;
> + goto fail;

I'm not sure if we should fail here. Lets just skip record (we can leave error
message) and continue with search.

Also make it like: if (!data) {error(); continue;};
Not need for if-else

> + }
> +
> + data = sdp_data_get(rec, SDP_ATTR_SVCNAME_PRIMARY);
> + if (data) {
> + name = data->val.str;
> + name_len = data->unitSize;
> + } else {
> + error("mce: cannot get mas instance name");
> + status = HAL_STATUS_FAILED;
> + goto fail;
> + }
> +
> + data = sdp_data_get(rec, SDP_ATTR_SUPPORTED_MESSAGE_TYPES);
> + if (data) {
> + msg_type = data->val.uint8;
> + } else {
> + error("mce: cannot get mas instance msg type");
> + status = HAL_STATUS_FAILED;
> + goto fail;
> + }
> +
> + if (!sdp_get_access_protos(rec, &protos)) {
> + scn = sdp_get_proto_port(protos, RFCOMM_UUID);
> +
> + sdp_list_foreach(protos,
> + (sdp_list_func_t) sdp_list_free, NULL);
> + sdp_list_free(protos, NULL);
> + } else {
> + error("mce: cannot get mas instance rfcomm channel");
> + status = HAL_STATUS_FAILED;
> + goto fail;
> + }
> +
> + size += fill_mce_inst(buf + size, id, scn, msg_type, name,
> + name_len);
> + num_instances++;
> + }
> +
> + status = HAL_STATUS_SUCCESS;

Please check if we are expected to return error if no instances were found.

> +
> +fail:
> + ev->num_instances = num_instances;
> + ev->status = status;
> +
> + ipc_send_notif(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT,
> + HAL_EV_MAP_CLIENT_REMOTE_MAS_INSTANCES, size, buf);
> +
> + free(dst);
> +}
> +
> static void handle_get_instances(const void *buf, uint16_t len)
> {
> + const struct hal_cmd_map_client_get_instances *cmd = buf;
> + uint8_t status;
> + bdaddr_t *dst;
> + uuid_t uuid;
> +
> DBG("");
>
> + dst = new0(bdaddr_t, 1);

Please check if allocation failed.

> + android2bdaddr(&cmd->bdaddr, dst);
> +
> + sdp_uuid16_create(&uuid, MAP_MSE_SVCLASS_ID);
> +
> + if (bt_search_service(&adapter_addr, dst, &uuid,
> + map_client_sdp_search_cb, dst, NULL, 0)) {

Just a hint: you can pass free as destroy function here instead of taking care
of that in callback.

> + error("mce: Failed to search SDP details");
> + status = HAL_STATUS_FAILED;
> + free(dst);
> + }
> +
> + status = HAL_STATUS_SUCCESS;

In case of error status is overwritten.

> ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT,
> - HAL_OP_MAP_CLIENT_GET_INSTANCES, HAL_STATUS_FAILED);
> + HAL_OP_MAP_CLIENT_GET_INSTANCES, status);
> }
>
> static const struct ipc_handler cmd_handlers[] = {

--
Szymon K. Janc
[email protected]

2014-10-13 19:58:13

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 02/10] android/map-client: Add stubs for MAP client commands handlers

Hi Grzegorz,

On Thursday 09 October 2014 14:45:06 Grzegorz Kolodziejczyk wrote:
> Add empty handlers for MAP client IPC commands.
> ---
> android/map-client.c | 33 ++++++++++++++++++++++++++++++++-
> 1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/android/map-client.c b/android/map-client.c
> index 4556461..1001b36 100644
> --- a/android/map-client.c
> +++ b/android/map-client.c
> @@ -28,17 +28,48 @@
> #include <stdbool.h>
> #include <stdlib.h>
> #include <stdint.h>
> +#include <glib.h>
>
> #include "ipc.h"
> #include "lib/bluetooth.h"
> #include "map-client.h"
> +#include "src/log.h"
> +#include "hal-msg.h"
> +
> +static struct ipc *hal_ipc = NULL;
> +static bdaddr_t adapter_addr;
> +
> +static void handle_get_instances(const void *buf, uint16_t len)
> +{
> + DBG("");
> +
> + ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT,
> + HAL_OP_MAP_CLIENT_GET_INSTANCES, HAL_STATUS_FAILED);
> +}
> +
> +static const struct ipc_handler cmd_handlers[] = {
> + {handle_get_instances, false,
> + sizeof(struct hal_cmd_map_client_get_instances)},

Style issue: there should be spaces after { and before }.
Also please add comment about define type just like in other handlers (I'm
aware that there is just 1 handler here but lets be consistent).

> +};
>
> bool bt_map_client_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t
> mode) {
> - return false;
> + DBG("");
> +
> + bacpy(&adapter_addr, addr);
> +
> + hal_ipc = ipc;
> +
> + ipc_register(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT, cmd_handlers,
> + G_N_ELEMENTS(cmd_handlers));
> +
> + return true;
> }
>
> void bt_map_client_unregister(void)
> {
> + DBG("");
>
> + ipc_unregister(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT);
> + hal_ipc = NULL;
> }

--
Szymon K. Janc
[email protected]

2014-10-09 12:45:13

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 09/10] android/client: Add code for mce method

From: Aleksander Drewnicki <[email protected]>

This patch adds implementation of mce method to haltest.
---
android/client/if-mce.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/android/client/if-mce.c b/android/client/if-mce.c
index c671fb2..76c9f73 100644
--- a/android/client/if-mce.c
+++ b/android/client/if-mce.c
@@ -58,6 +58,12 @@ static void init_p(int argc, const char **argv)

static void get_remote_mas_instances_p(int argc, const char **argv)
{
+ bt_bdaddr_t addr;
+
+ RETURN_IF_NULL(if_mce);
+ VERIFY_ADDR_ARG(2, &addr);
+
+ EXEC(if_mce->get_remote_mas_instances, &addr);
}

static struct method methods[] = {
--
1.9.3


2014-10-09 12:45:12

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 08/10] android/client: Add code for mce callback

From: Aleksander Drewnicki <[email protected]>

This adds implementation for mce callback.
---
android/client/if-mce.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/android/client/if-mce.c b/android/client/if-mce.c
index f9ff5f1..c671fb2 100644
--- a/android/client/if-mce.c
+++ b/android/client/if-mce.c
@@ -28,6 +28,16 @@ static void btmce_remote_mas_instances_cb(bt_status_t status,
int num_instances,
btmce_mas_instance_t *instances)
{
+ int i;
+
+ haltest_info("%s: status=%s bd_addr=%s num_instance=%d\n", __func__,
+ bt_status_t2str(status), bdaddr2str(bd_addr),
+ num_instances);
+
+ for (i = 0; i < num_instances; i++)
+ haltest_info("id=%d scn=%d msg_types=%d name=%s\n",
+ instances[i].id, instances[i].scn,
+ instances[i].msg_types, instances[i].p_name);
}

static btmce_callbacks_t mce_cbacks = {
--
1.9.3


2014-10-09 12:45:14

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 10/10] android/client: Add completion for mce method

From: Aleksander Drewnicki <[email protected]>

This patch adds completion functions to mce method.
---
android/client/if-mce.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/android/client/if-mce.c b/android/client/if-mce.c
index 76c9f73..5f101e0 100644
--- a/android/client/if-mce.c
+++ b/android/client/if-mce.c
@@ -54,6 +54,15 @@ static void init_p(int argc, const char **argv)
EXEC(if_mce->init, &mce_cbacks);
}

+static void get_remote_mas_instances_c(int argc, const char **argv,
+ enum_func *enum_func, void **user)
+{
+ if (argc == 3) {
+ *user = NULL;
+ *enum_func = enum_devices;
+ }
+}
+
/* search for MAS instances on remote device */

static void get_remote_mas_instances_p(int argc, const char **argv)
@@ -68,7 +77,7 @@ static void get_remote_mas_instances_p(int argc, const char **argv)

static struct method methods[] = {
STD_METHOD(init),
- STD_METHODH(get_remote_mas_instances, "<addr>"),
+ STD_METHODCH(get_remote_mas_instances, "<addr>"),
END_METHOD
};

--
1.9.3


2014-10-09 12:45:10

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 06/10] android/ipc-tester: Add cases for MAP client msg size

Add cases testing message size verification for MAP client opcodes.
---
android/ipc-tester.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index 7dd25e8..357dda9 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -1486,5 +1486,19 @@ int main(int argc, char *argv[])
HAL_SERVICE_ID_BLUETOOTH,
HAL_SERVICE_ID_HANDSFREE_CLIENT);

+ /* check for valid data size for MAP CLIENT */
+ test_datasize_valid("MAP CLIENT Get instances+",
+ HAL_SERVICE_ID_MAP_CLIENT,
+ HAL_OP_MAP_CLIENT_GET_INSTANCES,
+ sizeof(struct hal_cmd_map_client_get_instances),
+ 1, HAL_SERVICE_ID_BLUETOOTH,
+ HAL_SERVICE_ID_MAP_CLIENT);
+ test_datasize_valid("MAP CLIENT Get instances-",
+ HAL_SERVICE_ID_MAP_CLIENT,
+ HAL_OP_MAP_CLIENT_GET_INSTANCES,
+ sizeof(struct hal_cmd_map_client_get_instances),
+ -1, HAL_SERVICE_ID_BLUETOOTH,
+ HAL_SERVICE_ID_MAP_CLIENT);
+
return tester_run();
}
--
1.9.3


2014-10-09 12:45:11

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 07/10] android/client: Add skeleton for mce calls

From: Aleksander Drewnicki <[email protected]>

This patch adds skeleton for all methods of mce along with
all callbacks.
---
android/Android.mk | 4 +++-
android/Makefile.am | 1 +
android/client/haltest.c | 2 ++
android/client/if-bt.c | 3 +++
android/client/if-main.h | 3 +++
android/client/if-mce.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 74 insertions(+), 1 deletion(-)
create mode 100644 android/client/if-mce.c

diff --git a/android/Android.mk b/android/Android.mk
index a9e5d4b..aefe41c 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -184,7 +184,9 @@ LOCAL_SRC_FILES := \
bluez/android/hal-utils.c \

ifeq ($(BLUEZ_EXTENSIONS), true)
-LOCAL_SRC_FILES += bluez/android/client/if-hf-client.c
+LOCAL_SRC_FILES += \
+ bluez/android/client/if-hf-client.c \
+ bluez/android/client/if-mce.c
endif

LOCAL_C_INCLUDES += \
diff --git a/android/Makefile.am b/android/Makefile.am
index 9279bbd..b3eb1c5 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -125,6 +125,7 @@ android_haltest_SOURCES = android/client/haltest.c \
android/client/if-sock.c \
android/client/if-audio.c \
android/client/if-sco.c \
+ android/client/if-mce.c \
android/hardware/hardware.c \
android/hal-utils.h android/hal-utils.c
android_haltest_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
diff --git a/android/client/haltest.c b/android/client/haltest.c
index 5e1633d..781e45c 100644
--- a/android/client/haltest.c
+++ b/android/client/haltest.c
@@ -50,6 +50,7 @@ const struct interface *interfaces[] = {
&sock_if,
#ifdef BLUEZ_EXTENSIONS
&hf_client_if,
+ &mce_if,
#endif
NULL
};
@@ -397,6 +398,7 @@ static void init(void)
BT_PROFILE_SOCKETS_ID,
#ifdef BLUEZ_EXTENSIONS
BT_PROFILE_HANDSFREE_CLIENT_ID,
+ BT_PROFILE_MAP_CLIENT_ID,
#endif
};
const struct method *m;
diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 8f98ef3..2d7ac79 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -736,6 +736,7 @@ static void get_profile_interface_c(int argc, const char **argv,
BT_PROFILE_AV_RC_ID,
#ifdef BLUEZ_EXTENSIONS
BT_PROFILE_HANDSFREE_CLIENT_ID,
+ BT_PROFILE_MAP_CLIENT_ID,
#endif
NULL
};
@@ -778,6 +779,8 @@ static void get_profile_interface_p(int argc, const char **argv)
#ifdef BLUEZ_EXTENSIONS
else if (strcmp(BT_PROFILE_HANDSFREE_CLIENT_ID, id) == 0)
pif = (const void **) &if_hf_client;
+ else if (strcmp(BT_PROFILE_MAP_CLIENT_ID, id) == 0)
+ pif = (const void **) &if_mce;
#endif
else
haltest_error("%s is not correct for get_profile_interface\n",
diff --git a/android/client/if-main.h b/android/client/if-main.h
index 8aac3e3..cb5f558 100644
--- a/android/client/if-main.h
+++ b/android/client/if-main.h
@@ -39,6 +39,7 @@

#ifdef BLUEZ_EXTENSIONS
#include <hardware/bt_hf_client.h>
+#include <hardware/bt_mce.h>
#endif

#include <hardware/bt_rc.h>
@@ -63,6 +64,7 @@ extern const btgatt_server_interface_t *if_gatt_server;
extern const btgatt_client_interface_t *if_gatt_client;
#ifdef BLUEZ_EXTENSIONS
extern const bthf_client_interface_t *if_hf_client;
+extern const btmce_interface_t *if_mce;
#endif

/*
@@ -89,6 +91,7 @@ extern const struct interface hh_if;
extern const struct interface hl_if;
#ifdef BLUEZ_EXTENSIONS
extern const struct interface hf_client_if;
+extern const struct interface mce_if;
#endif

/* Interfaces that will show up in tool (first part of command line) */
diff --git a/android/client/if-mce.c b/android/client/if-mce.c
new file mode 100644
index 0000000..f9ff5f1
--- /dev/null
+++ b/android/client/if-mce.c
@@ -0,0 +1,62 @@
+/*
+ * 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 "if-main.h"
+#include "../hal-utils.h"
+
+const btmce_interface_t *if_mce = NULL;
+
+/*
+ * Callback for get_remote_mas_instances
+ */
+static void btmce_remote_mas_instances_cb(bt_status_t status,
+ bt_bdaddr_t *bd_addr,
+ int num_instances,
+ btmce_mas_instance_t *instances)
+{
+}
+
+static btmce_callbacks_t mce_cbacks = {
+ .size = sizeof(mce_cbacks),
+ .remote_mas_instances_cb = btmce_remote_mas_instances_cb,
+};
+
+/* init */
+
+static void init_p(int argc, const char **argv)
+{
+ RETURN_IF_NULL(if_mce);
+
+ EXEC(if_mce->init, &mce_cbacks);
+}
+
+/* search for MAS instances on remote device */
+
+static void get_remote_mas_instances_p(int argc, const char **argv)
+{
+}
+
+static struct method methods[] = {
+ STD_METHOD(init),
+ STD_METHODH(get_remote_mas_instances, "<addr>"),
+ END_METHOD
+};
+
+const struct interface mce_if = {
+ .name = "mce",
+ .methods = methods
+};
--
1.9.3


2014-10-09 12:45:06

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 02/10] android/map-client: Add stubs for MAP client commands handlers

Add empty handlers for MAP client IPC commands.
---
android/map-client.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/android/map-client.c b/android/map-client.c
index 4556461..1001b36 100644
--- a/android/map-client.c
+++ b/android/map-client.c
@@ -28,17 +28,48 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
+#include <glib.h>

#include "ipc.h"
#include "lib/bluetooth.h"
#include "map-client.h"
+#include "src/log.h"
+#include "hal-msg.h"
+
+static struct ipc *hal_ipc = NULL;
+static bdaddr_t adapter_addr;
+
+static void handle_get_instances(const void *buf, uint16_t len)
+{
+ DBG("");
+
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT,
+ HAL_OP_MAP_CLIENT_GET_INSTANCES, HAL_STATUS_FAILED);
+}
+
+static const struct ipc_handler cmd_handlers[] = {
+ {handle_get_instances, false,
+ sizeof(struct hal_cmd_map_client_get_instances)},
+};

bool bt_map_client_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode)
{
- return false;
+ DBG("");
+
+ bacpy(&adapter_addr, addr);
+
+ hal_ipc = ipc;
+
+ ipc_register(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT, cmd_handlers,
+ G_N_ELEMENTS(cmd_handlers));
+
+ return true;
}

void bt_map_client_unregister(void)
{
+ DBG("");

+ ipc_unregister(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT);
+ hal_ipc = NULL;
}
--
1.9.3


2014-10-09 12:45:09

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 05/10] android/ipc-tester: Add case for MAP client service opcode boundries

This patch adds test sending out of range opcode for service.
---
android/ipc-tester.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index 161777d..7dd25e8 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -940,6 +940,10 @@ int main(int argc, char *argv[])
HAL_SERVICE_ID_BLUETOOTH,
HAL_SERVICE_ID_HANDSFREE_CLIENT);

+ test_opcode_valid("MAP_CLIENT", HAL_SERVICE_ID_MAP_CLIENT, 0x01, 0,
+ HAL_SERVICE_ID_BLUETOOTH,
+ HAL_SERVICE_ID_MAP_CLIENT);
+
/* check for valid data size */
test_datasize_valid("CORE Register+", HAL_SERVICE_ID_CORE,
HAL_OP_REGISTER_MODULE,
--
1.9.3


2014-10-09 12:45:08

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 04/10] android/ipc-tester: Add missing service opcode boundries test cases

This patch adds tests sending out of range opcode for each service.
---
android/ipc-tester.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index ea71c8d..161777d 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -919,9 +919,23 @@ int main(int argc, char *argv[])
test_opcode_valid("PAN", HAL_SERVICE_ID_PAN, 0x05, 0,
HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);

+ test_opcode_valid("HANDSFREE", HAL_SERVICE_ID_HANDSFREE, 0x0f, 0,
+ HAL_SERVICE_ID_BLUETOOTH,
+ HAL_SERVICE_ID_HANDSFREE);
+
test_opcode_valid("A2DP", HAL_SERVICE_ID_A2DP, 0x03, 0,
HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_A2DP);

+ test_opcode_valid("HEALTH", HAL_SERVICE_ID_HEALTH, 0x06, 0,
+ HAL_SERVICE_ID_BLUETOOTH,
+ HAL_SERVICE_ID_HEALTH);
+
+ test_opcode_valid("AVRCP", HAL_SERVICE_ID_AVRCP, 0x0b, 0,
+ HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_AVRCP);
+
+ test_opcode_valid("GATT", HAL_SERVICE_ID_GATT, 0x24, 0,
+ HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_GATT);
+
test_opcode_valid("HF_CLIENT", HAL_SERVICE_ID_HANDSFREE_CLIENT, 0x10, 0,
HAL_SERVICE_ID_BLUETOOTH,
HAL_SERVICE_ID_HANDSFREE_CLIENT);
--
1.9.3


2014-10-09 12:45:07

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 03/10] android/map-client: Add support for get remote MAS instances

This allows to get remote mas instances. In case of wrong sdp record
fail status will be returned in notification.
---
android/map-client.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 123 insertions(+), 1 deletion(-)

diff --git a/android/map-client.c b/android/map-client.c
index 1001b36..adeae4b 100644
--- a/android/map-client.c
+++ b/android/map-client.c
@@ -30,21 +30,143 @@
#include <stdint.h>
#include <glib.h>

+#include "lib/sdp.h"
+#include "lib/sdp_lib.h"
+#include "src/sdp-client.h"
+
#include "ipc.h"
#include "lib/bluetooth.h"
#include "map-client.h"
#include "src/log.h"
#include "hal-msg.h"
+#include "ipc-common.h"
+#include "utils.h"
+#include "src/shared/util.h"

static struct ipc *hal_ipc = NULL;
static bdaddr_t adapter_addr;

+static int fill_mce_inst(void *buf, int32_t id, int32_t scn, int32_t msg_type,
+ const void *name, uint8_t name_len)
+{
+ struct hal_map_client_mas_instance *inst = buf;
+
+ inst->id = id;
+ inst->scn = scn;
+ inst->msg_types = msg_type;
+ inst->name_len = name_len;
+
+ if (name_len)
+ memcpy(inst->name, name, name_len);
+
+ return sizeof(*inst) + name_len;
+}
+
+static void map_client_sdp_search_cb(sdp_list_t *recs, int err, gpointer data)
+{
+ uint8_t buf[IPC_MTU];
+ struct hal_ev_map_client_remote_mas_instances *ev = (void *) buf;
+ bdaddr_t *dst = data;
+ sdp_list_t *list, *protos;
+ uint8_t status;
+ int32_t id, scn, msg_type, name_len, num_instances = 0;
+ char *name;
+ size_t size;
+
+ size = sizeof(*ev);
+ bdaddr2android(dst, &ev->bdaddr);
+
+ if (err < 0) {
+ error("mce: Unable to get SDP record: %s", strerror(-err));
+ status = HAL_STATUS_FAILED;
+ goto fail;
+ }
+
+ for (list = recs; list != NULL; list = list->next) {
+ sdp_record_t *rec = list->data;
+ sdp_data_t *data;
+
+ data = sdp_data_get(rec, SDP_ATTR_MAS_INSTANCE_ID);
+ if (data) {
+ id = data->val.uint8;
+ } else {
+ error("mce: cannot get mas instance id");
+ status = HAL_STATUS_FAILED;
+ goto fail;
+ }
+
+ data = sdp_data_get(rec, SDP_ATTR_SVCNAME_PRIMARY);
+ if (data) {
+ name = data->val.str;
+ name_len = data->unitSize;
+ } else {
+ error("mce: cannot get mas instance name");
+ status = HAL_STATUS_FAILED;
+ goto fail;
+ }
+
+ data = sdp_data_get(rec, SDP_ATTR_SUPPORTED_MESSAGE_TYPES);
+ if (data) {
+ msg_type = data->val.uint8;
+ } else {
+ error("mce: cannot get mas instance msg type");
+ status = HAL_STATUS_FAILED;
+ goto fail;
+ }
+
+ if (!sdp_get_access_protos(rec, &protos)) {
+ scn = sdp_get_proto_port(protos, RFCOMM_UUID);
+
+ sdp_list_foreach(protos,
+ (sdp_list_func_t) sdp_list_free, NULL);
+ sdp_list_free(protos, NULL);
+ } else {
+ error("mce: cannot get mas instance rfcomm channel");
+ status = HAL_STATUS_FAILED;
+ goto fail;
+ }
+
+ size += fill_mce_inst(buf + size, id, scn, msg_type, name,
+ name_len);
+ num_instances++;
+ }
+
+ status = HAL_STATUS_SUCCESS;
+
+fail:
+ ev->num_instances = num_instances;
+ ev->status = status;
+
+ ipc_send_notif(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT,
+ HAL_EV_MAP_CLIENT_REMOTE_MAS_INSTANCES, size, buf);
+
+ free(dst);
+}
+
static void handle_get_instances(const void *buf, uint16_t len)
{
+ const struct hal_cmd_map_client_get_instances *cmd = buf;
+ uint8_t status;
+ bdaddr_t *dst;
+ uuid_t uuid;
+
DBG("");

+ dst = new0(bdaddr_t, 1);
+ android2bdaddr(&cmd->bdaddr, dst);
+
+ sdp_uuid16_create(&uuid, MAP_MSE_SVCLASS_ID);
+
+ if (bt_search_service(&adapter_addr, dst, &uuid,
+ map_client_sdp_search_cb, dst, NULL, 0)) {
+ error("mce: Failed to search SDP details");
+ status = HAL_STATUS_FAILED;
+ free(dst);
+ }
+
+ status = HAL_STATUS_SUCCESS;
ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_MAP_CLIENT,
- HAL_OP_MAP_CLIENT_GET_INSTANCES, HAL_STATUS_FAILED);
+ HAL_OP_MAP_CLIENT_GET_INSTANCES, status);
}

static const struct ipc_handler cmd_handlers[] = {
--
1.9.3


2014-10-09 12:45:05

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 01/10] android/map-client: Add initial files

This adds initial daemon code for MAP client profile.
---
android/Android.mk | 1 +
android/Makefile.am | 1 +
android/main.c | 12 ++++++++++++
android/map-client.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
android/map-client.h | 26 ++++++++++++++++++++++++++
5 files changed, 84 insertions(+)
create mode 100644 android/map-client.c
create mode 100644 android/map-client.h

diff --git a/android/Android.mk b/android/Android.mk
index f25d60e..a9e5d4b 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -57,6 +57,7 @@ LOCAL_SRC_FILES := \
bluez/android/gatt.c \
bluez/android/health.c \
bluez/profiles/health/mcap.c \
+ bluez/android/map-client.c \
bluez/src/log.c \
bluez/src/shared/mgmt.c \
bluez/src/shared/util.c \
diff --git a/android/Makefile.am b/android/Makefile.am
index f11cff6..9279bbd 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -46,6 +46,7 @@ android_bluetoothd_SOURCES = android/main.c \
android/gatt.h android/gatt.c \
android/health.h android/health.c \
profiles/health/mcap.h profiles/health/mcap.c \
+ android/map-client.h android/map-client.c \
attrib/att.c attrib/att.h \
attrib/gatt.c attrib/gatt.h \
attrib/gattrib.c attrib/gattrib.h \
diff --git a/android/main.c b/android/main.c
index 703b3b6..b5f6937 100644
--- a/android/main.c
+++ b/android/main.c
@@ -62,6 +62,7 @@
#include "gatt.h"
#include "health.h"
#include "handsfree-client.h"
+#include "map-client.h"
#include "utils.h"

#define DEFAULT_VENDOR "BlueZ"
@@ -235,6 +236,14 @@ static void service_register(const void *buf, uint16_t len)
}

break;
+ case HAL_SERVICE_ID_MAP_CLIENT:
+ if (!bt_map_client_register(hal_ipc, &adapter_bdaddr,
+ m->mode)) {
+ status = HAL_STATUS_FAILED;
+ goto failed;
+ }
+
+ break;
default:
DBG("service %u not supported", m->service_id);
status = HAL_STATUS_FAILED;
@@ -288,6 +297,9 @@ static bool unregister_service(uint8_t id)
case HAL_SERVICE_ID_HANDSFREE_CLIENT:
bt_hf_client_unregister();
break;
+ case HAL_SERVICE_ID_MAP_CLIENT:
+ bt_map_client_unregister();
+ break;
default:
DBG("service %u not supported", id);
return false;
diff --git a/android/map-client.c b/android/map-client.c
new file mode 100644
index 0000000..4556461
--- /dev/null
+++ b/android/map-client.c
@@ -0,0 +1,44 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 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 <stdbool.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#include "ipc.h"
+#include "lib/bluetooth.h"
+#include "map-client.h"
+
+bool bt_map_client_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode)
+{
+ return false;
+}
+
+void bt_map_client_unregister(void)
+{
+
+}
diff --git a/android/map-client.h b/android/map-client.h
new file mode 100644
index 0000000..0e63072
--- /dev/null
+++ b/android/map-client.h
@@ -0,0 +1,26 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 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_map_client_register(struct ipc *ipc, const bdaddr_t *addr,
+ uint8_t mode);
+void bt_map_client_unregister(void);
--
1.9.3