X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bt-oal%2Fbluez_hal%2Fsrc%2Fbt-hal-bluetooth.c;h=1cba2497a08b8772e4387a8226a1e501bfdf087e;hb=12f6d720fe415dac5fb706c383471b53e81a7f0c;hp=3394a283891e4c971eabd3ad9b864f9803f034e6;hpb=3f91aa7033220a4114c7c92eb857865caaa6d1dd;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/bt-oal/bluez_hal/src/bt-hal-bluetooth.c b/bt-oal/bluez_hal/src/bt-hal-bluetooth.c index 3394a28..1cba249 100644 --- a/bt-oal/bluez_hal/src/bt-hal-bluetooth.c +++ b/bt-oal/bluez_hal/src/bt-hal-bluetooth.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -114,6 +115,14 @@ static int disable(void) } #ifdef TIZEN_BT_HAL +/* Tizen Specific Recover Adapter */ +static int recover(void) +{ + return _bt_hal_dbus_recover_adapter(); +} +#endif + +#ifdef TIZEN_BT_HAL /* Tizen Specific Reset Adapter */ static int reset(void) { @@ -214,7 +223,6 @@ static int cancel_discovery(void) static int create_bond(const bt_bdaddr_t *bd_addr, int transport) { - DBG("+"); return _bt_hal_device_create_bond(bd_addr, transport); } @@ -225,7 +233,6 @@ static int cancel_bond(const bt_bdaddr_t *bd_addr) static int remove_bond(const bt_bdaddr_t *bd_addr) { - DBG("+"); return _bt_hal_device_remove_bond(bd_addr); } @@ -252,6 +259,9 @@ static const void *get_profile_interface(const char *profile_id) if (!strncmp(profile_id, BT_PROFILE_HIDHOST_ID, strlen(profile_id))) return bt_get_hidhost_interface(); + if (!strcmp(profile_id, BT_PROFILE_HIDDEVICE_ID)) + return bt_get_hiddevice_interface(); + if (!strcmp(profile_id, BT_PROFILE_SOCKETS_ID)) return bt_get_socket_interface(); @@ -334,13 +344,11 @@ static int read_energy_info(void) static int authorize_response(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id, uint8_t authorize, uint8_t save_settings) { - DBG("+"); return _bt_hal_device_authorize_response(bd_addr, service_id, authorize, save_settings); } int set_authorization(bt_bdaddr_t *bd_addr, uint8_t auth) { - DBG("+"); return _bt_hal_device_set_trust(bd_addr, auth); } @@ -412,7 +420,6 @@ static int set_hal_le_request_state(int enable) static int dev_disconnect(const bt_bdaddr_t *bd_addr) { - DBG("+"); return _bt_hal_device_disconnect(bd_addr); } #endif @@ -422,7 +429,9 @@ static const bt_interface_t bluetooth_if = { .init = init, .enable = enable, .disable = disable, + #ifdef TIZEN_BT_HAL + .recover = recover, .reset = reset, #endif @@ -527,7 +536,7 @@ struct hw_module_t HAL_MODULE_INFO_SYM = { .version_major = 1, .version_minor = 0, .id = BT_HARDWARE_MODULE_ID, - .name = "Bluetooth stack", + .name = "bluez", .author = "Intel Corporation", .methods = &bluetooth_module_methods }; @@ -595,10 +604,7 @@ static void __bt_device_props_to_hal(bt_property_t *send_props, void *buf = prop; uint8_t i; - DBG("+"); - for (i = 0; i < num_props; i++) { - if (sizeof(*prop) + prop->len > len) { ERR("invalid device properties (%zu > %u), cant process further properties!!!", sizeof(*prop) + prop->len, len); @@ -607,8 +613,6 @@ static void __bt_device_props_to_hal(bt_property_t *send_props, send_props[i].type = prop->type; - DBG("HAL prop Type [%d]", prop->type); - switch (prop->type) { case HAL_PROP_DEVICE_TYPE: { @@ -658,7 +662,6 @@ static void __bt_device_props_to_hal(bt_property_t *send_props, } if (!len) { - DBG("-"); return; } @@ -669,7 +672,6 @@ static void __bt_hal_handle_adapter_property_changed(void *buf, uint16_t len) { struct hal_ev_adapter_props_changed *ev = (struct hal_ev_adapter_props_changed *)buf; bt_property_t props[ev->num_props]; - DBG("+"); if (!bt_hal_cbacks->adapter_properties_cb) return; @@ -685,8 +687,6 @@ static void __bt_hal_handle_adapter_discovery_state_changed(void *buf, uint16_t { struct hal_ev_discovery_state_changed *ev = (struct hal_ev_discovery_state_changed *)buf; - DBG("+"); - if (bt_hal_cbacks->discovery_state_changed_cb) bt_hal_cbacks->discovery_state_changed_cb(ev->state); } @@ -695,7 +695,6 @@ static void __bt_hal_handle_device_found_event(void *buf, uint16_t len) { struct hal_ev_device_found *ev = (struct hal_ev_device_found *) buf; bt_property_t props[ev->num_props]; - DBG("+"); if (!bt_hal_cbacks->device_found_cb) return; @@ -712,8 +711,6 @@ static void __bt_hal_handle_remote_device_properties_event(void *buf, uint16_t l bt_bdaddr_t bd_addr; bt_property_t props[ev->num_props]; - DBG("+"); - if (!bt_hal_cbacks->remote_device_properties_cb) return; @@ -722,7 +719,6 @@ static void __bt_hal_handle_remote_device_properties_event(void *buf, uint16_t l memcpy(bd_addr.address, ev->bdaddr, 6); bt_hal_cbacks->remote_device_properties_cb( ev->status, &bd_addr, ev->num_props, props); - DBG("-"); } static void __bt_hal_handle_bond_state_changed_event(void *buf, uint16_t len) @@ -730,16 +726,8 @@ static void __bt_hal_handle_bond_state_changed_event(void *buf, uint16_t len) struct hal_ev_bond_state_changed *ev = (struct hal_ev_bond_state_changed *)buf; bt_bdaddr_t bd_addr; - DBG("+"); memcpy(bd_addr.address, ev->bdaddr, 6); - /* BD address*/ - DBG("[0x%x]", bd_addr.address[0]); - DBG("[0x%x]", bd_addr.address[1]); - DBG("[0x%x]", bd_addr.address[2]); - DBG("[0x%x]", bd_addr.address[3]); - DBG("[0x%x]", bd_addr.address[4]); - DBG("[0x%x]", bd_addr.address[5]); DBG("Bonding State changed Status [0x%x]", ev->status); DBG("Bonding State [0x%x]", ev->state); @@ -750,26 +738,15 @@ static void __bt_hal_handle_bond_state_changed_event(void *buf, uint16_t len) } bt_hal_cbacks->bond_state_changed_cb(ev->status, &bd_addr, ev->state); - DBG("-"); } static void __bt_hal_handle_device_acl_state_changed_event(void *buf, uint16_t len) { struct hal_ev_acl_state_changed *ev = (struct hal_ev_acl_state_changed*)buf; bt_bdaddr_t bd_addr; - DBG("+"); memcpy(bd_addr.address, ev->bdaddr, 6); - /* BD address*/ - DBG("[0x%x]", bd_addr.address[0]); - DBG("[0x%x]", bd_addr.address[1]); - DBG("[0x%x]", bd_addr.address[2]); - DBG("[0x%x]", bd_addr.address[3]); - DBG("[0x%x]", bd_addr.address[4]); - DBG("[0x%x]", bd_addr.address[5]); - - DBG("ACL Status [0x%x]", ev->status); - DBG("ACL State [0x%x]", ev->state); + INFO("ACL status[0x%x], state[0x%x]: XX:XX:XX:XX:XX:%02X", ev->status, ev->state, bd_addr.address[5]); if (!bt_hal_cbacks->acl_state_changed_cb) { ERR("HAL User acl_state_changed_cb is not set!!"); @@ -777,14 +754,12 @@ static void __bt_hal_handle_device_acl_state_changed_event(void *buf, uint16_t l } bt_hal_cbacks->acl_state_changed_cb(ev->status, &bd_addr, ev->state); - DBG("-"); } static void __bt_hal_handle_device_le_conn_state_changed_event(void *buf, uint16_t len) { struct hal_ev_acl_state_changed *ev = (struct hal_ev_acl_state_changed*)buf; bt_bdaddr_t bd_addr; - DBG("+"); memcpy(bd_addr.address, ev->bdaddr, 6); /* BD address */ @@ -802,7 +777,6 @@ static void __bt_hal_handle_device_le_conn_state_changed_event(void *buf, uint16 bt_hal_cbacks->le_conn_state_changed_cb(ev->status, &bd_addr, ev->state); #endif - DBG("-"); } static void __bt_hal_handle_authorize_request_event(void *buf, uint16_t len) @@ -810,8 +784,6 @@ static void __bt_hal_handle_authorize_request_event(void *buf, uint16_t len) struct hal_ev_authorize_request *ev = (struct hal_ev_authorize_request *)buf; bt_bdaddr_t bd_addr; - DBG("+"); - memcpy(bd_addr.address, ev->bdaddr, 6); /* BD address*/ @@ -830,7 +802,6 @@ static void __bt_hal_handle_authorize_request_event(void *buf, uint16_t len) } bt_hal_cbacks->authorize_request_cb(&bd_addr, ev->service_id); - DBG("-"); } #ifdef TIZEN_BT_HAL @@ -843,8 +814,6 @@ static void __bt_hal_handle_socket_authorize_request_event(void *buf, uint16_t l uint8_t path[249] = {0, }; uint32_t fd; - DBG("+"); - memcpy(bd_addr.address, ev->bdaddr, 6); memcpy(uuid.uu, ev->uuid, 16); memcpy(name, ev->name, sizeof(name) - 1); @@ -857,7 +826,6 @@ static void __bt_hal_handle_socket_authorize_request_event(void *buf, uint16_t l } bt_hal_cbacks->socket_authorize_request_cb(&bd_addr, &uuid, name, path, fd); - DBG("-"); } #endif @@ -866,7 +834,6 @@ static void __bt_hal_handle_ssp_request_event(void *buf, uint16_t len) struct hal_ev_ssp_request *ev = (struct hal_ev_ssp_request *)buf; bt_bdaddr_t bd_addr; bt_bdname_t bd_name; - DBG("+"); memcpy(bd_addr.address, ev->bdaddr, 6); memcpy(bd_name.name, ev->name, 248); @@ -891,7 +858,6 @@ static void __bt_hal_handle_ssp_request_event(void *buf, uint16_t len) bt_hal_cbacks->ssp_request_cb(&bd_addr, &bd_name, ev->class_of_dev, ev->pairing_variant, ev->passkey); - DBG("-"); } static void __bt_hal_handle_pin_request_event(void *buf, uint16_t len) @@ -899,7 +865,6 @@ static void __bt_hal_handle_pin_request_event(void *buf, uint16_t len) struct hal_ev_pin_request *ev = (struct hal_ev_pin_request *)buf; bt_bdaddr_t bd_addr; bt_bdname_t bd_name; - DBG("+"); memcpy(bd_addr.address, ev->bdaddr, 6); memcpy(bd_name.name, ev->name, 248); @@ -921,14 +886,12 @@ static void __bt_hal_handle_pin_request_event(void *buf, uint16_t len) bt_hal_cbacks->pin_request_cb(&bd_addr, &bd_name, ev->class_of_dev); - DBG("-"); } static void __bt_hal_handle_device_trust_state_changed_event(void *buf, uint16_t len) { struct hal_ev_device_trust_state_changed *ev = (struct hal_ev_device_trust_state_changed*)buf; bt_bdaddr_t bd_addr; - DBG("+"); memcpy(bd_addr.address, ev->bdaddr, 6); /* BD address*/ @@ -947,7 +910,6 @@ static void __bt_hal_handle_device_trust_state_changed_event(void *buf, uint16_t } bt_hal_cbacks->device_trust_state_changed_cb(&bd_addr, ev->trust); - DBG("-"); } static void __bt_hal_handle_device_trusted_profiles_changed_event(void *buf, uint16_t len) @@ -955,7 +917,6 @@ static void __bt_hal_handle_device_trusted_profiles_changed_event(void *buf, uin struct hal_ev_device_trusted_profiles_changed *ev = buf; bt_bdaddr_t bd_addr; - DBG("+"); #ifdef TIZEN_BT_HAL memcpy(bd_addr.address, ev->bdaddr, 6); DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]", @@ -970,7 +931,6 @@ static void __bt_hal_handle_device_trusted_profiles_changed_event(void *buf, uin bt_hal_cbacks->device_trusted_profiles_changed_cb(&bd_addr, ev->trust_val); #endif - DBG("-"); } static void __bt_handle_rssi_monitor_state_changed(void *buf, uint16_t len) @@ -978,7 +938,6 @@ static void __bt_handle_rssi_monitor_state_changed(void *buf, uint16_t len) struct hal_ev_rssi_monitor_state_changed *ev = buf; bt_bdaddr_t bd_addr; - DBG("+"); #ifdef TIZEN_BT_HAL memcpy(bd_addr.address, ev->bdaddr, 6); DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]", @@ -990,7 +949,6 @@ static void __bt_handle_rssi_monitor_state_changed(void *buf, uint16_t len) bt_hal_cbacks->rssi_monitor_state_changed_cb( &bd_addr, ev->link_type, ev->state); #endif - DBG("-"); } static void __bt_handle_rssi_alert_recieved(void *buf, uint16_t len) @@ -998,7 +956,6 @@ static void __bt_handle_rssi_alert_recieved(void *buf, uint16_t len) struct hal_ev_rssi_alert_recieved *ev = buf; bt_bdaddr_t bd_addr; - DBG("+"); #ifdef TIZEN_BT_HAL memcpy(bd_addr.address, ev->bdaddr, 6); DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]", @@ -1010,7 +967,6 @@ static void __bt_handle_rssi_alert_recieved(void *buf, uint16_t len) bt_hal_cbacks->rssi_alert_cb( &bd_addr, ev->link_type, ev->alert_type, ev->rssi); #endif - DBG("-"); } static void __bt_handle_raw_rssi_recieved(void *buf, uint16_t len) @@ -1018,7 +974,6 @@ static void __bt_handle_raw_rssi_recieved(void *buf, uint16_t len) struct hal_ev_raw_rssi_recieved *ev = buf; bt_bdaddr_t bd_addr; - DBG("+"); #ifdef TIZEN_BT_HAL memcpy(bd_addr.address, ev->bdaddr, 6); DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]", @@ -1030,12 +985,21 @@ static void __bt_handle_raw_rssi_recieved(void *buf, uint16_t len) bt_hal_cbacks->raw_rssi_received_cb( &bd_addr, ev->link_type, ev->rssi); #endif - DBG("-"); +} + +static void __bt_handle_dbfw_plus_info_recieved(void *buf, uint16_t len) +{ + struct hal_ev_dbfw_plus_info_recieved *info = buf; + +#ifdef TIZEN_BT_HAL + if (bt_hal_cbacks->dbfw_plus_info_received_cb) + bt_hal_cbacks->dbfw_plus_info_received_cb( + info->data, info->data_len, info->event_code); +#endif } static void __bt_hal_handle_stack_messages(int message, void *buf, uint16_t len) { - DBG("+"); switch (message) { case HAL_EV_ADAPTER_STATE_CHANGED: DBG("Event: HAL_EV_ADAPTER_STATE_CHANGED"); @@ -1111,9 +1075,12 @@ static void __bt_hal_handle_stack_messages(int message, void *buf, uint16_t len) DBG("Event: HAL_EV_RAW_RSSI_RECIEVED"); __bt_handle_raw_rssi_recieved(buf, len); break; + case HAL_EV_DBFW_PLUS_INFO_RECIEVED: + DBG("Event: HAL_EV_DBFW_PLUS_INFO_RECIEVED"); + __bt_handle_dbfw_plus_info_recieved(buf, len); + break; default: DBG("Event Currently not handled!!"); break; } - DBG("-"); }