This set adds missing events for handsfree client ipc.
It also contains some fixes based on Luiz comments
Lukasz Rymanowski (6):
android/hal-ipc-api: Fix location size and add missing feature list
android/handsfree-client: Fix defines for action command
android/handsfree-client: Implement hf client events
android/handsfree-client: Implement hf client events
android/handsfree-client: Implement hf client events
android/handsfree-client: Implement hf client events
android/hal-handsfree-client.c | 295 +++++++++++++++++++++++++++++++++++++++++
android/hal-ipc-api.txt | 36 ++++-
android/hal-msg.h | 208 ++++++++++++++++++++++++++++-
3 files changed, 531 insertions(+), 8 deletions(-)
--
1.8.4
Hi Ćukasz,
On Friday 19 of September 2014 16:30:45 Lukasz Rymanowski wrote:
> This set adds missing events for handsfree client ipc.
> It also contains some fixes based on Luiz comments
>
> Lukasz Rymanowski (6):
> android/hal-ipc-api: Fix location size and add missing feature list
> android/handsfree-client: Fix defines for action command
> android/handsfree-client: Implement hf client events
> android/handsfree-client: Implement hf client events
> android/handsfree-client: Implement hf client events
> android/handsfree-client: Implement hf client events
>
> android/hal-handsfree-client.c | 295 +++++++++++++++++++++++++++++++++++++++++
> android/hal-ipc-api.txt | 36 ++++-
> android/hal-msg.h | 208 ++++++++++++++++++++++++++++-
> 3 files changed, 531 insertions(+), 8 deletions(-)
>
All patches applied (after fixing few typos), thanks.
--
Best regards,
Szymon Janc
This patch implemets skeleton for following events:
1. Volume Changed event
2. Command Complete event
3. Subscriber Info event
4. In Band Ringtone event
5. Last Voice Tag Number event
6. RING notification event
---
android/hal-handsfree-client.c | 85 ++++++++++++++++++++++++++++++++++++++++++
android/hal-msg.h | 48 ++++++++++++++++++++++++
2 files changed, 133 insertions(+)
diff --git a/android/hal-handsfree-client.c b/android/hal-handsfree-client.c
index 0987221..b2d072b 100644
--- a/android/hal-handsfree-client.c
+++ b/android/hal-handsfree-client.c
@@ -201,6 +201,74 @@ 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);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+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'
@@ -250,6 +318,23 @@ 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) },
+ /* 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) },
+ /* 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) },
+ /* 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 6cd6713..46c2e2b 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1847,3 +1847,51 @@ 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));
+
+#define HAL_HF_CLIENT_CMD_COMP_OK 0x00
+#define HAL_HF_CLIENT_CMD_COMP_ERR 0x01
+#define HAL_HF_CLIENT_CMD_COMP_ERR_NO_CARRIER 0x02
+#define HAL_HF_CLIENT_CMD_COMP_ERR_BUSY 0x03
+#define HAL_HF_CLIENT_CMD_COMP_ERR_NO_ANSWER 0x04
+#define HAL_HF_CLIENT_CMD_COMP_ERR_DELAYED 0x05
+#define HAL_HF_CLIENT_CMD_COMP_ERR_BACKLISTED 0x06
+#define HAL_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));
+
+#define HAL_HF_CLIENT_SUBSCR_TYPE_UNKNOWN 0x00
+#define HAL_HF_CLIENT_SUBSCR_TYPE_VOICE 0x01
+#define HAL_HF_CLIENT_SUBSCR_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));
+
+#define HAL_HF_CLIENT_INBAND_RINGTONE_NOT_PROVIDED 0x00
+#define HAL_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));
+
+#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));
+
+#define HAL_EV_CLIENT_RING_INDICATION 0x95
--
1.8.4
This patch implements skeletons for following events:
1. Call Indicator event
2. Call Setup Indicator event
3. Call Held Indicator event
4. Response and Hold Status event
5. Add Call Waiting and Call Line Ident. events
6. Add Current Client Call event
---
android/hal-handsfree-client.c | 111 +++++++++++++++++++++++++++++++++++++++++
android/hal-msg.h | 69 +++++++++++++++++++++++++
2 files changed, 180 insertions(+)
diff --git a/android/hal-handsfree-client.c b/android/hal-handsfree-client.c
index c33f7bc..0987221 100644
--- a/android/hal-handsfree-client.c
+++ b/android/hal-handsfree-client.c
@@ -111,6 +111,96 @@ 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);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+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'
@@ -139,6 +229,27 @@ 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) },
+ /* 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) },
+ /* 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) },
+ /* 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 53f3f51..6cd6713 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1778,3 +1778,72 @@ struct hal_ev_hf_client_operator_name {
uint16_t name_len;
uint8_t name[0];
} __attribute__((packed));
+
+#define HAL_HF_CLIENT_CALL_IND_NO_CALL_IN_PROGERSS 0x00
+#define HAL_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));
+
+#define HAL_HF_CLIENT_CALL_SETUP_NONE 0x00
+#define HAL_HF_CLIENT_CALL_SETUP_INCOMING 0x01
+#define HAL_HF_CLIENT_CALL_SETUP_OUTGOING 0x02
+#define HAL_HF_CLIENT_CALL_SETUP_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));
+
+#define HAL_HF_CLIENT_CALL_HELD_IND_NONE 0x00
+#define HAL_HF_CLIENT_CALL_HELD_IND_HOLD_AND_ACTIVE 0x01
+#define HAL_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));
+
+#define HAL_HF_CLIENT_RESP_AND_HOLD_STATUS_HELD 0x00
+#define HAL_HF_CLIENT_RESP_AND_HOLD_STATUS_ACCEPT 0x01
+#define HAL_HF_CLIENT_RESP_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));
+
+#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));
+
+#define HAL_HF_CLIENT_DIRECTION_OUTGOING 0x00
+#define HAL_HF_CLIENT_DIRECTION_INCOMIGN 0x01
+
+#define HAL_HF_CLIENT_CALL_STATE_ACTIVE 0x00
+#define HAL_HF_CLIENT_CALL_STATE_HELD 0x01
+#define HAL_HF_CLIENT_CALL_STATE_DIALING 0x02
+#define HAL_HF_CLIENT_CALL_STATE_ALERTING 0x03
+#define HAL_HF_CLIENT_CALL_STATE_INCOMING 0x04
+#define HAL_HF_CLIENT_CALL_STATE_WAITING 0x05
+#define HAL_HF_CLIENT_CALL_STATE_HELD_BY_RESP_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
This patch implements skeleton for following events:
1. Connection State event
2. Audio Connection State event
3. Voice Recognition State event
---
android/hal-handsfree-client.c | 33 +++++++++++++++++++++++++++
android/hal-msg.h | 51 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+)
diff --git a/android/hal-handsfree-client.c b/android/hal-handsfree-client.c
index 98b6cb6..f788f68 100644
--- a/android/hal-handsfree-client.c
+++ b/android/hal-handsfree-client.c
@@ -35,11 +35,44 @@ 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);
+}
+
+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));
+}
+
+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'
*/
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) },
+ /* 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 eba47df..295bf58 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1695,3 +1695,54 @@ 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 HAL_HF_CLIENT_CONN_STATE_DISCONNECTED 0x00
+#define HAL_HF_CLIENT_CONN_STATE_CONNECTING 0x01
+#define HAL_HF_CLIENT_CONN_STATE_SLC_CONNECTED 0x02
+#define HAL_HF_CLIENT_CONN_STATE_DISCONNECTING 0x03
+
+#define HAL_HF_CLIENT_PEER_FEAT_3WAY 0x00000001
+#define HAL_HF_CLIENT_PEER_FEAT_ECNR 0x00000002
+#define HAL_HF_CLIENT_PEER_FEAT_VREC 0x00000004
+#define HAL_HF_CLIENT_PEER_FEAT_INBAND 0x00000008
+#define HAL_HF_CLIENT_PEER_FEAT_VTAG 0x00000010
+#define HAL_HF_CLIENT_PEER_FEAT_REJECT 0x00000020
+#define HAL_HF_CLIENT_PEER_FEAT_ECS 0x00000040
+#define HAL_HF_CLIENT_PEER_FEAT_ECC 0x00000080
+#define HAL_HF_CLIENT_PEER_FEAT_EXTERR 0x00000100
+#define HAL_HF_CLIENT_PEER_FEAT_CODEC 0x00000200
+
+#define HAL_HF_CLIENT_CHLD_FEAT_REL 0x00000001
+#define HAL_HF_CLIENT_CHLD_FEAT_REL_ACC 0x00000002
+#define HAL_HF_CLIENT_CHLD_FEAT_REL_X 0x00000004
+#define HAL_HF_CLIENT_CHLD_FEAT_HOLD_ACC 0x00000008
+#define HAL_HF_CLIENT_CHLD_FEAT_PRIV_X 0x00000010
+#define HAL_HF_CLIENT_CHLD_FEAT_MERGE 0x00000020
+#define HAL_HF_CLIENT_CHLD_FEAT_MERGE_DETACH 0x00000040
+
+#define HAL_EV_HF_CLIENT_CONN_STATE 0x81
+struct hal_ev_hf_client_conn_state {
+ uint8_t state;
+ uint32_t peer_feat;
+ uint32_t chld_feat;
+ uint8_t bdaddr[6];
+} __attribute__((packed));
+
+#define HAL_HF_CLIENT_AUDIO_STATE_DISCONNECTED 0x00
+#define HAL_HF_CLIENT_AUDIO_STATE_CONNECTING 0x01
+#define HAL_HF_CLIENT_AUDIO_STATE_CONNECTED 0x02
+#define HAL_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));
+
+#define HAL_HF_CLIENT_VR_STOPPED 0x00
+#define HAL_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
This patch implements skeleton for following events:
1. Network State event
2. Network Roaming State event
3. Network Signal Strenght event
4. Battery Level event
5. Operator Name event
---
android/hal-handsfree-client.c | 66 ++++++++++++++++++++++++++++++++++++++++++
android/hal-msg.h | 32 ++++++++++++++++++++
2 files changed, 98 insertions(+)
diff --git a/android/hal-handsfree-client.c b/android/hal-handsfree-client.c
index f788f68..c33f7bc 100644
--- a/android/hal-handsfree-client.c
+++ b/android/hal-handsfree-client.c
@@ -60,6 +60,57 @@ 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);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+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'
@@ -73,6 +124,21 @@ 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)},
+ /*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) },
+ /* 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 295bf58..53f3f51 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1746,3 +1746,35 @@ struct hal_ev_hf_client_audio_state {
struct hal_ev_hf_client_vr_state {
uint8_t state;
} __attribute__((packed));
+
+#define HAL_HF_CLIENT_NET_NOT_AVAILABLE 0x00
+#define HAL_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));
+
+#define HAL_HF_CLIENT_NET_ROAMING_TYPE_HOME 0x00
+#define HAL_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));
+
+#define HAL_EV_HF_CLIENT_NET_SIGNAL_STRENGTH 0x86
+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));
+
+#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-msg.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index ba213b7..eba47df 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1026,13 +1026,13 @@ struct hal_cmd_hf_client_dial_memory {
#define HAL_HF_CLIENT_ACTION_CHLD_2 0x02
#define HAL_HF_CLIENT_ACTION_CHLD_3 0x03
#define HAL_HF_CLIENT_ACTION_CHLD_4 0x04
-#define HAL_HF_CLIENT_ACTION_CHLD_1x 0x05
-#define HAL_HF_CLIENT_ACTION_CHLD_2x 0x06
+#define HAL_HF_CLIENT_ACTION_CHLD_1x 0x05
+#define HAL_HF_CLIENT_ACTION_CHLD_2x 0x06
#define HAL_HF_CLIENT_ACTION_ATA 0x07
#define HAL_HF_CLIENT_ACTION_CHUP 0x08
#define HAL_HF_CLIENT_ACTION_BRTH_0 0x09
-#define HAL_HF_CLIENT_ACTION_BRTH_1 0x10
-#define HAL_HF_CLIENT_ACTION_BRTH_02 0x11
+#define HAL_HF_CLIENT_ACTION_BRTH_1 0x0a
+#define HAL_HF_CLIENT_ACTION_BRTH_02 0x0b
#define HAL_OP_HF_CLIENT_CALL_ACTION 0x0a
struct hal_cmd_hf_client_call_action {
--
1.8.4
This patch changes location size of Dial Memory command to 4 bytes in
order to be consistent with HAL API
It also adds missing peer and chld features values. Size of those
features also has been changed to be consisten with HAL API.
---
android/hal-ipc-api.txt | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index f6e1680..853d27f 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 (2 octet)
+ Command parameters: Location (4 octet)
Response parameters: <none>
In case of an error, the error response will be returned.
@@ -2228,8 +2228,8 @@ Notifications:
Opcode 0x81 - Connection State Changed notification
Notification parameters: State (1 octet)
- Peer Features (2 octets)
- CHLD Features (2 octets)
+ Peer Features (4 octets)
+ CHLD Features (4 octets)
Address (6 octets)
Valid State values: 0x00 = Disconnected
@@ -2237,7 +2237,35 @@ Notifications:
0x02 = SLC Connected
0x03 = Disconnecting
- Note: Peer Features is valid only in SCL Connected state
+ Peer Features is a bitmask of the supported features. Currently
+ available bits:
+
+ 0 Three way calling
+ 1 Echo cancellation and/or noise reduction
+ 2 Voice recognition
+ 3 In band ring tone
+ 4 Attach a number to a voice tag
+ 5 Ability to reject a call
+ 6 Enhanced call status
+ 7 Enhanced call control
+ 8 Extended Error Result Codes
+ 9 Codec negotiations
+ 10-31 Reserved for future use
+
+ CHLD Features is a bitmask of the supported features. Currently
+ available bits:
+
+ 0 Release waiting call or held calls
+ 1 Release active calls and accept other call
+ 2 Release specified active call only
+ 3 Place all active calls on hold and accept other call
+ 4 Request private mode with secified call
+ 5 Add a held call to the multiparty
+ 6 Connect two calls and leave multiparty
+ 7-31 Reserved for future use
+
+ Note: Peer and CHLD Features are valid only in SCL Connected state
+
Opcode 0x82 - Audio State Changed notification
--
1.8.4