The validate functions provide a generic interface via which a highly use-case specific validation algorithm can determine the current state of the logging and monitoring process.
- Note
- The validation has a close relationship with Memory block, as they will both call each other's API. Be careful with the order of initialization and calling the API's of the two blocks of code.
◆ Validate_Init()
void Validate_Init |
( |
uint32_t * |
pWorkspace | ) |
|
Initializes file scoped variables.
- Parameters
-
pWorkspace | Points to a 32-bit value free to be used by the validation process. Any change to this value is assumed to be stored in EEPROM or ALON before going to Power-off or Deep Power Down mode and given back unaltered in a next call to this function. This allows the validation process to keep track of it own internal state. |
- Note
- The value pointed to given may not change too often, never hitting the official endurance limit of 10k.
- Precondition
- Must be the first function called in this file.
-
Must be called before changes to state and/or configuration are to be made.
-
All calls to this function must provide the same workspace.
- Warning
- pWorkspace If
NULL
is given, functionality may be severely limited. Check the implementation for details.
◆ Validate_DeInit()
void Validate_DeInit |
( |
void |
| ) |
|
De-initializes the validation process.
- Warning
- This call can still change the contents pointed to by
pWorkspace
(see Validate_Init).
-
This call can still change MEMORY_CONFIG_T.status.
◆ Validate_Reset()
void Validate_Reset |
( |
void |
| ) |
|
To be called once per active lifetime: when monitoring - of whatever - starts, this call ensures the validation starts with a good known state, using initial values.
- Note
- Do not call this function each time after starting up or waking up from a low power state, as it will reset all intermediate validation data and conclusions.
- Warning
- This call may take a long time to complete. See the specific implementation for details.
◆ Validate_Temperature()
void Validate_Temperature |
( |
int16_t |
temperature | ) |
|
Checks the data from Memory_GetConfig and takes proper actions based on the updated data.
- Precondition
- Memory_Init must have been called.
- Parameters
-
temperature | The last temperature that was measured. |
- Warning
- This call may take a long time to complete. See the specific implementation for details.
◆ Validate_NewEvents()
void Validate_NewEvents |
( |
uint32_t |
newEvents | ) |
|
For each new event, call this function to ensure the algorithm takes them properly into account.
- Precondition
- Memory_Init must have been called.
- Parameters
-
newEvents | A bitmask of OR'd events of type EVENT_TAG_T. Only new events, which have not yet been reported are present. |
- Warning
- This call may take a long time to complete. See the specific implementation for details.
- Precondition
- All new events have already been handled by the memory application file, and can be queried for in the event handler module.
◆ Validate_Humidity()
void Validate_Humidity |
( |
uint16_t |
humidity | ) |
|
Checks the data from Memory_GetConfig and takes proper actions based on the updated data.
- Precondition
- Memory_Init must have been called.
- Parameters
-
humidity | The last humidity that was measured. |
- Warning
- This call may take a long time to complete. See the specific implementation for details.