Porting flight mode logic to HAL
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / bluez_hal / src / bt-hal-adapter-dbus-handler.c
index 1ced5f7..6a9a14d 100644 (file)
@@ -101,6 +101,39 @@ void _bt_hal_dbus_store_stack_msg_cb(handle_stack_msg cb)
        event_cb = cb;
 }
 
+int _bt_hal_enable_core(void)
+{
+       DBG("");
+       GDBusProxy *proxy;
+       GVariant *result;
+       GError *error = NULL;
+
+       proxy = __bt_get_core_proxy();
+       if(!proxy)
+               return BT_HAL_ERROR_INTERNAL;
+
+       /* Clean up the process */
+       result = g_dbus_proxy_call_sync(proxy,
+                              "EnableCore",
+                              NULL,
+                              G_DBUS_CALL_FLAGS_NONE,
+                             -1,
+                             NULL,
+                              &error);
+
+       if (!result) {
+               if (error != NULL) {
+                       ERR("Bt core call failed(Error: %s)", error->message);
+                       g_clear_error(&error);
+               } else
+                       ERR("Bt core call failed");
+               return BT_HAL_ERROR_INTERNAL;
+       }
+
+       g_variant_unref(result);
+       return BT_HAL_ERROR_NONE;
+}
+
 static gboolean __bt_hal_send_adapter_event(gpointer user_data)
 {
        struct hal_ev_adapter_state_changed ev;