[RFC BlueZ 2/2] mesh: Change BeaconFlags property type to a dict

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux