Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
AssetFiltering Class Reference

#include <cs_AssetFiltering.h>

Inheritance diagram for AssetFiltering:
Collaboration diagram for AssetFiltering:

Public Member Functions

cs_ret_code_t init ()
 Initialize this class. More...
 
bool isInitialized ()
 Returns true if init has been called successfully. More...
 
void handleEvent (event_t &evt)
 Internal usage. 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...
 
- Public Member Functions inherited from Component
template<class T >
T * getComponent (Component *requester=nullptr)
 Returns a component of type T* from _parent->children(), If not found try again with ancestors: _parent-> ... ->_parent->children(). More...
 
virtual cs_ret_code_t init ()
 Components can implement this if they need to get references to sibling or if they need to do specific initialization. More...
 
void parentAllChildren ()
 utility that loops over all elements of getChildren() and setParent on the non-nullptr ones. More...
 
virtual ~Component ()=default
 

Protected Member Functions

virtual std::vector< Component * > getChildren () override
 returns the following child-components in a vector of pointers: _filterStore, _filterSyncer, _assetForwarder, _assetStore _nearestCrownstoneTracker (if included in build) More...
 
- Protected Member Functions inherited from Component
virtual std::vector< Component * > getChildren ()
 Components with children can override this method to return them. More...
 
cs_ret_code_t initChildren ()
 
void setParent (Component *p)
 Children that are instantiated later can also be added individually. More...
 

Private Types

enum class  AssetFilteringState { NONE , INIT_FAILED , INIT_SUCCESS }
 

Private Member Functions

cs_ret_code_t initInternal ()
 Initializes this class. More...
 
void handleScannedDevice (const scanned_device_t &asset)
 Dispatches a TrackedEvent for the given advertisement. More...
 
bool checkIfFilterAccepts (uint8_t filterIndex, const scanned_device_t &device)
 Check if the filter with given index accepts the device, call handleAcceptedAsset and. More...
 
void handleAcceptedAsset (uint8_t filterIndex, AssetFilter filter, const scanned_device_t &asset)
 splits out into subhandlers based on filter output type. More...
 
void handleAcceptedAssetOutputMac (uint8_t filterId, AssetFilter filter, const scanned_device_t &asset)
 
void handleAcceptedAssetOutputAssetId (uint8_t filterId, AssetFilter filter, const scanned_device_t &asset)
 
void handleAcceptedAssetOutputAssetIdNearest (uint8_t filterId, AssetFilter filter, const scanned_device_t &asset)
 
bool isAssetRejected (const scanned_device_t &device)
 Returns true if there is a filter that rejects this device. More...
 

Private Attributes

AssetFilterStore_filterStore = nullptr
 
AssetFilterSyncer_filterSyncer = nullptr
 
AssetForwarder_assetForwarder = nullptr
 
AssetStore_assetStore = nullptr
 
AssetFilteringState _initState = AssetFilteringState::NONE
 

Member Enumeration Documentation

◆ AssetFilteringState

enum class AssetFiltering::AssetFilteringState
strongprivate
Enumerator
NONE 
INIT_FAILED 
INIT_SUCCESS 

Member Function Documentation

◆ checkIfFilterAccepts()

bool AssetFiltering::checkIfFilterAccepts ( uint8_t  filterIndex,
const scanned_device_t device 
)
private

Check if the filter with given index accepts the device, call handleAcceptedAsset and.

dispatches EVT_ASSET_ACCEPTED if so.

Returns true if the filter accepts the device and the exclude flag is false.

◆ getChildren()

virtual std::vector< Component * > AssetFiltering::getChildren ( )
overrideprotectedvirtual

returns the following child-components in a vector of pointers: _filterStore, _filterSyncer, _assetForwarder, _assetStore _nearestCrownstoneTracker (if included in build)

Reimplemented from Component.

◆ handleAcceptedAsset()

void AssetFiltering::handleAcceptedAsset ( uint8_t  filterIndex,
AssetFilter  filter,
const scanned_device_t asset 
)
private

splits out into subhandlers based on filter output type.

Performs desired actions for said output type.

◆ handleAcceptedAssetOutputAssetId()

void AssetFiltering::handleAcceptedAssetOutputAssetId ( uint8_t  filterId,
AssetFilter  filter,
const scanned_device_t asset 
)
private

◆ handleAcceptedAssetOutputAssetIdNearest()

void AssetFiltering::handleAcceptedAssetOutputAssetIdNearest ( uint8_t  filterId,
AssetFilter  filter,
const scanned_device_t asset 
)
private

◆ handleAcceptedAssetOutputMac()

void AssetFiltering::handleAcceptedAssetOutputMac ( uint8_t  filterId,
AssetFilter  filter,
const scanned_device_t asset 
)
private

◆ handleEvent()

void AssetFiltering::handleEvent ( event_t evt)
virtual

Internal usage.

Implements EventListener.

◆ handleScannedDevice()

void AssetFiltering::handleScannedDevice ( const scanned_device_t asset)
private

Dispatches a TrackedEvent for the given advertisement.

◆ init()

cs_ret_code_t AssetFiltering::init ( )
virtual

Initialize this class.

Constructs and initializes member classes. Checks result of previous call to init.

Reimplemented from Component.

◆ initInternal()

cs_ret_code_t AssetFiltering::initInternal ( )
private

Initializes this class.

Constructs and initializes member classes.

◆ isAssetRejected()

bool AssetFiltering::isAssetRejected ( const scanned_device_t device)
private

Returns true if there is a filter that rejects this device.

(Does not check if the filterstore is ready.)

◆ isInitialized()

bool AssetFiltering::isInitialized ( )

Returns true if init has been called successfully.

Member Data Documentation

◆ _assetForwarder

AssetForwarder* AssetFiltering::_assetForwarder = nullptr
private

◆ _assetStore

AssetStore* AssetFiltering::_assetStore = nullptr
private

◆ _filterStore

AssetFilterStore* AssetFiltering::_filterStore = nullptr
private

◆ _filterSyncer

AssetFilterSyncer* AssetFiltering::_filterSyncer = nullptr
private

◆ _initState

AssetFilteringState AssetFiltering::_initState = AssetFilteringState::NONE
private

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