code clean up
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / oal-adapter-mgr.c
index b2f718d..52812bc 100644 (file)
@@ -80,6 +80,7 @@ extern void cb_rssi_monitor_state_changed(bt_bdaddr_t *bd_addr, int32_t link_typ
 extern void cb_rssi_alert(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t alert_type, int32_t rssi);
 extern void cb_raw_rssi_received(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t rssi);
 extern void cb_dbfw_plus_info_received(unsigned char *data, uint32_t length, uint8_t event_code);
+extern void cb_controller_error_received(uint8_t error_code);
 #endif
 
 static bt_callbacks_t callbacks = {
@@ -108,6 +109,7 @@ static bt_callbacks_t callbacks = {
        .rssi_alert_cb = cb_rssi_alert,
        .raw_rssi_received_cb = cb_raw_rssi_received,
        .dbfw_plus_info_received_cb = cb_dbfw_plus_info_received,
+       .controller_error_received_cb = cb_controller_error_received,
 #endif
 };
 
@@ -354,6 +356,35 @@ oal_status_t adapter_get_powered_status(gboolean *status)
        return ret;
 }
 
+oal_status_t adapter_get_energy_info(uint32_t *tx_time, uint32_t *rx_time,
+                                       uint32_t *idle_time, uint32_t *energy_used)
+{
+       int ret;
+
+       API_TRACE();
+
+       CHECK_OAL_INITIALIZED();
+
+       OAL_CHECK_PARAMETER(tx_time, return);
+       OAL_CHECK_PARAMETER(rx_time, return);
+       OAL_CHECK_PARAMETER(idle_time, return);
+       OAL_CHECK_PARAMETER(energy_used, return);
+
+       BT_INFO("Get Adapter Energy Info");
+
+#ifdef TIZEN_BT_HAL
+       ret = blued_api->get_adapter_energy_info(tx_time, rx_time, idle_time, energy_used);
+       if (ret != BT_STATUS_SUCCESS) {
+               BT_ERR("get_adapter_energy_info failed: [%s]", status2string(ret));
+               return convert_to_oal_status(ret);
+       }
+#else
+       BT_INFO("Not Supported");
+       ret = OAL_STATUS_NOT_SUPPORT;
+#endif
+       return ret;
+}
+
 oal_status_t adapter_reset(void)
 {
        int ret;
@@ -530,6 +561,23 @@ oal_status_t adapter_get_name(void)
        return OAL_STATUS_SUCCESS;
 }
 
+oal_status_t adapter_get_connectable(void)
+{
+       int ret;
+
+       CHECK_OAL_INITIALIZED();
+
+       API_TRACE();
+
+       ret = blued_api->get_adapter_property(BT_PROPERTY_ADAPTER_SCAN_MODE);
+       if (ret != BT_STATUS_SUCCESS) {
+               BT_ERR("get_adapter_property failed: [%s]", status2string(ret));
+               return convert_to_oal_status(ret);
+       }
+
+       return OAL_STATUS_SUCCESS;
+}
+
 oal_status_t adapter_set_name(char * name)
 {
        int ret;
@@ -1088,3 +1136,14 @@ static void cb_adapter_device_found(int num_properties, bt_property_t *propertie
 
        BT_DBG("-");
 }
+
+void cb_controller_error_received(uint8_t error_code)
+{
+       uint8_t *event_data;
+
+       event_data = g_new0(uint8_t, 1);
+       *event_data = error_code;
+
+       send_event(OAL_EVENT_CONTROLLER_ERROR_RECEIVED,
+               (gpointer)event_data, sizeof(uint8_t));
+}