Zigbee Protocol Controller 1.6.0
Unify Datastore Fixture

Persistent Datastore fixture. More...

Macros

#define UIC_VERSION_MAX_LEN   100
 : MAX Length of typical version string: for e.g. ver_0.0.6_RC1-269-gb5a9d4be More...
 

Functions

sl_status_t datastore_fixt_setup (const char *datastore_file)
 Fixture for setting up the datastore component. More...
 
int datastore_fixt_teardown ()
 Fixture to tear down the datastore. More...
 
sl_status_t datastore_fixt_setup_and_handle_version (const char *datastore_file, int64_t db_version)
 Function for setting up the datastore component handling the datastore version. More...
 

Detailed Description

Persistent Datastore fixture.

Fixture to initialize the datastore from uic_main, in order to enable the Datastore in a Unify application, add datastore_fixt_setup to the fixt_setup array, when calling Main Function for Contiki

Macro Definition Documentation

◆ UIC_VERSION_MAX_LEN

#define UIC_VERSION_MAX_LEN   100

: MAX Length of typical version string: for e.g. ver_0.0.6_RC1-269-gb5a9d4be

Function Documentation

◆ datastore_fixt_setup()

sl_status_t datastore_fixt_setup ( const char *  datastore_file)

Fixture for setting up the datastore component.

This function gets the config string for datastore file and opens the datastore (Sqlite database) then calls datastore_table_init And calls datastore_attribure_init

Parameters
datastore_filepath for the datastore file.
Returns
SL_STATUS_OK for success, SL_STATUS_FAIL if an error occurred

◆ datastore_fixt_setup_and_handle_version()

sl_status_t datastore_fixt_setup_and_handle_version ( const char *  datastore_file,
int64_t  db_version 
)

Function for setting up the datastore component handling the datastore version.

This function calls reads the datastore config option and calls datastore_open which opens the database and calls datastore_table_init initializes generic tables and then this function checks if the database version is same as current version. (Generic tables have the database version stored)

If the versioning is good then writes the current Unify version in generic table and calls datastore_attribure_init to initialize attribute store table If there is no database version found, it writes the current database version and writes the current Unify version in generic table and calls datastore_attribure_init to initialize attribute store

Parameters
datastore_filepath for the datastore file.
db_versionExpected version number for the database file
Returns
SL_STATUS_OK for success, SL_STATUS_FAIL if an error occurred

◆ datastore_fixt_teardown()

int datastore_fixt_teardown ( )

Fixture to tear down the datastore.

This is basically a wrapper that calls datastore_teardown, see datastore_teardown for more details

Returns
int 0 for success, -1 for failure