Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1749188ybl; Thu, 9 Jan 2020 00:40:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwp8j2H3TAuhOyfmHBxN4dz2v0TlP0x3fFADbjI389aN9DVwPH/3Dm8AIMDKnpogHOwPQ1A X-Received: by 2002:a54:4715:: with SMTP id k21mr2339188oik.163.1578559208617; Thu, 09 Jan 2020 00:40:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578559208; cv=none; d=google.com; s=arc-20160816; b=Q1lOTWZzXY1/AYyEDUef1Ek6BqVs+rwBnP5/j7bbqry6NTNL/PJpBpfg+r6Z/6Ovgo EVdOzFNzFtjqMhM8bhbyRYf3Tot4MHhSkxfsdkkKD/puzX/EPnNuQDlTDBM+DUsw0pYl QaCDvzRDBlFwk/Kqtt50Pcc13MeaXe/FCb0NAADjOb93yVM4eDASITwbPCk5yv1CJh7a rn1K+sNj5g2yRitjfSknmbNpcVxbUvLHyOob5mm1dz9grYeQlMhX97eCQhJcafmOnvnQ DJvbnEcbRHmumS7gxiJle4y3yboK3yRswW+KF/2p8/hrmc1woMUTPDjsHFm3/M/4lcoS IRsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=hGW6uQ6pZvqEoYxkVJEfXUFMgiT2O6k17c3VAbzBRlg=; b=zz/Vun+49NTVKA9hkULXwwzbP4xxkpX9bXYwaj5w215P41FqnZKxhpXhmGWtnqDFv+ r2XqTG1yaQoElncvC2dWJ7CymfXuJJIWoYuers4etco3Jh/HTCi0ttAK64UToM/XteQ0 ZEepXcKyJSh0Cc7A0zXcwvFj2L7AbUJNDHoPe6WUCr2xfvOnNOXOZeS/bafjdKEAEeHA M09IlHLfz5LCkvqK2zFpQeT81J1fhuIj8SIkUKuOjQJgwV29rXuWu6mL7ZzaE+BlvTdg 1sCcDqqai9v3y5yH4rHXM9wUu0yMzWisi1gqOLtnsq3L2zZYLdYBkVCZmwUJCHeqPrhl 0bPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=PoF8DYt6; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r22si3485775otn.192.2020.01.09.00.39.57; Thu, 09 Jan 2020 00:40:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=PoF8DYt6; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728508AbgAIIjE (ORCPT + 99 others); Thu, 9 Jan 2020 03:39:04 -0500 Received: from mail-lf1-f44.google.com ([209.85.167.44]:37980 "EHLO mail-lf1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728435AbgAIIjE (ORCPT ); Thu, 9 Jan 2020 03:39:04 -0500 Received: by mail-lf1-f44.google.com with SMTP id r14so4558407lfm.5 for ; Thu, 09 Jan 2020 00:39:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silvair-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hGW6uQ6pZvqEoYxkVJEfXUFMgiT2O6k17c3VAbzBRlg=; b=PoF8DYt61U8KN7u1wrLTWRFfgJaA+yyyakQoCqEGAUI+ogmd18ch7frqSXDndVYzwo CiwkBLDOnF37inA19TJ5gIf5aCIXIS+3WpjaPUKODoo8c04A793b99WBLrF5e8kjxYZL EcTfq/rmqsQdlaeDWQVRCsQc8kGqaBwZPS4Ag891gDy6Twqo/tYI1DAzz7YIkScICtAj xiUOru/WpRhMAn9f6fBcwkBHd0nh0UNzp3FdR1UQbEwnTqt/ox3m5HVf71iuhi+4BncZ olqPyOYtTbs035qQlTTgBL/tPZepGqVSr8mV0ea8pQeMKE6OW6PjB+OonMqRKfZwN5h7 sNrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hGW6uQ6pZvqEoYxkVJEfXUFMgiT2O6k17c3VAbzBRlg=; b=oAKUj7boFNC5ZoIEegP5Z6cwwO39AEQMLeOFJJfaZ1BXJ8ZZc4oBB9N092ZhHnWbsX ZGQEntrzWKRfJ81VQp2sasFjspKZFzDAMlMpHX4/09sUjLzATz5jOkK+K8JxjqXZkU9v ssZbFemrghodg/J7M0m3myjkgUX5eozPCujTLNUG5TSqS8K2D4C5p1OXB3gh3k3PW6q7 6yIws5SblYTw7Qzzc2ZZbkMBS26Pax3pIOLNnFfKgp2s6b2yvMEyOYi+3n5bNbeyJD4T MQIuk3x9Pfhi1vq6AkrN6m1nOc3Y73D8E3ooV4cAfJyRKVwvVJ6eF9589t6XlN5GdTZ2 DOJQ== X-Gm-Message-State: APjAAAVThDcxq4iAngrRNHsyPLsZhshNtUbxvCtS+0XNeLhAebTAQ4g4 pJ2daJLiPqqC7onvPejOeYWBgdkYelA= X-Received: by 2002:a19:7604:: with SMTP id c4mr5660265lff.101.1578559141953; Thu, 09 Jan 2020 00:39:01 -0800 (PST) Received: from mlowasrzechonek2133.silvair.lan ([217.153.94.18]) by smtp.gmail.com with ESMTPSA id b22sm2930456lji.99.2020.01.09.00.39.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2020 00:39:01 -0800 (PST) From: =?UTF-8?q?Micha=C5=82=20Lowas-Rzechonek?= 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 Message-Id: <20200109083855.16000-3-michal.lowas-rzechonek@silvair.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200109083855.16000-1-michal.lowas-rzechonek@silvair.com> References: <20200109083855.16000-1-michal.lowas-rzechonek@silvair.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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