Remove some package dependencies for the headless image
[platform/core/connectivity/bluetooth-frwk.git] / plugin / headed.c
index 625c93c..ea00b61 100644 (file)
@@ -22,6 +22,8 @@
 #include <syspopup_caller.h>
 #include <bundle.h>
 #include <bundle_internal.h>
+#include <tethering.h>
+#include <mime_type.h>
 
 #include "plugin.h"
 #include "bluetooth-api.h"
@@ -236,6 +238,53 @@ gboolean bt_launch_unable_to_pairing_syspopup(int result)
 }
 
 
+gboolean bt_is_tethering_enabled(void)
+{
+       BT_DBG("+");
+
+       tethering_h tethering = NULL;
+       bool enabled = FALSE;
+       int ret;
+
+       ret = tethering_create(&tethering);
+
+       if (ret != TETHERING_ERROR_NONE) {
+               BT_ERR("Fail to create tethering: %d", ret);
+               return FALSE;
+       }
+
+       enabled = tethering_is_enabled(tethering, TETHERING_TYPE_BT);
+
+       if (enabled != true)
+               BT_ERR("BT tethering is not enabled");
+
+       ret = tethering_destroy(tethering);
+
+       if (ret != TETHERING_ERROR_NONE)
+               BT_ERR("Fail to destroy tethering: %d", ret);
+
+       return (gboolean)enabled;
+}
+
+int bt_get_mime_type(char *file_name, char **mime_type)
+{
+       BT_DBG("+");
+
+       int ret = MIME_TYPE_ERROR_NONE;
+
+       if (file_name == NULL)
+               return BLUETOOTH_ERROR_INVALID_PARAM;
+
+       ret = mime_type_get_mime_type(file_name, (gchar **)mime_type);
+
+       if (ret != MIME_TYPE_ERROR_NONE) {
+               BT_ERR("Fail to get mime type: %d", ret);
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
 void bt_destroy_popup_all(void)
 {
        syspopup_destroy_all();
@@ -252,18 +301,8 @@ struct bluetooth_headed_plugin_t headed_plugin = {
 #endif
        bt_launch_system_popup,
        bt_destroy_popup_all,
-       bt_launch_unable_to_pairing_syspopup
+       bt_launch_unable_to_pairing_syspopup,
+       bt_is_tethering_enabled,
+       bt_get_mime_type
 };
 
-
-
-
-
-
-
-
-
-
-
-
-