Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1635467ybt; Mon, 15 Jun 2020 05:44:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm8052xmznCYyYFoDV96FpP0Wong2UnOW6O+4G37o+z2mCH6SQjJUNOMiE7T7sQCVklp5m X-Received: by 2002:a17:906:ae81:: with SMTP id md1mr13155913ejb.128.1592225086135; Mon, 15 Jun 2020 05:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592225086; cv=none; d=google.com; s=arc-20160816; b=v45kpt2vrUxbycQvvtOdSWBRlMXKXndkqLRYInYXQxlUsUO++uMJz5mYD3l11ssTLu Ctvli27+7KCsvlmkFzJYWnFysZ10eZBdo++y9gmeLU3v4gyWMSbgWSuliqTjaFJreOle H86ZhdSXAkP2cQkThEWXrlwTQQx6GKp6CF4iSJRWaOBzhcZk3NBwVmdjIlsiXj9mSeyj ilBFONmuGYBQMsAGqauPvObRjRpoeYc58xy7A9DlEAWisiQ8gb6eoWJf0jThvG8tCFqk awIYO99ieeBieLjjQxvfz3rdG1uA+wAoPN4pxpKzg5+rH6AKWqCNqrUS+wmn36EcX5oD w2uA== 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 :message-id:date:subject:to:from:dkim-signature; bh=4hLQBaK4uf5u7ueEngGcyHZ26nc7pao38tXlhI/74uo=; b=KZ+OxfVv7f4tMB4FexKNp+o7pJwhmCw18KDm2siQumPBPHMuNoXh3Qu+kcRSiWuBk3 UKDSWluML5ztTnnZzTH9B4dii4DtAH6QYjuF63i7ptFNvCDcdjh+X44A0MxFyXSYUZI/ ba31FJIVg+nXpkyLzj0sHYxhx/ydEWKXtpiWAAml9xO5Dz2LsQZy3n2MMvhOBTpHzQiU tmQ3Fu4vbiB4uQcxGVrxvdgX6ChZDvGPhUoutUOvPgj/OgkOBPmRJ5ZTQAPvsHgrrMCm nhsb+fCAyX/NAABbxxst+pe9gGBEsgeZSBNiQRsEXPlTutTXrN8n3CkmVinAMOQvjtUn rBaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=xCyEkhze; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si8936380edr.276.2020.06.15.05.44.22; Mon, 15 Jun 2020 05:44:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=xCyEkhze; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728326AbgFOMlo (ORCPT + 99 others); Mon, 15 Jun 2020 08:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728285AbgFOMlo (ORCPT ); Mon, 15 Jun 2020 08:41:44 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9625AC061A0E for ; Mon, 15 Jun 2020 05:41:42 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id o4so1805759lfi.7 for ; Mon, 15 Jun 2020 05:41:42 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=4hLQBaK4uf5u7ueEngGcyHZ26nc7pao38tXlhI/74uo=; b=xCyEkhzeXk3X80q1Q1eWY7hgwD7gmMapxsuIIPV8+X0hWcC1ij+KdG3bb9vpfd/GNN e8PA1hT/Bt0iSsY3iODxXgh5bV73tdxpVyjvOWJgfkNqdHdCw2ez1c2yHonKU9tClHLW Vte0dwey/8BuKpMByVkyGkK8hnik2WgVtXVviAN7dQkYh67QbmIWeKsCPMT+cnY1ljGz ORI5R/XVvHn2zH5UCxoRNiLMpb1xypcozHDl+dzxikxWBWcnPBj4qI7Qz9C/xYvV2aMc JiahUQn0Fijc8QA3oauzDiT1Gm1SYwjHar2pZ1VBBc8SnOTLehCJSr47BjI9tZ6v8h49 TUJA== 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:mime-version :content-transfer-encoding; bh=4hLQBaK4uf5u7ueEngGcyHZ26nc7pao38tXlhI/74uo=; b=GjWbYstOzn2XXdi5LguLvl5oO9RWrJmckAMdFa3uEmFd8yVyDI2cCxynmXEwl3uyW2 sON5I4cR7MUihhX38NBL/x/NDyCgjdne9DA9xrcW0ufs1VXWqKqlitzwtKPXyV3QnYRZ J8bY/F0z/BhXIHaWjlQcHhqsmDWBFvWPuqbh54kJKzWAhZaOkiHlxRIS8Khyex5daLRt rL4tN7+1+NfZw5V9q7kzlr19KRKlFWuYN2IsnJvB4AM6c6I0Y9JA6Io9HNl7UPBe+i+a wikB25cUwTOdpRrcP+SS7QzuKlqF3YBDkiiXpZVuFYD2A+JIxDX3fqOODtmH5jOOT4eF ywOg== X-Gm-Message-State: AOAM530cMkfVjwc1IsTf4wyVEXfxFiJBiby2xYEGME2JE6jkvQArWxuY 0z7ZZZJYXsaZXzvc9/a3W98ncvARuNufsw== X-Received: by 2002:ac2:544b:: with SMTP id d11mr13524897lfn.157.1592224900805; Mon, 15 Jun 2020 05:41:40 -0700 (PDT) Received: from mlowasrzechonek2133.silvair.lan ([217.153.94.18]) by smtp.gmail.com with ESMTPSA id b10sm3398821lfi.20.2020.06.15.05.41.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2020 05:41:40 -0700 (PDT) From: =?UTF-8?q?Micha=C5=82=20Lowas-Rzechonek?= To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] mesh: Change BeaconFlags property type to a dict Date: Mon, 15 Jun 2020 14:41:58 +0200 Message-Id: <20200615124158.12163-1-michal.lowas-rzechonek@silvair.com> X-Mailer: git-send-email 2.20.1 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 7fbab32b6..26bc92807 100644 --- a/doc/mesh-api.txt +++ b/doc/mesh-api.txt @@ -431,11 +431,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 6140fdf9f..87a85a44d 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" @@ -2191,10 +2192,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; } @@ -2295,7 +2304,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, "y", + l_dbus_interface_property(iface, "BeaconFlags", 0, "a{sv}", beaconflags_getter, NULL); l_dbus_interface_property(iface, "IvIndex", 0, "u", ivindex_getter, NULL); -- 2.20.1