Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_Setup.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <ble/cs_Nordic.h>
11#include <cfg/cs_Config.h>
12#include <common/cs_Types.h>
15
16#include <cstdint>
17
18// All the state variables that are expected to be written to flash.
35};
36#define SETUP_CONFIG_MASK_ALL ((1 << SETUP_CONFIG_NUM_BITS) - 1)
37
51public:
52 // Gets a static singleton (no dynamic memory allocation)
53 static Setup& getInstance() {
54 static Setup instance;
55 return instance;
56 }
57
59
60 // Handle events as EventListener
61 void handleEvent(event_t& event);
62
63private:
65
66 // Used to check if all state variables are written to flash.
68
69 void setWithCheck(const CS_TYPE& type, void* value, const size16_t size);
70 void onStorageDone(const CS_TYPE& type);
72
75
76 // returns the uncached operation mode, read directly from flash.
78
85 void finalize();
86};
Event listener.
Definition: cs_EventListener.h:17
Setup class.
Definition: cs_Setup.h:50
void setWithCheck(const CS_TYPE &type, void *value, const size16_t size)
void resetDelayed()
static Setup & getInstance()
Definition: cs_Setup.h:53
cs_ret_code_t handleCommand(cs_data_t data)
void finalize()
Finalize the setup.
void setNormalMode()
void onStorageDone(const CS_TYPE &type)
OperationMode getPersistedOperationMode()
void resolveAsyncResult(ErrorCodesGeneral errCode)
void handleEvent(event_t &event)
Handle events.
uint32_t _successfullyStoredBitmask
Definition: cs_Setup.h:67
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
SetupConfigBit
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Apr 9,...
Definition: cs_Setup.h:19
@ SETUP_CONFIG_BIT_SWITCH
Definition: cs_Setup.h:33
@ SETUP_CONFIG_BIT_BASIC_KEY
Definition: cs_Setup.h:24
@ SETUP_CONFIG_BIT_LOCALIZATION_KEY
Definition: cs_Setup.h:26
@ SETUP_CONFIG_BIT_MEMBER_KEY
Definition: cs_Setup.h:23
@ SETUP_CONFIG_BIT_IBEACON_MAJOR
Definition: cs_Setup.h:31
@ SETUP_CONFIG_BIT_IBEACON_MINOR
Definition: cs_Setup.h:32
@ SETUP_CONFIG_NUM_BITS
Definition: cs_Setup.h:34
@ SETUP_CONFIG_BIT_STONE_ID
Definition: cs_Setup.h:20
@ SETUP_CONFIG_BIT_ADMIN_KEY
Definition: cs_Setup.h:22
@ SETUP_CONFIG_BIT_IBEACON_UUID
Definition: cs_Setup.h:30
@ SETUP_CONFIG_BIT_MESH_APP_KEY
Definition: cs_Setup.h:28
@ SETUP_CONFIG_BIT_MESH_NET_KEY
Definition: cs_Setup.h:29
@ SETUP_CONFIG_BIT_SPHERE_ID
Definition: cs_Setup.h:21
@ SETUP_CONFIG_BIT_MESH_DEVICE_KEY
Definition: cs_Setup.h:27
@ SETUP_CONFIG_BIT_SERVICE_DATA_KEY
Definition: cs_Setup.h:25
uint16_t size16_t
Definition: cs_Typedefs.h:25
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
OperationMode
Definition: cs_Types.h:440
CS_TYPE
Types:
Definition: cs_Types.h:79
Packets (structs) that are used internally in the firmware, and can be changed freely.
Definition: cs_PacketsInternal.h:27