3.2.6.7 RNWF System Service

The system service provides API's to set and get the system level details. The following table lists all the services exposed by the system service layer. The system service API prototype is as follows:
SYS_RNWF_RESULT_t SYS_RNWF_SYSTEM_SrvCtrl(SYS_RNWF_SYSTEM_SERVICE_t request, uint8_t *input)
The table below shows the various commands and options available for system service.
Table 3-28. System Service Options Table
Option/CommandInputRemarks
SYS_RNWF_SYSTEM_RESETNoneRequest/Trigger Reset the system
SYS_RNWF_SYSTEM_ECHO_OFFNoneTurn OFF the AT command Echo
SYS_RNWF_SYSTEM_GET_MAN_IDBuffer array to read Manufacturer IDGet the manufacturing ID
SYS_RNWF_SYSTEM_SET_TIME_UNIXTime (String) in UNIX formatSet the sytem time in UNIX format
SYS_RNWF_SYSTEM_SET_TIME_NTPTime (String) in NTP formatSet the system time in NTP format
SYS_RNWF_SYSTEM_SET_TIME_STRINGTime (String)Set the system time in string (YYYY-MM-DDTHH:MM:SS.00Z) format
SYS_RNWF_SYSTEM_SW_REVBuffer array to read Software RevisionRequest Software Revision
SYS_RNWF_SYSTEM_DEV_INFOBuffer array to read Device InfoRequest Device Info
SYS_RNWF_SYSTEM_SET_SNTPServer name (String)Enable SNTP with given server URL
SYS_RNWF_SYSTEM_GET_TIMEBuffer array to read TimeGet the system time
SYS_RNWF_SYSTEM_GET_CERT_LISTBuffer array to read Certification listGet the available certificate list
SYS_RNWF_SYSTEM_GET_KEY_LISTBuffer array to read Key listGet the available private key list
SYS_RNWF_SYSTEM_GET_WIFI_INFOBuffer array to read Wi-Fi InfoGet Wi-Fi configuration information
SYS_RNWF_SYSTEM_GET_MQTT_INFOBuffer array to read MQTT Config InfoGet MQTT configuration Information
Following are few examples to use the system service API's
/*
    System Service application
*/

/* Application buffer */
uint8_t app_buf[SYS_RNWF_BUF_LEN_MAX];

void APP_Initialize ( void )
{
    /* Place the App state machine in its initial state. */
    appData.state = APP_STATE_INITIALIZE;
}

void APP_Tasks ( void )
{
    switch(appData.state)
    {
        case APP_STATE_INITIALIZE:
        {
            SYS_RNWF_IF_Init();
            appData.state = APP_STATE_REGISTER_CALLBACK;
            SYS_CONSOLE_PRINT("APP_STATE_INITIALIZE\r\n");
            break;
        }
        case APP_STATE_REGISTER_CALLBACK:
        {              
            SYS_RNWF_SYSTEM_SrvCtrl(SYS_RWWF_SYSTEM_GET_WIFI_INFO, app_buf);    
            SYS_CONSOLE_PRINT("Wi-Fi Info:- \r\n%s\n", app_buf);   
    
            SYS_RNWF_SYSTEM_SrvCtrl(SYS_RNWF_SYSTEM_GET_CERT_LIST, app_buf);    
            SYS_CONSOLE_PRINT("Certs on RNWF:- \r\n%s\n", app_buf);
    
            SYS_RNWF_SYSTEM_SrvCtrl(SYS_RNWF_SYSTEM_GET_KEY_LIST, app_buf);    
            SYS_CONSOLE_PRINT("Keys on RNWF:- \r\n%s\n", app_buf);
                                                                                
            SYS_RNWF_SYSTEM_SrvCtrl(SYS_RNWF_SYSTEM_SW_REV, app_buf);    
            SYS_CONSOLE_PRINT("%s\n", app_buf);
    
            SYS_RNWF_SYSTEM_SrvCtrl(SYS_RNWF_SYSTEM_DEV_INFO, app_buf);    
            SYS_CONSOLE_PRINT("%s\n", app_buf);  
              
            appData.state = APP_STATE_TASK;
            break;
        }
        case APP_STATE_TASK:
        {
            if(g_AppState == APP_CLOUD_UP)
            {
                CLOUD_STATE_MACHINE();
            }
            RNWF_EVENT_Handler();
            break;
        }
        default:
        {
            break;
        }
    }
}