Fix svace 2.2 version issues
[platform/core/connectivity/bluetooth-frwk.git] / bt-core / bt-core-dbus-handler.c
old mode 100644 (file)
new mode 100755 (executable)
index 5e6b500..c9c07c3
@@ -1,11 +1,5 @@
 /*
- * Bluetooth-frwk
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *              Girishashok Joshi <girish.joshi@samsung.com>
- *              Chanyeol Park <chanyeol.park@samsung.com>
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -35,7 +29,7 @@
 #define BT_SERVICE_NAME                "org.projectx.bt"
 #define BT_SERVICE_PATH                "/org/projectx/bt_service"
 
-#ifdef HPS_FEATURE
+#ifdef TIZEN_FEATURE_BT_HPS
 #define BT_HPS_SERVICE_NAME "org.projectx.httpproxy"
 #define BT_HPS_OBJECT_PATH "/org/projectx/httpproxy"
 #define BT_HPS_INTERFACE_NAME "org.projectx.httpproxy_service"
@@ -43,7 +37,7 @@
 
 static GDBusConnection *service_gconn;
 static GDBusProxy *service_gproxy;
-#ifdef HPS_FEATURE
+#ifdef TIZEN_FEATURE_BT_HPS
 static GDBusProxy *hps_gproxy;
 #endif
 
@@ -85,8 +79,6 @@ static GDBusProxy *__bt_core_gdbus_init_service_proxy(void)
        GError *err = NULL;
        GDBusConnection *conn;
 
-       g_type_init();
-
        conn = _bt_core_get_gdbus_connection();
        if (!conn)
                return NULL;
@@ -116,7 +108,7 @@ GDBusProxy *_bt_core_gdbus_get_service_proxy(void)
        return (service_gproxy) ? service_gproxy : __bt_core_gdbus_init_service_proxy();
 }
 
-#ifdef HPS_FEATURE
+#ifdef TIZEN_FEATURE_BT_HPS
 int _bt_core_start_httpproxy(void)
 {
        GVariant *variant = NULL;
@@ -167,8 +159,6 @@ static GDBusProxy *_bt_core_gdbus_init_hps_proxy(void)
        GError *err = NULL;
        GDBusConnection *conn;
 
-       g_type_init();
-
        BT_DBG(" ");
 
        conn = _bt_core_get_gdbus_connection();
@@ -209,7 +199,7 @@ void _bt_core_gdbus_deinit_proxys(void)
                service_gproxy = NULL;
        }
 
-#ifdef HPS_FEATURE
+#ifdef TIZEN_FEATURE_BT_HPS
        if (hps_gproxy) {
                g_object_unref(hps_gproxy);
                hps_gproxy = NULL;
@@ -228,7 +218,7 @@ int _bt_core_service_request(int service_type, int service_function,
                        GArray **out_param1)
 {
        GDBusProxy  *proxy;
-       GVariant *ret;
+       GVariant *ret = NULL;
        GVariant *param1;
        GVariant *param2;
        GVariant *param3;
@@ -334,6 +324,9 @@ static const gchar bt_core_introspection_xml[] =
 "     </method>"
 "     <method name='EnableCore'>"
 "     </method>"
+"        <method name='SetTransferValue'>"
+"          <arg type='b' name='value' direction='in'/>"
+"        </method>"
 "     <method name='FactoryTestMode'>"
 "          <arg type='s' name='type' direction='in'/>"
 "          <arg type='s' name='arg' direction='in'/>"
@@ -371,6 +364,13 @@ static void __bt_core_dbus_method(GDBusConnection *connection,
                ret = _bt_core_disable_adapter_le();
        } else if (g_strcmp0(method_name, "EnableCore") == 0) {
                ret = _bt_core_enable_core();
+       } else if (g_strcmp0(method_name, "SetTransferValue") == 0) {
+               gboolean value = FALSE;
+
+               g_variant_get(parameters, "(b)", &value);
+               BT_DBG("Transfer value: %d", value);
+
+               ret = _bt_core_set_transfer_value(value);
        } else if (g_strcmp0(method_name, "FactoryTestMode") == 0) {
                const char *type = NULL;
                const char *arg = NULL;
@@ -477,9 +477,9 @@ static void __bt_core_event_filter(GDBusConnection *connection,
                g_variant_get(parameters, "(&o@a{sa{sv}})",
                                                &obj_path, &optional_param);
 
-               if (g_strcmp0(obj_path, "/org/bluez/hci0") == 0) {
+               if (g_strcmp0(obj_path, "/org/bluez/hci0") == 0)
                        _bt_core_adapter_added_cb();
-               }
+
        } else if (!g_strcmp0(signal_name, "InterfacesRemoved")) {
                char *obj_path = NULL;
                GVariant *optional_param;
@@ -487,9 +487,9 @@ static void __bt_core_event_filter(GDBusConnection *connection,
                g_variant_get(parameters, "(&o@as)", &obj_path,
                                                        &optional_param);
 
-               if (g_strcmp0(obj_path, "/org/bluez/hci0") == 0) {
+               if (g_strcmp0(obj_path, "/org/bluez/hci0") == 0)
                        _bt_core_adapter_removed_cb();
-               }
+
        } else { /* NameOwnerChanged */
                const char *name = NULL;
                const char *old_owner = NULL;