Implement local LE features adapter property
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / oal-adapter-mgr.c
index 94148f6..679906f 100644 (file)
@@ -261,6 +261,27 @@ oal_status_t le_deinit(void)
 #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;
@@ -534,13 +555,11 @@ oal_status_t adapter_get_service_uuids(void)
        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;
 }
 
@@ -695,6 +714,8 @@ static void cb_adapter_properties(bt_status_t status,
 
        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",
@@ -732,7 +753,7 @@ static void cb_adapter_properties(bt_status_t status,
                                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;
                }
@@ -827,6 +848,25 @@ static void cb_adapter_properties(bt_status_t status,
                                        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;
+               }
                default:
                         BT_WARN("Unhandled property: %d", properties[i].type);
                         break;