NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
bt_mesh_model_pub Struct Reference

#include <access.h>

Public Attributes

struct bt_mesh_modelmod
 
uint16_t addr
 
uint16_t key:12
 
uint16_t cred:1
 
uint16_t send_rel:1
 
uint16_t fast_period:1
 
uint8_t ttl
 
uint8_t retransmit
 
uint8_t period
 
uint8_t period_div:4
 
uint32_t period_start
 
struct os_mbufmsg
 Publication buffer, containing the publication message.
 
int(* update )(struct bt_mesh_model *mod)
 Callback for updating the publication buffer.
 
struct k_work_delayable timer
 

Detailed Description

Model publication context.

Member Data Documentation

◆ addr

uint16_t bt_mesh_model_pub::addr

Publish Address.

◆ cred

uint16_t bt_mesh_model_pub::cred

Friendship Credentials Flag.

◆ fast_period

uint16_t bt_mesh_model_pub::fast_period

Use FastPeriodDivisor

◆ key

uint16_t bt_mesh_model_pub::key

Publish AppKey Index.

◆ mod

struct bt_mesh_model* bt_mesh_model_pub::mod

The model the context belongs to. Initialized by the stack.

◆ msg

struct os_mbuf* bt_mesh_model_pub::msg

Publication buffer, containing the publication message.

The application is expected to initialize this with a valid os_mbuf pointer, with the help of e.g. the NET_BUF_SIMPLE() macro. The publication buffer must contain a valid publication message before calling the bt_mesh_model_publish() API or after the publication's bt_mesh_model_pub::update callback has been called and returned success. The buffer must be created outside of function context, i.e. it must not be on the stack. This is most conveniently acheived by creating it inline when declaring the publication context:

static struct bt_mesh_model_pub my_pub = {
        .msg = NET_BUF_SIMPLE(size),
};

◆ period

uint8_t bt_mesh_model_pub::period

Publish Period.

◆ period_div

uint8_t bt_mesh_model_pub::period_div

Divisor for the Period.

◆ period_start

uint32_t bt_mesh_model_pub::period_start

Start of the current period.

◆ retransmit

uint8_t bt_mesh_model_pub::retransmit

Retransmit Count & Interval Steps.

◆ send_rel

uint16_t bt_mesh_model_pub::send_rel

Force reliable sending (segment acks)

◆ timer

struct k_work_delayable bt_mesh_model_pub::timer

Publish Period Timer. Only for stack-internal use.

◆ ttl

uint8_t bt_mesh_model_pub::ttl

Publish Time to Live.

◆ update

int(* bt_mesh_model_pub::update) (struct bt_mesh_model *mod)

Callback for updating the publication buffer.

When set to NULL, the model is assumed not to support periodic publishing. When set to non-NULL the callback will be called periodically and is expected to update bt_mesh_model_pub::msg with a valid publication message.

If the callback returns non-zero, the publication is skipped and will resume on the next periodic publishing interval.

Parameters
modThe Model the Publication Context belogs to.
Returns
Zero on success or (negative) error code otherwise.