Bluetooth Mesh Message API.
More...
Bluetooth Mesh Message API.
◆ BT_MESH_MIC_LONG
#define BT_MESH_MIC_LONG 8 |
Length of a long Mesh MIC.
◆ BT_MESH_MIC_SHORT
#define BT_MESH_MIC_SHORT 4 |
Length of a short Mesh MIC.
◆ BT_MESH_MODEL_BUF_LEN
Helper for model message buffer length.
Returns the length of a Mesh model message buffer, including the opcode length and a short MIC.
- Parameters
-
_op | Opcode of the message. |
_payload_len | Length of the model payload. |
◆ BT_MESH_MODEL_BUF_LEN_LONG_MIC
Helper for model message buffer length.
Returns the length of a Mesh model message buffer, including the opcode length and a long MIC.
- Parameters
-
_op | Opcode of the message. |
_payload_len | Length of the model payload. |
◆ BT_MESH_MODEL_OP_LEN
#define BT_MESH_MODEL_OP_LEN |
( |
|
_op | ) |
((_op) <= 0xff ? 1 : (_op) <= 0xffff ? 2 : 3) |
Helper to determine the length of an opcode.
- Parameters
-
◆ bt_mesh_model_msg_init()
void bt_mesh_model_msg_init |
( |
struct os_mbuf * |
msg, |
|
|
uint32_t |
opcode |
|
) |
| |
Initialize a model message.
Clears the message buffer contents, and encodes the given opcode. The message buffer will be ready for filling in payload data.
- Parameters
-
msg | Message buffer. |
opcode | Opcode to encode. |
◆ bt_mesh_msg_ack_ctx_clear()
Clear parameters of an acknowledged message context.
This function clears the opcode, remote address and user data set by bt_mesh_msg_ack_ctx_prepare.
- Parameters
-
ack | Acknowledged message context to be cleared. |
◆ bt_mesh_msg_ack_ctx_match()
bool bt_mesh_msg_ack_ctx_match |
( |
const struct bt_mesh_msg_ack_ctx * |
ack, |
|
|
uint32_t |
op, |
|
|
uint16_t |
addr, |
|
|
void ** |
user_data |
|
) |
| |
Check if an opcode and address of a message matches the expected one.
- Parameters
-
ack | Acknowledged message context to be checked. |
op | OpCode of the incoming message. |
addr | Source address of the incoming message. |
user_data | If not NULL, returns a user data stored in the acknowledged message context by bt_mesh_msg_ack_ctx_prepare. |
- Returns
- true if the incoming message matches the expected one, false otherwise.
◆ bt_mesh_msg_ack_ctx_prepare()
int bt_mesh_msg_ack_ctx_prepare |
( |
struct bt_mesh_msg_ack_ctx * |
ack, |
|
|
uint32_t |
op, |
|
|
uint16_t |
dst, |
|
|
void * |
user_data |
|
) |
| |
Prepare an acknowledged message context for the incoming message to wait.
This function sets the opcode, remote address of the incoming message and stores the user data. Use this function before calling bt_mesh_msg_ack_ctx_wait.
- Parameters
-
ack | Acknowledged message context to prepare. |
op | The message OpCode. |
dst | Destination address of the message. |
user_data | User data for the acknowledged message context. |
- Returns
- 0 on success, or (negative) error code on failure.
◆ bt_mesh_msg_ack_ctx_wait()
Wait for a message acknowledge.
This function blocks execution until bt_mesh_msg_ack_ctx_rx is called or by timeout.
- Parameters
-
ack | Acknowledged message context of the message to wait for. |
timeout | Wait timeout. |
- Returns
- 0 on success, or (negative) error code on failure.