Bluetooth: Mesh: Fix mod sub status parameters upon failure

Mesh Profile Specification v1.0, 4.4.1.2.8:

"When an element receives a Config Model Subscription Add message
or a Config Model Subscription Virtual Address Add message that
is not successfully processed (i.e., it results in an error condition
listed in Table 4.113), it shall respond with the Config Model
Subscription Status message, setting its fields to the values
of the corresponding fields (i.e., the identically named fields)
of the incoming message and setting the Status field to a status code
(defined in Table 4.113), and setting all other fields to 0."

The same applies to other Model Subscription messages.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2017-10-10 17:30:16 +03:00 committed by Andrew Boie
commit fccdb28154

View file

@ -1212,11 +1212,7 @@ static void send_mod_sub_status(struct bt_mesh_model *model,
net_buf_simple_add_u8(msg, status);
net_buf_simple_add_le16(msg, elem_addr);
if (status) {
net_buf_simple_add_le16(msg, BT_MESH_ADDR_UNASSIGNED);
} else {
net_buf_simple_add_le16(msg, sub_addr);
}
net_buf_simple_add_le16(msg, sub_addr);
if (vnd) {
memcpy(net_buf_simple_add(msg, 4), mod_id, 4);