From: Brian Gix <brian.gix@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: inga.stotland@intel.com, michal.lowas-rzechonek@silvair.com,
brian.gix@intel.com
Subject: [PATCH BlueZ v2 5/9] mesh: Expose resources needed by Management1 interface
Date: Thu, 11 Jul 2019 15:59:48 -0700 [thread overview]
Message-ID: <20190711225952.1599-6-brian.gix@intel.com> (raw)
In-Reply-To: <20190711225952.1599-1-brian.gix@intel.com>
---
mesh/node.c | 42 ++++++++++++++++++++++++++++++++----------
mesh/node.h | 3 +++
2 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/mesh/node.c b/mesh/node.c
index 1f781cfe9..27235ef34 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -80,7 +80,8 @@ struct mesh_node {
struct l_queue *elements;
char *app_path;
char *owner;
- char *path;
+ char *obj_path;
+ struct mesh_agent *agent;
void *jconfig;
char *node_path;
uint32_t disc_watch;
@@ -242,14 +243,14 @@ static void free_node_dbus_resources(struct mesh_node *node)
l_free(node->app_path);
node->app_path = NULL;
- if (node->path) {
- l_dbus_object_remove_interface(dbus_get_bus(), node->path,
+ if (node->obj_path) {
+ l_dbus_object_remove_interface(dbus_get_bus(), node->obj_path,
MESH_NODE_INTERFACE);
- l_dbus_object_remove_interface(dbus_get_bus(), node->path,
+ l_dbus_object_remove_interface(dbus_get_bus(), node->obj_path,
MESH_MANAGEMENT_INTERFACE);
- l_free(node->path);
- node->path = NULL;
+ l_free(node->obj_path);
+ node->obj_path = NULL;
}
}
@@ -441,6 +442,11 @@ void node_cleanup_all(void)
l_dbus_unregister_interface(dbus_get_bus(), MESH_MANAGEMENT_INTERFACE);
}
+bool node_is_provisioner(struct mesh_node *node)
+{
+ return node->provisioner;
+}
+
bool node_is_provisioned(struct mesh_node *node)
{
return (!IS_UNASSIGNED(node->primary));
@@ -1026,14 +1032,14 @@ static bool register_node_object(struct mesh_node *node)
if (!hex2str(node->uuid, sizeof(node->uuid), uuid, sizeof(uuid)))
return false;
- node->path = l_strdup_printf(BLUEZ_MESH_PATH MESH_NODE_PATH_PREFIX
+ node->obj_path = l_strdup_printf(BLUEZ_MESH_PATH MESH_NODE_PATH_PREFIX
"%s", uuid);
- if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
+ if (!l_dbus_object_add_interface(dbus_get_bus(), node->obj_path,
MESH_NODE_INTERFACE, node))
return false;
- if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
+ if (!l_dbus_object_add_interface(dbus_get_bus(), node->obj_path,
MESH_MANAGEMENT_INTERFACE, node))
return false;
@@ -1509,6 +1515,9 @@ static void get_managed_objects_cb(struct l_dbus_message *msg, void *user_data)
&properties);
if (!agent)
goto fail;
+
+ node->agent = agent;
+
} else if (!strcmp(MESH_PROVISIONER_INTERFACE,
interface)) {
node->provisioner = true;
@@ -1736,7 +1745,7 @@ void node_build_attach_reply(struct mesh_node *node,
builder = l_dbus_message_builder_new(reply);
/* Node object path */
- l_dbus_message_builder_append_basic(builder, 'o', node->path);
+ l_dbus_message_builder_append_basic(builder, 'o', node->obj_path);
/* Array of element configurations "a*/
l_dbus_message_builder_enter_array(builder, "(ya(qa{sv}))");
@@ -2007,7 +2016,20 @@ char *node_path_get(struct mesh_node *node)
return node->node_path;
}
+const char *node_get_app_path(struct mesh_node *node)
+{
+ if (!node)
+ return NULL;
+
+ return node->app_path;
+}
+
struct mesh_net *node_get_net(struct mesh_node *node)
{
return node->net;
}
+
+struct mesh_agent *node_get_agent(struct mesh_node *node)
+{
+ return node->agent;
+}
diff --git a/mesh/node.h b/mesh/node.h
index 142527b30..d69887ed1 100644
--- a/mesh/node.h
+++ b/mesh/node.h
@@ -42,6 +42,7 @@ struct mesh_net *node_get_net(struct mesh_node *node);
struct mesh_node *node_find_by_addr(uint16_t addr);
struct mesh_node *node_find_by_uuid(uint8_t uuid[16]);
struct mesh_node *node_find_by_token(uint64_t token);
+bool node_is_provisioner(struct mesh_node *node);
bool node_is_provisioned(struct mesh_node *node);
bool node_app_key_delete(struct mesh_net *net, uint16_t addr,
uint16_t net_idx, uint16_t idx);
@@ -82,6 +83,7 @@ uint8_t node_friend_mode_get(struct mesh_node *node);
uint32_t node_seq_cache(struct mesh_node *node);
const char *node_get_element_path(struct mesh_node *node, uint8_t ele_idx);
const char *node_get_owner(struct mesh_node *node);
+const char *node_get_app_path(struct mesh_node *node);
bool node_add_pending_local(struct mesh_node *node, void *info);
void node_attach_io_all(struct mesh_io *io);
void node_attach_io(struct mesh_node *node, struct mesh_io *io);
@@ -99,3 +101,4 @@ void node_jconfig_set(struct mesh_node *node, void *jconfig);
void *node_jconfig_get(struct mesh_node *node);
void node_path_set(struct mesh_node *node, char *path);
char *node_path_get(struct mesh_node *node);
+struct mesh_agent *node_get_agent(struct mesh_node *node);
--
2.14.5
next prev parent reply other threads:[~2019-07-11 23:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-11 22:59 [PATCH BlueZ v2 0/9] mesh: Provisioner Initiator added Brian Gix
2019-07-11 22:59 ` [PATCH BlueZ v2 1/9] doc: Cleanup API Provisioner1 interface Brian Gix
2019-07-11 22:59 ` [PATCH BlueZ v2 2/9] mesh: Fix support for Provisioner Initiator Brian Gix
2019-07-11 22:59 ` [PATCH BlueZ v2 3/9] mesh: Add special Beacon handler for Provisioning Brian Gix
2019-07-11 22:59 ` [PATCH BlueZ v2 4/9] mesh: Expose mapping function for D-Bus errors Brian Gix
2019-07-11 22:59 ` Brian Gix [this message]
2019-07-11 22:59 ` [PATCH BlueZ v2 6/9] mesh: Fix implementation of Provisioner Initiator Brian Gix
2019-07-11 22:59 ` [PATCH BlueZ v2 7/9] mesh: Implement DBus Provisioning methods Brian Gix
2019-07-11 22:59 ` [PATCH BlueZ v2 8/9] mesh: Convert provisioning pkts to packed structs Brian Gix
2019-07-11 22:59 ` [PATCH BlueZ v2 9/9] test: This extends the mesh tool to exercise Provisioning methods Brian Gix
2019-07-12 8:39 ` [PATCH BlueZ v2 0/9] mesh: Provisioner Initiator added Michał Lowas-Rzechonek
2019-07-14 15:47 ` Gix, Brian
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=20190711225952.1599-6-brian.gix@intel.com \
--to=brian.gix@intel.com \
--cc=inga.stotland@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=michal.lowas-rzechonek@silvair.com \
/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).