From: "Michał Lowas-Rzechonek" <michal.lowas-rzechonek@silvair.com>
To: linux-bluetooth@vger.kernel.org
Subject: [RFC BlueZ 2/2] mesh: Change BeaconFlags property type to a dict
Date: Thu, 9 Jan 2020 09:38:55 +0100 [thread overview]
Message-ID: <20200109083855.16000-3-michal.lowas-rzechonek@silvair.com> (raw)
In-Reply-To: <20200109083855.16000-1-michal.lowas-rzechonek@silvair.com>
Instead of a binary value, return a dictionary consistent with
"flags" argument used in Import().
---
doc/mesh-api.txt | 18 ++++++++++++++----
mesh/node.c | 13 +++++++++++--
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/doc/mesh-api.txt b/doc/mesh-api.txt
index b33c24e12..33077bcfc 100644
--- a/doc/mesh-api.txt
+++ b/doc/mesh-api.txt
@@ -432,11 +432,21 @@ Properties:
This property indicates whether the periodic beaconing is
enabled (true) or disabled (false).
- uint8 BeaconFlags [read-only]
+ dict BeaconFlags [read-only]
- This property may be read at any time to determine the flag
- field setting on sent and received beacons of the primary
- network key.
+ This property may be read at any time to determine the flags
+ used in network beacons of the primary network key. Supported
+ values are:
+
+ boolean IvUpdate
+
+ When true, indicates that the network is in the
+ middle of IV Index Update procedure.
+
+ boolean KeyRefresh
+
+ When true, indicates that the network is in the
+ middle of a key refresh procedure.
uint32 IvIndex [read-only]
diff --git a/mesh/node.c b/mesh/node.c
index 0ad935105..0e28c650b 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -32,6 +32,7 @@
#include "mesh/mesh-defs.h"
#include "mesh/mesh.h"
#include "mesh/net.h"
+#include "mesh/net-keys.h"
#include "mesh/appkey.h"
#include "mesh/mesh-config.h"
#include "mesh/provision.h"
@@ -2233,10 +2234,18 @@ static bool beaconflags_getter(struct l_dbus *dbus, struct l_dbus_message *msg,
struct mesh_net *net = node_get_net(node);
uint8_t flags;
uint32_t iv_index;
+ bool ivu;
+ bool kr;
mesh_net_get_snb_state(net, &flags, &iv_index);
- l_dbus_message_builder_append_basic(builder, 'y', &flags);
+ ivu = flags & IV_INDEX_UPDATE;
+ kr = flags & KEY_REFRESH;
+
+ l_dbus_message_builder_enter_array(builder, "{sv}");
+ dbus_append_dict_entry_basic(builder, "IvUpdate", "b", &ivu);
+ dbus_append_dict_entry_basic(builder, "KeyRefresh", "b", &kr);
+ l_dbus_message_builder_leave_array(builder);
return true;
}
@@ -2337,7 +2346,7 @@ static void setup_node_interface(struct l_dbus_interface *iface)
l_dbus_interface_property(iface, "Features", 0, "a{sv}", features_getter,
NULL);
l_dbus_interface_property(iface, "Beacon", 0, "b", beacon_getter, NULL);
- l_dbus_interface_property(iface, "BeaconFlags", 0, "b",
+ l_dbus_interface_property(iface, "BeaconFlags", 0, "a{sv}",
beaconflags_getter, NULL);
l_dbus_interface_property(iface, "IvIndex", 0, "u", ivindex_getter,
NULL);
--
2.19.1
next prev parent reply other threads:[~2020-01-09 8:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-09 8:38 [RFC BlueZ 0/2] Fix types and names of beacon/import flags Michał Lowas-Rzechonek
2020-01-09 8:38 ` [RFC BlueZ 1/2] mesh: Rename IVUpdate import flag to IvUpdate Michał Lowas-Rzechonek
2020-01-09 8:38 ` Michał Lowas-Rzechonek [this message]
2020-01-21 20:15 ` [RFC BlueZ 0/2] Fix types and names of beacon/import flags Michał Lowas-Rzechonek
2020-01-22 0:44 ` Stotland, Inga
2020-01-22 1:14 ` Gix, Brian
2020-01-22 17:13 ` michal.lowas-rzechonek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200109083855.16000-3-michal.lowas-rzechonek@silvair.com \
--to=michal.lowas-rzechonek@silvair.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).