The provisioning service helps to configure the Wi-Fi interface credentials. It
supports TCP tunnel and Web server based provisioning services. It implements or handles
all the required AT commands to start the module in Access Point mode and open up a TCP
tunnel or serve a HTML web page to receive the Wi-Fi credentials. The provisioning
service call API syntax is provided below:
Provisioning complete and returns the
provisioned Access Point credentials. User
application can store it securely for auto
reconnection on every boot up
RNWF_PROV_FAILURE
None
Provisioning failure
The provisioning service sequence is provided below:Figure 3-36. Provisioning Service Sequence
Following example code showcases the use of provisioning service
/*
Provisioning application
*/voidAPP_WIFI_Callback(RNWF_WIFI_EVENT_t event, uint8_t *p_str)
{
switch(event)
{
case RNWF_CONNECTED:
printf("Wi-Fi Connected\n");
break;
case RNWF_DISCONNECTED:
printf("Wi-Fi Disconnected\nReconnecting... \n");
RNWF_WIFI_SrvCtrl(RNWF_STA_CONNECT, NULL);
break;
case RNWF_DHCP_DONE:
printf("DHCP IP:%s\n", &p_str[2]);
break;
default:
break;
}
}
voidAPP_PROV_Callback(RNWF_PROV_EVENT_t event, uint8_t *p_str)
{
switch(event)
{
case RNWF_PROV_COMPLTE:
{
RNWF_PROV_SrvCtrl(RNWF_PROV_DISABLE, NULL);
RNWF_WIFI_SrvCtrl(RNWF_WIFI_SET_CALLBACK, APP_WIFI_Callback);
// Application can save the configuration in NVM
RNWF_WIFI_SrvCtrl(RNWF_SET_WIFI_PARAMS, (void *)p_str);
}
break;
case RNWF_PROV_FAILURE:
break;
default:
break;
}
}
intmain(void)
{
SYSTEM_Initialize();
RNWF_IF_Init();
// Enable Provisioning Mode
RNWF_PROV_SrvCtrl(RNWF_PROV_ENABLE, NULL);
RNWF_PROV_SrvCtrl(RNWF_PROV_SET_CALLBACK, (void *)APP_PROV_Callback);
while(1)
{
RNWF_EVENT_Handler();
}
}
The online versions of the documents are provided as a courtesy. Verify all content and data in the device’s PDF documentation found on the device product page.