Application Settings

Functions for reading/writing/loading variables that are custom defined by ZentriOS applications. More...

zos_result_t zn_nvm_read (void *dst_buffer, uint16_t offset, uint16_t length)
 Read NVM cached data into given buffer. More...
 
zos_result_t zn_nvm_write (const void *src_buffer, uint16_t offset, uint16_t length)
 Write data to NVM cache. More...
 
zos_result_t zn_nvm_get_cache_reference (uint8_t **cache_ptr)
 Get pointer to NVM cached memory. More...
 
zos_result_t zn_nvm_save (const char *filename)
 Save cached NVM memory to NVM. More...
 

Detailed Description

Functions for reading/writing/loading variables that are custom defined by ZentriOS applications.

Function Documentation

zos_result_t zn_nvm_get_cache_reference ( uint8_t **  cache_ptr)

Get pointer to NVM cached memory.

The pointer is a cached reference to NVM used to store application-specific settings The cached NVM is stored in RAM and may be read/written (but is volatile) Issuing zn_nvm_save() saves the cached NVM to flash The maximum NVM size available to apps is ZOS_NVM_MAX_SIZE

Parameters
[out]cache_ptrPointer to hold pointer to NVM cache
Returns
Result of API, see zos_result_t
zos_result_t zn_nvm_read ( void *  dst_buffer,
uint16_t  offset,
uint16_t  length 
)

Read NVM cached data into given buffer.

On ZentriOS startup, the Zap NVM data is loaded into a cache. This API allows for reading the Zap's NVM cached data.

Note
The maximum NVM size available to apps is ZOS_NVM_MAX_SIZE
Parameters
[out]dst_bufferBuffer to hold read NVM cached data
[in]offsetOffset from beginning of NVM cache
[in]lengthNumber of bytes to read into dst_buffer
Returns
Result of API, see zos_result_t
zos_result_t zn_nvm_save ( const char *  filename)

Save cached NVM memory to NVM.

See ZentriOS Command API documentation: save.

Note
This also saves any updated ZentriOS settings to a separate section of NVM.

If the filename argument is not NULL, then the NVM memory is saved to the specified file on the file system.

Parameters
[in]filenameOptional filename to save NVM to, leave NULL to save to NVM
Returns
Result of API, see zos_result_t
zos_result_t zn_nvm_write ( const void *  src_buffer,
uint16_t  offset,
uint16_t  length 
)

Write data to NVM cache.

A Zap's NVM data is stored in a local cache. This API allows for writing the cache.

Note
The cache isn't saved to NVM until zn_nvm_save() is called.
The maximum NVM size available to apps is ZOS_NVM_MAX_SIZE
Parameters
[in]src_bufferBuffer containing data to write to NVM cache
[in]offsetOffset from beginning of NVM cache
[in]lengthNumber of bytes to write to cache
Returns
Result of API, see zos_result_t