Following patches adds
* HF client HAL
* HF client daemon skeleton
* ipc structs and defines for commands and events
* small fixes in hal-ipc-api
Lukasz Rymanowski (39):
android/hal-ipc-api: Use 2 bytes for location in dial memory
android/hal-ipc-api: Use Tone instead of Code DTMF
android/hal-ipc-api: Add missing peer features parameter
android/avrcp: Clean up command order
android/hf-client: Add hf-client ID
android/hf-client: Add hf-client daemon skeleton
android/hf-client: Add skeleton for HAL hf-client
android/hf-client: Add Connect/Disconnect commands
android/hf-client: Add Audio Connect/Disconnect commands
android/hf-client: Add Start/Stop Voice Recognition command
android/hf-client: Add Volume Control command
android/hf-client: Add Dial and Dial Memory command
android/hf-client: Add Command Action command
android/hf-client: Add Query Current Call and Operator Name command
android/hf-client: Add Retrieve Subscriber Info command
android/hf-client: Add Send DTMF command
android/hf-client: Add Get Last Voice Tag Number command
android/hf-client: Add Connection State event
android/hf-client: Add Audio Connection State event
android/hf-client: Add Voice Recognition State event
android/hf-client: Add Network State event
android/hf-client: Add Network Roaming State event
android/hf-client: Add Network Signal Strenght event
android/hf-client: Add Battery Level event
android/hf-client: Add Operator Name event
android/hf-client: Add Call Indicator event
android/hf-client: Add Call Setup Indicator event
android/hf-client: Add Call Held Indicator event
android/hf-client: Add Response and Hold Status event
android/hf-client: Add Call Waiting and Calling Line Ident. events
android/hf-client: Add Current Client Call event
android/hf-client: Add Volume Changed event
android/hf-client: Add Command Complete event
android/hf-client: Add Subscriber Info event
android/hf-client: Add In Band Ringtone event
android/hf-client: Add Last Voice Tag Number event
android/hf-client: Add RING notification event
android/hf-client: Add hf-client to Android build
android/readme: Add information about hf-client
android/Android.mk | 4 +
android/Makefile.am | 3 +
android/README | 10 +
android/hal-hf-client.c | 644 ++++++++++++++++++++++++++++++++++++++++++++++++
android/hal-ipc-api.txt | 9 +-
android/hal-msg.h | 463 ++++++++++++++++++++++++++--------
android/hal.h | 2 +
android/hf-client.c | 222 +++++++++++++++++
8 files changed, 1248 insertions(+), 109 deletions(-)
create mode 100644 android/hal-hf-client.c
create mode 100644 android/hf-client.c
--
1.8.4
Hi Luiz,
On 10 September 2014 09:24, Luiz Augusto von Dentz <[email protected]> wrote:
> Hi Lukasz,
>
> On Tue, Sep 9, 2014 at 10:56 PM, Lukasz Rymanowski
> <[email protected]> wrote:
>> Idea about order in this file is that commands goes first and
>> notifications in the end of file.
>>
>> This patch moves AVRCP commands up in the file
>
> I guess you need to be consistent with the ID, so AVRCP should be in
> between HEALTH and GATT,
You are right, will fix.
btw I have no idea why this is mixup in a
> patch-set for HFP client.
>
Well, when started to add hf-client I've noticed that avrcp did a
mixup in that file, so I fixed that- and yes I could send it before ,
but this is minor fix so thought it is not a big deal to add it in
this series.
BR
Lukasz
>> ---
>> android/hal-msg.h | 206 +++++++++++++++++++++++++++---------------------------
>> 1 file changed, 102 insertions(+), 104 deletions(-)
>>
>> diff --git a/android/hal-msg.h b/android/hal-msg.h
>> index 8adb9f1..5575d93 100644
>> --- a/android/hal-msg.h
>> +++ b/android/hal-msg.h
>> @@ -871,6 +871,108 @@ struct hal_cmd_gatt_server_send_response {
>> uint8_t data[0];
>> } __attribute__((packed));
>>
>> +#define HAL_AVRCP_PLAY_STATUS_STOPPED 0x00
>> +#define HAL_AVRCP_PLAY_STATUS_PLAYING 0x01
>> +#define HAL_AVRCP_PLAY_STATUS_PAUSED 0x02
>> +#define HAL_AVRCP_PLAY_STATUS_FWD_SEEK 0x03
>> +#define HAL_AVRCP_PLAY_STATUS_REV_SEEK 0x04
>> +#define HAL_AVRCP_PLAY_STATUS_ERROR 0xff
>> +
>> +#define HAL_OP_AVRCP_GET_PLAY_STATUS 0x01
>> +struct hal_cmd_avrcp_get_play_status {
>> + uint8_t status;
>> + uint32_t duration;
>> + uint32_t position;
>> +} __attribute__((packed));
>> +
>> +#define HAL_AVRCP_PLAYER_ATTR_EQUALIZER 0x01
>> +#define HAL_AVRCP_PLAYER_ATTR_REPEAT 0x02
>> +#define HAL_AVRCP_PLAYER_ATTR_SHUFFLE 0x03
>> +#define HAL_AVRCP_PLAYER_ATTR_SCAN 0x04
>> +
>> +#define HAL_OP_AVRCP_LIST_PLAYER_ATTRS 0x02
>> +struct hal_cmd_avrcp_list_player_attrs {
>> + uint8_t number;
>> + uint8_t attrs[0];
>> +} __attribute__((packed));
>> +
>> +#define HAL_OP_AVRCP_LIST_PLAYER_VALUES 0x03
>> +struct hal_cmd_avrcp_list_player_values {
>> + uint8_t number;
>> + uint8_t values[0];
>> +} __attribute__((packed));
>> +
>> +struct hal_avrcp_player_attr_value {
>> + uint8_t attr;
>> + uint8_t value;
>> +} __attribute__((packed));
>> +
>> +#define HAL_OP_AVRCP_GET_PLAYER_ATTRS 0x04
>> +struct hal_cmd_avrcp_get_player_attrs {
>> + uint8_t number;
>> + struct hal_avrcp_player_attr_value attrs[0];
>> +} __attribute__((packed));
>> +
>> +struct hal_avrcp_player_setting_text {
>> + uint8_t id;
>> + uint8_t len;
>> + uint8_t text[0];
>> +} __attribute__((packed));
>> +
>> +#define HAL_OP_AVRCP_GET_PLAYER_ATTRS_TEXT 0x05
>> +struct hal_cmd_avrcp_get_player_attrs_text {
>> + uint8_t number;
>> + struct hal_avrcp_player_setting_text attrs[0];
>> +} __attribute__((packed));
>> +
>> +#define HAL_OP_AVRCP_GET_PLAYER_VALUES_TEXT 0x06
>> +struct hal_cmd_avrcp_get_player_values_text {
>> + uint8_t number;
>> + struct hal_avrcp_player_setting_text values[0];
>> +} __attribute__((packed));
>> +
>> +#define HAL_AVRCP_MEDIA_ATTR_TITLE 0x01
>> +#define HAL_AVRCP_MEDIA_ATTR_ARTIST 0x02
>> +#define HAL_AVRCP_MEDIA_ATTR_ALBUM 0x03
>> +#define HAL_AVRCP_MEDIA_ATTR_TRACK_NUM 0x04
>> +#define HAL_AVRCP_MEDIA_ATTR_NUM_TRACKS 0x05
>> +#define HAL_AVRCP_MEDIA_ATTR_GENRE 0x06
>> +#define HAL_AVRCP_MEDIA_ATTR_DURATION 0x07
>> +
>> +#define HAL_OP_AVRCP_GET_ELEMENT_ATTRS_TEXT 0x07
>> +struct hal_cmd_avrcp_get_element_attrs_text {
>> + uint8_t number;
>> + struct hal_avrcp_player_setting_text values[0];
>> +} __attribute__((packed));
>> +
>> +#define HAL_OP_AVRCP_SET_PLAYER_ATTRS_VALUE 0x08
>> +struct hal_cmd_avrcp_set_player_attrs_value {
>> + uint8_t status;
>> +} __attribute__((packed));
>> +
>> +#define HAL_AVRCP_EVENT_STATUS_CHANGED 0x01
>> +#define HAL_AVRCP_EVENT_TRACK_CHANGED 0x02
>> +#define HAL_AVRCP_EVENT_TRACK_REACHED_END 0x03
>> +#define HAL_AVRCP_EVENT_TRACK_REACHED_START 0x04
>> +#define HAL_AVRCP_EVENT_POSITION_CHANGED 0x05
>> +#define HAL_AVRCP_EVENT_SETTING_CHANGED 0x08
>> +
>> +#define HAL_AVRCP_EVENT_TYPE_INTERIM 0x00
>> +#define HAL_AVRCP_EVENT_TYPE_CHANGED 0x01
>> +
>> +#define HAL_OP_AVRCP_REGISTER_NOTIFICATION 0x09
>> +struct hal_cmd_avrcp_register_notification {
>> + uint8_t event;
>> + uint8_t type;
>> + uint8_t len;
>> + uint8_t data[0];
>> +} __attribute__((packed));
>> +
>> +#define HAL_OP_AVRCP_SET_VOLUME 0x0a
>> +struct hal_cmd_avrcp_set_volume {
>> + uint8_t value;
>> +} __attribute__((packed));
>> +
>> /* Notifications and confirmations */
>>
>> #define HAL_POWER_OFF 0x00
>> @@ -1174,110 +1276,6 @@ struct hal_ev_handsfree_unknown_at {
>>
>> #define HAL_EV_HANDSFREE_HSP_KEY_PRESS 0x90
>>
>> -/* AVRCP HAL API */
>> -
>> -#define HAL_AVRCP_PLAY_STATUS_STOPPED 0x00
>> -#define HAL_AVRCP_PLAY_STATUS_PLAYING 0x01
>> -#define HAL_AVRCP_PLAY_STATUS_PAUSED 0x02
>> -#define HAL_AVRCP_PLAY_STATUS_FWD_SEEK 0x03
>> -#define HAL_AVRCP_PLAY_STATUS_REV_SEEK 0x04
>> -#define HAL_AVRCP_PLAY_STATUS_ERROR 0xff
>> -
>> -#define HAL_OP_AVRCP_GET_PLAY_STATUS 0x01
>> -struct hal_cmd_avrcp_get_play_status {
>> - uint8_t status;
>> - uint32_t duration;
>> - uint32_t position;
>> -} __attribute__((packed));
>> -
>> -#define HAL_AVRCP_PLAYER_ATTR_EQUALIZER 0x01
>> -#define HAL_AVRCP_PLAYER_ATTR_REPEAT 0x02
>> -#define HAL_AVRCP_PLAYER_ATTR_SHUFFLE 0x03
>> -#define HAL_AVRCP_PLAYER_ATTR_SCAN 0x04
>> -
>> -#define HAL_OP_AVRCP_LIST_PLAYER_ATTRS 0x02
>> -struct hal_cmd_avrcp_list_player_attrs {
>> - uint8_t number;
>> - uint8_t attrs[0];
>> -} __attribute__((packed));
>> -
>> -#define HAL_OP_AVRCP_LIST_PLAYER_VALUES 0x03
>> -struct hal_cmd_avrcp_list_player_values {
>> - uint8_t number;
>> - uint8_t values[0];
>> -} __attribute__((packed));
>> -
>> -struct hal_avrcp_player_attr_value {
>> - uint8_t attr;
>> - uint8_t value;
>> -} __attribute__((packed));
>> -
>> -#define HAL_OP_AVRCP_GET_PLAYER_ATTRS 0x04
>> -struct hal_cmd_avrcp_get_player_attrs {
>> - uint8_t number;
>> - struct hal_avrcp_player_attr_value attrs[0];
>> -} __attribute__((packed));
>> -
>> -struct hal_avrcp_player_setting_text {
>> - uint8_t id;
>> - uint8_t len;
>> - uint8_t text[0];
>> -} __attribute__((packed));
>> -
>> -#define HAL_OP_AVRCP_GET_PLAYER_ATTRS_TEXT 0x05
>> -struct hal_cmd_avrcp_get_player_attrs_text {
>> - uint8_t number;
>> - struct hal_avrcp_player_setting_text attrs[0];
>> -} __attribute__((packed));
>> -
>> -#define HAL_OP_AVRCP_GET_PLAYER_VALUES_TEXT 0x06
>> -struct hal_cmd_avrcp_get_player_values_text {
>> - uint8_t number;
>> - struct hal_avrcp_player_setting_text values[0];
>> -} __attribute__((packed));
>> -
>> -#define HAL_AVRCP_MEDIA_ATTR_TITLE 0x01
>> -#define HAL_AVRCP_MEDIA_ATTR_ARTIST 0x02
>> -#define HAL_AVRCP_MEDIA_ATTR_ALBUM 0x03
>> -#define HAL_AVRCP_MEDIA_ATTR_TRACK_NUM 0x04
>> -#define HAL_AVRCP_MEDIA_ATTR_NUM_TRACKS 0x05
>> -#define HAL_AVRCP_MEDIA_ATTR_GENRE 0x06
>> -#define HAL_AVRCP_MEDIA_ATTR_DURATION 0x07
>> -
>> -#define HAL_OP_AVRCP_GET_ELEMENT_ATTRS_TEXT 0x07
>> -struct hal_cmd_avrcp_get_element_attrs_text {
>> - uint8_t number;
>> - struct hal_avrcp_player_setting_text values[0];
>> -} __attribute__((packed));
>> -
>> -#define HAL_OP_AVRCP_SET_PLAYER_ATTRS_VALUE 0x08
>> -struct hal_cmd_avrcp_set_player_attrs_value {
>> - uint8_t status;
>> -} __attribute__((packed));
>> -
>> -#define HAL_AVRCP_EVENT_STATUS_CHANGED 0x01
>> -#define HAL_AVRCP_EVENT_TRACK_CHANGED 0x02
>> -#define HAL_AVRCP_EVENT_TRACK_REACHED_END 0x03
>> -#define HAL_AVRCP_EVENT_TRACK_REACHED_START 0x04
>> -#define HAL_AVRCP_EVENT_POSITION_CHANGED 0x05
>> -#define HAL_AVRCP_EVENT_SETTING_CHANGED 0x08
>> -
>> -#define HAL_AVRCP_EVENT_TYPE_INTERIM 0x00
>> -#define HAL_AVRCP_EVENT_TYPE_CHANGED 0x01
>> -
>> -#define HAL_OP_AVRCP_REGISTER_NOTIFICATION 0x09
>> -struct hal_cmd_avrcp_register_notification {
>> - uint8_t event;
>> - uint8_t type;
>> - uint8_t len;
>> - uint8_t data[0];
>> -} __attribute__((packed));
>> -
>> -#define HAL_OP_AVRCP_SET_VOLUME 0x0a
>> -struct hal_cmd_avrcp_set_volume {
>> - uint8_t value;
>> -} __attribute__((packed));
>> -
>> #define HAL_AVRCP_FEATURE_NONE 0x00
>> #define HAL_AVRCP_FEATURE_METADATA 0x01
>> #define HAL_AVRCP_FEATURE_ABSOLUTE_VOLUME 0x02
>> --
>> 1.8.4
>>
>> --
>> 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
>
>
>
> --
> Luiz Augusto von Dentz
Hi Lukasz,
On Tue, Sep 9, 2014 at 10:56 PM, Lukasz Rymanowski
<[email protected]> wrote:
> Idea about order in this file is that commands goes first and
> notifications in the end of file.
>
> This patch moves AVRCP commands up in the file
I guess you need to be consistent with the ID, so AVRCP should be in
between HEALTH and GATT, btw I have no idea why this is mixup in a
patch-set for HFP client.
> ---
> android/hal-msg.h | 206 +++++++++++++++++++++++++++---------------------------
> 1 file changed, 102 insertions(+), 104 deletions(-)
>
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index 8adb9f1..5575d93 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -871,6 +871,108 @@ struct hal_cmd_gatt_server_send_response {
> uint8_t data[0];
> } __attribute__((packed));
>
> +#define HAL_AVRCP_PLAY_STATUS_STOPPED 0x00
> +#define HAL_AVRCP_PLAY_STATUS_PLAYING 0x01
> +#define HAL_AVRCP_PLAY_STATUS_PAUSED 0x02
> +#define HAL_AVRCP_PLAY_STATUS_FWD_SEEK 0x03
> +#define HAL_AVRCP_PLAY_STATUS_REV_SEEK 0x04
> +#define HAL_AVRCP_PLAY_STATUS_ERROR 0xff
> +
> +#define HAL_OP_AVRCP_GET_PLAY_STATUS 0x01
> +struct hal_cmd_avrcp_get_play_status {
> + uint8_t status;
> + uint32_t duration;
> + uint32_t position;
> +} __attribute__((packed));
> +
> +#define HAL_AVRCP_PLAYER_ATTR_EQUALIZER 0x01
> +#define HAL_AVRCP_PLAYER_ATTR_REPEAT 0x02
> +#define HAL_AVRCP_PLAYER_ATTR_SHUFFLE 0x03
> +#define HAL_AVRCP_PLAYER_ATTR_SCAN 0x04
> +
> +#define HAL_OP_AVRCP_LIST_PLAYER_ATTRS 0x02
> +struct hal_cmd_avrcp_list_player_attrs {
> + uint8_t number;
> + uint8_t attrs[0];
> +} __attribute__((packed));
> +
> +#define HAL_OP_AVRCP_LIST_PLAYER_VALUES 0x03
> +struct hal_cmd_avrcp_list_player_values {
> + uint8_t number;
> + uint8_t values[0];
> +} __attribute__((packed));
> +
> +struct hal_avrcp_player_attr_value {
> + uint8_t attr;
> + uint8_t value;
> +} __attribute__((packed));
> +
> +#define HAL_OP_AVRCP_GET_PLAYER_ATTRS 0x04
> +struct hal_cmd_avrcp_get_player_attrs {
> + uint8_t number;
> + struct hal_avrcp_player_attr_value attrs[0];
> +} __attribute__((packed));
> +
> +struct hal_avrcp_player_setting_text {
> + uint8_t id;
> + uint8_t len;
> + uint8_t text[0];
> +} __attribute__((packed));
> +
> +#define HAL_OP_AVRCP_GET_PLAYER_ATTRS_TEXT 0x05
> +struct hal_cmd_avrcp_get_player_attrs_text {
> + uint8_t number;
> + struct hal_avrcp_player_setting_text attrs[0];
> +} __attribute__((packed));
> +
> +#define HAL_OP_AVRCP_GET_PLAYER_VALUES_TEXT 0x06
> +struct hal_cmd_avrcp_get_player_values_text {
> + uint8_t number;
> + struct hal_avrcp_player_setting_text values[0];
> +} __attribute__((packed));
> +
> +#define HAL_AVRCP_MEDIA_ATTR_TITLE 0x01
> +#define HAL_AVRCP_MEDIA_ATTR_ARTIST 0x02
> +#define HAL_AVRCP_MEDIA_ATTR_ALBUM 0x03
> +#define HAL_AVRCP_MEDIA_ATTR_TRACK_NUM 0x04
> +#define HAL_AVRCP_MEDIA_ATTR_NUM_TRACKS 0x05
> +#define HAL_AVRCP_MEDIA_ATTR_GENRE 0x06
> +#define HAL_AVRCP_MEDIA_ATTR_DURATION 0x07
> +
> +#define HAL_OP_AVRCP_GET_ELEMENT_ATTRS_TEXT 0x07
> +struct hal_cmd_avrcp_get_element_attrs_text {
> + uint8_t number;
> + struct hal_avrcp_player_setting_text values[0];
> +} __attribute__((packed));
> +
> +#define HAL_OP_AVRCP_SET_PLAYER_ATTRS_VALUE 0x08
> +struct hal_cmd_avrcp_set_player_attrs_value {
> + uint8_t status;
> +} __attribute__((packed));
> +
> +#define HAL_AVRCP_EVENT_STATUS_CHANGED 0x01
> +#define HAL_AVRCP_EVENT_TRACK_CHANGED 0x02
> +#define HAL_AVRCP_EVENT_TRACK_REACHED_END 0x03
> +#define HAL_AVRCP_EVENT_TRACK_REACHED_START 0x04
> +#define HAL_AVRCP_EVENT_POSITION_CHANGED 0x05
> +#define HAL_AVRCP_EVENT_SETTING_CHANGED 0x08
> +
> +#define HAL_AVRCP_EVENT_TYPE_INTERIM 0x00
> +#define HAL_AVRCP_EVENT_TYPE_CHANGED 0x01
> +
> +#define HAL_OP_AVRCP_REGISTER_NOTIFICATION 0x09
> +struct hal_cmd_avrcp_register_notification {
> + uint8_t event;
> + uint8_t type;
> + uint8_t len;
> + uint8_t data[0];
> +} __attribute__((packed));
> +
> +#define HAL_OP_AVRCP_SET_VOLUME 0x0a
> +struct hal_cmd_avrcp_set_volume {
> + uint8_t value;
> +} __attribute__((packed));
> +
> /* Notifications and confirmations */
>
> #define HAL_POWER_OFF 0x00
> @@ -1174,110 +1276,6 @@ struct hal_ev_handsfree_unknown_at {
>
> #define HAL_EV_HANDSFREE_HSP_KEY_PRESS 0x90
>
> -/* AVRCP HAL API */
> -
> -#define HAL_AVRCP_PLAY_STATUS_STOPPED 0x00
> -#define HAL_AVRCP_PLAY_STATUS_PLAYING 0x01
> -#define HAL_AVRCP_PLAY_STATUS_PAUSED 0x02
> -#define HAL_AVRCP_PLAY_STATUS_FWD_SEEK 0x03
> -#define HAL_AVRCP_PLAY_STATUS_REV_SEEK 0x04
> -#define HAL_AVRCP_PLAY_STATUS_ERROR 0xff
> -
> -#define HAL_OP_AVRCP_GET_PLAY_STATUS 0x01
> -struct hal_cmd_avrcp_get_play_status {
> - uint8_t status;
> - uint32_t duration;
> - uint32_t position;
> -} __attribute__((packed));
> -
> -#define HAL_AVRCP_PLAYER_ATTR_EQUALIZER 0x01
> -#define HAL_AVRCP_PLAYER_ATTR_REPEAT 0x02
> -#define HAL_AVRCP_PLAYER_ATTR_SHUFFLE 0x03
> -#define HAL_AVRCP_PLAYER_ATTR_SCAN 0x04
> -
> -#define HAL_OP_AVRCP_LIST_PLAYER_ATTRS 0x02
> -struct hal_cmd_avrcp_list_player_attrs {
> - uint8_t number;
> - uint8_t attrs[0];
> -} __attribute__((packed));
> -
> -#define HAL_OP_AVRCP_LIST_PLAYER_VALUES 0x03
> -struct hal_cmd_avrcp_list_player_values {
> - uint8_t number;
> - uint8_t values[0];
> -} __attribute__((packed));
> -
> -struct hal_avrcp_player_attr_value {
> - uint8_t attr;
> - uint8_t value;
> -} __attribute__((packed));
> -
> -#define HAL_OP_AVRCP_GET_PLAYER_ATTRS 0x04
> -struct hal_cmd_avrcp_get_player_attrs {
> - uint8_t number;
> - struct hal_avrcp_player_attr_value attrs[0];
> -} __attribute__((packed));
> -
> -struct hal_avrcp_player_setting_text {
> - uint8_t id;
> - uint8_t len;
> - uint8_t text[0];
> -} __attribute__((packed));
> -
> -#define HAL_OP_AVRCP_GET_PLAYER_ATTRS_TEXT 0x05
> -struct hal_cmd_avrcp_get_player_attrs_text {
> - uint8_t number;
> - struct hal_avrcp_player_setting_text attrs[0];
> -} __attribute__((packed));
> -
> -#define HAL_OP_AVRCP_GET_PLAYER_VALUES_TEXT 0x06
> -struct hal_cmd_avrcp_get_player_values_text {
> - uint8_t number;
> - struct hal_avrcp_player_setting_text values[0];
> -} __attribute__((packed));
> -
> -#define HAL_AVRCP_MEDIA_ATTR_TITLE 0x01
> -#define HAL_AVRCP_MEDIA_ATTR_ARTIST 0x02
> -#define HAL_AVRCP_MEDIA_ATTR_ALBUM 0x03
> -#define HAL_AVRCP_MEDIA_ATTR_TRACK_NUM 0x04
> -#define HAL_AVRCP_MEDIA_ATTR_NUM_TRACKS 0x05
> -#define HAL_AVRCP_MEDIA_ATTR_GENRE 0x06
> -#define HAL_AVRCP_MEDIA_ATTR_DURATION 0x07
> -
> -#define HAL_OP_AVRCP_GET_ELEMENT_ATTRS_TEXT 0x07
> -struct hal_cmd_avrcp_get_element_attrs_text {
> - uint8_t number;
> - struct hal_avrcp_player_setting_text values[0];
> -} __attribute__((packed));
> -
> -#define HAL_OP_AVRCP_SET_PLAYER_ATTRS_VALUE 0x08
> -struct hal_cmd_avrcp_set_player_attrs_value {
> - uint8_t status;
> -} __attribute__((packed));
> -
> -#define HAL_AVRCP_EVENT_STATUS_CHANGED 0x01
> -#define HAL_AVRCP_EVENT_TRACK_CHANGED 0x02
> -#define HAL_AVRCP_EVENT_TRACK_REACHED_END 0x03
> -#define HAL_AVRCP_EVENT_TRACK_REACHED_START 0x04
> -#define HAL_AVRCP_EVENT_POSITION_CHANGED 0x05
> -#define HAL_AVRCP_EVENT_SETTING_CHANGED 0x08
> -
> -#define HAL_AVRCP_EVENT_TYPE_INTERIM 0x00
> -#define HAL_AVRCP_EVENT_TYPE_CHANGED 0x01
> -
> -#define HAL_OP_AVRCP_REGISTER_NOTIFICATION 0x09
> -struct hal_cmd_avrcp_register_notification {
> - uint8_t event;
> - uint8_t type;
> - uint8_t len;
> - uint8_t data[0];
> -} __attribute__((packed));
> -
> -#define HAL_OP_AVRCP_SET_VOLUME 0x0a
> -struct hal_cmd_avrcp_set_volume {
> - uint8_t value;
> -} __attribute__((packed));
> -
> #define HAL_AVRCP_FEATURE_NONE 0x00
> #define HAL_AVRCP_FEATURE_METADATA 0x01
> #define HAL_AVRCP_FEATURE_ABSOLUTE_VOLUME 0x02
> --
> 1.8.4
>
> --
> 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
--
Luiz Augusto von Dentz
---
android/README | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/android/README b/android/README
index 20b61a6..6b6a62e 100644
--- a/android/README
+++ b/android/README
@@ -37,6 +37,9 @@ features (currently epoll_create1 and ppoll calls for Android 4.4). Sample
Bionic for Android 4.4 with all required features backported is available at
https://code.google.com/p/aosp-bluez.platform-bionic/
+- Some of the bluetooth HALs are available only when BLUEZ_EXTENSIONS flag is
+set in BoardConfig.mk or similar. Please read below for detail which HALs needs
+that.
Runtime requirements
--------------------
@@ -257,6 +260,7 @@ health bt_hl.h complete
pan bt_pan.h complete
avrcp bt_rc.h complete
socket bt_sock.h complete
+hf-client bt_hf_client.h initial
Implementation shortcomings
@@ -323,6 +327,12 @@ methods:
client->set_adv_data missing kernel support for vendor data
client->connect is_direct parameter is ignored
+HAL HF Client
+-------------
+
+Available on Android only when BLUEZ_EXTENSIONS flag set in BoardConfig.mk
+
+
Audio SCO HAL
=============
--
1.8.4
HF-Client is build for Android only when BLUEZ_EXTENSION flag is set
---
android/Android.mk | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/android/Android.mk b/android/Android.mk
index b2b55f7..a75fe53 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -128,6 +128,10 @@ LOCAL_SRC_FILES := \
bluez/android/hal-utils.c \
bluez/android/hal-health.c \
+ifeq ($(BLUEZ_EXTENSIONS), true)
+LOCAL_SRC_FILES += bluez/android/hal-hf-client.c
+endif
+
LOCAL_C_INCLUDES += \
$(call include-path-for, system-core) \
$(call include-path-for, libhardware) \
--
1.8.4
---
android/hal-hf-client.c | 22 ++++++++++++++++++++++
android/hal-msg.h | 6 ++++++
2 files changed, 28 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index b0726d0..ff3c050 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -244,6 +244,25 @@ static void handle_in_band_ringtone(void *buf, uint16_t len, int fd)
cbs->in_band_ring_tone_cb(ev->state);
}
+static void handle_last_voice_tag_number(void *buf, uint16_t len, int fd)
+{
+ const struct hal_ev_hf_client_last_void_call_tag_num *ev = buf;
+ char *number = NULL;
+ uint16_t num_len = ev->number_len;
+
+ if (len != sizeof(*ev) + num_len ||
+ (num_len != 0 && ev->number[num_len - 1] != '\0')) {
+ error("invalid voice tag, aborting");
+ exit(EXIT_FAILURE);
+ }
+
+ if (num_len)
+ number = (char *) ev->number;
+
+ if (cbs->last_voice_tag_number_callback)
+ cbs->last_voice_tag_number_callback(number);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -305,6 +324,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_CLIENT_INBAND_SETTINGS */
{ handle_in_band_ringtone, false,
sizeof(struct hal_ev_hf_client_inband_settings) },
+ /* HAL_EV_CLIENT_LAST_VOICE_CALL_TAG_NUM */
+ { handle_last_voice_tag_number, true,
+ sizeof(struct hal_ev_hf_client_last_void_call_tag_num) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index bb4620b..f09dcf0 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1864,3 +1864,9 @@ struct hal_ev_hf_client_subscriber_service_info {
struct hal_ev_hf_client_inband_settings {
uint8_t state;
} __attribute__((packed));
+
+#define HAL_EV_CLIENT_LAST_VOICE_CALL_TAG_NUM 0x94
+struct hal_ev_hf_client_last_void_call_tag_num {
+ uint16_t number_len;
+ uint8_t number[0];
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 8 ++++++++
android/hal-msg.h | 2 ++
2 files changed, 10 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index ff3c050..1dea263 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -263,6 +263,12 @@ static void handle_last_voice_tag_number(void *buf, uint16_t len, int fd)
cbs->last_voice_tag_number_callback(number);
}
+static void handle_ring_indication(void *buf, uint16_t len, int fd)
+{
+ if (cbs->ring_indication_cb)
+ cbs->ring_indication_cb();
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -327,6 +333,8 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_CLIENT_LAST_VOICE_CALL_TAG_NUM */
{ handle_last_voice_tag_number, true,
sizeof(struct hal_ev_hf_client_last_void_call_tag_num) },
+ /* HAL_EV_CLIENT_RING_INDICATION */
+ { handle_ring_indication, false, 0 },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index f09dcf0..16a341d 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1870,3 +1870,5 @@ struct hal_ev_hf_client_last_void_call_tag_num {
uint16_t number_len;
uint8_t number[0];
} __attribute__((packed));
+
+#define HAL_EV_CLIENT_RING_INDICATION 0x95
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 8 ++++++++
2 files changed, 19 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 82d9b56..b0726d0 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -236,6 +236,14 @@ static void handle_subscriber_info(void *buf, uint16_t len, int fd)
cbs->subscriber_info_cb(name, ev->type);
}
+static void handle_in_band_ringtone(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_inband_settings *ev = buf;
+
+ if (cbs->in_band_ring_tone_cb)
+ cbs->in_band_ring_tone_cb(ev->state);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -294,6 +302,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_CLIENT_SUBSCRIBER_SERVICE_INFO */
{ handle_subscriber_info, true,
sizeof(struct hal_ev_hf_client_subscriber_service_info) },
+ /* HAL_EV_CLIENT_INBAND_SETTINGS */
+ { handle_in_band_ringtone, false,
+ sizeof(struct hal_ev_hf_client_inband_settings) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 85671a5..bb4620b 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1856,3 +1856,11 @@ struct hal_ev_hf_client_subscriber_service_info {
uint16_t name_len;
uint8_t name[0];
} __attribute__((packed));
+
+#define HF_CLIENT_INBAND_RINGTONE_NOT_PROVIDED 0x00
+#define HF_CLIENT_INBAND_RINGTONE_PROVIDED 0x01
+
+#define HAL_EV_CLIENT_INBAND_SETTINGS 0x93
+struct hal_ev_hf_client_inband_settings {
+ uint8_t state;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 22 ++++++++++++++++++++++
android/hal-msg.h | 11 +++++++++++
2 files changed, 33 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index c4a4943..82d9b56 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -217,6 +217,25 @@ static void handle_command_cmp(void *buf, uint16_t len, int fd)
cbs->cmd_complete_cb(ev->type, ev->cme);
}
+static void handle_subscriber_info(void *buf, uint16_t len, int fd)
+{
+ const struct hal_ev_hf_client_subscriber_service_info *ev = buf;
+ uint16_t name_len = ev->name_len;
+ char *name = NULL;
+
+ if (len != sizeof(*ev) + name_len ||
+ (name_len != 0 && ev->name[name_len - 1] != '\0')) {
+ error("invalid sunscriber info, aborting");
+ exit(EXIT_FAILURE);
+ }
+
+ if (name_len)
+ name = (char *) ev->name;
+
+ if (cbs->subscriber_info_cb)
+ cbs->subscriber_info_cb(name, ev->type);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -272,6 +291,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_CLIENT_COMMAND_COMPLETE */
{ handle_command_cmp, false,
sizeof(struct hal_ev_hf_client_command_complete) },
+ /* HAL_EV_CLIENT_SUBSCRIBER_SERVICE_INFO */
+ { handle_subscriber_info, true,
+ sizeof(struct hal_ev_hf_client_subscriber_service_info) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index b88da52..85671a5 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1845,3 +1845,14 @@ struct hal_ev_hf_client_command_complete {
uint8_t type;
uint8_t cme;
} __attribute__((packed));
+
+#define HF_CLIENT_SUBSCRIBER_TYPE_UNKNOWN 0x00
+#define HF_CLIENT_SUBSCRIBER_TYPE_VOICE 0x01
+#define HF_CLIENT_SUBSCRIBER_TYPE_FAX 0x02
+
+#define HAL_EV_CLIENT_SUBSCRIBER_SERVICE_INFO 0x92
+struct hal_ev_hf_client_subscriber_service_info {
+ uint8_t type;
+ uint16_t name_len;
+ uint8_t name[0];
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 15 +++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 5ea90b0..c4a4943 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -209,6 +209,14 @@ static void handle_volume_change(void *buf, uint16_t len, int fd)
cbs->volume_change_cb(ev->type, ev->volume);
}
+static void handle_command_cmp(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_command_complete *ev = buf;
+
+ if (cbs->cmd_complete_cb)
+ cbs->cmd_complete_cb(ev->type, ev->cme);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -261,6 +269,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_CLIENT_VOLUME_CHANGED */
{ handle_volume_change, false,
sizeof(struct hal_ev_hf_client_volume_changed) },
+ /* HAL_EV_CLIENT_COMMAND_COMPLETE */
+ { handle_command_cmp, false,
+ sizeof(struct hal_ev_hf_client_command_complete) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 5da512c..b88da52 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1830,3 +1830,18 @@ struct hal_ev_hf_client_volume_changed {
uint8_t type;
uint8_t volume;
} __attribute__((packed));
+
+#define HF_CLIENT_CMD_COMP_OK 0x00
+#define HF_CLIENT_CMD_COMP_ERR 0x01
+#define HF_CLIENT_CMD_COMP_ERR_NO_CARRIER 0x02
+#define HF_CLIENT_CMD_COMP_ERR_BUSY 0x03
+#define HF_CLIENT_CMD_COMP_ERR_NO_ANSWER 0x04
+#define HF_CLIENT_CMD_COMP_ERR_DELAYED 0x05
+#define HF_CLIENT_CMD_COMP_ERR_BACKLISTED 0x06
+#define HF_CLIENT_CMD_COMP_ERR_CME 0x07
+
+#define HAL_EV_CLIENT_COMMAND_COMPLETE 0x91
+struct hal_ev_hf_client_command_complete {
+ uint8_t type;
+ uint8_t cme;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 6 ++++++
2 files changed, 17 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 4e31421..5ea90b0 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -201,6 +201,14 @@ static void handle_current_calls(void *buf, uint16_t len, int fd)
ev->multiparty, number);
}
+static void handle_volume_change(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_volume_changed *ev = buf;
+
+ if (cbs->volume_change_cb)
+ cbs->volume_change_cb(ev->type, ev->volume);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -250,6 +258,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_CURRENT_CALL */
{ handle_current_calls, true,
sizeof(struct hal_ev_hf_client_current_call) },
+ /* HAL_EV_CLIENT_VOLUME_CHANGED */
+ { handle_volume_change, false,
+ sizeof(struct hal_ev_hf_client_volume_changed) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 01a1711..5da512c 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1824,3 +1824,9 @@ struct hal_ev_hf_client_current_call {
uint16_t number_len;
uint8_t number[0];
} __attribute__((packed));
+
+#define HAL_EV_CLIENT_VOLUME_CHANGED 0x90
+struct hal_ev_hf_client_volume_changed {
+ uint8_t type;
+ uint8_t volume;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 23 +++++++++++++++++++++++
android/hal-msg.h | 21 +++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index a5fd84e..4e31421 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -181,6 +181,26 @@ static void handle_call_waiting(void *buf, uint16_t len, int fd)
cbs->call_waiting_cb(number);
}
+static void handle_current_calls(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_current_call *ev = buf;
+ uint16_t num_len = ev->number_len;
+ char *number = NULL;
+
+ if (len != sizeof(*ev) + num_len ||
+ (num_len != 0 && ev->number[num_len - 1] != '\0')) {
+ error("invalid current calls, aborting");
+ exit(EXIT_FAILURE);
+ }
+
+ if (num_len)
+ number = (char *) ev->number;
+
+ if (cbs->current_calls_cb)
+ cbs->current_calls_cb(ev->index, ev->direction, ev->call_state,
+ ev->multiparty, number);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -227,6 +247,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_CALL_WAITING */
{ handle_call_waiting, true,
sizeof(struct hal_ev_hf_client_call_waiting) },
+ /* HAL_EV_HF_CLIENT_CURRENT_CALL */
+ { handle_current_calls, true,
+ sizeof(struct hal_ev_hf_client_current_call) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 1532805..01a1711 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1803,3 +1803,24 @@ struct hal_ev_hf_client_call_waiting {
uint16_t number_len;
uint8_t number[0];
} __attribute__((packed));
+
+#define HF_CLIENT_DIRECTION_OUTGOING 0x00
+#define HF_CLIENT_DIRECTION_INCOMIGN 0x01
+
+#define HF_CLIENT_CALL_STATE_ACTIVE 0x00
+#define HF_CLIENT_CALL_STATE_HELD 0x01
+#define HF_CLIENT_CALL_STATE_DIALING 0x02
+#define HF_CLIENT_CALL_STATE_ALERTING 0x03
+#define HF_CLIENT_CALL_STATE_INCOMING 0x04
+#define HF_CLIENT_CALL_STATE_WAITING 0x05
+#define HF_CLIENT_CALL_STATE_HELD_BY_RESPONSE_AND_HOLD 0x06
+
+#define HAL_EV_HF_CLIENT_CURRENT_CALL 0x8f
+struct hal_ev_hf_client_current_call {
+ uint8_t index;
+ uint8_t direction;
+ uint8_t call_state;
+ uint8_t multiparty;
+ uint16_t number_len;
+ uint8_t number[0];
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
android/hal-msg.h | 12 ++++++++++++
2 files changed, 56 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index a4f7e0c..a5fd84e 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -143,6 +143,44 @@ static void handle_response_and_hold(void *buf, uint16_t len, int fd)
cbs->resp_and_hold_cb(ev->status);
}
+static void handle_clip(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_calling_line_ident *ev = buf;
+ uint16_t num_len = ev->number_len;
+ char *number = NULL;
+
+ if (len != sizeof(*ev) + num_len ||
+ (num_len != 0 && ev->number[num_len - 1] != '\0')) {
+ error("invalid clip, aborting");
+ exit(EXIT_FAILURE);
+ }
+
+ if (num_len)
+ number = (char *) ev->number;
+
+ if (cbs->clip_cb)
+ cbs->clip_cb(number);
+}
+
+static void handle_call_waiting(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_call_waiting *ev = buf;
+ uint16_t num_len = ev->number_len;
+ char *number = NULL;
+
+ if (len != sizeof(*ev) + num_len ||
+ (num_len != 0 && ev->number[num_len - 1] != '\0')) {
+ error("invalid call waiting, aborting");
+ exit(EXIT_FAILURE);
+ }
+
+ if (num_len)
+ number = (char *) ev->number;
+
+ if (cbs->call_waiting_cb)
+ cbs->call_waiting_cb(number);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -183,6 +221,12 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_RESPONSE_AND_HOLD_STATUS */
{ handle_response_and_hold, false,
sizeof(struct hal_ev_hf_client_response_and_hold_status) },
+ /* HAL_EV_HF_CLIENT_CALLING_LINE_IDENT */
+ { handle_clip, true,
+ sizeof(struct hal_ev_hf_client_calling_line_ident) },
+ /* HAL_EV_HF_CLIENT_CALL_WAITING */
+ { handle_call_waiting, true,
+ sizeof(struct hal_ev_hf_client_call_waiting) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 34cffbc..1532805 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1791,3 +1791,15 @@ struct hal_ev_hf_client_call_held_indicator {
struct hal_ev_hf_client_response_and_hold_status {
uint8_t status;
} __attribute__((packed));
+
+#define HAL_EV_HF_CLIENT_CALLING_LINE_IDENT 0x8d
+struct hal_ev_hf_client_calling_line_ident {
+ uint16_t number_len;
+ uint8_t number[0];
+} __attribute__((packed));
+
+#define HAL_EV_HF_CLIENT_CALL_WAITING 0x8e
+struct hal_ev_hf_client_call_waiting {
+ uint16_t number_len;
+ uint8_t number[0];
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 9 +++++++++
2 files changed, 20 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 8c03e52..a4f7e0c 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -135,6 +135,14 @@ static void handle_call_held(void *buf, uint16_t len, int fd)
cbs->callheld_cb(ev->call_held);
}
+static void handle_response_and_hold(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_response_and_hold_status *ev = buf;
+
+ if (cbs->resp_and_hold_cb)
+ cbs->resp_and_hold_cb(ev->status);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -172,6 +180,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_CALL_HELD_INDICATOR */
{ handle_call_held, false,
sizeof(struct hal_ev_hf_client_call_held_indicator) },
+ /* HAL_EV_HF_CLIENT_RESPONSE_AND_HOLD_STATUS */
+ { handle_response_and_hold, false,
+ sizeof(struct hal_ev_hf_client_response_and_hold_status) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index edf1d3e..34cffbc 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1782,3 +1782,12 @@ struct hal_ev_hf_client_call_setup_indicator {
struct hal_ev_hf_client_call_held_indicator {
uint8_t call_held;
} __attribute__((packed));
+
+#define HF_CLIENT_RESPONSE_AND_HOLD_STATUS_HELD 0x00
+#define HF_CLIENT_RESPONSE_AND_HOLD_STATUS_ACCEPT 0x01
+#define HF_CLIENT_RESPONSE_AND_HOLD_STATUS_REJECT 0x02
+
+#define HAL_EV_HF_CLIENT_RESPONSE_AND_HOLD_STATUS 0x8c
+struct hal_ev_hf_client_response_and_hold_status {
+ uint8_t status;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 9 +++++++++
2 files changed, 20 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index ef647f1..8c03e52 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -127,6 +127,14 @@ static void handle_call_setup(void *buf, uint16_t len, int fd)
cbs->callsetup_cb(ev->call_setup);
}
+static void handle_call_held(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_call_held_indicator *ev = buf;
+
+ if (cbs->callheld_cb)
+ cbs->callheld_cb(ev->call_held);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -161,6 +169,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_CALL_SETUP_INDICATOR */
{ handle_call_setup, false,
sizeof(struct hal_ev_hf_client_call_setup_indicator) },
+ /* HAL_EV_HF_CLIENT_CALL_HELD_INDICATOR */
+ { handle_call_held, false,
+ sizeof(struct hal_ev_hf_client_call_held_indicator) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 4620ce3..edf1d3e 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1773,3 +1773,12 @@ struct hal_ev_hf_client_call_indicator {
struct hal_ev_hf_client_call_setup_indicator {
uint8_t call_setup;
} __attribute__((packed));
+
+#define HF_CLIENT_CALL_HELD_IND_NONE 0x00
+#define HF_CLIENT_CALL_HELD_IND_HOLD_AND_ACTIVE 0x01
+#define HF_CLIENT_CALL_SETUP_IND_HOLD 0x02
+
+#define HAL_EV_HF_CLIENT_CALL_HELD_INDICATOR 0x8b
+struct hal_ev_hf_client_call_held_indicator {
+ uint8_t call_held;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 8 ++++++++
2 files changed, 19 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index b1b481f..b8e61ac 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -111,6 +111,14 @@ static void handle_operator_name(void *buf, uint16_t len, int fd)
cbs->current_operator_cb(name);
}
+static void handle_call(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_call_indicator *ev = buf;
+
+ if (cbs->call_cb)
+ cbs->call_cb(ev->call);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -139,6 +147,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_OPERATOR_NAME */
{ handle_operator_name, true,
sizeof(struct hal_ev_hf_client_operator_name) },
+ /* HAL_EV_HF_CLIENT_CALL_INDICATOR */
+ { handle_call, false,
+ sizeof(struct hal_ev_hf_client_call_indicator) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 0af198e..282bca5 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1755,3 +1755,11 @@ struct hal_ev_hf_client_operator_name {
uint16_t name_len;
uint8_t name[0];
} __attribute__((packed));
+
+#define HF_CLIENT_CALL_IND_NO_CALL_IN_PROGERSS 0x00
+#define HF_CLIENT_CALL_IND_CALL_IN_PROGERSS 0x01
+
+#define HAL_EV_HF_CLIENT_CALL_INDICATOR 0x89
+struct hal_ev_hf_client_call_indicator {
+ uint8_t call;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 10 ++++++++++
2 files changed, 21 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index b8e61ac..ef647f1 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -119,6 +119,14 @@ static void handle_call(void *buf, uint16_t len, int fd)
cbs->call_cb(ev->call);
}
+static void handle_call_setup(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_call_setup_indicator *ev = buf;
+
+ if (cbs->callsetup_cb)
+ cbs->callsetup_cb(ev->call_setup);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -150,6 +158,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_CALL_INDICATOR */
{ handle_call, false,
sizeof(struct hal_ev_hf_client_call_indicator) },
+ /* HAL_EV_HF_CLIENT_CALL_SETUP_INDICATOR */
+ { handle_call_setup, false,
+ sizeof(struct hal_ev_hf_client_call_setup_indicator) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 282bca5..4620ce3 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1763,3 +1763,13 @@ struct hal_ev_hf_client_operator_name {
struct hal_ev_hf_client_call_indicator {
uint8_t call;
} __attribute__((packed));
+
+#define HF_CLIENT_CALL_SETUP_IND_NONE 0x00
+#define HF_CLIENT_CALL_SETUP_IND_INCOMING 0x01
+#define HF_CLIENT_CALL_SETUP_IND_OUTGOING 0x02
+#define HF_CLIENT_CALL_SETUP_IND_ALERTING 0x03
+
+#define HAL_EV_HF_CLIENT_CALL_SETUP_INDICATOR 0x8a
+struct hal_ev_hf_client_call_setup_indicator {
+ uint8_t call_setup;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 22 ++++++++++++++++++++++
android/hal-msg.h | 6 ++++++
2 files changed, 28 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 72a764a..b1b481f 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -92,6 +92,25 @@ static void handle_battery_level(void *buf, uint16_t len, int fd)
cbs->battery_level_cb(ev->battery_level);
}
+static void handle_operator_name(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_operator_name *ev = buf;
+ uint16_t name_len = ev->name_len;
+ char *name = NULL;
+
+ if (len != sizeof(*ev) + name_len ||
+ (name_len != 0 && ev->name[name_len - 1] != '\0')) {
+ error("invalid clip, aborting");
+ exit(EXIT_FAILURE);
+ }
+
+ if (name_len)
+ name = (char *) ev->name;
+
+ if (cbs->current_operator_cb)
+ cbs->current_operator_cb(name);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -117,6 +136,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_BATTERY_LEVEL */
{ handle_battery_level, false,
sizeof(struct hal_ev_hf_client_battery_level) },
+ /* HAL_EV_HF_CLIENT_OPERATOR_NAME */
+ { handle_operator_name, true,
+ sizeof(struct hal_ev_hf_client_operator_name) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 85c81a8..0af198e 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1749,3 +1749,9 @@ struct hal_ev_hf_client_net_signal_strength {
struct hal_ev_hf_client_battery_level {
uint8_t battery_level;
} __attribute__((packed));
+
+#define HAL_EV_HF_CLIENT_OPERATOR_NAME 0x88
+struct hal_ev_hf_client_operator_name {
+ uint16_t name_len;
+ uint8_t name[0];
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 044e296..72a764a 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -84,6 +84,14 @@ static void handle_network_signal(void *buf, uint16_t len, int fd)
cbs->network_signal_cb(ev->signal_strength);
}
+static void handle_battery_level(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_battery_level *ev = buf;
+
+ if (cbs->battery_level_cb)
+ cbs->battery_level_cb(ev->battery_level);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -106,6 +114,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_NET_SIGNAL_STRENGTH */
{ handle_network_signal, false,
sizeof(struct hal_ev_hf_client_net_signal_strength) },
+ /* HAL_EV_HF_CLIENT_BATTERY_LEVEL */
+ { handle_battery_level, false,
+ sizeof(struct hal_ev_hf_client_battery_level) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index a780e30..85c81a8 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1744,3 +1744,8 @@ struct hal_ev_hf_client_net_roaming_type {
struct hal_ev_hf_client_net_signal_strength {
uint8_t signal_strength;
} __attribute__((packed));
+
+#define HAL_EV_HF_CLIENT_BATTERY_LEVEL 0x87
+struct hal_ev_hf_client_battery_level {
+ uint8_t battery_level;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 2ff9e9f..044e296 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -76,6 +76,14 @@ static void handle_network_roaming(void *buf, uint16_t len, int fd)
cbs->network_roaming_cb(ev->state);
}
+static void handle_network_signal(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_net_signal_strength *ev = buf;
+
+ if (cbs->network_signal_cb)
+ cbs->network_signal_cb(ev->signal_strength);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -95,6 +103,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/*HAL_EV_HF_CLIENT_NET_ROAMING_TYPE */
{ handle_network_roaming, false,
sizeof(struct hal_ev_hf_client_net_roaming_type) },
+ /* HAL_EV_HF_CLIENT_NET_SIGNAL_STRENGTH */
+ { handle_network_signal, false,
+ sizeof(struct hal_ev_hf_client_net_signal_strength) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 80aa244..a780e30 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1739,3 +1739,8 @@ struct hal_ev_hf_client_net_state {
struct hal_ev_hf_client_net_roaming_type {
uint8_t state;
} __attribute__((packed));
+
+#define HAL_EV_HF_CLIENT_NET_SIGNAL_STRENGTH 0x86
+struct hal_ev_hf_client_net_signal_strength {
+ uint8_t signal_strength;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 10 ++++++++++
android/hal-msg.h | 8 ++++++++
2 files changed, 18 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index c49666b..42908de 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -52,6 +52,14 @@ static void handle_audio_state(void *buf, uint16_t len, int fd)
cbs->audio_state_cb(ev->state, (bt_bdaddr_t *) (ev->bdaddr));
}
+static void handle_vr_state(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_vr_state *ev = buf;
+
+ if (cbs->vr_cmd_cb)
+ cbs->vr_cmd_cb(ev->state);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -63,6 +71,8 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_AUDIO_STATE */
{ handle_audio_state, false,
sizeof(struct hal_ev_hf_client_audio_state) },
+ /* HAL_EV_HF_CLIENT_VR_STATE */
+ { handle_vr_state, false, sizeof(struct hal_ev_hf_client_vr_state) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index a94606e..16b095b 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1715,3 +1715,11 @@ struct hal_ev_hf_client_audio_state {
uint8_t state;
uint8_t bdaddr[6];
} __attribute__((packed));
+
+#define HF_CLIENT_VR_STOPPED 0x00
+#define HF_CLIENT_VR_STARTED 0x01
+
+#define HAL_EV_HF_CLIENT_VR_STATE 0x83
+struct hal_ev_hf_client_vr_state {
+ uint8_t state;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 8 ++++++++
2 files changed, 19 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 7facb83..2ff9e9f 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -68,6 +68,14 @@ static void handle_network_state(void *buf, uint16_t len, int fd)
cbs->network_state_cb(ev->state);
}
+static void handle_network_roaming(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_net_roaming_type *ev = buf;
+
+ if (cbs->network_roaming_cb)
+ cbs->network_roaming_cb(ev->state);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -84,6 +92,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/*HAL_EV_HF_CLIENT_NET_STATE */
{ handle_network_state, false,
sizeof(struct hal_ev_hf_client_net_state)},
+ /*HAL_EV_HF_CLIENT_NET_ROAMING_TYPE */
+ { handle_network_roaming, false,
+ sizeof(struct hal_ev_hf_client_net_roaming_type) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index bbee8ad..80aa244 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1731,3 +1731,11 @@ struct hal_ev_hf_client_vr_state {
struct hal_ev_hf_client_net_state {
uint8_t state;
} __attribute__((packed));
+
+#define HF_CLIENT_NET_ROAMING_TYPE_HOME 0x00
+#define HF_CLIENT_NET_ROAMING_TYPE_ROAMING 0x01
+
+#define HAL_EV_HF_CLIENT_NET_ROAMING_TYPE 0x85
+struct hal_ev_hf_client_net_roaming_type {
+ uint8_t state;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 8 ++++++++
2 files changed, 19 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 42908de..7facb83 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -60,6 +60,14 @@ static void handle_vr_state(void *buf, uint16_t len, int fd)
cbs->vr_cmd_cb(ev->state);
}
+static void handle_network_state(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_net_state *ev = buf;
+
+ if (cbs->network_state_cb)
+ cbs->network_state_cb(ev->state);
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -73,6 +81,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
sizeof(struct hal_ev_hf_client_audio_state) },
/* HAL_EV_HF_CLIENT_VR_STATE */
{ handle_vr_state, false, sizeof(struct hal_ev_hf_client_vr_state) },
+ /*HAL_EV_HF_CLIENT_NET_STATE */
+ { handle_network_state, false,
+ sizeof(struct hal_ev_hf_client_net_state)},
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 16b095b..bbee8ad 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1723,3 +1723,11 @@ struct hal_ev_hf_client_audio_state {
struct hal_ev_hf_client_vr_state {
uint8_t state;
} __attribute__((packed));
+
+#define HF_CLIENT_NET_NOT_AVAILABLE 0x00
+#define HF_CLIENT_NET_AVAILABLE 0x01
+
+#define HAL_EV_HF_CLIENT_NET_STATE 0x84
+struct hal_ev_hf_client_net_state {
+ uint8_t state;
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 11 +++++++++++
android/hal-msg.h | 11 +++++++++++
2 files changed, 22 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index a7d164f..c49666b 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -44,6 +44,14 @@ static void handle_conn_state(void *buf, uint16_t len, int fd)
ev->chld_feat, (bt_bdaddr_t *) ev->bdaddr);
}
+static void handle_audio_state(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_audio_state *ev = buf;
+
+ if (cbs->audio_state_cb)
+ cbs->audio_state_cb(ev->state, (bt_bdaddr_t *) (ev->bdaddr));
+}
+
/*
* handlers will be called from notification thread context,
* index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -52,6 +60,9 @@ static const struct hal_ipc_handler ev_handlers[] = {
/* HAL_EV_HF_CLIENT_CONN_STATE */
{ handle_conn_state, false,
sizeof(struct hal_ev_hf_client_conn_state) },
+ /* HAL_EV_HF_CLIENT_AUDIO_STATE */
+ { handle_audio_state, false,
+ sizeof(struct hal_ev_hf_client_audio_state) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index e385f59..a94606e 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1704,3 +1704,14 @@ struct hal_ev_hf_client_conn_state {
uint16_t chld_feat;
uint8_t bdaddr[6];
} __attribute__((packed));
+
+#define HF_CLIENT_AUDIO_STATE_DISCONNECTED 0x00
+#define HF_CLIENT_AUDIO_STATE_CONNECTING 0x01
+#define HF_CLIENT_AUDIO_STATE_CONNECTED 0x02
+#define HF_CLIENT_AUDIO_STATE_CONNECTED_MSBC 0x03
+
+#define HAL_EV_HF_CLIENT_AUDIO_STATE 0x82
+struct hal_ev_hf_client_audio_state {
+ uint8_t state;
+ uint8_t bdaddr[6];
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 12 ++++++++++++
android/hal-msg.h | 13 +++++++++++++
2 files changed, 25 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 8ee77f2..a7d164f 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -35,11 +35,23 @@ static bool interface_ready(void)
return cbs != NULL;
}
+static void handle_conn_state(void *buf, uint16_t len, int fd)
+{
+ struct hal_ev_hf_client_conn_state *ev = buf;
+
+ if (cbs->connection_state_cb)
+ cbs->connection_state_cb(ev->state, ev->peer_feat,
+ ev->chld_feat, (bt_bdaddr_t *) ev->bdaddr);
+}
+
/*
* 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_HF_CLIENT_CONN_STATE */
+ { handle_conn_state, false,
+ sizeof(struct hal_ev_hf_client_conn_state) },
};
static bt_status_t init(bthf_client_callbacks_t *callbacks)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 9445c66..e385f59 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1691,3 +1691,16 @@ struct hal_ev_gatt_server_rsp_confirmation {
#define HAL_GATT_AUTHENTICATION_NONE 0
#define HAL_GATT_AUTHENTICATION_NO_MITM 1
#define HAL_GATT_AUTHENTICATION_MITM 2
+
+#define HF_CLIENT_CONN_STATE_DISCONNECTED 0x00
+#define HF_CLIENT_CONN_STATE_CONNECTING 0x01
+#define HF_CLIENT_CONN_STATE_SLC_CONNECTED 0x02
+#define HF_CLIENT_CONN_STATE_DISCONNECTING 0x03
+
+#define HAL_EV_HF_CLIENT_CONN_STATE 0x81
+struct hal_ev_hf_client_conn_state {
+ uint8_t state;
+ uint16_t peer_feat;
+ uint16_t chld_feat;
+ uint8_t bdaddr[6];
+} __attribute__((packed));
--
1.8.4
---
android/hal-hf-client.c | 13 +++++++++++++
android/hal-msg.h | 2 ++
android/hf-client.c | 10 ++++++++++
3 files changed, 25 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index e7d9abe..8ee77f2 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -291,6 +291,18 @@ static bt_status_t send_dtmf(char tone)
sizeof(cmd), &cmd, NULL, NULL, NULL);
}
+static bt_status_t request_last_voice_tag_number(void)
+{
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_GET_LAST_VOICE_TAG_NUM,
+ 0, NULL, NULL, NULL, NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -327,6 +339,7 @@ static bthf_client_interface_t iface = {
.query_current_operator_name = query_operator_name,
.retrieve_subscriber_info = retrieve_subsr_info,
.send_dtmf = send_dtmf,
+ .request_last_voice_tag_number = request_last_voice_tag_number,
.cleanup = cleanup
};
diff --git a/android/hal-msg.h b/android/hal-msg.h
index b43f7d9..9445c66 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1045,6 +1045,8 @@ struct hal_cmd_hf_client_send_dtmf {
uint8_t tone;
} __attribute__((packed));
+#define HAL_OP_HF_CLIENT_GET_LAST_VOICE_TAG_NUM 0x15
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index bcb2f51..1d03c46 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -151,6 +151,14 @@ static void handle_send_dtmf(const void *buf, uint16_t len)
HAL_OP_HF_CLIENT_SEND_DTMF, HAL_STATUS_UNSUPPORTED);
}
+static void handle_get_last_vc_tag_num(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_GET_LAST_VOICE_TAG_NUM,
+ HAL_STATUS_UNSUPPORTED);
+}
+
static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CONNECT */
{ handle_connect, false,
@@ -188,6 +196,8 @@ static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_SEND_DTMF */
{ handle_send_dtmf, false,
sizeof(struct hal_cmd_hf_client_send_dtmf) },
+ /* HAL_OP_HF_CLIENT_GET_LAST_VOICE_TAG_NUM */
+ { handle_get_last_vc_tag_num, false, 0 },
};
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
--
1.8.4
---
android/hal-hf-client.c | 17 +++++++++++++++++
android/hal-msg.h | 5 +++++
android/hf-client.c | 10 ++++++++++
3 files changed, 32 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index d74958d..e7d9abe 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -275,6 +275,22 @@ static bt_status_t retrieve_subsr_info(void)
0, NULL, NULL, NULL, NULL);
}
+static bt_status_t send_dtmf(char tone)
+{
+ struct hal_cmd_hf_client_send_dtmf cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ cmd.tone = tone;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_SEND_DTMF,
+ sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -310,6 +326,7 @@ static bthf_client_interface_t iface = {
.query_current_calls = query_current_calls,
.query_current_operator_name = query_operator_name,
.retrieve_subscriber_info = retrieve_subsr_info,
+ .send_dtmf = send_dtmf,
.cleanup = cleanup
};
diff --git a/android/hal-msg.h b/android/hal-msg.h
index e08c002..b43f7d9 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1040,6 +1040,11 @@ struct hal_cmd_hf_client_call_action {
#define HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME 0x12
#define HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO 0x13
+#define HAL_OP_HF_CLIENT_SEND_DTMF 0x14
+struct hal_cmd_hf_client_send_dtmf {
+ uint8_t tone;
+} __attribute__((packed));
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index bdd60b1..bcb2f51 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -144,6 +144,13 @@ static void handle_retrieve_subscr_info(const void *buf, uint16_t len)
HAL_STATUS_UNSUPPORTED);
}
+static void handle_send_dtmf(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_SEND_DTMF, HAL_STATUS_UNSUPPORTED);
+}
+
static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CONNECT */
{ handle_connect, false,
@@ -178,6 +185,9 @@ static const struct ipc_handler cmd_handlers[] = {
{ handle_query_operator_name, false, 0 },
/* HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO */
{ handle_retrieve_subscr_info, false, 0 },
+ /* HAL_OP_HF_CLIENT_SEND_DTMF */
+ { handle_send_dtmf, false,
+ sizeof(struct hal_cmd_hf_client_send_dtmf) },
};
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
--
1.8.4
---
android/hal-hf-client.c | 13 +++++++++++++
android/hal-msg.h | 1 +
android/hf-client.c | 10 ++++++++++
3 files changed, 24 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 6e34106..d74958d 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -263,6 +263,18 @@ static bt_status_t query_operator_name(void)
0, NULL, NULL, NULL, NULL);
}
+static bt_status_t retrieve_subsr_info(void)
+{
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO,
+ 0, NULL, NULL, NULL, NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -297,6 +309,7 @@ static bthf_client_interface_t iface = {
.handle_call_action = call_action,
.query_current_calls = query_current_calls,
.query_current_operator_name = query_operator_name,
+ .retrieve_subscriber_info = retrieve_subsr_info,
.cleanup = cleanup
};
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 4ec716a..e08c002 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1038,6 +1038,7 @@ struct hal_cmd_hf_client_call_action {
#define HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS 0x11
#define HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME 0x12
+#define HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO 0x13
/* Notifications and confirmations */
diff --git a/android/hf-client.c b/android/hf-client.c
index 8b7386c..bdd60b1 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -136,6 +136,14 @@ static void handle_query_operator_name(const void *buf, uint16_t len)
HAL_STATUS_UNSUPPORTED);
}
+static void handle_retrieve_subscr_info(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO,
+ HAL_STATUS_UNSUPPORTED);
+}
+
static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CONNECT */
{ handle_connect, false,
@@ -168,6 +176,8 @@ static const struct ipc_handler cmd_handlers[] = {
{ handle_query_current_calls, false, 0 },
/* HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME */
{ handle_query_operator_name, false, 0 },
+ /* HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO */
+ { handle_retrieve_subscr_info, false, 0 },
};
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
--
1.8.4
---
android/hal-hf-client.c | 26 ++++++++++++++++++++++++++
android/hal-msg.h | 3 +++
android/hf-client.c | 20 ++++++++++++++++++++
3 files changed, 49 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 7766985..6e34106 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -239,6 +239,30 @@ static bt_status_t call_action(bthf_client_call_action_t action, int index)
sizeof(cmd), &cmd, NULL, NULL, NULL);
}
+static bt_status_t query_current_calls(void)
+{
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS,
+ 0, NULL, NULL, NULL, NULL);
+}
+
+static bt_status_t query_operator_name(void)
+{
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME,
+ 0, NULL, NULL, NULL, NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -271,6 +295,8 @@ static bthf_client_interface_t iface = {
.dial = dial,
.dial_memory = dial_memory,
.handle_call_action = call_action,
+ .query_current_calls = query_current_calls,
+ .query_current_operator_name = query_operator_name,
.cleanup = cleanup
};
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 7cee365..4ec716a 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1036,6 +1036,9 @@ struct hal_cmd_hf_client_call_action {
uint8_t index;
} __attribute__((packed));
+#define HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS 0x11
+#define HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME 0x12
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index 66954b9..8b7386c 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -120,6 +120,22 @@ static void handle_call_action(const void *buf, uint16_t len)
HAL_OP_HF_CLIENT_CALL_ACTION, HAL_STATUS_UNSUPPORTED);
}
+static void handle_query_current_calls(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS,
+ HAL_STATUS_UNSUPPORTED);
+}
+
+static void handle_query_operator_name(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME,
+ HAL_STATUS_UNSUPPORTED);
+}
+
static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CONNECT */
{ handle_connect, false,
@@ -148,6 +164,10 @@ static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CALL_ACTION */
{ handle_call_action, false,
sizeof(struct hal_cmd_hf_client_call_action) },
+ /* HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS */
+ { handle_query_current_calls, false, 0 },
+ /* HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME */
+ { handle_query_operator_name, false, 0 },
};
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
--
1.8.4
---
android/hal-hf-client.c | 18 ++++++++++++++++++
android/hal-msg.h | 19 +++++++++++++++++++
android/hf-client.c | 10 ++++++++++
3 files changed, 47 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 1f8c85f..7766985 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -222,6 +222,23 @@ static bt_status_t dial_memory(int location)
&cmd, NULL, NULL, NULL);
}
+static bt_status_t call_action(bthf_client_call_action_t action, int index)
+{
+ struct hal_cmd_hf_client_call_action cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ cmd.action = action;
+ cmd.index = index;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_CALL_ACTION,
+ sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -253,6 +270,7 @@ static bthf_client_interface_t iface = {
.volume_control = volume_control,
.dial = dial,
.dial_memory = dial_memory,
+ .handle_call_action = call_action,
.cleanup = cleanup
};
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 5218b06..7cee365 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1017,6 +1017,25 @@ struct hal_cmd_hf_client_dial_memory {
uint16_t location;
} __attribute__((packed));
+#define HF_CLIENT_ACTION_CHLD_0 0x00
+#define HF_CLIENT_ACTION_CHLD_1 0x01
+#define HF_CLIENT_ACTION_CHLD_2 0x02
+#define HF_CLIENT_ACTION_CHLD_3 0x03
+#define HF_CLIENT_ACTION_CHLD_4 0x04
+#define HF_CLIENT_ACTION_CHLD_1x 0x05
+#define HF_CLIENT_ACTION_CHLD_2x 0x06
+#define HF_CLIENT_ACTION_ATA 0x07
+#define HF_CLIENT_ACTION_CHUP 0x08
+#define HF_CLIENT_ACTION_BRTH_0 0x09
+#define HF_CLIENT_ACTION_BRTH_1 0x10
+#define HF_CLIENT_ACTION_BRTH_02 0x11
+
+#define HAL_OP_HF_CLIENT_CALL_ACTION 0x10
+struct hal_cmd_hf_client_call_action {
+ uint8_t action;
+ uint8_t index;
+} __attribute__((packed));
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index e1cb88d..66954b9 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -113,6 +113,13 @@ static void handle_dial_memory(const void *buf, uint16_t len)
HAL_OP_HF_CLIENT_DIAL_MEMORY, HAL_STATUS_UNSUPPORTED);
}
+static void handle_call_action(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_CALL_ACTION, HAL_STATUS_UNSUPPORTED);
+}
+
static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CONNECT */
{ handle_connect, false,
@@ -138,6 +145,9 @@ static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_DIAL_MEMORY */
{ handle_dial_memory, false,
sizeof(struct hal_cmd_hf_client_dial_memory) },
+ /* HAL_OP_HF_CLIENT_CALL_ACTION */
+ { handle_call_action, false,
+ sizeof(struct hal_cmd_hf_client_call_action) },
};
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
--
1.8.4
---
android/hal-hf-client.c | 38 ++++++++++++++++++++++++++++++++++++++
android/hal-msg.h | 11 +++++++++++
android/hf-client.c | 19 +++++++++++++++++++
3 files changed, 68 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 52f3113..1f8c85f 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -186,6 +186,42 @@ static bt_status_t volume_control(bthf_client_volume_type_t type,
sizeof(cmd), &cmd, NULL, NULL, NULL);
}
+static bt_status_t dial(const char *number)
+{
+ char buf[IPC_MTU];
+ struct hal_cmd_hf_client_dial *cmd = (void *) buf;
+ size_t len;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ cmd->number_len = strlen(number);
+ memcpy(cmd->number, number, cmd->number_len);
+
+ len = sizeof(*cmd) + cmd->number_len;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT, HAL_OP_HF_CLIENT_DIAL,
+ len, cmd, NULL, NULL, NULL);
+}
+
+static bt_status_t dial_memory(int location)
+{
+ struct hal_cmd_hf_client_dial_memory cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ cmd.location = location;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_DIAL_MEMORY, sizeof(cmd),
+ &cmd, NULL, NULL, NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -215,6 +251,8 @@ static bthf_client_interface_t iface = {
.start_voice_recognition = start_voice_recognition,
.stop_voice_recognition = stop_voice_recognition,
.volume_control = volume_control,
+ .dial = dial,
+ .dial_memory = dial_memory,
.cleanup = cleanup
};
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 816fb45..5218b06 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1006,6 +1006,17 @@ struct hal_cmd_hf_client_volume_control {
uint8_t volume;
} __attribute__((packed));
+#define HAL_OP_HF_CLIENT_DIAL 0x08
+struct hal_cmd_hf_client_dial {
+ uint16_t number_len;
+ uint8_t number[0];
+} __attribute__((packed));
+
+#define HAL_OP_HF_CLIENT_DIAL_MEMORY 0x09
+struct hal_cmd_hf_client_dial_memory {
+ uint16_t location;
+} __attribute__((packed));
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index 74f0181..e1cb88d 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -99,6 +99,20 @@ static void handle_volume_control(const void *buf, uint16_t len)
HAL_STATUS_UNSUPPORTED);
}
+static void handle_dial(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_DIAL, HAL_STATUS_UNSUPPORTED);
+}
+
+static void handle_dial_memory(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_DIAL_MEMORY, HAL_STATUS_UNSUPPORTED);
+}
+
static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CONNECT */
{ handle_connect, false,
@@ -119,6 +133,11 @@ static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_VOLUME_CONTROL */
{ handle_volume_control, false,
sizeof(struct hal_cmd_hf_client_volume_control) },
+ /* HAL_OP_HF_CLIENT_DIAL */
+ { handle_dial, true, sizeof(struct hal_cmd_hf_client_dial) },
+ /* HAL_OP_HF_CLIENT_DIAL_MEMORY */
+ { handle_dial_memory, false,
+ sizeof(struct hal_cmd_hf_client_dial_memory) },
};
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
--
1.8.4
---
android/hal-hf-client.c | 40 ++++++++++++++++++++++++++++++++++++++++
android/hal-msg.h | 10 ++++++++++
android/hf-client.c | 21 +++++++++++++++++++++
3 files changed, 71 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 40553ff..5a31563 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -70,6 +70,44 @@ static bt_status_t init(bthf_client_callbacks_t *callbacks)
return ret;
}
+static bt_status_t hf_client_connect(bt_bdaddr_t *bd_addr)
+{
+ struct hal_cmd_hf_client_connect cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ if (!bd_addr)
+ return BT_STATUS_PARM_INVALID;
+
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT, HAL_OP_HF_CLIENT_CONNECT,
+ sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
+static bt_status_t disconnect(bt_bdaddr_t *bd_addr)
+{
+ struct hal_cmd_hf_client_disconnect cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ if (!bd_addr)
+ return BT_STATUS_PARM_INVALID;
+
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_DISCONNECT,
+ sizeof(cmd), &cmd, NULL, NULL,
+ NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -92,6 +130,8 @@ static void cleanup(void)
static bthf_client_interface_t iface = {
.size = sizeof(iface),
.init = init,
+ .connect = hf_client_connect,
+ .disconnect = disconnect,
.cleanup = cleanup
};
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 986f26b..fa8beb9 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -974,6 +974,16 @@ struct hal_cmd_avrcp_set_volume {
uint8_t value;
} __attribute__((packed));
+#define HAL_OP_HF_CLIENT_CONNECT 0x01
+struct hal_cmd_hf_client_connect {
+ uint8_t bdaddr[6];
+} __attribute__((packed));
+
+#define HAL_OP_HF_CLIENT_DISCONNECT 0x02
+struct hal_cmd_hf_client_disconnect {
+ uint8_t bdaddr[6];
+} __attribute__((packed));
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index f1566d0..d6c2ef6 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -44,7 +44,28 @@ static bdaddr_t adapter_addr;
static struct ipc *hal_ipc = NULL;
+static void handle_connect(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_CONNECT, HAL_STATUS_UNSUPPORTED);
+}
+
+static void handle_disconnect(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_DISCONNECT,
+ HAL_STATUS_UNSUPPORTED);
+}
+
static const struct ipc_handler cmd_handlers[] = {
+ /* HAL_OP_HF_CLIENT_CONNECT */
+ { handle_connect, false,
+ sizeof(struct hal_cmd_hf_client_connect) },
+ /* HAL_OP_HF_CLIENT_DISCONNECT */
+ { handle_disconnect, false,
+ sizeof(struct hal_cmd_hf_client_disconnect) },
};
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
--
1.8.4
---
android/hal-hf-client.c | 19 +++++++++++++++++++
android/hal-msg.h | 9 +++++++++
android/hf-client.c | 11 +++++++++++
3 files changed, 39 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 5ae13f8..52f3113 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -168,6 +168,24 @@ static bt_status_t stop_voice_recognition(void)
0, NULL, NULL, NULL, NULL);
}
+static bt_status_t volume_control(bthf_client_volume_type_t type,
+ int volume)
+{
+ struct hal_cmd_hf_client_volume_control cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ cmd.type = type;
+ cmd.volume = volume;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_VOLUME_CONTROL,
+ sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -196,6 +214,7 @@ static bthf_client_interface_t iface = {
.disconnect_audio = disconnect_audio,
.start_voice_recognition = start_voice_recognition,
.stop_voice_recognition = stop_voice_recognition,
+ .volume_control = volume_control,
.cleanup = cleanup
};
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 57e57a7..816fb45 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -997,6 +997,15 @@ struct hal_cmd_hf_client_disconnect_audio {
#define HAL_OP_HF_CLIENT_START_VR 0x05
#define HAL_OP_HF_CLIENT_STOP_VR 0x06
+#define HF_CLIENT_VOLUME_TYPE_SPEAKER 0x00
+#define HF_CLIENT_VOLUME_TYPE_MIC 0x01
+
+#define HAL_OP_HF_CLIENT_VOLUME_CONTROL 0x07
+struct hal_cmd_hf_client_volume_control {
+ uint8_t type;
+ uint8_t volume;
+} __attribute__((packed));
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index c49b895..74f0181 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -91,6 +91,14 @@ static void handle_stop_vr(const void *buf, uint16_t len)
HAL_STATUS_UNSUPPORTED);
}
+static void handle_volume_control(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_VOLUME_CONTROL,
+ HAL_STATUS_UNSUPPORTED);
+}
+
static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CONNECT */
{ handle_connect, false,
@@ -108,6 +116,9 @@ static const struct ipc_handler cmd_handlers[] = {
{ handle_start_vr, false, 0 },
/* define HAL_OP_HF_CLIENT_STOP_VR */
{ handle_stop_vr, false, 0 },
+ /* HAL_OP_HF_CLIENT_VOLUME_CONTROL */
+ { handle_volume_control, false,
+ sizeof(struct hal_cmd_hf_client_volume_control) },
};
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
--
1.8.4
---
android/hal-hf-client.c | 24 ++++++++++++++++++++++++
android/hal-msg.h | 3 +++
android/hf-client.c | 20 ++++++++++++++++++++
3 files changed, 47 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 0ebd9d1..5ae13f8 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -146,6 +146,28 @@ static bt_status_t disconnect_audio(bt_bdaddr_t *bd_addr)
sizeof(cmd), &cmd, NULL, NULL, NULL);
}
+static bt_status_t start_voice_recognition(void)
+{
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT, HAL_OP_HF_CLIENT_START_VR,
+ 0, NULL, NULL, NULL, NULL);
+}
+
+static bt_status_t stop_voice_recognition(void)
+{
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT, HAL_OP_HF_CLIENT_STOP_VR,
+ 0, NULL, NULL, NULL, NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -172,6 +194,8 @@ static bthf_client_interface_t iface = {
.disconnect = disconnect,
.connect_audio = connect_audio,
.disconnect_audio = disconnect_audio,
+ .start_voice_recognition = start_voice_recognition,
+ .stop_voice_recognition = stop_voice_recognition,
.cleanup = cleanup
};
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 42b0c1f..57e57a7 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -994,6 +994,9 @@ struct hal_cmd_hf_client_disconnect_audio {
uint8_t bdaddr[6];
} __attribute__((packed));
+#define HAL_OP_HF_CLIENT_START_VR 0x05
+#define HAL_OP_HF_CLIENT_STOP_VR 0x06
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index d4fca21..c49b895 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -75,6 +75,22 @@ static void handle_disconnect_audio(const void *buf, uint16_t len)
HAL_STATUS_UNSUPPORTED);
}
+static void handle_start_vr(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_START_VR,
+ HAL_STATUS_UNSUPPORTED);
+}
+
+static void handle_stop_vr(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_STOP_VR,
+ HAL_STATUS_UNSUPPORTED);
+}
+
static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CONNECT */
{ handle_connect, false,
@@ -88,6 +104,10 @@ static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_DISCONNECT_AUDIO */
{ handle_disconnect_audio, false,
sizeof(struct hal_cmd_hf_client_disconnect_audio) },
+ /* define HAL_OP_HF_CLIENT_START_VR */
+ { handle_start_vr, false, 0 },
+ /* define HAL_OP_HF_CLIENT_STOP_VR */
+ { handle_stop_vr, false, 0 },
};
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
--
1.8.4
---
android/hal-hf-client.c | 40 ++++++++++++++++++++++++++++++++++++++++
android/hal-msg.h | 10 ++++++++++
android/hf-client.c | 22 ++++++++++++++++++++++
3 files changed, 72 insertions(+)
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 5a31563..0ebd9d1 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -108,6 +108,44 @@ static bt_status_t disconnect(bt_bdaddr_t *bd_addr)
NULL);
}
+static bt_status_t connect_audio(bt_bdaddr_t *bd_addr)
+{
+ struct hal_cmd_hf_client_connect_audio cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ if (!bd_addr)
+ return BT_STATUS_PARM_INVALID;
+
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_CONNECT_AUDIO,
+ sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
+static bt_status_t disconnect_audio(bt_bdaddr_t *bd_addr)
+{
+ struct hal_cmd_hf_client_disconnect_audio cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ if (!bd_addr)
+ return BT_STATUS_PARM_INVALID;
+
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_DISCONNECT_AUDIO,
+ sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -132,6 +170,8 @@ static bthf_client_interface_t iface = {
.init = init,
.connect = hf_client_connect,
.disconnect = disconnect,
+ .connect_audio = connect_audio,
+ .disconnect_audio = disconnect_audio,
.cleanup = cleanup
};
diff --git a/android/hal-msg.h b/android/hal-msg.h
index fa8beb9..42b0c1f 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -984,6 +984,16 @@ struct hal_cmd_hf_client_disconnect {
uint8_t bdaddr[6];
} __attribute__((packed));
+#define HAL_OP_HF_CLIENT_CONNECT_AUDIO 0x03
+struct hal_cmd_hf_client_connect_audio {
+ uint8_t bdaddr[6];
+} __attribute__((packed));
+
+#define HAL_OP_HF_CLIENT_DISCONNECT_AUDIO 0x04
+struct hal_cmd_hf_client_disconnect_audio {
+ uint8_t bdaddr[6];
+} __attribute__((packed));
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index d6c2ef6..d4fca21 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -59,6 +59,22 @@ static void handle_disconnect(const void *buf, uint16_t len)
HAL_STATUS_UNSUPPORTED);
}
+static void handle_connect_audio(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_CONNECT_AUDIO,
+ HAL_STATUS_UNSUPPORTED);
+}
+
+static void handle_disconnect_audio(const void *buf, uint16_t len)
+{
+ DBG("Not Implemented");
+ ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+ HAL_OP_HF_CLIENT_DISCONNECT_AUDIO,
+ HAL_STATUS_UNSUPPORTED);
+}
+
static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CONNECT */
{ handle_connect, false,
@@ -66,6 +82,12 @@ static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_DISCONNECT */
{ handle_disconnect, false,
sizeof(struct hal_cmd_hf_client_disconnect) },
+ /* HAL_OP_HF_CLIENT_CONNECT_AUDIO */
+ { handle_connect_audio, false,
+ sizeof(struct hal_cmd_hf_client_connect_audio) },
+ /* HAL_OP_HF_CLIENT_DISCONNECT_AUDIO */
+ { handle_disconnect_audio, false,
+ sizeof(struct hal_cmd_hf_client_disconnect_audio) },
};
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
--
1.8.4
---
android/Makefile.am | 2 +
android/hal-hf-client.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++
android/hal.h | 2 +
3 files changed, 105 insertions(+)
create mode 100644 android/hal-hf-client.c
diff --git a/android/Makefile.am b/android/Makefile.am
index e92ccf1..9464df7 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -75,6 +75,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
android/hal-a2dp.c \
android/hal-avrcp.c \
android/hal-handsfree.c \
+ android/hal-hf-client.c \
android/hal-gatt.c \
android/hardware/bluetooth.h \
android/hardware/bt_av.h \
@@ -88,6 +89,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
android/hardware/bt_pan.h \
android/hardware/bt_rc.h \
android/hardware/bt_sock.h \
+ android/hardware/bt_hf_client.h \
android/hardware/hardware.h \
android/cutils/properties.h \
android/ipc-common.h \
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
new file mode 100644
index 0000000..40553ff
--- /dev/null
+++ b/android/hal-hf-client.c
@@ -0,0 +1,101 @@
+/*
+ * 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 <stdbool.h>
+#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <cutils/properties.h>
+
+#include "hal-log.h"
+#include "hal.h"
+#include "hal-msg.h"
+#include "ipc-common.h"
+#include "hal-ipc.h"
+
+static const bthf_client_callbacks_t *cbs = NULL;
+
+static bool interface_ready(void)
+{
+ return cbs != 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(bthf_client_callbacks_t *callbacks)
+{
+ struct hal_cmd_register_module cmd;
+ int ret;
+
+ DBG("");
+
+ if (interface_ready())
+ return BT_STATUS_DONE;
+
+ cbs = callbacks;
+
+ hal_ipc_register(HAL_SERVICE_ID_HF_CLIENT, ev_handlers,
+ sizeof(ev_handlers)/sizeof(ev_handlers[0]));
+
+ cmd.service_id = HAL_SERVICE_ID_HF_CLIENT;
+
+ ret = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
+ sizeof(cmd), &cmd, NULL, NULL, NULL);
+
+ if (ret != BT_STATUS_SUCCESS) {
+ cbs = NULL;
+ hal_ipc_unregister(HAL_SERVICE_ID_HF_CLIENT);
+ }
+
+ return ret;
+}
+
+static void cleanup(void)
+{
+ struct hal_cmd_unregister_module cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return;
+
+ cbs = NULL;
+
+ cmd.service_id = HAL_SERVICE_ID_HF_CLIENT;
+
+ hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
+ sizeof(cmd), &cmd, NULL, NULL, NULL);
+
+ hal_ipc_unregister(HAL_SERVICE_ID_HF_CLIENT);
+}
+
+static bthf_client_interface_t iface = {
+ .size = sizeof(iface),
+ .init = init,
+ .cleanup = cleanup
+};
+
+bthf_client_interface_t *bt_get_hf_client_interface(void)
+{
+ return &iface;
+}
diff --git a/android/hal.h b/android/hal.h
index 6998e9a..be81ed9 100644
--- a/android/hal.h
+++ b/android/hal.h
@@ -26,6 +26,7 @@
#include <hardware/bt_gatt_client.h>
#include <hardware/bt_gatt_server.h>
#include <hardware/bt_hl.h>
+#include <hardware/bt_hf_client.h>
btsock_interface_t *bt_get_socket_interface(void);
bthh_interface_t *bt_get_hidhost_interface(void);
@@ -35,6 +36,7 @@ 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);
+bthf_client_interface_t *bt_get_hf_client_interface(void);
void bt_thread_associate(void);
void bt_thread_disassociate(void);
--
1.8.4
---
android/Makefile.am | 1 +
android/hf-client.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+)
create mode 100644 android/hf-client.c
diff --git a/android/Makefile.am b/android/Makefile.am
index 49fbddc..e92ccf1 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -52,6 +52,7 @@ android_bluetoothd_SOURCES = android/main.c \
android/socket.h android/socket.c \
android/pan.h android/pan.c \
android/handsfree.h android/handsfree.c \
+ android/hf-client.c android/hf-client.h \
android/gatt.h android/gatt.c \
android/health.h android/health.c \
android/mcap-lib.h android/mcap-lib.c \
diff --git a/android/hf-client.c b/android/hf-client.c
new file mode 100644
index 0000000..f1566d0
--- /dev/null
+++ b/android/hf-client.c
@@ -0,0 +1,69 @@
+/*
+ *
+ * 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 <stdlib.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <unistd.h>
+#include <glib.h>
+
+#include "lib/bluetooth.h"
+#include "ipc.h"
+#include "ipc-common.h"
+#include "src/log.h"
+#include "utils.h"
+
+#include "hal-msg.h"
+#include "hf-client.h"
+
+static bdaddr_t adapter_addr;
+
+static struct ipc *hal_ipc = NULL;
+
+static const struct ipc_handler cmd_handlers[] = {
+};
+
+bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
+{
+ DBG("");
+
+ bacpy(&adapter_addr, addr);
+
+ hal_ipc = ipc;
+ ipc_register(hal_ipc, HAL_SERVICE_ID_HF_CLIENT, cmd_handlers,
+ G_N_ELEMENTS(cmd_handlers));
+
+ return true;
+}
+
+void bt_hf_client_unregister(void)
+{
+ DBG("");
+
+ ipc_unregister(hal_ipc, HAL_SERVICE_ID_HANDSFREE);
+ hal_ipc = NULL;
+}
--
1.8.4
---
android/hal-msg.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 5575d93..986f26b 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -35,8 +35,9 @@ static const char BLUEZ_HAL_SK_PATH[] = "\0bluez_hal_socket";
#define HAL_SERVICE_ID_HEALTH 7
#define HAL_SERVICE_ID_AVRCP 8
#define HAL_SERVICE_ID_GATT 9
+#define HAL_SERVICE_ID_HF_CLIENT 10
-#define HAL_SERVICE_ID_MAX HAL_SERVICE_ID_GATT
+#define HAL_SERVICE_ID_MAX HAL_SERVICE_ID_HF_CLIENT
/* Core Service */
--
1.8.4
Idea about order in this file is that commands goes first and
notifications in the end of file.
This patch moves AVRCP commands up in the file
---
android/hal-msg.h | 206 +++++++++++++++++++++++++++---------------------------
1 file changed, 102 insertions(+), 104 deletions(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 8adb9f1..5575d93 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -871,6 +871,108 @@ struct hal_cmd_gatt_server_send_response {
uint8_t data[0];
} __attribute__((packed));
+#define HAL_AVRCP_PLAY_STATUS_STOPPED 0x00
+#define HAL_AVRCP_PLAY_STATUS_PLAYING 0x01
+#define HAL_AVRCP_PLAY_STATUS_PAUSED 0x02
+#define HAL_AVRCP_PLAY_STATUS_FWD_SEEK 0x03
+#define HAL_AVRCP_PLAY_STATUS_REV_SEEK 0x04
+#define HAL_AVRCP_PLAY_STATUS_ERROR 0xff
+
+#define HAL_OP_AVRCP_GET_PLAY_STATUS 0x01
+struct hal_cmd_avrcp_get_play_status {
+ uint8_t status;
+ uint32_t duration;
+ uint32_t position;
+} __attribute__((packed));
+
+#define HAL_AVRCP_PLAYER_ATTR_EQUALIZER 0x01
+#define HAL_AVRCP_PLAYER_ATTR_REPEAT 0x02
+#define HAL_AVRCP_PLAYER_ATTR_SHUFFLE 0x03
+#define HAL_AVRCP_PLAYER_ATTR_SCAN 0x04
+
+#define HAL_OP_AVRCP_LIST_PLAYER_ATTRS 0x02
+struct hal_cmd_avrcp_list_player_attrs {
+ uint8_t number;
+ uint8_t attrs[0];
+} __attribute__((packed));
+
+#define HAL_OP_AVRCP_LIST_PLAYER_VALUES 0x03
+struct hal_cmd_avrcp_list_player_values {
+ uint8_t number;
+ uint8_t values[0];
+} __attribute__((packed));
+
+struct hal_avrcp_player_attr_value {
+ uint8_t attr;
+ uint8_t value;
+} __attribute__((packed));
+
+#define HAL_OP_AVRCP_GET_PLAYER_ATTRS 0x04
+struct hal_cmd_avrcp_get_player_attrs {
+ uint8_t number;
+ struct hal_avrcp_player_attr_value attrs[0];
+} __attribute__((packed));
+
+struct hal_avrcp_player_setting_text {
+ uint8_t id;
+ uint8_t len;
+ uint8_t text[0];
+} __attribute__((packed));
+
+#define HAL_OP_AVRCP_GET_PLAYER_ATTRS_TEXT 0x05
+struct hal_cmd_avrcp_get_player_attrs_text {
+ uint8_t number;
+ struct hal_avrcp_player_setting_text attrs[0];
+} __attribute__((packed));
+
+#define HAL_OP_AVRCP_GET_PLAYER_VALUES_TEXT 0x06
+struct hal_cmd_avrcp_get_player_values_text {
+ uint8_t number;
+ struct hal_avrcp_player_setting_text values[0];
+} __attribute__((packed));
+
+#define HAL_AVRCP_MEDIA_ATTR_TITLE 0x01
+#define HAL_AVRCP_MEDIA_ATTR_ARTIST 0x02
+#define HAL_AVRCP_MEDIA_ATTR_ALBUM 0x03
+#define HAL_AVRCP_MEDIA_ATTR_TRACK_NUM 0x04
+#define HAL_AVRCP_MEDIA_ATTR_NUM_TRACKS 0x05
+#define HAL_AVRCP_MEDIA_ATTR_GENRE 0x06
+#define HAL_AVRCP_MEDIA_ATTR_DURATION 0x07
+
+#define HAL_OP_AVRCP_GET_ELEMENT_ATTRS_TEXT 0x07
+struct hal_cmd_avrcp_get_element_attrs_text {
+ uint8_t number;
+ struct hal_avrcp_player_setting_text values[0];
+} __attribute__((packed));
+
+#define HAL_OP_AVRCP_SET_PLAYER_ATTRS_VALUE 0x08
+struct hal_cmd_avrcp_set_player_attrs_value {
+ uint8_t status;
+} __attribute__((packed));
+
+#define HAL_AVRCP_EVENT_STATUS_CHANGED 0x01
+#define HAL_AVRCP_EVENT_TRACK_CHANGED 0x02
+#define HAL_AVRCP_EVENT_TRACK_REACHED_END 0x03
+#define HAL_AVRCP_EVENT_TRACK_REACHED_START 0x04
+#define HAL_AVRCP_EVENT_POSITION_CHANGED 0x05
+#define HAL_AVRCP_EVENT_SETTING_CHANGED 0x08
+
+#define HAL_AVRCP_EVENT_TYPE_INTERIM 0x00
+#define HAL_AVRCP_EVENT_TYPE_CHANGED 0x01
+
+#define HAL_OP_AVRCP_REGISTER_NOTIFICATION 0x09
+struct hal_cmd_avrcp_register_notification {
+ uint8_t event;
+ uint8_t type;
+ uint8_t len;
+ uint8_t data[0];
+} __attribute__((packed));
+
+#define HAL_OP_AVRCP_SET_VOLUME 0x0a
+struct hal_cmd_avrcp_set_volume {
+ uint8_t value;
+} __attribute__((packed));
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
@@ -1174,110 +1276,6 @@ struct hal_ev_handsfree_unknown_at {
#define HAL_EV_HANDSFREE_HSP_KEY_PRESS 0x90
-/* AVRCP HAL API */
-
-#define HAL_AVRCP_PLAY_STATUS_STOPPED 0x00
-#define HAL_AVRCP_PLAY_STATUS_PLAYING 0x01
-#define HAL_AVRCP_PLAY_STATUS_PAUSED 0x02
-#define HAL_AVRCP_PLAY_STATUS_FWD_SEEK 0x03
-#define HAL_AVRCP_PLAY_STATUS_REV_SEEK 0x04
-#define HAL_AVRCP_PLAY_STATUS_ERROR 0xff
-
-#define HAL_OP_AVRCP_GET_PLAY_STATUS 0x01
-struct hal_cmd_avrcp_get_play_status {
- uint8_t status;
- uint32_t duration;
- uint32_t position;
-} __attribute__((packed));
-
-#define HAL_AVRCP_PLAYER_ATTR_EQUALIZER 0x01
-#define HAL_AVRCP_PLAYER_ATTR_REPEAT 0x02
-#define HAL_AVRCP_PLAYER_ATTR_SHUFFLE 0x03
-#define HAL_AVRCP_PLAYER_ATTR_SCAN 0x04
-
-#define HAL_OP_AVRCP_LIST_PLAYER_ATTRS 0x02
-struct hal_cmd_avrcp_list_player_attrs {
- uint8_t number;
- uint8_t attrs[0];
-} __attribute__((packed));
-
-#define HAL_OP_AVRCP_LIST_PLAYER_VALUES 0x03
-struct hal_cmd_avrcp_list_player_values {
- uint8_t number;
- uint8_t values[0];
-} __attribute__((packed));
-
-struct hal_avrcp_player_attr_value {
- uint8_t attr;
- uint8_t value;
-} __attribute__((packed));
-
-#define HAL_OP_AVRCP_GET_PLAYER_ATTRS 0x04
-struct hal_cmd_avrcp_get_player_attrs {
- uint8_t number;
- struct hal_avrcp_player_attr_value attrs[0];
-} __attribute__((packed));
-
-struct hal_avrcp_player_setting_text {
- uint8_t id;
- uint8_t len;
- uint8_t text[0];
-} __attribute__((packed));
-
-#define HAL_OP_AVRCP_GET_PLAYER_ATTRS_TEXT 0x05
-struct hal_cmd_avrcp_get_player_attrs_text {
- uint8_t number;
- struct hal_avrcp_player_setting_text attrs[0];
-} __attribute__((packed));
-
-#define HAL_OP_AVRCP_GET_PLAYER_VALUES_TEXT 0x06
-struct hal_cmd_avrcp_get_player_values_text {
- uint8_t number;
- struct hal_avrcp_player_setting_text values[0];
-} __attribute__((packed));
-
-#define HAL_AVRCP_MEDIA_ATTR_TITLE 0x01
-#define HAL_AVRCP_MEDIA_ATTR_ARTIST 0x02
-#define HAL_AVRCP_MEDIA_ATTR_ALBUM 0x03
-#define HAL_AVRCP_MEDIA_ATTR_TRACK_NUM 0x04
-#define HAL_AVRCP_MEDIA_ATTR_NUM_TRACKS 0x05
-#define HAL_AVRCP_MEDIA_ATTR_GENRE 0x06
-#define HAL_AVRCP_MEDIA_ATTR_DURATION 0x07
-
-#define HAL_OP_AVRCP_GET_ELEMENT_ATTRS_TEXT 0x07
-struct hal_cmd_avrcp_get_element_attrs_text {
- uint8_t number;
- struct hal_avrcp_player_setting_text values[0];
-} __attribute__((packed));
-
-#define HAL_OP_AVRCP_SET_PLAYER_ATTRS_VALUE 0x08
-struct hal_cmd_avrcp_set_player_attrs_value {
- uint8_t status;
-} __attribute__((packed));
-
-#define HAL_AVRCP_EVENT_STATUS_CHANGED 0x01
-#define HAL_AVRCP_EVENT_TRACK_CHANGED 0x02
-#define HAL_AVRCP_EVENT_TRACK_REACHED_END 0x03
-#define HAL_AVRCP_EVENT_TRACK_REACHED_START 0x04
-#define HAL_AVRCP_EVENT_POSITION_CHANGED 0x05
-#define HAL_AVRCP_EVENT_SETTING_CHANGED 0x08
-
-#define HAL_AVRCP_EVENT_TYPE_INTERIM 0x00
-#define HAL_AVRCP_EVENT_TYPE_CHANGED 0x01
-
-#define HAL_OP_AVRCP_REGISTER_NOTIFICATION 0x09
-struct hal_cmd_avrcp_register_notification {
- uint8_t event;
- uint8_t type;
- uint8_t len;
- uint8_t data[0];
-} __attribute__((packed));
-
-#define HAL_OP_AVRCP_SET_VOLUME 0x0a
-struct hal_cmd_avrcp_set_volume {
- uint8_t value;
-} __attribute__((packed));
-
#define HAL_AVRCP_FEATURE_NONE 0x00
#define HAL_AVRCP_FEATURE_METADATA 0x01
#define HAL_AVRCP_FEATURE_ABSOLUTE_VOLUME 0x02
--
1.8.4
---
android/hal-ipc-api.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 326fa21..0948af2 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -2228,7 +2228,8 @@ Notifications:
Opcode 0x81 - Connection State Changed notification
Notification parameters: State (1 octet)
- Peer Features (1 octet)
+ Peer Features (2 octets)
+ CHLD Features (2 octets)
Address (6 octets)
Valid State values: 0x00 = Disconnected
--
1.8.4
To be consistent with existing code for handsfree
---
android/hal-ipc-api.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 26e777e..326fa21 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -2209,9 +2209,9 @@ Commands and response:
In case of an error, the error response will be returned.
- Opcode 0x14 - Send DTMF Code command/response
+ Opcode 0x14 - Send DTMF Tone command/response
- Command parameters: Code (1 octet)
+ Command parameters: Tone (1 octet)
Response parameters: <none>
In case of an error, the error response will be returned.
--
1.8.4
---
android/hal-ipc-api.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index ca41cff..26e777e 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -2162,7 +2162,7 @@ Commands and response:
Opcode 0x09 - Dial Memory command/response
- Command parameters: Location (1 octet)
+ Command parameters: Location (2 octet)
Response parameters: <none>
In case of an error, the error response will be returned.
--
1.8.4