//--tested, working--// IPAddress WiFiClass::localIP() { // //the local IP is maintained with callbacks, so _SlNonOsMainLoopTask() //is critical. The IP is "written" into the buffer to avoid memory errors // _SlNonOsMainLoopTask(); IPAddress retIP(0,0,0,0); retIP = sl_Htonl(local_IP); return retIP; }
//--tested, working--// IPAddress WiFiClass::gatewayIP() { if (!_initialized) { init(); } // //get current configuration // _NetCfgIpV4Args_t config = {0}; unsigned char len = sizeof(_NetCfgIpV4Args_t); sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO, NULL, &len, (unsigned char*)&config); // //change the uint32_t IP to the IPAddress class and return // IPAddress retIP(0,0,0,0); retIP = sl_Htonl(config.ipV4Gateway); return retIP; }
//--tested, working--// IPAddress WiFiClass::localIP() { // //the local IP is maintained with callbacks, so _SlNonOsMainLoopTask() //is critical. The IP is "written" into the buffer to avoid memory errors // _SlNonOsMainLoopTask(); SlNetCfgIpV4Args_t config = {0}; unsigned char len = sizeof(SlNetCfgIpV4Args_t); sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO, NULL, &len, (unsigned char*)&config); // //change the uint32_t IP to the IPAddress class and return // IPAddress retIP(0,0,0,0); retIP = sl_Htonl(config.ipV4); return retIP; }