extern void cb_device_authorize_request(bt_bdaddr_t *remote_bd_addr, bt_service_id_t service_d);
extern void cb_device_trust_state_changed(bt_bdaddr_t *remote_bd_addr, bt_device_trust_state_t trusted);
#ifdef TIZEN_BT_HAL
-extern void cb_socket_conn_authorize_request(bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid);
+extern void cb_socket_conn_authorize_request(bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid, uint8_t *name, uint8_t *path, uint32_t fd);
static void cb_ble_state_change(bt_state_t status);
extern void cb_device_le_conn_state_changed(bt_status_t status, bt_bdaddr_t *bd_addr,
bt_le_conn_state_t state);
#endif
static bt_callbacks_t callbacks = {
- sizeof(callbacks),
- cb_adapter_state_change,
- cb_adapter_properties,
- cb_device_properties,
- cb_adapter_device_found,
- cb_adapter_discovery_state_changed,
- cb_device_pin_request,
- cb_device_ssp_request,
- cb_device_bond_state_changed,
- cb_device_acl_state_changed,
- NULL, /* callback_thread_event */
- NULL, /* dut_mode_recv_callback */
- NULL, /* le_test_mode_callback*/
- NULL, /* energy_info_callback */
- cb_device_authorize_request,
- cb_device_trust_state_changed,
+ .size = sizeof(callbacks),
+ .adapter_state_changed_cb = cb_adapter_state_change,
+ .adapter_properties_cb = cb_adapter_properties,
+ .remote_device_properties_cb = cb_device_properties,
+ .device_found_cb = cb_adapter_device_found,
+ .discovery_state_changed_cb = cb_adapter_discovery_state_changed,
+ .pin_request_cb = cb_device_pin_request,
+ .ssp_request_cb = cb_device_ssp_request,
+ .bond_state_changed_cb = cb_device_bond_state_changed,
+ .acl_state_changed_cb = cb_device_acl_state_changed,
+ .thread_evt_cb = NULL,
+ .dut_mode_recv_cb = NULL,
+ .le_test_mode_cb = NULL,
+ .energy_info_cb = NULL,
+ .authorize_request_cb = cb_device_authorize_request,
+ .device_trust_state_changed_cb = cb_device_trust_state_changed,
#ifdef TIZEN_BT_HAL
- cb_socket_conn_authorize_request,
- cb_ble_state_change,
- cb_device_le_conn_state_changed,
- cb_device_trusted_profiles_changed,
- cb_rssi_monitor_state_changed,
- cb_rssi_alert,
- cb_raw_rssi_received,
+ .socket_authorize_request_cb = cb_socket_conn_authorize_request,
+ .le_state_changed_cb = cb_ble_state_change,
+ .le_conn_state_changed_cb = cb_device_le_conn_state_changed,
+ .device_trusted_profiles_changed_cb = cb_device_trusted_profiles_changed,
+ .rssi_monitor_state_changed_cb = cb_rssi_monitor_state_changed,
+ .rssi_alert_cb = cb_rssi_alert,
+ .raw_rssi_received_cb = cb_raw_rssi_received,
#endif
};
BT_DBG();
}
+#ifdef TIZEN_BT_HAL
+int oal_set_adapter_request_state(int enable)
+{
+ return blued_api->set_hal_adapter_request_state(enable);
+}
+
+int oal_set_le_request_state(int enable)
+{
+ return blued_api->set_hal_le_request_state(enable);
+}
+#endif
+
oal_status_t adapter_enable(void)
{
int ret = BT_STATUS_SUCCESS;
CHECK_OAL_INITIALIZED();
API_TRACE();
-
ret = blued_api->get_adapter_property(BT_PROPERTY_UUIDS);
if (ret != BT_STATUS_SUCCESS) {
BT_ERR("get_adapter_property failed: [%s]", status2string(ret));
return convert_to_oal_status(ret);
}
-
return OAL_STATUS_SUCCESS;
}
return OAL_STATUS_SUCCESS;
}
+oal_status_t adapter_set_le_static_random_address(int enable)
+{
+ int ret;
+
+ CHECK_OAL_INITIALIZED();
+ API_TRACE("%d", enable);
+
+#ifdef TIZEN_BT_HAL
+ ret = blued_api->set_le_static_random_address((enable ? 1 : 0));
+ if (ret != BT_STATUS_SUCCESS)
+ BT_ERR("Static address set failed: [%s]", status2string(ret));
+ ret = convert_to_oal_status(ret);
+#else
+ BT_INFO("Not Supported");
+ ret = OAL_STATUS_NOT_SUPPORT;
+#endif
+
+ return ret;
+}
+
+oal_status_t adapter_set_manufacturer_data(oal_manufacturer_data_t *m_data)
+{
+ int ret;
+
+ CHECK_OAL_INITIALIZED();
+ API_TRACE();
+
+ OAL_CHECK_PARAMETER(m_data, return);
+ ret = blued_api->adapter_le_set_manufacturer_data((bt_manufacturer_data_t*)m_data);
+ if (ret != BT_STATUS_SUCCESS)
+ BT_ERR("Setting manufacturer data Failed: [%s]",status2string(ret));
+
+ ret = convert_to_oal_status(ret);
+ return ret;
+}
+
+oal_status_t adapter_set_white_list(bt_address_t *device_address, int address_type, bool is_add)
+{
+ int ret;
+ bdstr_t bdstr;
+
+ CHECK_OAL_INITIALIZED();
+ API_TRACE();
+
+ BT_INFO("BT remote device Address: %s", bdt_bd2str(device_address, &bdstr));
+
+ ret = blued_api->adapter_le_set_white_list((bt_bdaddr_t*)device_address, address_type, is_add);
+ if (ret != BT_STATUS_SUCCESS) {
+ if(is_add)
+ BT_ERR("Add to White List Failed: [%s]",status2string(ret));
+ else
+ BT_ERR("Remove from White List Failed: [%s]",status2string(ret));
+ }
+ ret = convert_to_oal_status(ret);
+ return ret;
+}
+
+oal_status_t adapter_ble_set_privacy(int set_privacy)
+{
+ int res;
+
+ CHECK_OAL_INITIALIZED();
+ API_TRACE();
+
+ res = blued_api->adapter_le_set_privacy(set_privacy);
+ if (res != BT_STATUS_SUCCESS)
+ BT_ERR("Setting LE Privacy Failed: [%s]", status2string(res));
+ res = convert_to_oal_status(res);
+
+ return res;
+}
+
static void cb_adapter_properties(bt_status_t status,
int num_properties,
bt_property_t *properties)
BT_DBG("status: %d, count: %d", status, num_properties);
+ print_bt_properties(num_properties, properties);
+
if (status != BT_STATUS_SUCCESS) {
if (num_properties == 1) {
BT_ERR("Adapter Prop failed: status: [%s], count: %d, prop: %d",
event_data, (sizeof(event_device_list_t) + num_bonded * sizeof(bt_bdaddr_t)));
break;
}
+ case BT_PROPERTY_A2DP_ROLE: {
+ unsigned int a2dp_role;
+
+ a2dp_role = *((uint32_t*)properties[i].val);
+
+ BT_INFO("A2DP role: %u", a2dp_role);
+
+ send_event(OAL_EVENT_ADAPTER_PROPERTY_A2DP_ROLE,
+ g_memdup(properties[i].val, sizeof(uint32_t)),
+ sizeof(uint32_t));
+ break;
+ }
+ case BT_PROPERTY_LOCAL_LE_FEATURES: {
+ event_adapter_le_features_t *le_features;
+
+ le_features = g_malloc(sizeof(event_adapter_le_features_t));
+
+ le_features->max_adv_instance = ((bt_local_le_features_t *)(properties[i].val))->max_adv_instance;
+ le_features->rpa_offloading = ((bt_local_le_features_t *)(properties[i].val))->rpa_offload_supported;
+ le_features->max_adv_filter = ((bt_local_le_features_t *)(properties[i].val))->max_adv_filter_supported;
+ le_features->le_2m_phy_support = ((bt_local_le_features_t *)(properties[i].val))->le_2m_phy_supported;
+ le_features->le_coded_phy_support = ((bt_local_le_features_t *)(properties[i].val))->le_2m_phy_supported;
+
+ BT_INFO("LE 2M PHY Support (%d)", le_features->le_2m_phy_support);
+ BT_INFO("LE CODED PHY Support (%d)", le_features->le_coded_phy_support);
+
+ send_event(OAL_EVENT_BLE_LOCAL_FEATURES,
+ le_features,
+ sizeof(event_adapter_le_features_t));
+ break;
+ }
+ case BT_PROPERTY_ADAPTER_LE_DISCOVERY_STARTED: {
+ BT_INFO("LE Discovery started");
+ send_event(OAL_EVENT_BLE_DISCOVERY_STARTED, NULL, 0);
+ break;
+ }
+ case BT_PROPERTY_ADAPTER_LE_DISCOVERY_STOPPED: {
+ BT_INFO("LE Discovery stopped");
+ send_event(OAL_EVENT_BLE_DISCOVERY_STOPPED, NULL, 0);
+ break;
+ }
default:
BT_WARN("Unhandled property: %d", properties[i].type);
break;
print_bt_properties(num_properties, properties);
parse_device_properties(num_properties, properties, &dev_info, &adv_info);
- BT_INFO("number of properties= [%d] ", num_properties, size);
+ BT_INFO("number of properties= [%d] ", num_properties);
if (dev_info.type != DEV_TYPE_BREDR) {
/* BLE Single or DUAL mode found, so it should have Adv data */