GetProperties() is declared as obsolete but might be useful in certain
occasion.
---
doc/peer-api.txt | 12 +++++++++++-
src/peer.c | 20 ++++++++++++++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/doc/peer-api.txt b/doc/peer-api.txt
index c54d785..e38066f 100644
--- a/doc/peer-api.txt
+++ b/doc/peer-api.txt
@@ -5,7 +5,17 @@ Service net.connman
Interface net.connman.Peer
Object path [variable prefix]/{peer0,peer1,...}
-Methods void Connect() [experimental]
+Methods dict GetProperties() [deprecated]
+
+ Returns properties for the peer object. See the
+ properties sections for available properties.
+
+ Usage of this method is highly discouraged. Use
+ the Manager.GetPeers() method instead.
+
+ Possible Errors: [service].Error.InvalidArguments
+
+ void Connect() [experimental]
Connect this peer.
diff --git a/src/peer.c b/src/peer.c
index b949d0f..ce3b582 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -60,6 +60,23 @@ static void append_properties(DBusMessageIter *iter, struct
connman_peer *peer)
connman_dbus_dict_close(iter, &dict);
}
+static DBusMessage *get_peer_properties(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct connman_peer *peer = data;
+ DBusMessageIter dict;
+ DBusMessage *reply;
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return NULL;
+
+ dbus_message_iter_init_append(reply, &dict);
+ append_properties(&dict, peer);
+
+ return reply;
+}
+
static void append_peer_struct(gpointer key, gpointer value,
gpointer user_data)
{
@@ -213,6 +230,9 @@ void connman_peer_set_name(struct connman_peer *peer, const
char *name)
}
static const GDBusMethodTable peer_methods[] = {
+ { GDBUS_METHOD("GetProperties",
+ NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
+ get_peer_properties) },
{ GDBUS_ASYNC_METHOD("Connect", NULL, NULL, NULL) },
{ GDBUS_METHOD("Disconnect", NULL, NULL, NULL) },
{ },
--
1.8.3.2
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman