diff --git a/android/hal-a2dp.c b/android/hal-a2dp.c
index d43c873..87aebde 100644
--- a/android/hal-a2dp.c
+++ b/android/hal-a2dp.c
return cbs != NULL;
}
-static void handle_conn_state(void *buf, uint16_t len)
+static void handle_conn_state(void *buf, uint16_t len, int fd)
{
struct hal_ev_a2dp_conn_state *ev = buf;
(bt_bdaddr_t *) (ev->bdaddr));
}
-static void handle_audio_state(void *buf, uint16_t len)
+static void handle_audio_state(void *buf, uint16_t len, int fd)
{
struct hal_ev_a2dp_audio_state *ev = buf;
diff --git a/android/hal-avrcp.c b/android/hal-avrcp.c
index 5e07366..09f5463 100644
--- a/android/hal-avrcp.c
+++ b/android/hal-avrcp.c
return cbs != NULL;
}
-static void handle_remote_features(void *buf, uint16_t len)
+static void handle_remote_features(void *buf, uint16_t len, int fd)
{
struct hal_ev_avrcp_remote_features *ev = buf;
ev->features);
}
-static void handle_get_play_status(void *buf, uint16_t len)
+static void handle_get_play_status(void *buf, uint16_t len, int fd)
{
if (cbs->get_play_status_cb)
cbs->get_play_status_cb();
}
-static void handle_list_player_attrs(void *buf, uint16_t len)
+static void handle_list_player_attrs(void *buf, uint16_t len, int fd)
{
if (cbs->list_player_app_attr_cb)
cbs->list_player_app_attr_cb();
}
-static void handle_list_player_values(void *buf, uint16_t len)
+static void handle_list_player_values(void *buf, uint16_t len, int fd)
{
struct hal_ev_avrcp_list_player_values *ev = buf;
cbs->list_player_app_values_cb(ev->attr);
}
-static void handle_get_player_values(void *buf, uint16_t len)
+static void handle_get_player_values(void *buf, uint16_t len, int fd)
{
struct hal_ev_avrcp_get_player_values *ev = buf;
btrc_player_attr_t attrs[4];
cbs->get_player_app_value_cb(ev->number, attrs);
}
-static void handle_get_player_attrs_text(void *buf, uint16_t len)
+static void handle_get_player_attrs_text(void *buf, uint16_t len, int fd)
{
struct hal_ev_avrcp_get_player_attrs_text *ev = buf;
btrc_player_attr_t attrs[4];
cbs->get_player_app_attrs_text_cb(ev->number, attrs);
}
-static void handle_get_player_values_text(void *buf, uint16_t len)
+static void handle_get_player_values_text(void *buf, uint16_t len, int fd)
{
struct hal_ev_avrcp_get_player_values_text *ev = buf;
ev->values);
}
-static void handle_set_player_value(void *buf, uint16_t len)
+static void handle_set_player_value(void *buf, uint16_t len, int fd)
{
struct hal_ev_avrcp_set_player_values *ev = buf;
struct hal_avrcp_player_attr_value *attrs;
cbs->set_player_app_value_cb(&values);
}
-static void handle_get_element_attrs(void *buf, uint16_t len)
+static void handle_get_element_attrs(void *buf, uint16_t len, int fd)
{
struct hal_ev_avrcp_get_element_attrs *ev = buf;
btrc_media_attr_t attrs[BTRC_MAX_APP_SETTINGS];
cbs->get_element_attr_cb(ev->number, attrs);
}
-static void handle_register_notification(void *buf, uint16_t len)
+static void handle_register_notification(void *buf, uint16_t len, int fd)
{
struct hal_ev_avrcp_register_notification *ev = buf;
cbs->register_notification_cb(ev->event, ev->param);
}
-static void handle_volume_changed(void *buf, uint16_t len)
+static void handle_volume_changed(void *buf, uint16_t len, int fd)
{
struct hal_ev_avrcp_volume_changed *ev = buf;
cbs->volume_change_cb(ev->volume, ev->type);
}
-static void handle_passthrough_cmd(void *buf, uint16_t len)
+static void handle_passthrough_cmd(void *buf, uint16_t len, int fd)
{
struct hal_ev_avrcp_passthrough_cmd *ev = buf;
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index b8eae69..4291430 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
*hal_len = 1; \
} while (0)
-static void handle_adapter_state_changed(void *buf, uint16_t len)
+static void handle_adapter_state_changed(void *buf, uint16_t len, int fd)
{
struct hal_ev_adapter_state_changed *ev = buf;
exit(EXIT_FAILURE);
}
-static void handle_adapter_props_changed(void *buf, uint16_t len)
+static void handle_adapter_props_changed(void *buf, uint16_t len, int fd)
{
struct hal_ev_adapter_props_changed *ev = buf;
bt_property_t props[ev->num_props];
bt_hal_cbacks->adapter_properties_cb(ev->status, ev->num_props, props);
}
-static void handle_bond_state_change(void *buf, uint16_t len)
+static void handle_bond_state_change(void *buf, uint16_t len, int fd)
{
struct hal_ev_bond_state_changed *ev = buf;
bt_bdaddr_t *addr = (bt_bdaddr_t *) ev->bdaddr;
ev->state);
}
-static void handle_pin_request(void *buf, uint16_t len)
+static void handle_pin_request(void *buf, uint16_t len, int fd)
{
struct hal_ev_pin_request *ev = buf;
/* Those are declared as packed, so it's safe to assign pointers */
bt_hal_cbacks->pin_request_cb(addr, name, ev->class_of_dev);
}
-static void handle_ssp_request(void *buf, uint16_t len)
+static void handle_ssp_request(void *buf, uint16_t len, int fd)
{
struct hal_ev_ssp_request *ev = buf;
/* Those are declared as packed, so it's safe to assign pointers */
return bt_hal_cbacks != NULL;
}
-static void handle_discovery_state_changed(void *buf, uint16_t len)
+static void handle_discovery_state_changed(void *buf, uint16_t len, int fd)
{
struct hal_ev_discovery_state_changed *ev = buf;
bt_hal_cbacks->discovery_state_changed_cb(ev->state);
}
-static void handle_device_found(void *buf, uint16_t len)
+static void handle_device_found(void *buf, uint16_t len, int fd)
{
struct hal_ev_device_found *ev = buf;
bt_property_t props[ev->num_props];
bt_hal_cbacks->device_found_cb(ev->num_props, props);
}
-static void handle_device_state_changed(void *buf, uint16_t len)
+static void handle_device_state_changed(void *buf, uint16_t len, int fd)
{
struct hal_ev_remote_device_props *ev = buf;
bt_property_t props[ev->num_props];
ev->num_props, props);
}
-static void handle_acl_state_changed(void *buf, uint16_t len)
+static void handle_acl_state_changed(void *buf, uint16_t len, int fd)
{
struct hal_ev_acl_state_changed *ev = buf;
bt_bdaddr_t *addr = (bt_bdaddr_t *) ev->bdaddr;
ev->state);
}
-static void handle_dut_mode_receive(void *buf, uint16_t len)
+static void handle_dut_mode_receive(void *buf, uint16_t len, int fd)
{
struct hal_ev_dut_mode_receive *ev = buf;
bt_hal_cbacks->dut_mode_recv_cb(ev->opcode, ev->data, ev->len);
}
-static void handle_le_test_mode(void *buf, uint16_t len)
+static void handle_le_test_mode(void *buf, uint16_t len, int fd)
{
struct hal_ev_le_test_mode *ev = buf;
diff --git a/android/hal-gatt.c b/android/hal-gatt.c
index 043c379..c22113f 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
/* Client Event Handlers */
-static void handle_register_client(void *buf, uint16_t len)
+static void handle_register_client(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_register_client *ev = buf;
(bt_uuid_t *) ev->app_uuid);
}
-static void handle_scan_result(void *buf, uint16_t len)
+static void handle_scan_result(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_scan_result *ev = buf;
uint8_t ad[62];
ad);
}
-static void handle_connect(void *buf, uint16_t len)
+static void handle_connect(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_connect *ev = buf;
(bt_bdaddr_t *) ev->bda);
}
-static void handle_disconnect(void *buf, uint16_t len)
+static void handle_disconnect(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_disconnect *ev = buf;
(bt_bdaddr_t *) ev->bda);
}
-static void handle_search_complete(void *buf, uint16_t len)
+static void handle_search_complete(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_search_complete *ev = buf;
cbs->client->search_complete_cb(ev->conn_id, ev->status);
}
-static void handle_search_result(void *buf, uint16_t len)
+static void handle_search_result(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_search_result *ev = buf;
btgatt_srvc_id_t srvc_id;
cbs->client->search_result_cb(ev->conn_id, &srvc_id);
}
-static void handle_get_characteristic(void *buf, uint16_t len)
+static void handle_get_characteristic(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_get_characteristic *ev = buf;
btgatt_gatt_id_t char_id;
ev->char_prop);
}
-static void handle_get_descriptor(void *buf, uint16_t len)
+static void handle_get_descriptor(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_get_descriptor *ev = buf;
btgatt_gatt_id_t descr_id;
&srvc_id, &char_id, &descr_id);
}
-static void handle_get_included_service(void *buf, uint16_t len)
+static void handle_get_included_service(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_get_inc_service *ev = buf;
btgatt_srvc_id_t srvc_id;
&incl_srvc_id);
}
-static void handle_register_for_notification(void *buf, uint16_t len)
+static void handle_register_for_notification(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_reg_for_notif *ev = buf;
btgatt_gatt_id_t char_id;
&char_id);
}
-static void handle_notify(void *buf, uint16_t len)
+static void handle_notify(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_notify *ev = buf;
btgatt_notify_params_t params;
cbs->client->notify_cb(ev->conn_id, ¶ms);
}
-static void handle_read_characteristic(void *buf, uint16_t len)
+static void handle_read_characteristic(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_read_characteristic *ev = buf;
btgatt_read_params_t params;
¶ms);
}
-static void handle_write_characteristic(void *buf, uint16_t len)
+static void handle_write_characteristic(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_write_characteristic *ev = buf;
btgatt_write_params_t params;
¶ms);
}
-static void handle_read_descriptor(void *buf, uint16_t len)
+static void handle_read_descriptor(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_read_descriptor *ev = buf;
btgatt_read_params_t params;
¶ms);
}
-static void handle_write_descriptor(void *buf, uint16_t len)
+static void handle_write_descriptor(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_write_descriptor *ev = buf;
btgatt_write_params_t params;
¶ms);
}
-static void handle_execute_write(void *buf, uint16_t len)
+static void handle_execute_write(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_exec_write *ev = buf;
cbs->client->execute_write_cb(ev->conn_id, ev->status);
}
-static void handle_read_remote_rssi(void *buf, uint16_t len)
+static void handle_read_remote_rssi(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_read_remote_rssi *ev = buf;
ev->rssi, ev->status);
}
-static void handle_listen(void *buf, uint16_t len)
+static void handle_listen(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_client_listen *ev = buf;
/* Server Event Handlers */
-static void handle_register_server(void *buf, uint16_t len)
+static void handle_register_server(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_register *ev = buf;
(bt_uuid_t *) &ev->uuid);
}
-static void handle_connection(void *buf, uint16_t len)
+static void handle_connection(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_connection *ev = buf;
(bt_bdaddr_t *) &ev->bdaddr);
}
-static void handle_service_added(void *buf, uint16_t len)
+static void handle_service_added(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_service_added *ev = buf;
btgatt_srvc_id_t srvc_id;
&srvc_id, ev->srvc_handle);
}
-static void handle_included_service_added(void *buf, uint16_t len)
+static void handle_included_service_added(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_inc_srvc_added *ev = buf;
ev->incl_srvc_handle);
}
-static void handle_characteristic_added(void *buf, uint16_t len)
+static void handle_characteristic_added(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_characteristic_added *ev = buf;
ev->char_handle);
}
-static void handle_descriptor_added(void *buf, uint16_t len)
+static void handle_descriptor_added(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_descriptor_added *ev = buf;
ev->descr_handle);
}
-static void handle_service_started(void *buf, uint16_t len)
+static void handle_service_started(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_service_started *ev = buf;
ev->srvc_handle);
}
-static void handle_service_stopped(void *buf, uint16_t len)
+static void handle_service_stopped(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_service_stopped *ev = buf;
ev->srvc_handle);
}
-static void handle_service_deleted(void *buf, uint16_t len)
+static void handle_service_deleted(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_service_deleted *ev = buf;
ev->srvc_handle);
}
-static void handle_request_read(void *buf, uint16_t len)
+static void handle_request_read(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_request_read *ev = buf;
ev->is_long);
}
-static void handle_request_write(void *buf, uint16_t len)
+static void handle_request_write(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_request_write *ev = buf;
ev->is_prep, ev->value);
}
-static void handle_request_exec_write(void *buf, uint16_t len)
+static void handle_request_exec_write(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_request_exec_write *ev = buf;
ev->exec_write);
}
-static void handle_response_confirmation(void *buf, uint16_t len)
+static void handle_response_confirmation(void *buf, uint16_t len, int fd)
{
struct hal_ev_gatt_server_rsp_confirmation *ev = buf;
diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c
index d992506..1d9a1a2 100644
--- a/android/hal-handsfree.c
+++ b/android/hal-handsfree.c
return cbs != NULL;
}
-static void handle_conn_state(void *buf, uint16_t len)
+static void handle_conn_state(void *buf, uint16_t len, int fd)
{
struct hal_ev_handsfree_conn_state *ev = buf;
(bt_bdaddr_t *) (ev->bdaddr));
}
-static void handle_audio_state(void *buf, uint16_t len)
+static void handle_audio_state(void *buf, uint16_t len, int fd)
{
struct hal_ev_handsfree_audio_state *ev = buf;
cbs->audio_state_cb(ev->state, (bt_bdaddr_t *) (ev->bdaddr));
}
-static void handle_vr_state(void *buf, uint16_t len)
+static void handle_vr_state(void *buf, uint16_t len, int fd)
{
struct hal_ev_handsfree_vr_state *ev = buf;
cbs->vr_cmd_cb(ev->state);
}
-static void handle_answer(void *buf, uint16_t len)
+static void handle_answer(void *buf, uint16_t len, int fd)
{
if (cbs->answer_call_cmd_cb)
cbs->answer_call_cmd_cb();
}
-static void handle_hangup(void *buf, uint16_t len)
+static void handle_hangup(void *buf, uint16_t len, int fd)
{
if (cbs->hangup_call_cmd_cb)
cbs->hangup_call_cmd_cb();
}
-static void handle_volume(void *buf, uint16_t len)
+static void handle_volume(void *buf, uint16_t len, int fd)
{
struct hal_ev_handsfree_volume *ev = buf;
cbs->volume_cmd_cb(ev->type, ev->volume);
}
-static void handle_dial(void *buf, uint16_t len)
+static void handle_dial(void *buf, uint16_t len, int fd)
{
struct hal_ev_handsfree_dial *ev = buf;
uint16_t num_len = ev->number_len;
cbs->dial_call_cmd_cb(NULL);
}
-static void handle_dtmf(void *buf, uint16_t len)
+static void handle_dtmf(void *buf, uint16_t len, int fd)
{
struct hal_ev_handsfree_dtmf *ev = buf;
cbs->dtmf_cmd_cb(ev->tone);
}
-static void handle_nrec(void *buf, uint16_t len)
+static void handle_nrec(void *buf, uint16_t len, int fd)
{
struct hal_ev_handsfree_nrec *ev = buf;
cbs->nrec_cmd_cb(ev->nrec);
}
-static void handle_chld(void *buf, uint16_t len)
+static void handle_chld(void *buf, uint16_t len, int fd)
{
struct hal_ev_handsfree_chld *ev = buf;
cbs->chld_cmd_cb(ev->chld);
}
-static void handle_cnum(void *buf, uint16_t len)
+static void handle_cnum(void *buf, uint16_t len, int fd)
{
if (cbs->cnum_cmd_cb)
cbs->cnum_cmd_cb();
}
-static void handle_cind(void *buf, uint16_t len)
+static void handle_cind(void *buf, uint16_t len, int fd)
{
if (cbs->cind_cmd_cb)
cbs->cind_cmd_cb();
}
-static void handle_cops(void *buf, uint16_t len)
+static void handle_cops(void *buf, uint16_t len, int fd)
{
if (cbs->cops_cmd_cb)
cbs->cops_cmd_cb();
}
-static void handle_clcc(void *buf, uint16_t len)
+static void handle_clcc(void *buf, uint16_t len, int fd)
{
if (cbs->clcc_cmd_cb)
cbs->clcc_cmd_cb();
}
-static void handle_unknown_at(void *buf, uint16_t len)
+static void handle_unknown_at(void *buf, uint16_t len, int fd)
{
struct hal_ev_handsfree_unknown_at *ev = buf;
cbs->unknown_at_cmd_cb((char *) ev->buf);
}
-static void handle_hsp_key_press(void *buf, uint16_t len)
+static void handle_hsp_key_press(void *buf, uint16_t len, int fd)
{
if (cbs->key_pressed_cmd_cb)
cbs->key_pressed_cmd_cb();
diff --git a/android/hal-health.c b/android/hal-health.c
index e7326d7..0ef6afc 100644
--- a/android/hal-health.c
+++ b/android/hal-health.c
return cbacks != NULL;
}
-static void handle_app_registration_state(void *buf, uint16_t len)
+static void handle_app_registration_state(void *buf, uint16_t len, int fd)
{
struct hal_ev_health_app_reg_state *ev = buf;
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index ce93af8..949e2a0 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
return cbacks != NULL;
}
-static void handle_conn_state(void *buf, uint16_t len)
+static void handle_conn_state(void *buf, uint16_t len, int fd)
{
struct hal_ev_hidhost_conn_state *ev = buf;
ev->state);
}
-static void handle_info(void *buf, uint16_t len)
+static void handle_info(void *buf, uint16_t len, int fd)
{
struct hal_ev_hidhost_info *ev = buf;
bthh_hid_info_t info;
cbacks->hid_info_cb((bt_bdaddr_t *) ev->bdaddr, info);
}
-static void handle_proto_mode(void *buf, uint16_t len)
+static void handle_proto_mode(void *buf, uint16_t len, int fd)
{
struct hal_ev_hidhost_proto_mode *ev = buf;
ev->status, ev->mode);
}
-static void handle_idle_time(void *buf, uint16_t len)
+static void handle_idle_time(void *buf, uint16_t len, int fd)
{
struct hal_ev_hidhost_idle_time *ev = buf;
ev->idle_rate);
}
-static void handle_get_report(void *buf, uint16_t len)
+static void handle_get_report(void *buf, uint16_t len, int fd)
{
struct hal_ev_hidhost_get_report *ev = buf;
ev->data, ev->len);
}
-static void handle_virtual_unplug(void *buf, uint16_t len)
+static void handle_virtual_unplug(void *buf, uint16_t len, int fd)
{
struct hal_ev_hidhost_virtual_unplug *ev = buf;
diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index 7dd6870..494ba85 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
services[service].size = 0;
}
-static bool handle_msg(void *buf, ssize_t len)
+static bool handle_msg(void *buf, ssize_t len, int fd)
{
struct ipc_hdr *msg = buf;
const struct hal_ipc_handler *handler;
return false;
}
- handler->handler(msg->payload, msg->len);
+ handler->handler(msg->payload, msg->len, fd);
return true;
}
}
}
- if (!handle_msg(buf, ret))
+ if (!handle_msg(buf, ret, fd))
goto failed;
}
diff --git a/android/hal-ipc.h b/android/hal-ipc.h
index b61d557..08ed7cc 100644
--- a/android/hal-ipc.h
+++ b/android/hal-ipc.h
*/
struct hal_ipc_handler {
- void (*handler) (void *buf, uint16_t len);
+ void (*handler) (void *buf, uint16_t len, int fd);
bool var_len;
size_t data_len;
};
diff --git a/android/hal-pan.c b/android/hal-pan.c
index e2bc02e..d3f93ff 100644
--- a/android/hal-pan.c
+++ b/android/hal-pan.c
return cbs != NULL;
}
-static void handle_conn_state(void *buf, uint16_t len)
+static void handle_conn_state(void *buf, uint16_t len, int fd)
{
struct hal_ev_pan_conn_state *ev = buf;
ev->local_role, ev->remote_role);
}
-static void handle_ctrl_state(void *buf, uint16_t len)
+static void handle_ctrl_state(void *buf, uint16_t len, int fd)
{
struct hal_ev_pan_ctrl_state *ev = buf;