Add the session timer to handle the exception case
[platform/core/connectivity/bluetooth-frwk.git] / plugin / headed.c
index ea00b61..9a2b3c5 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <stdio.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -24,6 +25,7 @@
 #include <bundle_internal.h>
 #include <tethering.h>
 #include <mime_type.h>
+#include <app_control.h>
 
 #include "plugin.h"
 #include "bluetooth-api.h"
@@ -205,7 +207,7 @@ int bt_launch_system_popup(bt_agent_event_type_t event_type,
        return 0;
 }
 
-gboolean bt_launch_unable_to_pairing_syspopup(int result)
+bool bt_launch_unable_to_pairing_syspopup(int result)
 {
        BT_DBG("+");
        int ret = 0;
@@ -213,7 +215,7 @@ gboolean bt_launch_unable_to_pairing_syspopup(int result)
 
        b = bundle_create();
        if (b == NULL)
-               return FALSE;
+               return false;
 
        bundle_add(b, "event-type", "unable-to-pairing");
 
@@ -234,11 +236,11 @@ gboolean bt_launch_unable_to_pairing_syspopup(int result)
        }
 
        BT_DBG("-");
-       return TRUE;
+       return true;
 }
 
 
-gboolean bt_is_tethering_enabled(void)
+bool bt_is_tethering_enabled(void)
 {
        BT_DBG("+");
 
@@ -263,7 +265,7 @@ gboolean bt_is_tethering_enabled(void)
        if (ret != TETHERING_ERROR_NONE)
                BT_ERR("Fail to destroy tethering: %d", ret);
 
-       return (gboolean)enabled;
+       return enabled;
 }
 
 int bt_get_mime_type(char *file_name, char **mime_type)
@@ -290,6 +292,27 @@ void bt_destroy_popup_all(void)
        syspopup_destroy_all();
 }
 
+int bt_app_control_send_launch_request(char *absolute_path)
+{
+       BT_DBG("+");
+
+       app_control_h app_control;
+       int ret;
+
+       app_control_create(&app_control);
+       app_control_set_operation(app_control, APP_CONTROL_OPERATION_VIEW);
+       app_control_set_uri(app_control, absolute_path);
+       app_control_set_mime(app_control, "*/*");
+
+       if (app_control_send_launch_request(app_control, NULL, NULL) == APP_CONTROL_ERROR_NONE)
+               ret = BLUETOOTH_ERROR_NONE;
+       else
+               ret = BLUETOOTH_ERROR_INTERNAL;
+
+       app_control_destroy(app_control);
+
+       return ret;
+}
 
 extern struct bluetooth_headed_plugin_t headed_plugin
 __attribute__ ((visibility("default")));