Definition: cs_AssetStore.h:15
Store< asset_record_t, MAX_RECORDS > _store
Definition: cs_AssetStore.h:76
Coroutine updateLastSentCounterRoutine
Definition: cs_AssetStore.h:79
Coroutine updateLastReceivedCounterRoutine
Definition: cs_AssetStore.h:78
static constexpr auto MAX_RECORDS
Definition: cs_AssetStore.h:72
static constexpr auto THROTTLE_COUNTER_PERIOD_MS
Interval at which the throttle countdown is decreased.
Definition: cs_AssetStore.h:34
uint16_t throttlingBumpMsToTicks(uint16_t timeToNextThrottleOpenMs)
Convert ms to ticks, rounding fractional parts upwards.
void incrementLastReceivedCounters()
Adds 1 to the update/sent counters of all valid records, until 0xff is reached.
cs_ret_code_t init() override
Components can implement this if they need to get references to sibling or if they need to do specifi...
asset_record_t * getOrCreateRecord(const asset_id_t &id)
returns a pointer of record if found, else tries to create a new blank record and return a pointer to...
void addThrottlingBump(asset_record_t &record, uint16_t timeToNextThrottleOpenMs)
Adds a value to the records' throttlingCountdownTicks.
void decrementThrottlingCounters()
Decrements throttlingCountdownTicks by 1of all valid records, until zero is reached.
asset_record_t * handleAcceptedAsset(const scanned_device_t &asset, const asset_id_t &assetId)
Get or create a record for the given assetId.
asset_record_t * getRecord(const asset_id_t &id)
returns a pointer of record if found, else returns nullptr.
static constexpr uint8_t LAST_RECEIVED_TIMEOUT_THRESHOLD_S
Time in seconds after which a record is timed out.
Definition: cs_AssetStore.h:24
static constexpr auto LAST_RECEIVED_COUNTER_PERIOD_MS
Interval at which the timeout counter is increased, should be 1 second.
Definition: cs_AssetStore.h:29
void handleEvent(event_t &evt) override
Handle events.
Helper class to manage decoupling of components.
Definition: cs_Component.h:35
A coroutine essentially is a throttling mechanism: it takes in a tick-event or tick count and execute...
Definition: cs_Coroutine.h:40
Event listener.
Definition: cs_EventListener.h:17
A variable size storage utility for objects of type RecordType with absolute maximum MaxItemCount.
Definition: cs_Store.h:25
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
Definition: cs_AssetFilterPackets.h:93
Definition: cs_AssetRecord.h:12
Scanned device.
Definition: cs_PacketsInternal.h:107