Skip to contentSkip to conversation

Start implementing mesh Management interface

PATCH In review Inga Stotland 2 participants 4 messages May 14, 2019 – May 15, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Start implementing mesh Management interface

This patch set ads a sketleton for org.bluez.mesh.Management1 interface. Also, adds check for the existence of the provisioning agent for an attaching node: this information will be further used to validate number of method calls on Management interface

Inga Stotland (2):
mesh: Add check for org.bluez.mesh.Provisioner1 interface
mesh: Add skeleton for org.bluez.mesh.Management1 interface

 Makefile.mesh  |   1 +
 mesh/dbus.c    |  12 ++-
 mesh/error.h   |   1 +
 mesh/manager.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++
 mesh/manager.h |  20 ++++
 mesh/mesh.h    |   4 +-
 mesh/node.c    |   5 +-
 7 files changed, 303 insertions(+), 6 deletions(-)
 create mode 100644 mesh/manager.c
 create mode 100644 mesh/manager.h
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/2 mesh: Add check for org.bluez.mesh.Provisioner1 interface

This adds check for the presence of org.bluez.mesh.Provisioner1 interface when collecting information about mesh application that is received in callback of GetManagedObjects() method. Set "provisioner" flag in the node structure to trueto indicate that the node may act aa a provisioner.

---
 mesh/mesh.h | 3 ++-
 mesh/node.c | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
mesh/mesh.h +2 -1
index ff4e04fa1..9b63500d1 100644
@@ -2,7 +2,7 @@
  *
  *  BlueZ - Bluetooth protocol stack for Linux
  *
- *  Copyright (C) 2018  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2018-2019  Intel Corporation. All rights reserved.
  *
  *
  *  This library is free software; you can redistribute it and/or
@@ -24,6 +24,7 @@
 #define MESH_ELEMENT_INTERFACE "org.bluez.mesh.Element1"
 #define MESH_APPLICATION_INTERFACE "org.bluez.mesh.Application1"
 #define MESH_PROVISION_AGENT_INTERFACE "org.bluez.mesh.ProvisionAgent1"
+#define MESH_PROVISIONER_INTERFACE "org.bluez.mesh.Provisioner1"
 #define ERROR_INTERFACE "org.bluez.mesh.Error"
 
 typedef void (*prov_rx_cb_t)(void *user_data, const uint8_t *data,
mesh/node.c +4 -1
index 3618595b3..21dcfd007 100644
@@ -2,7 +2,7 @@
  *
  *  BlueZ - Bluetooth protocol stack for Linux
  *
- *  Copyright (C) 2017-2018  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2017-2019  Intel Corporation. All rights reserved.
  *
  *
  *  This library is free software; you can redistribute it and/or
@@ -1492,6 +1492,9 @@ static void get_managed_objects_cb(struct l_dbus_message *msg, void *user_data)
 								&properties);
 				if (!agent)
 					goto fail;
+			} else if (!strcmp(MESH_PROVISIONER_INTERFACE,
+								interface)) {
+				node->provisioner = true;
 			}
 		}
 	}
Signature · 1 line
2.21.0
#2 lore raw

PATCH 2/2 mesh: Add skeleton for org.bluez.mesh.Management1 interface

In reply to Inga Stotland

This adds bare-bones imlementation of methods on org.bluez.mesh.Management1 interface.

---
 Makefile.mesh  |   1 +
 mesh/dbus.c    |  12 ++-
 mesh/error.h   |   1 +
 mesh/manager.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++
 mesh/manager.h |  20 ++++
 mesh/mesh.h    |   1 +
 6 files changed, 297 insertions(+), 4 deletions(-)
 create mode 100644 mesh/manager.c
 create mode 100644 mesh/manager.h
Makefile.mesh +1 -0
index bccd4d946..d494287ab 100644
@@ -24,6 +24,7 @@ mesh_sources = mesh/mesh.h mesh/mesh.c \
 				mesh/dbus.h mesh/dbus.c \
 				mesh/agent.h mesh/agent.c \
 				mesh/prov-acceptor.c mesh/prov-initiator.c \
+				mesh/manager.h mesh/manager.c \
 				mesh/pb-adv.h mesh/pb-adv.c \
 				mesh/keyring.h mesh/keyring.c \
 				mesh/mesh-defs.h
mesh/dbus.c +8 -4
index 3b2e2aa81..083a7f77e 100644
@@ -2,7 +2,7 @@
  *
  *  BlueZ - Bluetooth protocol stack for Linux
  *
- *  Copyright (C) 2018  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2018-2019 Intel Corporation. All rights reserved.
  *
  *
  *  This library is free software; you can redistribute it and/or
@@ -33,10 +33,9 @@
 #include "mesh/mesh-defs.h"
 #include "mesh/mesh-io.h"
 #include "mesh/node.h"
+#include "mesh/manager.h"
 #include "mesh/net.h"
-#include "mesh/storage.h"
 #include "mesh/cfgmod.h"
-#include "mesh/model.h"
 #include "mesh/mesh.h"
 #include "mesh/error.h"
 #include "mesh/dbus.h"
@@ -62,7 +61,8 @@ static struct error_entry const error_table[] =
 	{ ERROR_INTERFACE ".InProgress", "Already in progress"},
 	{ ERROR_INTERFACE ".AlreadyExists", "Already exists"},
 	{ ERROR_INTERFACE ".DoesNotExist", "Does not exist"},
-	{ ERROR_INTERFACE ".Canceled", "Operation canceled"}
+	{ ERROR_INTERFACE ".Canceled", "Operation canceled"},
+	{ ERROR_INTERFACE ".NotImplemented", "Not implemented"},
 };
 
 struct l_dbus_message *dbus_error(struct l_dbus_message *msg, int err,
@@ -99,6 +99,10 @@ bool dbus_init(struct l_dbus *bus)
 	if (!node_dbus_init(bus))
 		return false;
 
+	/* Management interface */
+	if (!manager_dbus_init(bus))
+		return false;
+
 	dbus = bus;
 
 	return true;
mesh/error.h +1 -0
index a6aaa2fef..1669c070a 100644
@@ -31,4 +31,5 @@ enum mesh_error {
 	MESH_ERROR_ALREADY_EXISTS,
 	MESH_ERROR_DOES_NOT_EXIST,
 	MESH_ERROR_CANCELED,
+	MESH_ERROR_NOT_IMPLEMENTED,
 };
mesh/manager.c new file +266 -0

266 lines not on this page · raw message

mesh/manager.h new file +20 -0
new file mode 100644
index 000000000..f27ca4181
@@ -0,0 +1,20 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2019  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ */
+
+bool manager_dbus_init(struct l_dbus *dbus);
mesh/mesh.h +1 -0
index 9b63500d1..320a108ed 100644
@@ -21,6 +21,7 @@
 
 #define MESH_NETWORK_INTERFACE "org.bluez.mesh.Network1"
 #define MESH_NODE_INTERFACE "org.bluez.mesh.Node1"
+#define MESH_MANAGEMENT_INTERFACE "org.bluez.mesh.Management1"
 #define MESH_ELEMENT_INTERFACE "org.bluez.mesh.Element1"
 #define MESH_APPLICATION_INTERFACE "org.bluez.mesh.Application1"
 #define MESH_PROVISION_AGENT_INTERFACE "org.bluez.mesh.ProvisionAgent1"
Signature · 1 line
2.21.0
#3 lore raw
In reply to Inga Stotland

Patch-set applied

Quoted 20 lines · Inga Stotland

This patch set ads a sketleton for org.bluez.mesh.Management1 interface. Also, adds check for the existence of the provisioning agent for an attaching node: this information will be further used to validate number of method calls on Management interface

Inga Stotland (2):
mesh: Add check for org.bluez.mesh.Provisioner1 interface
mesh: Add skeleton for org.bluez.mesh.Management1 interface

 Makefile.mesh  |   1 +
 mesh/dbus.c    |  12 ++-
 mesh/error.h   |   1 +
 mesh/manager.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++
 mesh/manager.h |  20 ++++
 mesh/mesh.h    |   4 +-
 mesh/node.c    |   5 +-
 7 files changed, 303 insertions(+), 6 deletions(-)
 create mode 100644 mesh/manager.c
 create mode 100644 mesh/manager.h