diff --git a/android/hal-handsfree-client.c b/android/hal-handsfree-client.c
index 39e9ff3..079103e 100644
--- a/android/hal-handsfree-client.c
+++ b/android/hal-handsfree-client.c
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 operator name, 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'
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 0af0171..77aa456 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
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));