All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/4] Mesh send/publish API change
@ 2020-08-24  3:54 Inga Stotland
  2020-08-24  3:54 ` [PATCH BlueZ 1/4] doc/mesh-api: Add "options" dictionary to Send/Publish Inga Stotland
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Inga Stotland @ 2020-08-24  3:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, Inga Stotland

This patch set modifies Send, DevKeySend, Publish & VendorPublish
methods on bleuz.mesh.Node interface to include additional argument
"options".
This new argument is a dictionary that currently has only one
new key word defined:
    "ForceSegmented" - to force small payloads to be sent as
    		      one-segment messages

Other key words may be defined in future to accommodate evolving
requirements of Mesh Profile specification.


Inga Stotland (4):
  doc/mesh-api: Add "options" dictionary to Send/Publish
  mesh: Handle "options" dictionary in Send/Publish methods
  tools/mesh-cfglient: Add "options" to Send/DevKeySend
  test/test-mesh: Add "options" to Send/Publish

 doc/mesh-api.txt       | 47 ++++++++++++++++++--
 mesh/cfgmod-server.c   |  2 +-
 mesh/model.c           |  6 +--
 mesh/model.h           |  9 ++--
 mesh/node.c            | 99 +++++++++++++++++++++++++++++-------------
 test/test-mesh         | 10 ++++-
 tools/mesh-cfgclient.c |  8 ++++
 7 files changed, 136 insertions(+), 45 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH BlueZ 1/4] doc/mesh-api: Add "options" dictionary to Send/Publish
  2020-08-24  3:54 [PATCH BlueZ 0/4] Mesh send/publish API change Inga Stotland
@ 2020-08-24  3:54 ` Inga Stotland
  2020-08-24  4:27   ` [BlueZ,1/4] " bluez.test.bot
  2020-08-24 15:04   ` [PATCH BlueZ 1/4] " Gix, Brian
  2020-08-24  3:54 ` [PATCH BlueZ 2/4] mesh: Handle "options" dictionary in Send/Publish methods Inga Stotland
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 7+ messages in thread
From: Inga Stotland @ 2020-08-24  3:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, Inga Stotland

This modifies Send, DevKeySend, Publish & VendorPublish methods
on mesh.Node interface to include additional argument "options".
This new argument is a dictionary that currently has only one
new key word defined:
    "ForceSegmented" - to force small payloads to be sent as
    		      one-segment messages

Other key words may be defined in future to accommodate evolving
requirements of Mesh Profile specification.
---
 doc/mesh-api.txt | 47 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/doc/mesh-api.txt b/doc/mesh-api.txt
index 495f95b0b..f836142a7 100644
--- a/doc/mesh-api.txt
+++ b/doc/mesh-api.txt
@@ -229,7 +229,7 @@ Object path	/org/bluez/mesh/node<uuid>
 
 Methods:
 	void Send(object element_path, uint16 destination, uint16 key_index,
-							array{byte} data)
+						dict options, array{byte} data)
 
 		This method is used to send a message originated by a local
 		model.
@@ -248,6 +248,14 @@ Methods:
 		this element. Otherwise, org.bluez.mesh.Error.NotAuthorized will
 		be returned.
 
+		The options parameter is a dictionary with the following keys
+		defined:
+
+			bool ForceSegmented
+				Specifies whether to force sending of a short
+				message as one-segment payload. If not present,
+				the default setting is "false".
+
 		The data parameter is an outgoing message to be encypted by the
 		bluetooth-meshd daemon and sent on.
 
@@ -257,7 +265,7 @@ Methods:
 			org.bluez.mesh.Error.NotFound
 
 	void DevKeySend(object element_path, uint16 destination, boolean remote,
-					uint16 net_index, array{byte} data)
+			uint16 net_index, dict options, array{byte} data)
 
 		This method is used to send a message originated by a local
 		model encoded with the device key of the remote node.
@@ -279,6 +287,14 @@ Methods:
 		The net_index parameter is the subnet index of the network on
 		which the message is to be sent.
 
+		The options parameter is a dictionary with the following keys
+		defined:
+
+			bool ForceSegmented
+				Specifies whether to force sending of a short
+				message as one-segment payload. If not present,
+				the default setting is "false".
+
 		The data parameter is an outgoing message to be encypted by the
 		meshd daemon and sent on.
 
@@ -344,7 +360,8 @@ Methods:
 			org.bluez.mesh.Error.InvalidArguments
 			org.bluez.mesh.Error.NotFound
 
-	void Publish(object element_path, uint16 model, array{byte} data)
+	void Publish(object element_path, uint16 model, dict options,
+							array{byte} data)
 
 		This method is used to send a publication originated by a local
 		model. If the model does not exist, or it has no publication
@@ -358,6 +375,17 @@ Methods:
 		The model parameter contains a model ID, as defined by the
 		Bluetooth SIG.
 
+		The options parameter is a dictionary with the following keys
+		defined:
+
+			bool ForceSegmented
+				Specifies whether to force sending of a short
+				message as one-segment payload. If not present,
+				the default setting is "false".
+
+		The data parameter is an outgoing message to be encypted by the
+		meshd daemon and sent on.
+
 		Since only one Publish record may exist per element-model, the
 		destination and key_index are obtained from the Publication
 		record cached by the daemon.
@@ -367,7 +395,7 @@ Methods:
 			org.bluez.mesh.Error.InvalidArguments
 
 	void VendorPublish(object element_path, uint16 vendor, uint16 model_id,
-							array{byte} data)
+						dict options, array{byte} data)
 
 		This method is used to send a publication originated by a local
 		vendor model. If the model does not exist, or it has no
@@ -383,6 +411,17 @@ Methods:
 		The model_id parameter is a 16-bit vendor-assigned Model
 		Identifier.
 
+		The options parameter is a dictionary with the following keys
+		defined:
+
+			bool ForceSegmented
+				Specifies whether to force sending of a short
+				message as one-segment payload. If not present,
+				the default setting is "false".
+
+		The data parameter is an outgoing message to be encypted by the
+		meshd daemon and sent on.
+
 		Since only one Publish record may exist per element-model, the
 		destination and key_index are obtained from the Publication
 		record cached by the daemon.
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH BlueZ 2/4] mesh: Handle "options" dictionary in Send/Publish methods
  2020-08-24  3:54 [PATCH BlueZ 0/4] Mesh send/publish API change Inga Stotland
  2020-08-24  3:54 ` [PATCH BlueZ 1/4] doc/mesh-api: Add "options" dictionary to Send/Publish Inga Stotland
@ 2020-08-24  3:54 ` Inga Stotland
  2020-08-24  3:54 ` [PATCH BlueZ 3/4] tools/mesh-cfglient: Add "options" to Send/DevKeySend Inga Stotland
  2020-08-24  3:54 ` [PATCH BlueZ 4/4] test/test-mesh: Add "options" to Send/Publish Inga Stotland
  3 siblings, 0 replies; 7+ messages in thread
From: Inga Stotland @ 2020-08-24  3:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, Inga Stotland

This adds processing of "options" dictionary argument in Send,
DevKeySend, Publish & VendorPublish methods on mesh.Node interface.

Only "ForceSegmented" keyword is defined to require sending small
payloads as one-segment messages.
---
 mesh/cfgmod-server.c |  2 +-
 mesh/model.c         |  6 +--
 mesh/model.h         |  9 ++--
 mesh/node.c          | 99 +++++++++++++++++++++++++++++++-------------
 4 files changed, 77 insertions(+), 39 deletions(-)

diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index 239ea889d..2e5da863a 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -1088,7 +1088,7 @@ static bool cfg_srv_pkt(uint16_t src, uint16_t dst, uint16_t app_idx,
 
 	if (n)
 		mesh_model_send(node, dst, src, APP_IDX_DEV_LOCAL, net_idx,
-						DEFAULT_TTL, false, msg, n);
+						DEFAULT_TTL, false, n, msg);
 
 	return true;
 }
diff --git a/mesh/model.c b/mesh/model.c
index bb5d30083..7bbc9cca7 100644
--- a/mesh/model.c
+++ b/mesh/model.c
@@ -999,7 +999,7 @@ done:
 }
 
 int mesh_model_publish(struct mesh_node *node, uint32_t id, uint16_t src,
-					const void *msg, uint16_t msg_len)
+			bool segmented, uint16_t msg_len, const void *msg)
 {
 	struct mesh_net *net = node_get_net(node);
 	struct mesh_model *mod;
@@ -1041,7 +1041,7 @@ int mesh_model_publish(struct mesh_node *node, uint32_t id, uint16_t src,
 	result = msg_send(node, mod->pub->credential != 0, src, mod->pub->addr,
 				mod->pub->idx, net_idx, label, mod->pub->ttl,
 				mod->pub->rtx.cnt, mod->pub->rtx.interval,
-				false, msg, msg_len);
+				segmented, msg, msg_len);
 
 	return result ? MESH_ERROR_NONE : MESH_ERROR_FAILED;
 }
@@ -1049,7 +1049,7 @@ int mesh_model_publish(struct mesh_node *node, uint32_t id, uint16_t src,
 bool mesh_model_send(struct mesh_node *node, uint16_t src, uint16_t dst,
 					uint16_t app_idx, uint16_t net_idx,
 					uint8_t ttl, bool segmented,
-					const void *msg, uint16_t msg_len)
+					uint16_t msg_len, const void *msg)
 {
 	struct mesh_net *net = node_get_net(node);
 	uint8_t cnt;
diff --git a/mesh/model.h b/mesh/model.h
index a1afedd19..fe0648d04 100644
--- a/mesh/model.h
+++ b/mesh/model.h
@@ -112,19 +112,16 @@ int mesh_model_sub_get(struct mesh_node *node, uint16_t ele_addr, uint32_t id,
 			uint8_t *buf, uint16_t buf_size, uint16_t *size);
 uint16_t mesh_model_cfg_blk(uint8_t *pkt);
 bool mesh_model_send(struct mesh_node *node, uint16_t src, uint16_t dst,
-					uint16_t app_idx, uint16_t net_idx,
-					uint8_t ttl, bool segmented,
-					const void *msg, uint16_t msg_len);
+			uint16_t app_idx, uint16_t net_idx, uint8_t ttl,
+			bool segmented, uint16_t len, const void *data);
 int mesh_model_publish(struct mesh_node *node, uint32_t id, uint16_t src,
-					const void *msg, uint16_t msg_len);
+			bool segmented, uint16_t len, const void *data);
 bool mesh_model_rx(struct mesh_node *node, bool szmict, uint32_t seq0,
 			uint32_t seq, uint32_t iv_index, uint16_t net_idx,
 			uint16_t src, uint16_t dst, uint8_t key_aid,
 			const uint8_t *data, uint16_t size);
-void mesh_model_app_key_generate_new(struct mesh_node *node, uint16_t net_idx);
 void mesh_model_app_key_delete(struct mesh_node *node, uint16_t ele_idx,
 				struct l_queue *models, uint16_t app_idx);
-struct l_queue *mesh_model_get_appkeys(struct mesh_node *node);
 uint16_t mesh_model_opcode_set(uint32_t opcode, uint8_t *buf);
 bool mesh_model_opcode_get(const uint8_t *buf, uint16_t size, uint32_t *opcode,
 								uint16_t *n);
diff --git a/mesh/node.c b/mesh/node.c
index a6e9cee65..a06c290f9 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -134,6 +134,10 @@ struct managed_obj_request {
 	};
 };
 
+struct send_options {
+	bool segmented;
+};
+
 static struct l_queue *nodes;
 
 static bool match_device_uuid(const void *a, const void *b)
@@ -1745,13 +1749,33 @@ void node_build_attach_reply(struct mesh_node *node,
 	l_dbus_message_builder_destroy(builder);
 }
 
+static bool parse_send_options(struct l_dbus_message_iter *itr,
+						struct send_options *opts)
+{
+	const char *key;
+	struct l_dbus_message_iter var;
+
+	opts->segmented = false;
+
+	while (l_dbus_message_iter_next_entry(itr, &key, &var)) {
+		if (!strcmp(key, "ForceSegmented")) {
+			if (!l_dbus_message_iter_get_variant(&var, "b",
+							&opts->segmented))
+				return false;
+		}
+	}
+
+	return true;
+}
+
 static struct l_dbus_message *send_call(struct l_dbus *dbus,
 						struct l_dbus_message *msg,
 						void *user_data)
 {
 	struct mesh_node *node = user_data;
 	const char *sender, *ele_path;
-	struct l_dbus_message_iter iter_data;
+	struct l_dbus_message_iter dict, iter_data;
+	struct send_options opts;
 	struct node_element *ele;
 	uint16_t dst, app_idx, net_idx, src;
 	uint8_t *data;
@@ -1764,8 +1788,8 @@ static struct l_dbus_message *send_call(struct l_dbus *dbus,
 	if (strcmp(sender, node->owner))
 		return dbus_error(msg, MESH_ERROR_NOT_AUTHORIZED, NULL);
 
-	if (!l_dbus_message_get_arguments(msg, "oqqay", &ele_path, &dst,
-							&app_idx, &iter_data))
+	if (!l_dbus_message_get_arguments(msg, "oqqa{sv}ay", &ele_path, &dst,
+						&app_idx, &dict, &iter_data))
 		return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
 
 	ele = l_queue_find(node->elements, match_element_path, ele_path);
@@ -1773,6 +1797,9 @@ static struct l_dbus_message *send_call(struct l_dbus *dbus,
 		return dbus_error(msg, MESH_ERROR_NOT_FOUND,
 							"Element not found");
 
+	if (!parse_send_options(&dict, &opts))
+		return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
+
 	src = node_get_primary(node) + ele->idx;
 
 	if (!l_dbus_message_iter_get_fixed_array(&iter_data, &data, &len) ||
@@ -1790,7 +1817,7 @@ static struct l_dbus_message *send_call(struct l_dbus *dbus,
 							"Key not found");
 
 	if (!mesh_model_send(node, src, dst, app_idx, net_idx, DEFAULT_TTL,
-							false, data, len))
+						opts.segmented, len, data))
 		return dbus_error(msg, MESH_ERROR_FAILED, NULL);
 
 	return l_dbus_message_new_method_return(msg);
@@ -1802,7 +1829,8 @@ static struct l_dbus_message *dev_key_send_call(struct l_dbus *dbus,
 {
 	struct mesh_node *node = user_data;
 	const char *sender, *ele_path;
-	struct l_dbus_message_iter iter_data;
+	struct l_dbus_message_iter iter_data, dict;
+	struct send_options opts;
 	struct node_element *ele;
 	uint16_t dst, app_idx, net_idx, src;
 	bool remote;
@@ -1816,8 +1844,8 @@ static struct l_dbus_message *dev_key_send_call(struct l_dbus *dbus,
 	if (strcmp(sender, node->owner))
 		return dbus_error(msg, MESH_ERROR_NOT_AUTHORIZED, NULL);
 
-	if (!l_dbus_message_get_arguments(msg, "oqbqay", &ele_path, &dst,
-						&remote, &net_idx, &iter_data))
+	if (!l_dbus_message_get_arguments(msg, "oqbqa{sv}ay", &ele_path, &dst,
+					&remote, &net_idx, &dict, &iter_data))
 		return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
 
 	/* Loopbacks to local servers must use *remote* addressing */
@@ -1829,6 +1857,9 @@ static struct l_dbus_message *dev_key_send_call(struct l_dbus *dbus,
 		return dbus_error(msg, MESH_ERROR_NOT_FOUND,
 							"Element not found");
 
+	if (!parse_send_options(&dict, &opts))
+		return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
+
 	src = node_get_primary(node) + ele->idx;
 
 	if (!l_dbus_message_iter_get_fixed_array(&iter_data, &data, &len) ||
@@ -1838,7 +1869,7 @@ static struct l_dbus_message *dev_key_send_call(struct l_dbus *dbus,
 
 	app_idx = remote ? APP_IDX_DEV_REMOTE : APP_IDX_DEV_LOCAL;
 	if (!mesh_model_send(node, src, dst, app_idx, net_idx, DEFAULT_TTL,
-							false, data, len))
+						opts.segmented, len, data))
 		return dbus_error(msg, MESH_ERROR_NOT_FOUND, NULL);
 
 	return l_dbus_message_new_method_return(msg);
@@ -1896,7 +1927,7 @@ static struct l_dbus_message *add_netkey_call(struct l_dbus *dbus,
 	l_put_le16(sub_idx, &data[2]);
 
 	if (!mesh_model_send(node, src, dst, APP_IDX_DEV_REMOTE, net_idx,
-						DEFAULT_TTL, false, data, 20))
+						DEFAULT_TTL, false, 20, data))
 		return dbus_error(msg, MESH_ERROR_NOT_FOUND, NULL);
 
 	return l_dbus_message_new_method_return(msg);
@@ -1962,7 +1993,7 @@ static struct l_dbus_message *add_appkey_call(struct l_dbus *dbus,
 	data[3] = app_idx >> 4;
 
 	if (!mesh_model_send(node, src, dst, APP_IDX_DEV_REMOTE, net_idx,
-						DEFAULT_TTL, false, data, 20))
+						DEFAULT_TTL, false, 20, data))
 		return dbus_error(msg, MESH_ERROR_NOT_FOUND, NULL);
 
 	return l_dbus_message_new_method_return(msg);
@@ -1974,8 +2005,9 @@ static struct l_dbus_message *publish_call(struct l_dbus *dbus,
 {
 	struct mesh_node *node = user_data;
 	const char *sender, *ele_path;
-	struct l_dbus_message_iter iter_data;
+	struct l_dbus_message_iter iter_data, dict;
 	uint16_t mod_id, src;
+	struct send_options opts;
 	struct node_element *ele;
 	uint8_t *data;
 	uint32_t len, id;
@@ -1988,8 +2020,8 @@ static struct l_dbus_message *publish_call(struct l_dbus *dbus,
 	if (strcmp(sender, node->owner))
 		return dbus_error(msg, MESH_ERROR_NOT_AUTHORIZED, NULL);
 
-	if (!l_dbus_message_get_arguments(msg, "oqay", &ele_path, &mod_id,
-								&iter_data))
+	if (!l_dbus_message_get_arguments(msg, "oqa{sv}ay", &ele_path, &mod_id,
+							&dict, &iter_data))
 		return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
 
 	ele = l_queue_find(node->elements, match_element_path, ele_path);
@@ -1997,6 +2029,9 @@ static struct l_dbus_message *publish_call(struct l_dbus *dbus,
 		return dbus_error(msg, MESH_ERROR_NOT_FOUND,
 							"Element not found");
 
+	if (!parse_send_options(&dict, &opts))
+		return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
+
 	src = node_get_primary(node) + ele->idx;
 
 	if (!l_dbus_message_iter_get_fixed_array(&iter_data, &data, &len) ||
@@ -2005,7 +2040,7 @@ static struct l_dbus_message *publish_call(struct l_dbus *dbus,
 							"Incorrect data");
 
 	id = SET_ID(SIG_VENDOR, mod_id);
-	result = mesh_model_publish(node, id, src, data, len);
+	result = mesh_model_publish(node, id, src, opts.segmented, len, data);
 
 	if (result != MESH_ERROR_NONE)
 		return dbus_error(msg, result, NULL);
@@ -2019,8 +2054,9 @@ static struct l_dbus_message *vendor_publish_call(struct l_dbus *dbus,
 {
 	struct mesh_node *node = user_data;
 	const char *sender, *ele_path;
-	struct l_dbus_message_iter iter_data;
+	struct l_dbus_message_iter iter_data, dict;
 	uint16_t src, mod_id, vendor_id;
+	struct send_options opts;
 	struct node_element *ele;
 	uint8_t *data = NULL;
 	uint32_t len;
@@ -2033,8 +2069,8 @@ static struct l_dbus_message *vendor_publish_call(struct l_dbus *dbus,
 	if (strcmp(sender, node->owner))
 		return dbus_error(msg, MESH_ERROR_NOT_AUTHORIZED, NULL);
 
-	if (!l_dbus_message_get_arguments(msg, "oqqay", &ele_path, &vendor_id,
-							&mod_id, &iter_data))
+	if (!l_dbus_message_get_arguments(msg, "oqqa{sv}ay", &ele_path,
+					&vendor_id, &mod_id, &dict, &iter_data))
 		return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
 
 	ele = l_queue_find(node->elements, match_element_path, ele_path);
@@ -2042,6 +2078,9 @@ static struct l_dbus_message *vendor_publish_call(struct l_dbus *dbus,
 		return dbus_error(msg, MESH_ERROR_NOT_FOUND,
 							"Element not found");
 
+	if (!parse_send_options(&dict, &opts))
+		return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
+
 	src = node_get_primary(node) + ele->idx;
 
 	if (!l_dbus_message_iter_get_fixed_array(&iter_data, &data, &len) ||
@@ -2050,7 +2089,7 @@ static struct l_dbus_message *vendor_publish_call(struct l_dbus *dbus,
 							"Incorrect data");
 
 	result = mesh_model_publish(node, SET_ID(vendor_id, mod_id), src,
-								data, len);
+						opts.segmented, len, data);
 
 	if (result != MESH_ERROR_NONE)
 		return dbus_error(msg, result, NULL);
@@ -2192,27 +2231,29 @@ static bool addresses_getter(struct l_dbus *dbus, struct l_dbus_message *msg,
 
 static void setup_node_interface(struct l_dbus_interface *iface)
 {
-	l_dbus_interface_method(iface, "Send", 0, send_call, "", "oqqay",
+	l_dbus_interface_method(iface, "Send", 0, send_call, "", "oqqa{sv}ay",
 						"element_path", "destination",
-						"key_index", "data");
-	l_dbus_interface_method(iface, "DevKeySend", 0, dev_key_send_call,
-						"", "oqbqay", "element_path",
+						"key_index", "options", "data");
+	l_dbus_interface_method(iface, "DevKeySend", 0, dev_key_send_call, "",
+						"oqbqa{sv}ay", "element_path",
 						"destination", "remote",
-						"net_index", "data");
+						"net_index", "options", "data");
 	l_dbus_interface_method(iface, "AddNetKey", 0, add_netkey_call, "",
 					"oqqqb", "element_path", "destination",
 					"subnet_index", "net_index", "update");
 	l_dbus_interface_method(iface, "AddAppKey", 0, add_appkey_call, "",
 					"oqqqb", "element_path", "destination",
 					"app_index", "net_index", "update");
-	l_dbus_interface_method(iface, "Publish", 0, publish_call, "", "oqay",
-					"element_path", "model_id", "data");
+	l_dbus_interface_method(iface, "Publish", 0, publish_call, "",
+					"oqa{sv}ay", "element_path", "model_id",
+							"options", "data");
 	l_dbus_interface_method(iface, "VendorPublish", 0, vendor_publish_call,
-						"", "oqqay", "element_path",
-						"vendor", "model_id", "data");
+					"", "oqqa{sv}ay", "element_path",
+						"vendor", "model_id", "options",
+									"data");
 
-	l_dbus_interface_property(iface, "Features", 0, "a{sv}", features_getter,
-									NULL);
+	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, "IvUpdate", 0, "b", ivupdate_getter,
 									NULL);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH BlueZ 3/4] tools/mesh-cfglient: Add "options" to Send/DevKeySend
  2020-08-24  3:54 [PATCH BlueZ 0/4] Mesh send/publish API change Inga Stotland
  2020-08-24  3:54 ` [PATCH BlueZ 1/4] doc/mesh-api: Add "options" dictionary to Send/Publish Inga Stotland
  2020-08-24  3:54 ` [PATCH BlueZ 2/4] mesh: Handle "options" dictionary in Send/Publish methods Inga Stotland
@ 2020-08-24  3:54 ` Inga Stotland
  2020-08-24  3:54 ` [PATCH BlueZ 4/4] test/test-mesh: Add "options" to Send/Publish Inga Stotland
  3 siblings, 0 replies; 7+ messages in thread
From: Inga Stotland @ 2020-08-24  3:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, Inga Stotland

This adds a new dictionary paramenter (empty by default) when
invoking Send() and DevKeySend() methods.
---
 tools/mesh-cfgclient.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/mesh-cfgclient.c b/tools/mesh-cfgclient.c
index 59f079213..3987e3179 100644
--- a/tools/mesh-cfgclient.c
+++ b/tools/mesh-cfgclient.c
@@ -274,6 +274,14 @@ static void send_msg_setup(struct l_dbus_message *msg, void *user_data)
 		l_dbus_message_builder_append_basic(builder, 'b', &req->rmt);
 
 	l_dbus_message_builder_append_basic(builder, 'q', &req->idx);
+
+	/* Options */
+	l_dbus_message_builder_enter_array(builder, "{sv}");
+	l_dbus_message_builder_enter_dict(builder, "sv");
+	l_dbus_message_builder_leave_dict(builder);
+	l_dbus_message_builder_leave_array(builder);
+
+	/* Data */
 	append_byte_array(builder, req->data, req->len);
 	l_dbus_message_builder_finalize(builder);
 	l_dbus_message_builder_destroy(builder);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH BlueZ 4/4] test/test-mesh: Add "options" to Send/Publish
  2020-08-24  3:54 [PATCH BlueZ 0/4] Mesh send/publish API change Inga Stotland
                   ` (2 preceding siblings ...)
  2020-08-24  3:54 ` [PATCH BlueZ 3/4] tools/mesh-cfglient: Add "options" to Send/DevKeySend Inga Stotland
@ 2020-08-24  3:54 ` Inga Stotland
  3 siblings, 0 replies; 7+ messages in thread
From: Inga Stotland @ 2020-08-24  3:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, Inga Stotland

This adds a new dictionary paramenter (empty by default) when
invoking Send() or Publish() methods.
---
 test/test-mesh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/test/test-mesh b/test/test-mesh
index 5da0278d6..918ec8799 100755
--- a/test/test-mesh
+++ b/test/test-mesh
@@ -183,6 +183,8 @@ current_menu = None
 
 user_input = 0
 input_error = False
+#send_opts = {'ForcedSegmented' : dbus.Boolean(False)}
+send_opts = dbus.Dictionary(signature='sv')
 
 def raise_error(str_value):
 	global input_error
@@ -538,14 +540,18 @@ class Model():
 		self.pub_period = period
 
 	def send_publication(self, data):
+		global send_opts
+
 		print('Send publication ', end='')
 		print(data)
-		node.Publish(self.path, self.model_id, data,
+		node.Publish(self.path, self.model_id, send_opts, data,
 						reply_handler=generic_reply_cb,
 						error_handler=generic_error_cb)
 
 	def send_message(self, dest, key, data):
-		node.Send(self.path, dest, key, data,
+		global send_opts
+
+		node.Send(self.path, dest, key, send_opts, data,
 						reply_handler=generic_reply_cb,
 						error_handler=generic_error_cb)
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [BlueZ,1/4] doc/mesh-api: Add "options" dictionary to Send/Publish
  2020-08-24  3:54 ` [PATCH BlueZ 1/4] doc/mesh-api: Add "options" dictionary to Send/Publish Inga Stotland
@ 2020-08-24  4:27   ` bluez.test.bot
  2020-08-24 15:04   ` [PATCH BlueZ 1/4] " Gix, Brian
  1 sibling, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2020-08-24  4:27 UTC (permalink / raw)
  To: linux-bluetooth, inga.stotland

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]


This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While we are preparing for reviewing the patches, we found the following
issue/warning.

Test Result:
checkgitlint Failed

Outputs:
8: B3 Line contains hard tab characters (\t): "    		      one-segment messages"



---
Regards,
Linux Bluetooth

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH BlueZ 1/4] doc/mesh-api: Add "options" dictionary to Send/Publish
  2020-08-24  3:54 ` [PATCH BlueZ 1/4] doc/mesh-api: Add "options" dictionary to Send/Publish Inga Stotland
  2020-08-24  4:27   ` [BlueZ,1/4] " bluez.test.bot
@ 2020-08-24 15:04   ` Gix, Brian
  1 sibling, 0 replies; 7+ messages in thread
From: Gix, Brian @ 2020-08-24 15:04 UTC (permalink / raw)
  To: linux-bluetooth, Stotland, Inga; +Cc: michal.lowas-rzechonek

On Sun, 2020-08-23 at 20:54 -0700, Inga Stotland wrote:
> This modifies Send, DevKeySend, Publish & VendorPublish methods
> on mesh.Node interface to include additional argument "options".
> This new argument is a dictionary that currently has only one
> new key word defined:
>     "ForceSegmented" - to force small payloads to be sent as
>     		      one-segment messages
> 
> Other key words may be defined in future to accommodate evolving
> requirements of Mesh Profile specification.
> ---
>  doc/mesh-api.txt | 47 +++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 43 insertions(+), 4 deletions(-)
> 
> diff --git a/doc/mesh-api.txt b/doc/mesh-api.txt
> index 495f95b0b..f836142a7 100644
> --- a/doc/mesh-api.txt
> +++ b/doc/mesh-api.txt
> @@ -229,7 +229,7 @@ Object path	/org/bluez/mesh/node<uuid>
>  
>  
> -	void Publish(object element_path, uint16 model, array{byte} data)
> +	void Publish(object element_path, uint16 model, dict options,
> +							array{byte} data)
>  
>  		This method is used to send a publication originated by a local
>  		model. If the model does not exist, or it has no publication
> @@ -358,6 +375,17 @@ Methods:
>  		The model parameter contains a model ID, as defined by the
>  		Bluetooth SIG.
>  
> +		The options parameter is a dictionary with the following keys
> +		defined:
> +
> +			bool ForceSegmented
> +				Specifies whether to force sending of a short
> +				message as one-segment payload. If not present,
> +				the default setting is "false".
> +
> +		The data parameter is an outgoing message to be encypted by the
> +		meshd daemon and sent on.
> +
>  		Since only one Publish record may exist per element-model, the
>  		destination and key_index are obtained from the Publication
>  		record cached by the daemon.
> @@ -367,7 +395,7 @@ Methods:
>  			org.bluez.mesh.Error.InvalidArguments
>  
>  	void VendorPublish(object element_path, uint16 vendor, uint16 model_id,
> -							array{byte} data)
> +						dict options, array{byte} data)

I wonder if we should take this opportunity to eliminate this Method in favor of adding a Vendor key to the new
dictionary in Publish().  If the key is missing, then from the dictionary in Publish(), then it is a Sig
defined model, and if present, then it operating like the current PublishVendor().  This would simplify the
code in the daemon, and make a smaller code footprint.

>  
>  		This method is used to send a publication originated by a local
>  		vendor model. If the model does not exist, or it has no
> @@ -383,6 +411,17 @@ Methods:
>  		The model_id parameter is a 16-bit vendor-assigned Model
>  		Identifier.
>  
> +		The options parameter is a dictionary with the following keys
> +		defined:
> +
> +			bool ForceSegmented
> +				Specifies whether to force sending of a short
> +				message as one-segment payload. If not present,
> +				the default setting is "false".
> +
> +

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-24 15:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24  3:54 [PATCH BlueZ 0/4] Mesh send/publish API change Inga Stotland
2020-08-24  3:54 ` [PATCH BlueZ 1/4] doc/mesh-api: Add "options" dictionary to Send/Publish Inga Stotland
2020-08-24  4:27   ` [BlueZ,1/4] " bluez.test.bot
2020-08-24 15:04   ` [PATCH BlueZ 1/4] " Gix, Brian
2020-08-24  3:54 ` [PATCH BlueZ 2/4] mesh: Handle "options" dictionary in Send/Publish methods Inga Stotland
2020-08-24  3:54 ` [PATCH BlueZ 3/4] tools/mesh-cfglient: Add "options" to Send/DevKeySend Inga Stotland
2020-08-24  3:54 ` [PATCH BlueZ 4/4] test/test-mesh: Add "options" to Send/Publish Inga Stotland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.