/**
*  @brief Start provisioning
*
*  Used to start Limited Access Point
*
*  @param  AP ssid
*  @param  AP WiFi channel
*  @param  AP Host IP (string)
*  @param  AP Host subnet mask (string)
*  @param  AP Host name
*
*  @return True if successful
*/
bool GS_API_StartProvisioning(char* provSsid, char* provChannel, char* ip,
								char* subnetMask, char* hostName) {

	 GS_Api_SetResponseTimeoutHandle(TIMEOUT_RESPONSE_INTERVAL_HIGH);

     // Disable DHCP
     if (!gs_api_handle_cmd_resp(AtLibGs_DHCPSet(0)))
          return false;

     // Set Static IP
     if (!gs_api_handle_cmd_resp(
              AtLibGs_IPSet((int8_t*) ip, (int8_t*) subnetMask, (int8_t*) ip)))
          return false;

     // Enable DHCP Server
     if (!gs_api_handle_cmd_resp(AtLibGs_SetDHCPServerMode(1)))
    	 return false;

     // Enable Limited AP
     if (!gs_api_handle_cmd_resp(AtLibGs_Mode(2)))
          return false;

     // Set SSID and Channel
     if (!gs_api_handle_cmd_resp(
              AtLibGs_Assoc((int8_t*) provSsid, (int8_t*) "",
                            (int8_t*) provChannel)))
          return false;

     /* Reset the receive buffer */
     AtLib_FlushRxBuffer();

     GS_Api_SetResponseTimeoutHandle(TIMEOUT_RESPONSE_INTERVAL_LOW);

     return true;
}
Example #2
0
void GS_API_StartProvisioning(char* provSsid, char* provChannel, char* username,
                              char* password, char* ip, char* subnetMask, char* hostName) {


     // Disable DHCP
     if (!gs_api_handle_cmd_resp(AtLibGs_DHCPSet(0)))
          return;

     // Set Static IP
     if (!gs_api_handle_cmd_resp(
              AtLibGs_IPSet((int8_t*) ip, (int8_t*) subnetMask, (int8_t*) ip)))
          return;

     // Enable Limited AP
     if (!gs_api_handle_cmd_resp(AtLibGs_Mode(2)))
          return;

     // Set SSID and Channel
     if (!gs_api_handle_cmd_resp(
              AtLibGs_Assoc((int8_t*) provSsid, (int8_t*) "",
                            (int8_t*) provChannel)))
          return;

     // Enable DHCP Server
     gs_api_handle_cmd_resp(AtLibGs_SetDHCPServerMode(1));

     // Enable DNS Server
     //if (!gs_api_handle_cmd_resp(AtLibGs_SetDNSServerMode(1, hostName)))
     //     return;

     if (!gs_api_handle_cmd_resp(AtLibGs_BData (1)))
		return;
     // Enable Provisioning
     //if (!gs_api_handle_cmd_resp(AtLibGs_StartProv(username, password)))
     //     return;

     //GS_API_Printf("Prov Up SSID:%s", provSsid);
     //GS_API_Printf("%s/gsclient.html", ip);

     /* Reset the receive buffer */
     AtLib_FlushRxBuffer();

}