Fix LE discovery state miss-matching issue
[platform/core/connectivity/bluetooth-frwk.git] / bt-otp / bt-otpserver.c
index ae40cef..903caee 100644 (file)
 #define BT_DBG(fmt, arg...) SLOGD(fmt, ##arg)
 
 /* OTP object paths */
-char *otp_obj_path = NULL;
-char *otp_feature_obj_path = NULL;
-char *otp_object_name_obj_path = NULL;
-char *otp_object_type_obj_path = NULL;
-char *otp_object_size_obj_path = NULL;
-char *otp_object_first_created_obj_path = NULL;
-char *otp_object_last_modified_obj_path = NULL;
-char *otp_object_id_obj_path = NULL;
-char *otp_object_prop_obj_path = NULL;
-char *otp_oacp_obj_path = NULL;
-char *otp_olcp_obj_path = NULL;
-char *otp_oacp_desc_obj_path = NULL;
-char *otp_olcp_desc_obj_path = NULL;
+static char *otp_obj_path = NULL;
+static char *otp_feature_obj_path = NULL;
+static char *otp_object_name_obj_path = NULL;
+static char *otp_object_type_obj_path = NULL;
+static char *otp_object_size_obj_path = NULL;
+static char *otp_object_first_created_obj_path = NULL;
+static char *otp_object_last_modified_obj_path = NULL;
+static char *otp_object_id_obj_path = NULL;
+static char *otp_object_prop_obj_path = NULL;
+static char *otp_oacp_obj_path = NULL;
+static char *otp_olcp_obj_path = NULL;
+static char *otp_oacp_desc_obj_path = NULL;
+static char *otp_olcp_desc_obj_path = NULL;
 
 static GMainLoop *main_loop;
-GDBusNodeInfo *otp_node_info = NULL;
+static GDBusNodeInfo *otp_node_info = NULL;
 static GDBusConnection *conn;
 static GDBusConnection *g_conn;
 
@@ -113,13 +113,13 @@ static guint curr_obj_index;
 static int adv_handle = 0;
 static gboolean OACP_indicate = FALSE;
 static gboolean OLCP_indicate = FALSE;
-char *directory = NULL;
-gboolean mutiple_obj_support = false;
+static char *directory = NULL;
+static gboolean mutiple_obj_support = false;
 static gboolean otc_connection_status = FALSE;
-struct oacp_operation *oacp_op = NULL;
-unsigned int timeout_id;
-unsigned int oacp_create_timeout_id;
-uint64_t curr_obj_id, prev_obj_id;
+static struct oacp_operation *oacp_op = NULL;
+static unsigned int timeout_id;
+static unsigned int oacp_create_timeout_id;
+static uint64_t curr_obj_id, prev_obj_id;
 static gboolean oacp_create = FALSE;
 
 static const gchar otp_introspection_xml[] =
@@ -693,7 +693,7 @@ static void _bt_otp_method(GDBusConnection *connection,
                struct stat st;
                struct object_metadata *object = NULL;
 
-               g_variant_get(parameters, "(s)", &directory);
+               g_variant_get(parameters, "(&s)", &directory);
                BT_DBG("Directory = [%s]", directory);
 
                dir = g_dir_open(directory, 0, &error);
@@ -789,7 +789,7 @@ fail:
                char address[BT_ADDRESS_STRING_SIZE] = { 0 };
                int fd;
 
-               g_variant_get(parameters, "(oh)", &dev_path, &index);
+               g_variant_get(parameters, "(&oh)", &dev_path, &index);
 
                msg = g_dbus_method_invocation_get_message(invocation);
                fd_list = g_dbus_message_get_unix_fd_list(msg);
@@ -2173,7 +2173,7 @@ int _bt_otp_init_event_receiver()
                                        NULL, NULL);
 
        device_property_sub_id = g_dbus_connection_signal_subscribe(conn,
-                               NULL, BT_PROPERTIES_INTERFACE,
+                               BT_BLUEZ_NAME, BT_PROPERTIES_INTERFACE,
                                PROPERTIES_CHANGED, NULL, NULL, 0,
                                _bt_otp_device_property_event_filter,
                                NULL, NULL);