Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
BackgroundAdvertisementHandler Class Referenceabstract

Class that parses advertisements for background broadcasts. More...

#include <cs_BackgroundAdvHandler.h>

Inheritance diagram for BackgroundAdvertisementHandler:
Collaboration diagram for BackgroundAdvertisementHandler:

Public Member Functions

void handleEvent (event_t &event)
 Handle events. More...
 
- Public Member Functions inherited from EventListener
 EventListener ()
 
virtual ~EventListener ()
 unregisters the listener. More...
 
virtual void handleEvent (event_t &event)=0
 Handle events. More...
 
void listen ()
 Registers this with the EventDispatcher. More...
 

Static Public Member Functions

static BackgroundAdvertisementHandlergetInstance ()
 

Private Member Functions

 TYPIFY (CONFIG_SPHERE_ID) _sphereId=0
 Own sphere id. More...
 
 BackgroundAdvertisementHandler ()
 
void parseAdvertisement (scanned_device_t *scannedDevice)
 Parse, decrypt, and validate an advertisement. More...
 
void parseServicesAdvertisement (scanned_device_t *scannedDevice)
 Parse an advertisement with incomplete list of service UUIDs. More...
 
void handleBackgroundAdvertisement (adv_background_t *backgroundAdvertisement)
 Handle a validated background advertisement. More...
 
int8_t getAdjustedRssi (int16_t rssi, int16_t rssiOffset)
 Return the adjusted RSSI value, given the actual RSSI and the offset from the background advertisement payload. More...
 

Private Attributes

uint8_t _uuidMap [256]
 Map 16 bit service UUIDs to bit positions in the 128b bitmask. More...
 
uint64_t _lastBitmask [2] = {0}
 Store the last mapped bitmask. More...
 
uint8_t _lastMacAddress [MAC_ADDRESS_LEN] = {0}
 Store the address of the last bitmask. More...
 

Detailed Description

Class that parses advertisements for background broadcasts.

Receives data from either EVT_DEVICE_SCANNED, or EVT_ADV_BACKGROUND. Parses and decrypts. Sends event EVT_ADV_BACKGROUND_PARSED.

Constructor & Destructor Documentation

◆ BackgroundAdvertisementHandler()

Member Function Documentation

◆ getAdjustedRssi()

int8_t BackgroundAdvertisementHandler::getAdjustedRssi ( int16_t  rssi,
int16_t  rssiOffset 
)
private

Return the adjusted RSSI value, given the actual RSSI and the offset from the background advertisement payload.

◆ getInstance()

static BackgroundAdvertisementHandler & BackgroundAdvertisementHandler::getInstance ( )
inlinestatic

◆ handleBackgroundAdvertisement()

void BackgroundAdvertisementHandler::handleBackgroundAdvertisement ( adv_background_t backgroundAdvertisement)
private

Handle a validated background advertisement.

Adjusts RSSI, and send event.

◆ handleEvent()

void BackgroundAdvertisementHandler::handleEvent ( event_t event)
virtual

Handle events.

This method is overloaded by all classes that derive from EventListener. They can receive an event_t struct and act upon it. These events are dispatched by the EventDispatcher.

Implements EventListener.

◆ parseAdvertisement()

void BackgroundAdvertisementHandler::parseAdvertisement ( scanned_device_t scannedDevice)
private

Parse, decrypt, and validate an advertisement.

◆ parseServicesAdvertisement()

void BackgroundAdvertisementHandler::parseServicesAdvertisement ( scanned_device_t scannedDevice)
private

Parse an advertisement with incomplete list of service UUIDs.

These get mapped to a bitmask, and stored together with the mac address.

◆ TYPIFY()

BackgroundAdvertisementHandler::TYPIFY ( CONFIG_SPHERE_ID  )
privatepure virtual

Own sphere id.

Member Data Documentation

◆ _lastBitmask

uint64_t BackgroundAdvertisementHandler::_lastBitmask[2] = {0}
private

Store the last mapped bitmask.

◆ _lastMacAddress

uint8_t BackgroundAdvertisementHandler::_lastMacAddress[MAC_ADDRESS_LEN] = {0}
private

Store the address of the last bitmask.

◆ _uuidMap

uint8_t BackgroundAdvertisementHandler::_uuidMap[256]
private
Initial value:
= {
255, 255, 255, 255, 47, 255, 255, 255, 255, 111, 71, 10, 255, 115, 255, 255, 91, 90, 37, 85,
126, 74, 69, 57, 56, 50, 46, 44, 40, 38, 36, 35, 80, 51, 31, 28, 27, 25, 26, 117,
21, 65, 98, 64, 8, 20, 22, 15, 14, 13, 4, 255, 255, 62, 255, 255, 255, 255, 107, 255,
255, 43, 79, 255, 48, 255, 59, 123, 255, 255, 58, 30, 255, 255, 11, 255, 255, 255, 255, 114,
255, 255, 55, 39, 255, 255, 109, 255, 118, 255, 61, 255, 255, 93, 255, 33, 255, 121, 78, 94,
255, 255, 0, 92, 7, 255, 255, 81, 255, 255, 255, 9, 255, 32, 255, 255, 255, 255, 255, 112,
255, 255, 54, 255, 255, 255, 67, 255, 255, 255, 255, 72, 255, 76, 6, 255, 42, 41, 105, 24,
18, 255, 97, 86, 255, 120, 2, 255, 255, 255, 255, 19, 255, 110, 16, 255, 255, 255, 53, 255,
99, 255, 255, 255, 255, 77, 255, 255, 255, 17, 255, 73, 255, 116, 255, 255, 127, 255, 255, 255,
29, 106, 255, 255, 255, 255, 66, 83, 95, 255, 255, 124, 255, 122, 255, 255, 255, 87, 255, 255,
68, 255, 101, 255, 255, 255, 34, 255, 49, 63, 255, 255, 45, 255, 255, 84, 23, 255, 255, 96,
255, 113, 5, 52, 119, 255, 60, 255, 12, 89, 103, 255, 3, 255, 255, 88, 102, 255, 255, 255,
125, 255, 255, 255, 70, 82, 104, 255, 1, 75, 108, 255, 100, 255, 255, 255,
}

Map 16 bit service UUIDs to bit positions in the 128b bitmask.


The documentation for this class was generated from the following file: