Methods:
void MessageReceived(uint16 source, uint16 key_index,
- boolean subscription, array{byte} data)
+ variant destination, array{byte} data)
This method is called by bluetooth-meshd daemon when a message
arrives addressed to the application.
be used by the application when sending a response to this
message (in case a response is expected).
- The subscription parameter is a boolean that is set to true if
- the message is received as a part of the subscription (i.e., the
- destination is either a well known group address or a virtual
- label.
+ The destination parameter contains the destination address of
+ received message. Underlying variant types are:
+
+ uint16
+
+ Destination is an unicast address, or a well known
+ group address
+
+ array{byte}
+
+ Destination is a virtual address label
The data parameter is the incoming message.
l_dbus_send(dbus, msg);
}
-static void send_msg_rcvd(struct mesh_node *node, uint8_t ele_idx, bool is_sub,
- uint16_t src, uint16_t app_idx,
+static void send_msg_rcvd(struct mesh_node *node, uint8_t ele_idx,
+ uint16_t src, uint16_t dst,
+ const struct mesh_virtual *virt,
+ uint16_t app_idx,
uint16_t size, const uint8_t *data)
{
struct l_dbus *dbus = dbus_get_bus();
l_dbus_message_builder_append_basic(builder, 'q', &src);
l_dbus_message_builder_append_basic(builder, 'q', &app_idx);
- l_dbus_message_builder_append_basic(builder, 'b', &is_sub);
+
+ if (virt) {
+ l_dbus_message_builder_enter_variant(builder, "ay");
+ dbus_append_byte_array(builder, virt->label,
+ sizeof(virt->label));
+ l_dbus_message_builder_leave_variant(builder);
+ } else {
+ l_dbus_message_builder_enter_variant(builder, "q");
+ l_dbus_message_builder_append_basic(builder, 'q', &dst);
+ l_dbus_message_builder_leave_variant(builder);
+ }
dbus_append_byte_array(builder, data, size);
*/
if (forward.has_dst && !forward.done) {
if ((decrypt_idx & APP_IDX_MASK) == decrypt_idx)
- send_msg_rcvd(node, i, is_subscription, src,
+ send_msg_rcvd(node, i, src, dst, decrypt_virt,
forward.app_idx, forward.size,
forward.data);
else if (decrypt_idx == APP_IDX_DEV_REMOTE ||
self.UpdateModelConfiguration(mod_id, config[1])
@dbus.service.method(MESH_ELEMENT_IFACE,
- in_signature="qqbay", out_signature="")
- def MessageReceived(self, source, key, is_sub, data):
- print('Message Received on Element ', end='')
- print(self.index)
+ in_signature="qqvay", out_signature="")
+ def MessageReceived(self, source, key, destination, data):
+ print('Message Received on Element %d, src=%04x, dst=%s' %
+ self.index, source, destination)
for model in self.models:
model.process_message(source, key, data)
self.UpdateModelConfiguration(mod_id, config[1])
@dbus.service.method(MESH_ELEMENT_IFACE,
- in_signature="qqbay", out_signature="")
- def MessageReceived(self, source, key, is_sub, data):
- print('Message Received on Element ', end='')
- print(self.index)
+ in_signature="qqvay", out_signature="")
+ def MessageReceived(self, source, key, destination, data):
+ print('Message Received on Element %d, src=%04x, dst=%s' %
+ self.index, source, destination)
for model in self.models:
model.process_message(source, key, data)