Remove some package dependencies for the headless image 74/133874/1 accepted/tizen/unified/20170615.020639 submit/tizen/20170614.010332
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 14 Jun 2017 00:03:39 +0000 (09:03 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 14 Jun 2017 00:24:49 +0000 (09:24 +0900)
capi-network-tethering and capi-content-mime-type package is not used
in the headless image. So we devide this function's usage to the headed
plugin.

Change-Id: If3810136c9bca995fe2933559e7ea8755009e57a
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-service/CMakeLists.txt
bt-service/bt-service-agent.c
bt-service/bt-service-map-client.c
bt-service/bt-service-opp-client.c
bt-service/include/bt-service-common.h
include/plugin.h
packaging/bluetooth-frwk.spec
plugin/CMakeLists.txt
plugin/headed.c

index 913185b..0002ee4 100644 (file)
@@ -61,14 +61,12 @@ SET(PKG_MODULES
        gio-2.0
        gio-unix-2.0
        alarm-service
-       capi-content-mime-type
        capi-network-connection
        pkgmgr
        cynara-client
        cynara-creds-gdbus
        eventsystem
        storage
-       capi-network-tethering
        capi-system-info
 )
 
index 3457d77..88db75a 100644 (file)
@@ -23,8 +23,6 @@
 #include <vconf.h>
 #include <bundle_internal.h>
 
-#include <tethering.h>
-
 #include "bt-internal-types.h"
 #include "bt-service-common.h"
 #include "bt-service-agent.h"
@@ -494,10 +492,8 @@ static gboolean __authorize_request(GapAgentPrivate *agent, GDBusProxy *device,
        GVariant *reply = NULL;
        GVariant *reply_temp = NULL;
        GVariant *tmp_value;
-       bool enabled;
        int result = BLUETOOTH_ERROR_NONE;
        int request_type = BT_AGENT_EVENT_AUTHORIZE_REQUEST;
-       tethering_h tethering = NULL;
 
        BT_DBG("+");
 
@@ -545,24 +541,12 @@ static gboolean __authorize_request(GapAgentPrivate *agent, GDBusProxy *device,
                                BT_ERR("Max connection exceeded");
                                goto fail;
                        }
-                       int ret;
-                       ret = tethering_create(&tethering);
-
-                       if (ret != TETHERING_ERROR_NONE) {
-                               BT_ERR("Fail to create tethering: %d", ret);
-                               goto fail;
-                       }
 
-                       enabled = tethering_is_enabled(tethering, TETHERING_TYPE_BT);
-
-                       ret = tethering_destroy(tethering);
-
-                       if (ret != TETHERING_ERROR_NONE)
-                               BT_ERR("Fail to create tethering: %d", ret);
-
-                       if (enabled != true) {
-                               BT_ERR("BT tethering is not enabled");
-                               goto fail;
+                       if (headed_plugin_info->plugin_headed_enabled) {
+                               if (headed_plugin_info->headed_plugin->bt_is_tethering_enabled() == FALSE) {
+                                       BT_ERR("BT tethering is not enabled");
+                                       goto fail;
+                               }
                        }
                }
 
index 795237a..0939bf0 100644 (file)
@@ -18,7 +18,6 @@
 #include <glib.h>
 #include <dlog.h>
 #include <string.h>
-#include <mime_type.h>
 #include <glib.h>
 #include <gio/gio.h>
 
index b6aabf9..d749aea 100644 (file)
@@ -18,7 +18,6 @@
 #include <glib.h>
 #include <dlog.h>
 #include <string.h>
-#include <mime_type.h>
 #include <glib.h>
 #include <gio/gio.h>
 
@@ -574,7 +573,7 @@ void _bt_sending_files(void)
        GError *err = NULL;
        GDBusConnection *g_conn;
        GDBusProxy *client_proxy;
-       gchar *mime_type = NULL;
+       char *mime_type = NULL;
 
        if (sending_info == NULL)
                return;
@@ -589,7 +588,9 @@ void _bt_sending_files(void)
                                                BT_OBEX_OBJECT_PUSH_INTERFACE,
                                                NULL, &err);
                ret_if(client_proxy == NULL);
-               if (mime_type_get_mime_type(sending_info->file_name_array[file_offset], &mime_type) == MIME_TYPE_ERROR_NONE) {
+               if (headed_plugin_info->plugin_headed_enabled) {
+                       if (headed_plugin_info->headed_plugin->bt_get_mime_type(sending_info->file_name_array[file_offset],
+                                       &mime_type) == BLUETOOTH_ERROR_NONE) {
                                BT_DBG("MLME type = %s", mime_type);
 
                                /* For IOPT compliance, change "text/x-iMelody" to "audio/imelody"
@@ -603,6 +604,7 @@ void _bt_sending_files(void)
                                        strncpy(mime_type, "text/x-vcard", BT_MIME_TYPE_MAX_LEN);
                                        BT_DBG("over writing mime type to  = %s", mime_type);
                                }
+                       }
                }
 
                BT_DBG("Calling SendFile");
index ca4ae48..b8b5c3d 100644 (file)
@@ -345,6 +345,8 @@ struct bluetooth_headed_plugin_t {
                                                        const char *agent_path);
        void (*bt_destroy_popup_all)(void);
        gboolean (*bt_launch_unable_to_pairing_syspopup)(int result);
+       gboolean (*bt_is_tethering_enabled)(void);
+       int (*bt_get_mime_type)(char *file_name, char **mime_type);
 };
 
 typedef struct {
index 3451a15..0112dc4 100644 (file)
@@ -90,6 +90,8 @@ struct bluetooth_headed_plugin_t {
 
        void (*bt_destroy_popup_all)(void);
        gboolean (*bt_launch_unable_to_pairing_syspopup)(int result);
+       gboolean (*bt_is_tethering_enabled)(void);
+       int (*bt_get_mime_type)(char *file_name, char **mime_type);
 };
 
 #ifdef TIZEN_FEATURE_BT_DPM
index f0bf497..00b16d0 100644 (file)
@@ -8,7 +8,7 @@
 
 Name:       bluetooth-frwk
 Summary:    Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
-Version:    0.2.157
+Version:    0.2.158
 Release:    1
 Group:      Network & Connectivity/Bluetooth
 License:    Apache-2.0
index 4558d03..d46b329 100755 (executable)
@@ -20,6 +20,8 @@ PKG_CHECK_MODULES(pkgs_headed REQUIRED
        eventsystem
        syspopup-caller
        capi-system-info
+       capi-network-tethering
+       capi-content-mime-type
        )
 
 FOREACH(flag ${pkgs_headed_CFLAGS})
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
 };
 
-
-
-
-
-
-
-
-
-
-
-
-