Correct values of _msg_len arg in ESP_BLE_MESH_MODEL_PUB_DEFINE macro
Posted: Tue Feb 02, 2021 1:17 pm
I ask about some explanation for choosing the correct values for _msg_len arg in ESP_BLE_MESH_MODEL_PUB_DEFINE(_name, _msg_len, _role) macro, which defines the length of the publication message. As I understand, it should be exactly the length of Access payload (3.7.3 Access payload, Mesh Profile v1.0.1) from Access layer, which includes an opcode length, 1, 2 or 3 bytes, and the length of parameters.
In an example of Generic OnOff Server _msg_len has value "2 + 3". According to the Bluetooth mesh documentation, Generic OnOff Server publishes (3.3.1.2.3 Sending a Generic OnOff Status message, Mesh Model v1.0.1) Generic OnOff Status message (3.2.1.4 Generic OnOff Status, Mesh Model v1.0.1), which has the minimum length - 1 byte, and the maximum length - 3 bytes. So, in the example of Generic OnOff Server, "2 + 3" matches the maximum possible length of the Generic OnOff Status message, which is enough to publish both mandatory and optional fields of Generic OnOff Status message. Everything seems fine, but if to look at another example, Generic OnOff Client, _msg_len has value "2 + 1". According to the Bluetooth mesh documentation, Generic OnOff Client publishes (3.4.1.2.2 Sending Generic OnOff Set / Generic OnOff Set Unacknowledged messages, Mesh Model v1.0.1) Generic OnOff Set message (3.2.1.2 Generic OnOff Set, Mesh Model v1.0.1), which has the minimum length - 2 bytes, and the maximum length - 4 bytes, but not 1, as it's defined in the example. So, tell me, please, is it a mistake or I understand something wrongly? I would like to understand clearly which length _msg_len arg in ESP_BLE_MESH_MODEL_PUB_DEFINE macro really defines.
And I have another related question. ESP-IDF contains a series of macros which serve to define Bluetooth mesh models:
Thank you in advance for any explanation.
In an example of Generic OnOff Server _msg_len has value "2 + 3". According to the Bluetooth mesh documentation, Generic OnOff Server publishes (3.3.1.2.3 Sending a Generic OnOff Status message, Mesh Model v1.0.1) Generic OnOff Status message (3.2.1.4 Generic OnOff Status, Mesh Model v1.0.1), which has the minimum length - 1 byte, and the maximum length - 3 bytes. So, in the example of Generic OnOff Server, "2 + 3" matches the maximum possible length of the Generic OnOff Status message, which is enough to publish both mandatory and optional fields of Generic OnOff Status message. Everything seems fine, but if to look at another example, Generic OnOff Client, _msg_len has value "2 + 1". According to the Bluetooth mesh documentation, Generic OnOff Client publishes (3.4.1.2.2 Sending Generic OnOff Set / Generic OnOff Set Unacknowledged messages, Mesh Model v1.0.1) Generic OnOff Set message (3.2.1.2 Generic OnOff Set, Mesh Model v1.0.1), which has the minimum length - 2 bytes, and the maximum length - 4 bytes, but not 1, as it's defined in the example. So, tell me, please, is it a mistake or I understand something wrongly? I would like to understand clearly which length _msg_len arg in ESP_BLE_MESH_MODEL_PUB_DEFINE macro really defines.
And I have another related question. ESP-IDF contains a series of macros which serve to define Bluetooth mesh models:
- and so on.
Thank you in advance for any explanation.