11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_MSG_H_
12#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_MSG_H_
26#define BT_MESH_MIC_SHORT 4
28#define BT_MESH_MIC_LONG 8
36#define BT_MESH_MODEL_OP_LEN(_op) ((_op) <= 0xff ? 1 : (_op) <= 0xffff ? 2 : 3)
49#define BT_MESH_MODEL_BUF_LEN(_op, _payload_len) \
50 (BT_MESH_MODEL_OP_LEN(_op) + (_payload_len) + BT_MESH_MIC_SHORT)
63#define BT_MESH_MODEL_BUF_LEN_LONG_MIC(_op, _payload_len) \
64 (BT_MESH_MODEL_OP_LEN(_op) + (_payload_len) + BT_MESH_MIC_LONG)
75#define BT_MESH_MODEL_BUF(_op, _payload_len) \
76 NET_BUF_SIMPLE(BT_MESH_MODEL_BUF_LEN(_op, (_payload_len)))
135 k_sem_init(&ack->
sem, 0, 1);
146 k_sem_reset(&ack->
sem);
171 uint32_t op, uint16_t dst,
void *user_data);
181 return (ack->
op != 0);
203 k_sem_give(&ack->
sem);
217 uint32_t op, uint16_t addr,
void **user_data);
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.
int bt_mesh_msg_ack_ctx_wait(struct bt_mesh_msg_ack_ctx *ack, int32_t timeout)
Wait for a message acknowledge.
void bt_mesh_msg_ack_ctx_clear(struct bt_mesh_msg_ack_ctx *ack)
Clear parameters of an acknowledged message context.
void bt_mesh_model_msg_init(struct os_mbuf *msg, uint32_t opcode)
Initialize a model message.
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.
uint32_t op
Definition msg.h:121
void * user_data
Definition msg.h:123
struct k_sem sem
Definition msg.h:120
uint16_t dst
Definition msg.h:122
uint16_t net_idx
Definition msg.h:82
int8_t recv_rssi
Definition msg.h:94
bool send_rel
Definition msg.h:100
uint16_t addr
Definition msg.h:88
uint8_t send_ttl
Definition msg.h:103
uint16_t app_idx
Definition msg.h:85
uint16_t recv_dst
Definition msg.h:91
uint8_t recv_ttl
Definition msg.h:97