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.
Option/Command | Input | Remarks |
---|---|---|
RNWF_SYSTEM_RESET | None | Request/Trigger Reset the system |
RNWF_SYSTEM_ECHO_OFF | None | Turn OFF the AT command Echo |
RNWF_SYSTEM_GET_MAN_ID | Buffer array to read Manufacturer ID | Get the manufacturing ID |
RNWF_SYSTEM_TBL | None | Request RNWF to reset to bootloader |
RNWF_SYSTEM_SET_TIME_UNIX | Time (String) in UNIX format | Set the sytem time in UNIX format |
RNWF_SYSTEM_SET_TIME_NTP | Time (String) in NTP format | Set the system time in NTP format |
RNWF_SYSTEM_SET_TIME_STRING | Time (String) | Set the system time in string (YYYY-MM-DDTHH:MM:SS.00Z) format |
RNWF_SYSTEM_SW_REV | Buffer array to read Software Revision | Request Software Revision |
RNWF_SYSTEM_DEV_INFO | Buffer array to read Device Info | Request Device Info |
RNWF_SYSTEM_SET_SNTP | Server name (String) | Enable SNTP with given server URL |
RNWF_SYSTEM_GET_TIME | Buffer array to read Time | Get the system time |
RNWF_SYSTEM_GET_CERT_LIST | Buffer array to read Certification list | Get the available certificate list |
RNWF_SYSTEM_GET_KEY_LIST | Buffer array to read Key list | Get the available private key list |
RNWF_SYSTEM_GET_WIFI_INFO | Buffer array to read Wi-Fi Info | Get Wi-Fi configuration information |
RNWF_SYSTEM_GET_MQTT_INFO | Buffer array to read MQTT Config Info | Get 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(); } }