Keeps up the asset filters.
Definition: cs_AssetFilterStore.h:26
static constexpr uint8_t MAX_FILTER_IDS
Max number of filters.
Definition: cs_AssetFilterStore.h:75
Class that takes care of synchronizing the asset filters between crownstones.
Definition: cs_AssetFilterSyncer.h:21
void setStep(SyncStep step)
Set the current step of the sync process.
uint16_t _nextChunkIndex
Next chunk index to upload.
Definition: cs_AssetFilterSyncer.h:69
static constexpr uint16_t VERSION_BROADCAST_NORMAL_INTERVAL_SECONDS
Interval at which the master version is broadcasted.
Definition: cs_AssetFilterSyncer.h:26
uint16_t _sendVersionAtLowIntervalCountdown
Countdown counter that keeps track when the send version interval should go back to normal again.
Definition: cs_AssetFilterSyncer.h:86
void sendVersion(bool reliable)
Sends the master version and CRC over the mesh.
void done()
When the whole sync process to a stone was successful, call done().
VersionCompare compareToMyVersion(asset_filter_cmd_protocol_t protocol, uint16_t masterVersion, uint32_t masterCrc)
Compare given master version with the master version of this crownstone.
VersionCompare
Results of comparing master version with another crownstone.
Definition: cs_AssetFilterSyncer.h:49
static constexpr uint16_t VERSION_BROADCAST_LOW_INTERVAL_SECONDS
Definition: cs_AssetFilterSyncer.h:27
uint8_t _filterIdsToUpload[AssetFilterStore::MAX_FILTER_IDS]
Filter IDs that should be uploaded.
Definition: cs_AssetFilterSyncer.h:74
void connect(stone_id_t stoneId)
Steps of the sync process.
AssetFilterStore * _store
Pointer to the (intialized) filter store.
Definition: cs_AssetFilterSyncer.h:54
uint8_t _filterRemoveCount
Definition: cs_AssetFilterSyncer.h:81
SyncStep
Async steps that are taken when synchronizing filters to another crownstone.
Definition: cs_AssetFilterSyncer.h:44
void onFilterSummaries(cs_data_t &payload)
uint8_t _nextFilterIndex
Next index of filter IDs to upload/remove array.
Definition: cs_AssetFilterSyncer.h:64
void onConnectResult(cs_ret_code_t retCode)
Handle steps of the sync process.
void onModificationInProgress(bool inProgress)
Handle a possible change of "filter modification in progress".
cs_ret_code_t init()
Init the class:
cs_ret_code_t onVersion(stone_id_t stoneId, cs_mesh_model_msg_asset_filter_version_t &packet)
Handle a received version mesh message.
uint8_t _filterUploadCount
Definition: cs_AssetFilterSyncer.h:75
void reset()
Abort the sync process.
void onWriteResult(cs_central_write_result_t &result)
void onTick(uint32_t tickCount)
Handle the tick event.
void sendVersionAtLowInterval()
Send version at a low interval for some time.
SyncStep _step
Current step.
Definition: cs_AssetFilterSyncer.h:59
uint16_t _sendVersionCountdown
Countdown counter that keeps track when to call sendVersion again.
Definition: cs_AssetFilterSyncer.h:91
static constexpr uint16_t VERSION_BROADCAST_INTERVAL_RESET_SECONDS
How long the low interval will be used after setting it to low interval.
Definition: cs_AssetFilterSyncer.h:32
void syncFilters(stone_id_t stoneId)
Start updating filters of another crownstone.
void handleEvent(event_t &evt)
Internal usage.
uint8_t _filterIdsToRemove[AssetFilterStore::MAX_FILTER_IDS]
Filter IDs that should be removed.
Definition: cs_AssetFilterSyncer.h:80
Helper class to manage decoupling of components.
Definition: cs_Component.h:35
Event listener.
Definition: cs_EventListener.h:17
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 9,...
Definition: cs_Event.h:26
uint8_t asset_filter_cmd_protocol_t
Definition: cs_AssetFilterPackets.h:15
uint8_t stone_id_t
Definition: cs_Typedefs.h:23
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
Result of writing a control command.
Definition: cs_CrownstoneCentralPackets.h:38
Packets (structs) that are used internally in the firmware, and can be changed freely.
Definition: cs_PacketsInternal.h:27
Definition: cs_MeshModelPackets.h:320