Fix the coding style errors (bt-service)
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-obex-server.c
old mode 100755 (executable)
new mode 100644 (file)
index e22aada..ebc4915
 #include <dlog.h>
 #include <string.h>
 #include <dirent.h>
-#ifdef TIZEN_MDM_ENABLE
-#include <bt-service-mdm.h>
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-service-dpm.h"
 #endif
+
 #include <vconf.h>
 
 #include <gio/gio.h>
@@ -316,7 +317,7 @@ static GDBusProxy *__bt_get_transfer_properties_proxy(const char *transfer_path)
        retv_if(conn == NULL, NULL);
 
        proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
-                                       NULL,BT_OBEX_SERVICE_NAME,
+                                       NULL, BT_OBEX_SERVICE_NAME,
                                        transfer_path,
                                        BT_PROPERTIES_INTERFACE,
                                        NULL, &err);
@@ -410,7 +411,7 @@ static gboolean __bt_authorize_cb(GDBusMethodInvocation *context,
        char *device_name = NULL;
        int result = BLUETOOTH_ERROR_NONE;
        GDBusProxy *transfer_properties_proxy;
-       char * bdaddress = NULL;
+       char *bdaddress = NULL;
        GVariant *ret;
        GVariantIter *iter;
        GVariant *param = NULL;
@@ -443,10 +444,6 @@ static gboolean __bt_authorize_cb(GDBusMethodInvocation *context,
                return FALSE;
        }
 
-#ifdef TIZEN_MDM_ENABLE
-       mdm_bt_allow_t mode = MDM_BT_ALLOWED;
-#endif
-
        __bt_free_auth_info(agent_info.auth_info);
 
        agent_info.auth_info = g_malloc(sizeof(bt_auth_info_t));
@@ -457,13 +454,21 @@ static gboolean __bt_authorize_cb(GDBusMethodInvocation *context,
 
        agent_info.auth_info->transfer_path = g_strdup(path);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_HANDSFREE_ONLY) {
+               /* Free auth info in next function */
+               _bt_obex_server_reject_authorize();
+               return FALSE;
+       }
+#endif
+
        if (iter) {
                const gchar *key;
                GVariant *val;
                gsize len = 0;
                while (g_variant_iter_loop(iter, "{sv}", &key, &val)) {
                        if (g_strcmp0(key, "Name") == 0) {
-                               agent_info.auth_info->filename = g_variant_dup_string(val,&len);
+                               agent_info.auth_info->filename = g_variant_dup_string(val, &len);
                        } else if (g_strcmp0(key, "Address") == 0) {
                                bdaddress = g_variant_dup_string(val, &len);
                        } else if (g_strcmp0(key, "Size") == 0) {
@@ -871,7 +876,7 @@ int _bt_obex_server_accept_authorize(const char *filename, gboolean is_native)
                snprintf(file_path, sizeof(file_path), "%s", filename);
 
        g_dbus_method_invocation_return_value(agent_info.auth_info->reply_context,
-               g_variant_new("(s)",&file_path));
+               g_variant_new("(s)", &file_path));
        agent_info.auth_info->reply_context = NULL;
        agent_info.auth_info->file_path = g_strdup(file_path);