nRF5 SDK for Mesh v3.2.0
Data Structures | Macros | Typedefs | Functions
AD listener

De-multiplexing of the advertising data. More...

Data Structures

struct  ad_listener_t
 

Macros

#define ADL_WILDCARD_AD_TYPE   0u
 
#define ADL_WILDCARD_ADV_TYPE   (ble_packet_type_t)0xFFu
 

Typedefs

typedef void(* ad_handler_t) (const uint8_t *p_packet, uint32_t ad_packet_length, const nrf_mesh_rx_metadata_t *p_metadata)
 

Functions

uint32_t ad_listener_subscribe (ad_listener_t *p_adl)
 Subscribe component to the certain AD. More...
 
uint32_t ad_listener_unsubscribe (ad_listener_t *p_adl)
 Unsubscribe component from the certain AD. More...
 
void ad_listener_process (ble_packet_type_t adv_type, const uint8_t *p_payload, uint32_t payload_length, const nrf_mesh_rx_metadata_t *p_metadata)
 Process the incoming data from the scanner. More...
 

Detailed Description

De-multiplexing of the advertising data.

Provides a listener-based interface for the incoming advertisement packets.

Function Documentation

◆ ad_listener_subscribe()

uint32_t ad_listener_subscribe ( ad_listener_t p_adl)

Subscribe component to the certain AD.

The component shall provide pointer to a listener structure with AD value, priority for the listener and handler.

Warning
It is prohibited subscribing one listener twice.
Parameters
[in]p_adlPointer to the listener structure
Return values
NRF_SUCCESSThe listener was subscribed successfully.
NRF_ERROR_INVALID_PARAMadv_packet_type is incorrect
NRF_ERROR_NULLhandler is NULL

◆ ad_listener_unsubscribe()

uint32_t ad_listener_unsubscribe ( ad_listener_t p_adl)

Unsubscribe component from the certain AD.

The component shall provide pointer to a listener structure with AD value, priority for the listener and handler.

Warning
The listener shall be subscribed previously.
Parameters
[in]p_adlPointer to the listener structure
Return values
NRF_SUCCESSThe listener was unsubscribed successfully.
NRF_ERROR_INVALID_PARAMadv_packet_type is incorrect
NRF_ERROR_NULLhandler is NULL

◆ ad_listener_process()

void ad_listener_process ( ble_packet_type_t  adv_type,
const uint8_t *  p_payload,
uint32_t  payload_length,
const nrf_mesh_rx_metadata_t p_metadata 
)

Process the incoming data from the scanner.

The function reads out the received frame from scanner, performs preliminary parsing of AD fields and sends out parsed AD frames to subscribers.

Warning
The listener shall be subscribed previously.
Parameters
[in]adv_typeAdvertising type for the packet.
[in]p_payloadPointer to the packet payload.
[in]payload_lengthThe length of the given payload.
[in]p_metadataMetadata attached to the packet.

Documentation feedback | Developer Zone | Subscribe | Updated