Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_AssetFiltering.h
Go to the documentation of this file.
1/*
2 * Author: Crownstone Team
3 * Copyright: Crownstone (https://crownstone.rocks)
4 * Date: May 7, 2021
5 * License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
6 */
7
8#pragma once
9
10#include <common/cs_Component.h>
17#include <util/cs_Utils.h>
18
19class AssetFiltering : public EventListener, public Component {
20public:
28
33
34protected:
43 virtual std::vector<Component*> getChildren() override;
44
45private:
50
51#if BUILD_CLOSEST_CROWNSTONE_TRACKER == 1
52 NearestCrownstoneTracker* _nearestCrownstoneTracker = nullptr;
53#endif
54
55 // Keeps up the init state of this class.
57 NONE, // Nothing happened yet.
58 INIT_FAILED, // Init failed.
59 INIT_SUCCESS // Init was successful.
60 };
62
69
70 // --------- Processing of accepted Assest ---------------
71
76
83 bool checkIfFilterAccepts(uint8_t filterIndex, const scanned_device_t& device);
84
89 void handleAcceptedAsset(uint8_t filterIndex, AssetFilter filter, const scanned_device_t& asset);
90
91 void handleAcceptedAssetOutputMac(uint8_t filterId, AssetFilter filter, const scanned_device_t& asset);
92 void handleAcceptedAssetOutputAssetId(uint8_t filterId, AssetFilter filter, const scanned_device_t& asset);
93 void handleAcceptedAssetOutputAssetIdNearest(uint8_t filterId, AssetFilter filter, const scanned_device_t& asset);
94
99 bool isAssetRejected(const scanned_device_t& device);
100
101public:
106};
Keeps up the asset filters.
Definition: cs_AssetFilterStore.h:26
Class that takes care of synchronizing the asset filters between crownstones.
Definition: cs_AssetFilterSyncer.h:21
Class that contains all data required for an asset filter:
Definition: cs_AssetFilter.h:19
Definition: cs_AssetFiltering.h:19
void handleAcceptedAssetOutputAssetId(uint8_t filterId, AssetFilter filter, const scanned_device_t &asset)
cs_ret_code_t initInternal()
Initializes this class.
void handleAcceptedAsset(uint8_t filterIndex, AssetFilter filter, const scanned_device_t &asset)
splits out into subhandlers based on filter output type.
void handleAcceptedAssetOutputAssetIdNearest(uint8_t filterId, AssetFilter filter, const scanned_device_t &asset)
void handleEvent(event_t &evt)
Internal usage.
AssetFilteringState _initState
Definition: cs_AssetFiltering.h:61
void handleAcceptedAssetOutputMac(uint8_t filterId, AssetFilter filter, const scanned_device_t &asset)
AssetFilterSyncer * _filterSyncer
Definition: cs_AssetFiltering.h:47
virtual std::vector< Component * > getChildren() override
returns the following child-components in a vector of pointers: _filterStore, _filterSyncer,...
AssetForwarder * _assetForwarder
Definition: cs_AssetFiltering.h:48
AssetFilteringState
Definition: cs_AssetFiltering.h:56
bool checkIfFilterAccepts(uint8_t filterIndex, const scanned_device_t &device)
Check if the filter with given index accepts the device, call handleAcceptedAsset and.
bool isInitialized()
Returns true if init has been called successfully.
void handleScannedDevice(const scanned_device_t &asset)
Dispatches a TrackedEvent for the given advertisement.
AssetStore * _assetStore
Definition: cs_AssetFiltering.h:49
AssetFilterStore * _filterStore
Definition: cs_AssetFiltering.h:46
cs_ret_code_t init()
Initialize this class.
bool isAssetRejected(const scanned_device_t &device)
Returns true if there is a filter that rejects this device.
AssetForwarder makes it possible for the AssetFiltering to merge mesh messages when they have very si...
Definition: cs_AssetForwarder.h:29
Definition: cs_AssetStore.h:15
Helper class to manage decoupling of components.
Definition: cs_Component.h:35
Event listener.
Definition: cs_EventListener.h:17
This class implements the in-mesh computation of which crownstone is nearest to a 'trackable' device.
Definition: cs_NearestCrownstoneTracker.h:32
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 9,...
Definition: cs_Event.h:26
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
Scanned device.
Definition: cs_PacketsInternal.h:107