188 template <
class BehaviourType>
Describes a recent change event of the behaviour store.
Definition: cs_BehaviourMutation.h:14
Keeps track of the behaviours that are active on this crownstone.
Definition: cs_BehaviourStore.h:25
void storeUpdate(uint8_t index, SwitchBehaviour::Type type, uint8_t *buf, cs_buffer_size_t bufSize)
call state store for the given switch type and update masterhash.
ErrorCodesGeneral removeBehaviour(uint8_t index)
Remove the behaviour at [index].
virtual void handleEvent(event_t &evt)
handles events concerning updates of the active behaviours on this crownstone.
BehaviourMutation handleSaveBehaviour(event_t &evt)
Deserializes the behaviour from event data, and allocate new instance of correct type on the heap.
ErrorCodesGeneral checkSizeAndType(SwitchBehaviour::Type type, cs_buffer_size_t bufSize)
If type is not a valid behaviour type: ERR_WRONG_PARAMETER If bufSize does not match expected size: E...
void assignBehaviour(uint8_t index, Behaviour *behaviour)
Assign it to activateBehaviour[index] and print it.
void LoadBehavioursFromMemory(CS_TYPE BehaviourCsType)
BehaviourMutation handleReplaceBehaviour(event_t &evt)
Deserializes the behaviour from event data, and allocate new instance of correct type on the heap.
std::array< Behaviour *, MaxBehaviours > & getActiveBehaviours()
Definition: cs_BehaviourStore.h:55
uint8_t findEmptyIndex()
returns MaxBehaviours if not found.
ErrorCodesGeneral replaceBehaviour(uint8_t index, Behaviour *behaviour)
Add behaviour to the ActiveBehaviours if there is space.
uint32_t calculateMasterHash()
Calculate the hash over all behaviours.
void handleGetBehaviourIndices(event_t &evt)
void handleGetBehaviour(event_t &evt)
cs_ret_code_t init() override
Initialize store from flash.
Behaviour * getBehaviour(uint8_t index)
void dispatchBehaviourMutationEvent(BehaviourMutation mutation)
void clearActiveBehavioursArray()
Clear all behaviours - usefull for a clean start of the test suite.
size_t getBehaviourSize(SwitchBehaviour::Type type)
returns 0 for unknown types, else the obvious.
void storeUpdate(uint8_t index, Behaviour *behaviour)
call state store for the given behaviour and update masterhash.
void storeMasterHash()
Calculate master hash and store it in State.
static constexpr size_t MaxBehaviours
Definition: cs_BehaviourStore.h:29
ErrorCodesGeneral addBehaviour(Behaviour *behaviour)
Add behaviour to the ActiveBehaviours if there is space.
std::array< Behaviour *, MaxBehaviours > activeBehaviours
Definition: cs_BehaviourStore.h:32
BehaviourStore(BehaviourStore &&other)=delete
ErrorCodesGeneral addBehaviour(uint8_t *buf, cs_buffer_size_t bufSize, uint8_t &index)
Add behaviour to a new index.
BehaviourMutation handleRemoveBehaviour(event_t &evt)
ErrorCodesGeneral replaceParameterValidation(event_t &evt, uint8_t index, SwitchBehaviour::Type type)
BehaviourStore(BehaviourStore &other)=delete
Behaviour * allocateBehaviour(uint8_t index, SwitchBehaviour::Type type, uint8_t *buf, cs_buffer_size_t bufSize)
Heap allocate an instance of given type from the buffer.
virtual ~BehaviourStore()
Class to derrive behaviours from, centralizing common variables such as from and until times.
Definition: cs_Behaviour.h:20
Type
Definition: cs_Behaviour.h:22
Helper class to manage decoupling of components.
Definition: cs_Component.h:35
Event listener.
Definition: cs_EventListener.h:17
Definition: cs_TestAccess.h:11
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 9,...
Definition: cs_Event.h:26
ErrorCodesGeneral
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Jun 17,...
Definition: cs_ErrorCodes.h:9
uint16_t cs_buffer_size_t
Definition: cs_Typedefs.h:20
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
CS_TYPE
Types:
Definition: cs_Types.h:79