|
Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
|
Class that enables the feature to run microapps on the firmware. More...
#include <cs_Microapp.h>


Public Member Functions | |
| void | init (OperationMode operationMode) |
| Initialize storage, and load microapps in normal mode. More... | |
| bool | canRunApp (uint8_t index) |
| Checks app state and returns true if this app is allowed to run. More... | |
| void | onExcessiveCallDuration (uint8_t appIndex) |
| To be called when a microapp took too long to yield. More... | |
Public Member Functions inherited from EventListener | |
| EventListener () | |
| virtual | ~EventListener () |
| unregisters the listener. More... | |
| virtual void | handleEvent (event_t &event)=0 |
| Handle events. More... | |
| void | listen () |
| Registers this with the EventDispatcher. More... | |
Static Public Member Functions | |
| static Microapp & | getInstance () |
Private Member Functions | |
| Microapp () | |
| Singleton, constructor, also copy constructor, is private. More... | |
| Microapp (Microapp const &)=delete | |
| void | operator= (Microapp const &)=delete |
| void | loadApps () |
| void | loadState (uint8_t index) |
| void | updateStateFromOperatingData (uint8_t index) |
| Update state from operating data in IPC. More... | |
| cs_ret_code_t | validateApp (uint8_t index) |
| Validates app: compare checksum. More... | |
| cs_ret_code_t | enableApp (uint8_t index) |
| Enables app: checks sdk version. More... | |
| cs_ret_code_t | startApp (uint8_t index) |
| Start app, if it passed all tests according to cached state. More... | |
| void | resetState (uint8_t index) |
| Resets app state in ram only. More... | |
| void | resetTestState (uint8_t index) |
| Resets app state tests in ram only. More... | |
| cs_ret_code_t | storeState (uint8_t index) |
| Store app state to flash. More... | |
| void | tick () |
| To be called every tick. More... | |
| cs_ret_code_t | handleGetInfo (cs_result_t &result) |
| Handle control commands. More... | |
| cs_ret_code_t | handleUpload (microapp_upload_internal_t *packet) |
| cs_ret_code_t | handleValidate (microapp_ctrl_header_t *packet) |
| cs_ret_code_t | handleRemove (microapp_ctrl_header_t *packet) |
| cs_ret_code_t | handleEnable (microapp_ctrl_header_t *packet) |
| cs_ret_code_t | handleDisable (microapp_ctrl_header_t *packet) |
| cs_ret_code_t | handleMessage (microapp_message_internal_t *packet, cs_result_t &result) |
| cs_ret_code_t | checkHeader (microapp_ctrl_header_t *packet) |
| Checks if control command header is ok. More... | |
| cs_ret_code_t | factoryReset () |
| Removes all microapps and sends an event when done: EVT_MICROAPP_FACTORY_RESET_DONE. More... | |
| cs_ret_code_t | resumeFactoryReset () |
| Remove next microapp and sends an event when done: EVT_MICROAPP_FACTORY_RESET_DONE. More... | |
| void | onStorageEvent (cs_async_result_t &event) |
| Handle microapp storage event. More... | |
| void | handleEvent (event_t &event) |
| Handle incoming events. More... | |
Private Attributes | |
| microapp_state_t | _states [g_MICROAPP_COUNT] |
| The state of each microapp. More... | |
| bool | _started [g_MICROAPP_COUNT] = {} |
| Keep up whether the microapp has been started yet. More... | |
| bool | _loaded = false |
| Local flag to indicate that ram section has been loaded. More... | |
| uint8_t | _currentMicroappIndex = MICROAPP_INDEX_NONE |
| Keep up which microapp is currently being operated on. More... | |
| bool | _factoryResetMode = false |
| Whether we are in factory reset mode. More... | |
Class that enables the feature to run microapps on the firmware.
This class:
|
private |
Singleton, constructor, also copy constructor, is private.
|
privatedelete |
| bool Microapp::canRunApp | ( | uint8_t | index | ) |
Checks app state and returns true if this app is allowed to run.
|
private |
Checks if control command header is ok.
|
private |
Enables app: checks sdk version.
App state is updated in this call, make sure to store the state afterwards.
|
private |
Removes all microapps and sends an event when done: EVT_MICROAPP_FACTORY_RESET_DONE.
|
inlinestatic |
|
private |
|
private |
|
privatevirtual |
Handle incoming events.
Implements EventListener.
|
private |
Handle control commands.
|
private |
|
private |
|
private |
|
private |
| void Microapp::init | ( | OperationMode | operationMode | ) |
Initialize storage, and load microapps in normal mode.
Checks operation mode and only actually initializes for some modes.
|
private |
|
private |
| void Microapp::onExcessiveCallDuration | ( | uint8_t | appIndex | ) |
To be called when a microapp took too long to yield.
|
private |
Handle microapp storage event.
For now, this just handles CMD_RESOLVE_ASYNC_CONTROL_COMMAND. We should register an event handler instead.
|
privatedelete |
|
private |
Resets app state in ram only.
|
private |
Resets app state tests in ram only.
|
private |
Remove next microapp and sends an event when done: EVT_MICROAPP_FACTORY_RESET_DONE.
|
private |
Start app, if it passed all tests according to cached state.
|
private |
Store app state to flash.
|
private |
To be called every tick.
Calls all microapps.
|
private |
Update state from operating data in IPC.
For example, when a reboot has happened when a microapp was running, this updates the state accordingly.
|
private |
Validates app: compare checksum.
App state is updated in this call, make sure to store the state afterwards.
|
private |
Keep up which microapp is currently being operated on.
Used for factory reset. Set to MICROAPP_INDEX_NONE when not operating on anything.
|
private |
Whether we are in factory reset mode.
|
private |
Local flag to indicate that ram section has been loaded.
|
private |
Keep up whether the microapp has been started yet.
Init to false (default bool constructor).
|
private |
The state of each microapp.