summaryrefslogtreecommitdiffstats
path: root/network/server.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-04-17 19:48:53 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-04-17 19:48:53 +0000
commit4bae43ca784e1c1cb9d6da6b748c93532fc05c00 (patch)
treedbfcaf7285889fb58feea3e0762fd890ce8fe8b4 /network/server.c
parentf9398eaf08b49c1e8af5bc87a4b19d862ab5a4de (diff)
Add GetInfo to network.Server interface.
Diffstat (limited to 'network/server.c')
-rw-r--r--network/server.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/network/server.c b/network/server.c
index 7f4fbcf6..f6f54474 100644
--- a/network/server.c
+++ b/network/server.c
@@ -50,6 +50,7 @@
#include "dbus.h"
#include "error.h"
#include "textfile.h"
+#include "dbus-helper.h"
#define NETWORK_SERVER_INTERFACE "org.bluez.network.Server"
@@ -937,6 +938,38 @@ static DBusHandlerResult get_security(DBusConnection *conn,
return send_message_and_unref(conn, reply);
}
+static DBusHandlerResult get_info(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct network_server *ns = data;
+ DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ const char *uuid;
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ dbus_message_iter_init_append(reply, &iter);
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+
+ dbus_message_iter_append_dict_entry(&dict, "name",
+ DBUS_TYPE_STRING, &ns->name);
+
+ uuid = bnep_uuid(ns->id);
+ dbus_message_iter_append_dict_entry(&dict, "uuid",
+ DBUS_TYPE_STRING, &uuid);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
+ return send_message_and_unref(conn, reply);
+}
+
static DBusHandlerResult server_message(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -975,6 +1008,9 @@ static DBusHandlerResult server_message(DBusConnection *conn,
if (strcmp(member, "GetSecurity") == 0)
return get_security(conn, msg, data);
+ if (strcmp(member, "GetInfo") == 0)
+ return get_info(conn, msg, data);
+
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}