#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;
#endif
return ret;
}
+oal_status_t is_advertising(void)
+{
+ int ret = BT_STATUS_SUCCESS;
+ API_TRACE();
+ CHECK_OAL_INITIALIZED();
+#ifdef TIZEN_BT_HAL
+ if (OAL_STATUS_SUCCESS != hw_is_module_ready()) {
+ g_timeout_add(200, retry_enable_le, NULL);
+ return OAL_STATUS_PENDING;
+ }
+ int r = blued_api->is_advertising();
+ if (r == TRUE)
+ ret = BT_STATUS_SUCCESS;
+ else
+ ret = BT_STATUS_FAIL;
+#else
+ BT_INFO("Not Supported");
+ ret = OAL_STATUS_NOT_SUPPORT;
+#endif
+ return ret;
+}
oal_status_t adapter_start_custom_inquiry(discovery_type_t disc_type)
{
int ret;
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_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",
char * adap_name = g_strdup(local_name);
/* Application has requested this property SET/GET hence send EVENT */
- send_event(OAL_EVENT_ADAPTER_PROPERTY_NAME, adap_name, strlen(adap_name));
+ send_event(OAL_EVENT_ADAPTER_PROPERTY_NAME, adap_name, strlen(adap_name)+1);
}
break;
}
event_data, (sizeof(event_device_list_t) + num_bonded * sizeof(bt_bdaddr_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_FINISHED: {
+ gboolean le_discovering = *(gboolean *)properties[i].val;
+ if (le_discovering == FALSE) {
+ BT_INFO("LE Discovery finished");
+ send_event(OAL_EVENT_BLE_DISCOVERY_FINISHED, 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 */