ZentriOS Settings

Functions for reading/writing/loading ZentriOS variables. More...

Functions

zos_result_t zn_load_app_settings (const char *settings_name)
 Load settings file built into ZAP image. More...
 
zos_result_t zn_settings_set_str (const char *setting, const char *value)
 Set ZentriOS string setting. More...
 
zos_result_t zn_settings_set_uint32 (const char *setting, uint32_t value)
 Set uint32 setting. More...
 
zos_result_t zn_settings_set_int32 (const char *setting, int32_t value)
 Set int32 setting. More...
 
zos_result_t zn_settings_get_str (const char *setting, char *buffer, uint16_t max_length)
 Get string setting. More...
 
char * zn_settings_get_print_str (const char *setting, char *buffer, uint16_t max_length)
 Get string setting for printing. More...
 
zos_result_t zn_settings_get_uint32 (const char *setting, uint32_t *value_ptr)
 Get uint32 setting. More...
 
zos_result_t zn_settings_save (const char *filename)
 Save settings to NVM or file. More...
 
zos_result_t zn_settings_load (const char *filename)
 Load settings from file. More...
 

Detailed Description

Functions for reading/writing/loading ZentriOS variables.

Function Documentation

zos_result_t zn_load_app_settings ( const char *  settings_name)

Load settings file built into ZAP image.

This configures module settings based on the specified configuration file. When the ZAP app is built, the settings file(s) are built into the ZAP image. Note that the settings files always resides on serial flash.

One or more settings file may specified in the app's .mk file. The filename of the settings file should be passed to this API.

Parameters
settings_nameSettings filename, specified in the app's .mk file.
Returns
zos_result_t result of api call
Examples:
basic/display_stream/display_stream.c, basic/http_server/http_server.c, basic/http_stream/http_stream.c, basic/softap_tcp_server/softap_tcp_server.c, basic/tcp_client/tcp_client.c, basic/websocket_client/websocket_client.c, basic/websocket_server/websocket_server.c, cloud/mqttdemo/main.c, demo/accelerometer_stream/accelerometer_stream.c, demo/gps/main.c, demo/led_matrix/led_matrix.c, demo/moray3d/moray3d.c, demo/pong/link.c, demo/pong/link_client.c, demo/pong/link_server.c, nxp/nfc3d/main.c, nxp/nxp3d/nxp3d.c, sensors/accel_interrupt/main.c, and sensors/skink/main.c.
char* zn_settings_get_print_str ( const char *  setting,
char *  buffer,
uint16_t  max_length 
)

Get string setting for printing.

See ZentriOS Command API documentation: get.

For variables available to get, see ZentriOS Command API documentation: variables.

Returns null-terminated string on failure

Parameters
[in]settingThe setting's name
[out]bufferBuffer to hold setting's string value
[in]max_lengthThe length in bytes of the given buffer
Returns
Result of API, see zos_result_t
zos_result_t zn_settings_get_str ( const char *  setting,
char *  buffer,
uint16_t  max_length 
)

Get string setting.

See ZentriOS Command API documentation: get.

For variables available to get, see ZentriOS Command API documentation: variables.

Note
The returned string may NOT be null-terminated
Parameters
[in]settingThe setting's name
[out]bufferBuffer to hold setting's string value
[in]max_lengthThe length in bytes of the given buffer
Returns
Result of API, see zos_result_t
zos_result_t zn_settings_get_uint32 ( const char *  setting,
uint32_t *  value_ptr 
)

Get uint32 setting.

See ZentriOS Command API documentation: get.

For variables available to get, see ZentriOS Command API documentation: variables.

Parameters
[in]settingThe setting's name
[out]value_ptrPointer to hold setting's uint32 value
Returns
Result of API, see zos_result_t
zos_result_t zn_settings_load ( const char *  filename)

Load settings from file.

See ZentriOS Command API documentation: load.

Wi-Fi module settings are loaded from file on extended/bulk flash file system. The settings will be lost on a power-cycle/reboot. Refer to zn_settings_save() to save settings to NVM.

Parameters
[in]filenameFilename of file to load settings from
zos_result_t zn_settings_save ( const char *  filename)

Save settings to NVM or file.

See ZentriOS Command API documentation: save.

This saves the settings cache to the device's onboard NVM.

If filename is NULL then save settings to NVM else settings are saved to file on extended/bulk flash file system.

Parameters
[in]filenameOptional filename of file to save settings, leave NULL to save to onboard NVM
Examples:
nxp/nfc3d/main.c.
zos_result_t zn_settings_set_int32 ( const char *  setting,
int32_t  value 
)

Set int32 setting.

See ZentriOS Command API documentation: set.

For variables available to set, see ZentriOS Command API documentation: variables.

Note
This only updates the setting in the volatile cache. Use zn_settings_save() for the setting to persist through reboots/powercycles.
Parameters
[in]settingThe setting's name
[in]valueThe setting's new int32 value
Returns
Result of API, see zos_result_t
zos_result_t zn_settings_set_str ( const char *  setting,
const char *  value 
)

Set ZentriOS string setting.

See ZentriOS Command API documentation: set.

For variables available to set, see ZentriOS Command API documentation: variables.

Note
This only updates the setting in the volatile cache. Use zn_settings_save() for the setting to persist through reboots/powercycles.
Parameters
[in]settingThe setting's name
[in]valueThe setting's new string value
Returns
Result of API, see zos_result_t
zos_result_t zn_settings_set_uint32 ( const char *  setting,
uint32_t  value 
)

Set uint32 setting.

See ZentriOS Command API documentation: set.

For variables available to set, see ZentriOS Command API documentation: variables.

Note
This only updates the setting in the volatile cache. Use zn_settings_save() for the setting to persist through reboots/powercycles.
Parameters
[in]settingThe setting's name
[in]valueThe setting's new uint32 value
Returns
Result of API, see zos_result_t