10#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_MSG_H_ 
   11#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_MSG_H_ 
   30#define BT_MESH_MIC_SHORT 4 
   32#define BT_MESH_MIC_LONG 8 
   39#define BT_MESH_MODEL_OP_LEN(_op) ((_op) <= 0xff ? 1 : (_op) <= 0xffff ? 2 : 3) 
   50#define BT_MESH_MODEL_BUF_LEN(_op, _payload_len)                               \ 
   51        (BT_MESH_MODEL_OP_LEN(_op) + (_payload_len) + BT_MESH_MIC_SHORT) 
   62#define BT_MESH_MODEL_BUF_LEN_LONG_MIC(_op, _payload_len)                      \ 
   63        (BT_MESH_MODEL_OP_LEN(_op) + (_payload_len) + BT_MESH_MIC_LONG) 
   72#define BT_MESH_MODEL_BUF_DEFINE(_buf, _op, _payload_len)                      \ 
   73        NET_BUF_SIMPLE_DEFINE(_buf, BT_MESH_MODEL_BUF_LEN(_op, (_payload_len))) 
  111#define BT_MESH_MSG_CTX_INIT(net_key_idx, app_key_idx, dst, ttl) \ 
  113                .net_idx = (net_key_idx), \ 
  114                .app_idx = (app_key_idx), \ 
  125#define BT_MESH_MSG_CTX_INIT_APP(app_key_idx, dst) \ 
  126        BT_MESH_MSG_CTX_INIT(0, app_key_idx, dst, BT_MESH_TTL_DEFAULT) 
  135#define BT_MESH_MSG_CTX_INIT_DEV(net_key_idx, dst) \ 
  136        BT_MESH_MSG_CTX_INIT(net_key_idx, BT_MESH_KEY_DEV_REMOTE, dst, BT_MESH_TTL_DEFAULT) 
  143#define BT_MESH_MSG_CTX_INIT_PUB(pub) \ 
  144        BT_MESH_MSG_CTX_INIT(0, (pub)->key, (pub)->addr, (pub)->ttl) 
  222        return (ack->
op != 0);
 
ZTEST_BMEM int timeout
Definition: main.c:31
 
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.
 
static void bt_mesh_msg_ack_ctx_rx(struct bt_mesh_msg_ack_ctx *ack)
Mark a message as acknowledged.
Definition: msg.h:242
 
void bt_mesh_msg_ack_ctx_clear(struct bt_mesh_msg_ack_ctx *ack)
Clear parameters of an acknowledged message context.
 
int bt_mesh_msg_ack_ctx_wait(struct bt_mesh_msg_ack_ctx *ack, k_timeout_t timeout)
Wait for a message acknowledge.
 
static void bt_mesh_msg_ack_ctx_reset(struct bt_mesh_msg_ack_ctx *ack)
Reset the synchronization semaphore in an acknowledged message context.
Definition: msg.h:184
 
static bool bt_mesh_msg_ack_ctx_busy(struct bt_mesh_msg_ack_ctx *ack)
Check if the acknowledged message context is initialized with an opcode.
Definition: msg.h:220
 
void bt_mesh_model_msg_init(struct net_buf_simple *msg, uint32_t opcode)
Initialize a model message.
 
static void bt_mesh_msg_ack_ctx_init(struct bt_mesh_msg_ack_ctx *ack)
Initialize an acknowledged message context.
Definition: msg.h:173
 
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.
 
void k_sem_reset(struct k_sem *sem)
Resets a semaphore's count to zero.
 
void k_sem_give(struct k_sem *sem)
Give a semaphore.
 
int k_sem_init(struct k_sem *sem, unsigned int initial_count, unsigned int limit)
Initialize a semaphore.
 
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
 
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
 
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
 
__INT8_TYPE__ int8_t
Definition: stdint.h:72
 
uint32_t op
Definition: msg.h:161
 
void * user_data
Definition: msg.h:163
 
struct k_sem sem
Definition: msg.h:160
 
uint16_t dst
Definition: msg.h:162
 
uint16_t net_idx
Definition: msg.h:78
 
int8_t recv_rssi
Definition: msg.h:90
 
bool send_rel
Definition: msg.h:96
 
uint16_t addr
Definition: msg.h:84
 
uint8_t send_ttl
Definition: msg.h:99
 
uint16_t app_idx
Definition: msg.h:81
 
uint16_t recv_dst
Definition: msg.h:87
 
uint8_t recv_ttl
Definition: msg.h:93
 
Kernel timeout type.
Definition: sys_clock.h:65
 
Simple network buffer representation.
Definition: buf.h:82
 
static void msg(uint64_t c64)
Definition: main.c:17
 
static const intptr_t user_data[5]
Definition: main.c:588