3.1.7.6 RNWF System Service

The system service provides APIs 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:
RNWF_RESULT_t RNWF_SYSTEM_SrvCtrl(RNWF_SYSTEM_SERVICE_t request, uint8_t *input)
The table below shows the various commands and options available for system service.
Table 3-12. System Service Options
Option/CommandInputRemarks
RNWF_SYSTEM_RESETNoneRequest/Trigger Reset the system
RNWF_SYSTEM_ECHO_OFFNoneTurn OFF the AT command Echo
RNWF_SYSTEM_GET_MAN_IDBuffer array to read Manufacturer IDGet the manufacturing ID
RNWF_SYSTEM_TBLNoneRequest RNWF to reset to bootloader
RNWF_SYSTEM_SET_TIME_UNIXTime (String) in UNIX formatSet the sytem time in UNIX format
RNWF_SYSTEM_SET_TIME_NTPTime (String) in NTP formatSet the system time in NTP format
RNWF_SYSTEM_SET_TIME_STRINGTime (String)Set the system time in string (YYYY-MM-DDTHH:MM:SS.00Z) format
RNWF_SYSTEM_SW_REVBuffer array to read Software RevisionRequest Software Revision
RNWF_SYSTEM_DEV_INFOBuffer array to read Device InfoRequest Device Info
RNWF_SYSTEM_SET_SNTPServer name (String)Enable SNTP with given server URL
RNWF_SYSTEM_GET_TIMEBuffer array to read TimeGet the system time
RNWF_SYSTEM_GET_CERT_LISTBuffer array to read Certification listGet the available certificate list
RNWF_SYSTEM_GET_KEY_LISTBuffer array to read Key listGet the available private key list
RNWF_SYSTEM_GET_WIFI_INFOBuffer array to read Wi-Fi InfoGet Wi-Fi configuration information
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[APP_BUFFER_SIZE_MAX];

int main(void)
{         
    SYSTEM_Initialize();
    RNWF_IF_Init(); 
    
    RNWF_SYSTEM_SrvCtrl(RWWF_SYSTEM_GET_WIFI_INFO, app_buf);    
    printf("Wi-Fi Info:- \r\n%s\n", app_buf);   
    
    RNWF_SYSTEM_SrvCtrl(RNWF_SYSTEM_GET_CERT_LIST, app_buf);    
    printf("Certs on RNWF:- \r\n%s\n", app_buf);
    
    RNWF_SYSTEM_SrvCtrl(RNWF_SYSTEM_GET_KEY_LIST, app_buf);    
    printf("Keys on RNWF:- \r\n%s\n", app_buf);
                                                                     
    const char sntp_url[] =  "0.in.pool.ntp.org";    
    RNWF_SYSTEM_SrvCtrl(RNWF_SYSTEM_SET_SNTP, sntp_url);             
                
    RNWF_SYSTEM_SrvCtrl(RNWF_SYSTEM_SW_REV, app_buf);    
    printf("%s\n", app_buf);
    
    RNWF_SYSTEM_SrvCtrl(RNWF_SYSTEM_DEV_INFO, app_buf);    
    printf("%s\n", app_buf);  
                                
    while(1)
    {                                                             
        RNWF_EVENT_Handler();            
    }    
}