Handling le connection interval
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-obex-agent.c
index 5d519ae..f8f3af7 100644 (file)
@@ -87,7 +87,7 @@ static const gchar obex_service_agent_xml1[] =
 "    <method name='Complete'>"
 "      <annotation name='org.freedesktop.DBus.GLib.Async' value=''/>"
 "      <arg type='o' name='transfer'/>"
- "   </method>"
+"   </method>"
 "    <method name='Release'>"
 "      <annotation name='org.freedesktop.DBus.GLib.Async' value=''/>"
 "    </method>"
@@ -122,11 +122,11 @@ static const gchar obex_service_agent_xml2[] =
 
 static const gchar obex_service_reply_xml3[] =
 "<node name='/'>"
-"       <interface name='org.bluez.obex.reply'>"
+"      <interface name='org.bluez.obex.reply'>"
 "              <method name='ReplyAuthorize'>"
-"                      <arg type='u' name='accept' direction='in'/>"
-"               </method>"
-"      </interface>"
+"                      <arg type='u' name='accept' direction='in'/>"
+"              </method>"
+"      </interface>"
 "</node>";
 
 static bt_obex_agent_info *__find_obex_agent_info(char *path)
@@ -194,9 +194,8 @@ static void __new_connection_method(GDBusConnection *connection,
                if (info->name == NULL) {
                        info->name = sender;
                } else {
-                       if (g_strcmp0(sender, info->name) != 0) {
+                       if (g_strcmp0(sender, info->name) != 0)
                                goto fail;
-                       }
                }
 
                if (info->request_cb == NULL)
@@ -240,9 +239,8 @@ static void __new_connection_method(GDBusConnection *connection,
 
                sender = (char *)g_dbus_method_invocation_get_sender(invocation);
 
-               if (g_strcmp0(sender, info->name) != 0) {
+               if (g_strcmp0(sender, info->name) != 0)
                        goto fail;
-               }
 
                if (info->progress_cb == NULL)
                        goto fail;
@@ -285,9 +283,8 @@ static void __new_connection_method(GDBusConnection *connection,
 
                sender = (char *)g_dbus_method_invocation_get_sender(invocation);
 
-               if (g_strcmp0(sender, info->name) != 0) {
+               if (g_strcmp0(sender, info->name) != 0)
                        goto fail;
-               }
 
                if (info->error_cb == NULL)
                        goto fail;
@@ -325,9 +322,8 @@ static void __new_connection_method(GDBusConnection *connection,
 
                sender = (char *)g_dbus_method_invocation_get_sender(invocation);
 
-               if (g_strcmp0(sender, info->name) != 0) {
+               if (g_strcmp0(sender, info->name) != 0)
                        goto fail;
-               }
 
                if (info->complete_cb == NULL)
                        goto fail;
@@ -364,9 +360,8 @@ static void __new_connection_method(GDBusConnection *connection,
                if (info->name) {
                        /*In H2 if user denies auth,release will come without request and hence
                        info->name will be NULL */
-                       if (g_strcmp0(sender, info->name) != 0) {
+                       if (g_strcmp0(sender, info->name) != 0)
                                goto fail;
-                       }
                }
 
                if (info->release_cb == NULL)
@@ -450,8 +445,8 @@ gboolean _bt_obex_setup(const char *path)
 {
        bt_obex_agent_info *info;
        GDBusProxy *proxy;
-       GDBusNodeInfo *new_conn_node;
-       GDBusNodeInfo *auth_reply_node;
+       GDBusNodeInfo *new_conn_node = NULL;
+       GDBusNodeInfo *auth_reply_node = NULL;
        GError *err = NULL;
 
        info = __find_obex_agent_info((char *)path);
@@ -494,6 +489,9 @@ gboolean _bt_obex_setup(const char *path)
                BT_ERR("Error while registering object");
 
        new_conn_node = g_dbus_node_info_new_for_xml(obex_service_agent_xml2, NULL);
+       if (new_conn_node == NULL)
+               return FALSE;
+
        info->obex_agent_id = g_dbus_connection_register_object(conn, info->path,
                                                new_conn_node->interfaces[0],
                                                &method_table,
@@ -508,6 +506,12 @@ gboolean _bt_obex_setup(const char *path)
        }
 
        auth_reply_node = g_dbus_node_info_new_for_xml(obex_service_reply_xml3, NULL);
+
+       if (auth_reply_node == NULL) {
+               BT_ERR("Fail to create the node info for xml");
+               return FALSE;
+       }
+
        info->obex_reply_id = g_dbus_connection_register_object(auth_reply_conn, info->path,
                auth_reply_node->interfaces[0], &method_table, NULL, NULL, &err);
        g_dbus_node_info_unref(auth_reply_node);
@@ -568,7 +572,7 @@ void _bt_obex_set_progress_cb(char *object_path,
 void _bt_obex_set_complete_cb(char *object_path,
                        bt_obex_complete_cb func, gpointer data)
 {
-       bt_obex_agent_info *info =__find_obex_agent_info(object_path);;
+       bt_obex_agent_info *info = __find_obex_agent_info(object_path);;
        if (info == NULL)
                return;