37 #ifndef ADVERTISER_H__ 38 #define ADVERTISER_H__ 40 #include "broadcast.h" 41 #include "timer_scheduler.h" 42 #include "packet_buffer.h" 43 #include "nrf_mesh_defines.h" 44 #include "nrf_mesh_config_bearer.h" 46 #include "bearer_event.h" 56 #define ADVERTISER_INTERVAL_RANDOMIZATION_US MS_TO_US(10) 58 #define ADVERTISER_REPEAT_INFINITE 0xFF 62 #define ADVERTISER_PACKET_BUFFER_PACKET_MAXLEN (sizeof(packet_buffer_packet_t) + sizeof(adv_packet_t)) 160 uint32_t buffer_size);
301 return p_adv->
broadcast.params.radio_config.tx_power;
uint8_t repeats
Number of times the packet should be transmitted on each channel.
void advertiser_disable(advertiser_t *p_adv)
Disables the advertiser instance given, so that no more packets are sent from this advertiser even if...
void advertiser_config_get(const advertiser_t *p_adv, advertiser_config_t *p_config)
Gets the current advertiser configuration.
static radio_tx_power_t advertiser_tx_power_get(const advertiser_t *p_adv)
Gets the TX power for the given advertiser.
void(* advertiser_tx_complete_cb_t)(advertiser_t *p_adv, nrf_mesh_tx_token_t token, timestamp_t timestamp)
Transmit complete callback for notifying the users after a given packet has been sent the desired num...
timestamp_t timestamp
Timestamp of the last transmission of the packet, in microseconds.
void advertiser_channels_set(advertiser_t *p_adv, const advertiser_channels_t *p_channels)
Sets the advertiser channels used by the given advertiser instance.
uint32_t advertisement_interval_us
On init the advertiser will use BEARER_ADV_INT_DEFAULT_MS.
nrf_mesh_tx_token_t token
TX token, set by the application.
void advertiser_config_set(advertiser_t *p_adv, const advertiser_config_t *p_config)
Updates the advertiser configuration.
void advertiser_init(void)
Initialize the advertiser module.
broadcast_t broadcast
Broadcast module, used as a context to send a single advertisement.
adv_packet_t * p_packet
Pointer to the current packet, only for internal use.
void advertiser_packet_discard(advertiser_t *p_adv, adv_packet_t *p_packet)
Discards an allocated advertisement packet.
bearer_event_sequential_t tx_complete_event
Bearer event for executing the TX_COMPLETE event outside the radio interrupt.
The structure defining the contents of an advertisement packet.
bool enabled
Flag indicating whether the event is enabled.
static void advertiser_address_get(const advertiser_t *p_adv, ble_gap_addr_t *p_addr)
Gets the advertiser address used by the given advertiser instance.
struct __attribute__((packed))
Provisioning data required by the remote provisioning client for command type SERIAL_PB_REMOTE_CLIENT...
bool randomize_order
If set, the advertiser will randomize the order of the advertisement channels before each transmit...
static uint32_t advertiser_interval_get(const advertiser_t *p_adv)
Gets the given advertiser's advertisement interval.
timer_event_t timer
Timer event used to set up periodic advertisements.
void advertiser_address_default_get(ble_gap_addr_t *p_addr)
Gets the default advertisement address from device factory information structure. ...
advertiser_tx_complete_params_t tx_complete_params
Parameters of the TX_COMPLETE event.
#define BEARER_ADV_CHANNELS_MAX
Maximum number of channels an advertiser can transmit on.
advertiser_config_t config
Advertiser configuration.
advertiser_tx_complete_cb_t tx_complete_callback
TX complete callback to call at the end of a completed transmission.
uint32_t nrf_mesh_tx_token_t
TX Token type, used as a context parameter to notify the application of ended transmissions.
uint8_t count
Number of channels in the channel_map.
void advertiser_instance_init(advertiser_t *p_adv, advertiser_tx_complete_cb_t tx_complete_cb, uint8_t *p_buffer, uint32_t buffer_size)
Initialize an advertiser instance.
void advertiser_packet_send(advertiser_t *p_adv, adv_packet_t *p_packet)
Sends a given packet using the given advertiser instance, this can be called multiple times without h...
ble_gap_addr_t adv_addr
On init the advertiser will use the address in the device FICR.
static bool advertiser_is_enabled(const advertiser_t *p_adv)
Checks if an advertiser is enabled.
void advertiser_tx_power_set(advertiser_t *p_adv, radio_tx_power_t tx_power)
Sets the TX power for the given advertiser.
void advertiser_address_set(advertiser_t *p_adv, const ble_gap_addr_t *p_addr)
Sets the advertiser address used by the given advertiser instance.
advertiser_channels_t channels
On init the advertiser will use all the default BLE advertisement channels, without randomization...
nrf_mesh_tx_token_t token
TX token, set by the application.
Configuration of the advertiser to be used when sending the packets.
adv_packet_t * advertiser_packet_alloc(advertiser_t *p_adv, uint32_t adv_payload_size)
Allocates a buffer, if available, from the given advertiser instance.
void advertiser_interval_set(advertiser_t *p_adv, uint32_t interval_ms)
Sets the advertisement interval for the given advertiser.
packet_buffer_t buf
Packet buffer for outgoing packets.
void advertiser_enable(advertiser_t *p_adv)
Enables the advertiser instance given.
void advertiser_flush(advertiser_t *p_adv)
Flushes the given advertiser's packet queue.
Single advertiser instance.
Advertiser channel configuration.