int application_start( void ) { OSStatus err = kNoErr; MicoInit( ); /*The notification message for the registered WiFi status change*/ err = MICOAddNotification( mico_notify_WIFI_STATUS_CHANGED, (void *)micoNotify_WifiStatusHandler ); require_noerr( err, exit ); memset(&wNetConfig, 0x0, sizeof(network_InitTypeDef_st)); strcpy((char*)wNetConfig.wifi_ssid, ap_ssid); strcpy((char*)wNetConfig.wifi_key, ap_key); wNetConfig.wifi_mode = Soft_AP; wNetConfig.dhcpMode = DHCP_Server; wNetConfig.wifi_retry_interval = 100; strcpy((char*)wNetConfig.local_ip_addr, "192.168.0.1"); strcpy((char*)wNetConfig.net_mask, "255.255.255.0"); strcpy((char*)wNetConfig.dnsServer_ip_addr, "192.168.0.1"); micoWlanStart(&wNetConfig); wifi_softap_log("ssid:%s key:%s", wNetConfig.wifi_ssid, wNetConfig.wifi_key); exit: return err; }
void _easylinkStartSoftAp( mico_Context_t * const inContext) { OSStatus err; easylink_log_trace(); network_InitTypeDef_st wNetConfig; memset(&wNetConfig, 0, sizeof(network_InitTypeDef_st)); wNetConfig.wifi_mode = Soft_AP; snprintf(wNetConfig.wifi_ssid, 32, "MXCHIP_%c%c%c%c%c%c", inContext->micoStatus.mac[9], inContext->micoStatus.mac[10], \ inContext->micoStatus.mac[12], inContext->micoStatus.mac[13], inContext->micoStatus.mac[15], inContext->micoStatus.mac[16] ); strcpy((char*)wNetConfig.wifi_key, ""); strcpy((char*)wNetConfig.local_ip_addr, "10.10.10.1"); strcpy((char*)wNetConfig.net_mask, "255.255.255.0"); strcpy((char*)wNetConfig.gateway_ip_addr, "10.10.10.1"); wNetConfig.dhcpMode = DHCP_Server; micoWlanStart(&wNetConfig); easylink_log("Establish soft ap: %s.....", wNetConfig.wifi_ssid); if(inContext->flashContentInRam.micoSystemConfig.bonjourEnable == true){ err = MICOStartBonjourService( Soft_AP , inContext ); require_noerr(err, exit); } if(inContext->flashContentInRam.micoSystemConfig.configServerEnable == true){ err = MICOStartConfigServer ( inContext ); require_noerr(err, exit); } ConfigSoftApWillStart( inContext ); exit: return; }
OSStatus startEasyLinkSoftAP( mico_Context_t * const inContext) { easylink_uap_log_trace(); OSStatus err = kUnknownErr; network_InitTypeDef_st wNetConfig; err = MICOAddNotification( mico_notify_WIFI_STATUS_CHANGED, (void *)_EasyLinkNotify_WifiStatusHandler ); require_noerr(err, exit); err = MICOAddNotification( mico_notify_WiFI_PARA_CHANGED, (void *)_EasyLinkNotify_WiFIParaChangedHandler ); require_noerr(err, exit); err = MICOAddNotification( mico_notify_DHCP_COMPLETED, (void *)_EasyLinkNotify_DHCPCompleteHandler ); require_noerr( err, exit ); // Start the EasyLink thread ConfigWillStart(inContext); if(inContext->flashContentInRam.micoSystemConfig.easyLinkByPass == EASYLINK_BYPASS_NO){ memset(&wNetConfig, 0, sizeof(network_InitTypeDef_st)); wNetConfig.wifi_mode = Soft_AP; snprintf(wNetConfig.wifi_ssid, 32, "EasyLink_%c%c%c%c%c%c", inContext->micoStatus.mac[9], inContext->micoStatus.mac[10], inContext->micoStatus.mac[12], inContext->micoStatus.mac[13], inContext->micoStatus.mac[15], inContext->micoStatus.mac[16] ); strcpy((char*)wNetConfig.wifi_key, ""); strcpy((char*)wNetConfig.local_ip_addr, "10.10.10.1"); strcpy((char*)wNetConfig.net_mask, "255.255.255.0"); strcpy((char*)wNetConfig.gateway_ip_addr, "10.10.10.1"); wNetConfig.dhcpMode = DHCP_Server; micoWlanStart(&wNetConfig); easylink_uap_log("Establish soft ap: %s.....", wNetConfig.wifi_ssid); err = _initBonjourForEasyLink( Soft_AP , inContext ); require_noerr(err, exit); }else{ err = _initBonjourForEasyLink( Station , inContext ); _easylinkConnectWiFi_fast(inContext); require_noerr(err, exit); } start_bonjour_service(); _bonjourStarted = true; err = MICOStartConfigServer ( inContext ); require_noerr(err, exit); ConfigSoftApWillStart( inContext ); exit: return err; }
//------------------------------ static void _stopWifiSta(void) { network_InitTypeDef_st wNetConfig; memset(&wNetConfig, 0x00, sizeof(network_InitTypeDef_st)); wNetConfig.wifi_mode = Station; wNetConfig.wifi_retry_interval = 0x7FFFFFFF; sprintf((char*)&wNetConfig.dnsServer_ip_addr, "208.67.222.222"); sprintf((char*)&wNetConfig.gateway_ip_addr, "0.0.0.0"); sprintf((char*)&wNetConfig.local_ip_addr, "0.0.0.0"); sprintf((char*)&wNetConfig.net_mask, "0.0.0.0"); micoWlanSuspendStation(); //mico_thread_msleep(10); micoWlanStart(&wNetConfig); mico_thread_msleep(10); micoWlanSuspendStation(); wifi_sta_started = 0; }
int application_start( void ) { network_InitTypeDef_st wNetConfig; #if MCU_POWERSAVE_ENABLED MicoMcuPowerSaveConfig(true); #endif power_log( "Power measure program: RTOS and wlan initialized and setup soft ap" ); MicoInit( ); memset(&wNetConfig, 0, sizeof(network_InitTypeDef_st)); wNetConfig.wifi_mode = Soft_AP; snprintf(wNetConfig.wifi_ssid, 32, "EasyLink_PM" ); strcpy((char*)wNetConfig.wifi_key, ""); strcpy((char*)wNetConfig.local_ip_addr, "10.10.10.1"); strcpy((char*)wNetConfig.net_mask, "255.255.255.0"); strcpy((char*)wNetConfig.gateway_ip_addr, "10.10.10.1"); wNetConfig.dhcpMode = DHCP_Server; micoWlanStart(&wNetConfig); mico_rtos_delete_thread( NULL ); return 0; }
//======================================= static int lwifi_startsta( lua_State* L ) { LinkStatusTypeDef link; network_InitTypeDef_st wNetConfig; size_t len=0; lua_system_param_t lua_system_param; uint8_t has_default = 0; signed retry_interval = 0; int con_wait = 0; int tmo = mico_get_time(); // check if wifi is already connected memset(&link, 0x00, sizeof(link)); micoWlanGetLinkStatus(&link); if (!lua_istable(L, 1)) { // ==== Call without parameters, return connection status === if (link.is_connected != 0) lua_pushboolean(L, true); else lua_pushboolean(L, false); return 1; } // ==== parameters exists, configure and start ==== if (wifi_sta_started == 1) _stopWifiSta(); memset(&wNetConfig, 0x0, sizeof(network_InitTypeDef_st)); // check if default params exists if (getLua_systemParams(&lua_system_param) == 1) { if ((strlen(lua_system_param.wifi_ssid) > 0) && (strlen(lua_system_param.wifi_key) > 0)) { has_default = 1; } } //wait for connection lua_getfield(L, 1, "wait"); if (!lua_isnil(L, -1)) { int wfc = luaL_checkinteger( L, -1 ); if ((wfc > 0) && (wfc < 16)) con_wait = wfc * 1000; else return luaL_error( L, "wait must be 1 ~ 15"); } //ssid lua_getfield(L, 1, "ssid"); if (!lua_isnil(L, -1)) { if ( lua_isstring(L, -1) ) { const char *ssid = luaL_checklstring( L, -1, &len ); if (len >= 32) return luaL_error( L, "ssid: <32" ); strncpy(wNetConfig.wifi_ssid,ssid,len); } else return luaL_error( L, "wrong arg type:ssid" ); } else if (has_default == 1) { strcpy(wNetConfig.wifi_ssid, lua_system_param.wifi_ssid); } else return luaL_error( L, "arg: ssid needed" ); //pwd lua_getfield(L, 1, "pwd"); if (!lua_isnil(L, -1)) { if ( lua_isstring(L, -1) ) { const char *pwd = luaL_checklstring( L, -1, &len ); if (len >= 64) return luaL_error( L, "pwd: <64" ); if (len > 0) strncpy(wNetConfig.wifi_key,pwd,len); else strcpy(wNetConfig.wifi_key,""); } else return luaL_error( L, "wrong arg type: pwd" ); } else if (has_default == 1) { strcpy(wNetConfig.wifi_key, lua_system_param.wifi_key); } else return luaL_error( L, "arg: pwd needed" ); //dhcp wNetConfig.dhcpMode = DHCP_Client; lua_getfield(L, 1, "dhcp"); if (!lua_isnil(L, -1)) { if ( lua_isstring(L, -1) ) { const char *pwd = luaL_checklstring( L, -1, &len ); if (strcmp(pwd, "disable") == 0) wNetConfig.dhcpMode = DHCP_Disable; } else return luaL_error( L, "wrong arg type: dhcp" ); } //ip lua_getfield(L, 1, "ip"); if (!lua_isnil(L, -1)) { if ( lua_isstring(L, -1) ) { const char *ip = luaL_checklstring( L, -1, &len ); if (len >= 16) return luaL_error( L, "ip: <16" ); if (is_valid_ip(ip) == false) return luaL_error( L, "ip invalid" ); strncpy(wNetConfig.local_ip_addr,ip,len); } else return luaL_error( L, "wrong arg type:ip" ); } else if (wNetConfig.dhcpMode == DHCP_Disable) return luaL_error( L, "arg: ip needed" ); //netmask lua_getfield(L, 1, "netmask"); if (!lua_isnil(L, -1)) { if ( lua_isstring(L, -1) ) { const char *netmask = luaL_checklstring( L, -1, &len ); if (len >= 16) return luaL_error( L, "netmask: <16" ); if (is_valid_ip(netmask) == false) return luaL_error( L, "netmask invalid" ); strncpy(wNetConfig.net_mask,netmask,len); } else return luaL_error( L, "wrong arg type: netmask" ); } else if (wNetConfig.dhcpMode == DHCP_Disable) return luaL_error( L, "arg: netmask needed" ); //gateway lua_getfield(L, 1, "gateway"); if (!lua_isnil(L, -1)) { if ( lua_isstring(L, -1) ) { const char *gateway = luaL_checklstring( L, -1, &len ); if (len >= 16) return luaL_error( L, "gateway: <16" ); if (is_valid_ip(gateway) == false) return luaL_error( L, "gateway invalid" ); strncpy(wNetConfig.gateway_ip_addr,gateway,len); } else return luaL_error( L, "wrong arg type: gateway" ); } else if(wNetConfig.dhcpMode == DHCP_Disable) return luaL_error( L, "arg: gateway needed" ); //dnsSrv lua_getfield(L, 1, "dnsSrv"); if (!lua_isnil(L, -1)) { if ( lua_isstring(L, -1) ) { const char *dnsSrv = luaL_checklstring( L, -1, &len ); if (len >= 16) return luaL_error( L, "dnsSrv: <16" ); if (is_valid_ip(dnsSrv) == false) return luaL_error( L, "dnsSrv invalid" ); strncpy(wNetConfig.dnsServer_ip_addr,dnsSrv,len); } else return luaL_error( L, "wrong arg type: dnsSrv" ); } else if (wNetConfig.dhcpMode == DHCP_Disable) return luaL_error( L, "arg: dnsSrv needed" ); //retry_interval lua_getfield(L, 1, "retry_interval"); if (!lua_isnil(L, -1)) { retry_interval = (signed)luaL_checknumber( L, -1 ); if (retry_interval < 0) return luaL_error( L, "retry_interval: >=0ms" ); if (retry_interval == 0) retry_interval = 0x7FFFFFFF; } else retry_interval = 1000; wNetConfig.wifi_retry_interval = retry_interval; gL = L; //notify, set CB function for wifi state change if (wifi_status_changed_STA != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, wifi_status_changed_STA); wifi_status_changed_STA = LUA_NOREF; if (lua_type(L, 2) == LUA_TFUNCTION || lua_type(L, 2) == LUA_TLIGHTFUNCTION) { lua_pushvalue(L, 2); // copy argument (func) to the top of stack wifi_status_changed_STA = luaL_ref(L, LUA_REGISTRYINDEX); } mico_system_notify_register( mico_notify_WIFI_STATUS_CHANGED, (void *)_micoNotify_WifiStatusHandler, NULL ); //start wNetConfig.wifi_mode = Station; micoWlanStart(&wNetConfig); wifi_sta_started = 1; if (con_wait == 0) { lua_pushboolean(L, false); return 1; } tmo = mico_get_time(); micoWlanGetLinkStatus(&link); while (link.is_connected == 0) { if ((mico_get_time() - tmo) > con_wait) break; mico_thread_msleep(50); luaWdgReload(); micoWlanGetLinkStatus(&link); } if (link.is_connected == 0) lua_pushboolean(L, false); else lua_pushboolean(L, true); return 1; }
//====================================== static int lwifi_startap( lua_State* L ) { //4 stations Max network_InitTypeDef_st wNetConfig; size_t len=0; memset(&wNetConfig, 0x0, sizeof(network_InitTypeDef_st)); if (!lua_istable(L, 1)) { // ==== Call without parameters, return status === if (wifi_ap_started == 1) lua_pushboolean(L, true); else lua_pushboolean(L, false); return 1; } //ssid lua_getfield(L, 1, "ssid"); if (!lua_isnil(L, -1)) { if( lua_isstring(L, -1) ) { const char *ssid = luaL_checklstring( L, -1, &len ); if(len >= 32) return luaL_error( L, "ssid: <32" ); strncpy(wNetConfig.wifi_ssid,ssid,len); } else return luaL_error( L, "wrong arg type: ssid" ); } else return luaL_error( L, "arg: ssid needed" ); //pwd lua_getfield(L, 1, "pwd"); if (!lua_isnil(L, -1)) { if( lua_isstring(L, -1) ) { const char *pwd = luaL_checklstring( L, -1, &len ); if (len >= 64) return luaL_error( L, "pwd: <64" ); if (len > 0) strncpy(wNetConfig.wifi_key, pwd, len); else strcpy(wNetConfig.wifi_key, ""); } else return luaL_error( L, "wrong arg type: pwd" ); } else return luaL_error( L, "arg: pwd needed" ); //ip lua_getfield(L, 1, "ip"); if (!lua_isnil(L, -1)) { if( lua_isstring(L, -1) ) { const char *ip = luaL_checklstring( L, -1, &len ); if (len >= 16) return luaL_error( L, "ip: <16" ); if (is_valid_ip(ip) == false) return luaL_error( L, "ip invalid" ); strncpy(wNetConfig.local_ip_addr, ip, len); } else return luaL_error( L, "wrong arg type: ip" ); } else { strcpy(wNetConfig.local_ip_addr, "11.11.11.1"); } //netmask lua_getfield(L, 1, "netmask"); if (!lua_isnil(L, -1)) { if ( lua_isstring(L, -1) ) { const char *netmask = luaL_checklstring( L, -1, &len ); if (len >= 16) return luaL_error( L, "netmask: <16" ); if (is_valid_ip(netmask) == false) return luaL_error( L, "netmask invalid" ); strncpy(wNetConfig.net_mask,netmask,len); } else return luaL_error( L, "wrong arg type: netmask" ); } else { strcpy(wNetConfig.net_mask, "255.255.255.0"); } //gateway lua_getfield(L, 1, "gateway"); if (!lua_isnil(L, -1)) { if ( lua_isstring(L, -1) ) { const char *gateway = luaL_checklstring( L, -1, &len ); if (len >= 16) return luaL_error( L, "gateway: <16" ); if (is_valid_ip(gateway) == false) return luaL_error( L, "gateway invalid" ); strncpy(wNetConfig.gateway_ip_addr,gateway,len); } else return luaL_error( L, "wrong arg type: gateway" ); } else { strcpy(wNetConfig.gateway_ip_addr,"11.11.11.1"); } //dnsSrv lua_getfield(L, 1, "dnsSrv"); if (!lua_isnil(L, -1)) { if ( lua_isstring(L, -1) ) { const char *dnsSrv = luaL_checklstring( L, -1, &len ); if (len >= 16) return luaL_error( L, "dnsSrv: <16" ); if (is_valid_ip(dnsSrv) == false) return luaL_error( L, "dnsSrv invalid" ); strncpy(wNetConfig.dnsServer_ip_addr,dnsSrv,len); } else return luaL_error( L, "wrong arg type: dnsSrv" ); } else { strcpy(wNetConfig.dnsServer_ip_addr, "11.11.11.1"); } //retry_interval signed retry_interval = 0; lua_getfield(L, 1, "retry_interval"); if (!lua_isnil(L, -1)) { retry_interval = (signed)luaL_checknumber( L, -1 ); if (retry_interval < 0) return luaL_error( L, "retry_interval: >=0ms" ); if (retry_interval == 0) retry_interval = 0x7FFFFFFF; } else retry_interval = 1000; wNetConfig.wifi_retry_interval = retry_interval; //notify gL = L; if (wifi_status_changed_AP != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, wifi_status_changed_AP); wifi_status_changed_AP = LUA_NOREF; if (lua_type(L, 2) == LUA_TFUNCTION || lua_type(L, 2) == LUA_TLIGHTFUNCTION) { lua_pushvalue(L, 2); // copy argument (func) to the top of stack if (wifi_status_changed_AP != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, wifi_status_changed_AP); wifi_status_changed_AP = luaL_ref(L, LUA_REGISTRYINDEX); } mico_system_notify_register( mico_notify_WIFI_STATUS_CHANGED, (void *)_micoNotify_WifiStatusHandler, NULL ); //start wifi_ap_started = 0; wNetConfig.dhcpMode = DHCP_Server; wNetConfig.wifi_mode = Soft_AP; micoWlanStart(&wNetConfig); int tmo = mico_get_time(); while (wifi_ap_started == 0) { if ((mico_get_time() - tmo) > 1000) break; mico_thread_msleep(10); luaWdgReload(); } if (wifi_ap_started == 1) lua_pushboolean(L, true); else lua_pushboolean(L, false); return 1; }
/*cfg={} cfg.ssid="" cfg.pwd="" cfg.ip (optional,default:11.11.11.1) cfg.netmask(optional,default:255.255.255.0) cfg.gateway(optional,default:11.11.11.1) cfg.dnsSrv(optional,default:11.11.11.1) cfg.retry_interval(optional,default:1000ms) wifi.startap(cfg,function(optional))*/ static int lwifi_startap( lua_State* L ) {//4 stations Max network_InitTypeDef_st wNetConfig; size_t len=0; memset(&wNetConfig, 0x0, sizeof(network_InitTypeDef_st)); if (!lua_istable(L, 1)) return luaL_error( L, "table arg needed" ); //ssid lua_getfield(L, 1, "ssid"); if (!lua_isnil(L, -1)){ /* found? */ if( lua_isstring(L, -1) ) // deal with the string { const char *ssid = luaL_checklstring( L, -1, &len ); if(len>32) return luaL_error( L, "ssid:<32" ); strncpy(wNetConfig.wifi_ssid,ssid,len); } else return luaL_error( L, "wrong arg type:ssid" ); } else return luaL_error( L, "arg: ssid needed" ); //pwd lua_getfield(L, 1, "pwd"); if (!lua_isnil(L, -1)){ /* found? */ if( lua_isstring(L, -1) ) // deal with the string { const char *pwd = luaL_checklstring( L, -1, &len ); if(len>64) return luaL_error( L, "pwd:<64" ); if(len>0) strncpy(wNetConfig.wifi_key,pwd,len); else strcpy(wNetConfig.wifi_key,""); } else return luaL_error( L, "wrong arg type:pwd" ); } else return luaL_error( L, "arg: pwd needed" ); //ip lua_getfield(L, 1, "ip"); if (!lua_isnil(L, -1)){ /* found? */ if( lua_isstring(L, -1) ) // deal with the ssid string { const char *ip = luaL_checklstring( L, -1, &len ); if(len>16) return luaL_error( L, "ip:<16" ); if(is_valid_ip(ip)==false) return luaL_error( L, "ip invalid" ); strncpy(wNetConfig.local_ip_addr,ip,len); } else return luaL_error( L, "wrong arg type:ip" ); } else { strcpy(wNetConfig.local_ip_addr,"11.11.11.1"); //return luaL_error( L, "arg: ip needed" ); } //netmask lua_getfield(L, 1, "netmask"); if (!lua_isnil(L, -1)){ /* found? */ if( lua_isstring(L, -1) ) // deal with the ssid string { const char *netmask = luaL_checklstring( L, -1, &len ); if(len>16) return luaL_error( L, "netmask:<16" ); if(is_valid_ip(netmask)==false) return luaL_error( L, "netmask invalid" ); strncpy(wNetConfig.net_mask,netmask,len); } else return luaL_error( L, "wrong arg type:netmask" ); } else { strcpy(wNetConfig.net_mask,"255.255.255.0"); //return luaL_error( L, "arg: netmask needed" ); } //gateway lua_getfield(L, 1, "gateway"); if (!lua_isnil(L, -1)){ /* found? */ if( lua_isstring(L, -1) ) // deal with the ssid string { const char *gateway = luaL_checklstring( L, -1, &len ); if(len>16) return luaL_error( L, "gateway:<16" ); if(is_valid_ip(gateway)==false) return luaL_error( L, "gateway invalid" ); strncpy(wNetConfig.gateway_ip_addr,gateway,len); } else return luaL_error( L, "wrong arg type:gateway" ); } else { strcpy(wNetConfig.gateway_ip_addr,"11.11.11.1"); // return luaL_error( L, "arg: gateway needed" ); } //dnsSrv lua_getfield(L, 1, "dnsSrv"); if (!lua_isnil(L, -1)){ /* found? */ if( lua_isstring(L, -1) ) // deal with the ssid string { const char *dnsSrv = luaL_checklstring( L, -1, &len ); if(len>16) return luaL_error( L, "dnsSrv:<16" ); if(is_valid_ip(dnsSrv)==false) return luaL_error( L, "dnsSrv invalid" ); strncpy(wNetConfig.dnsServer_ip_addr,dnsSrv,len); } else return luaL_error( L, "wrong arg type:dnsSrv" ); } else { strcpy(wNetConfig.dnsServer_ip_addr,"11.11.11.1"); //return luaL_error( L, "arg: dnsSrv needed" ); } //retry_interval signed retry_interval=0; lua_getfield(L, 1, "retry_interval"); if (!lua_isnil(L, -1)){ /* found? */ retry_interval= luaL_checknumber( L, -1 ); if(retry_interval<=0) return luaL_error( L, "retry_interval:>0ms" ); } else retry_interval = 1000; wNetConfig.wifi_retry_interval = retry_interval; /*MCU_DBG("wifi_ssid:%s\r\n",wNetConfig.wifi_ssid); MCU_DBG("wifi_key:%s\r\n",wNetConfig.wifi_key); MCU_DBG("local_ip_addr:%s\r\n",wNetConfig.local_ip_addr); MCU_DBG("net_mask:%s\r\n",wNetConfig.net_mask); MCU_DBG("gateway_ip_addr:%s\r\n",wNetConfig.gateway_ip_addr); MCU_DBG("dnsServer_ip_addr:%s\r\n",wNetConfig.dnsServer_ip_addr); MCU_DBG("wifi_retry_interval:%d\r\n",wNetConfig.wifi_retry_interval);*/ //notify gL = L; if (lua_type(L, 2) == LUA_TFUNCTION || lua_type(L, 2) == LUA_TLIGHTFUNCTION) { lua_pushvalue(L, 2); // copy argument (func) to the top of stack if(wifi_status_changed_AP != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, wifi_status_changed_AP); wifi_status_changed_AP = luaL_ref(L, LUA_REGISTRYINDEX); MICOAddNotification( mico_notify_WIFI_STATUS_CHANGED, (void *)_micoNotify_WifiStatusHandler ); } else { if(wifi_status_changed_AP != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, wifi_status_changed_AP); wifi_status_changed_AP = LUA_NOREF; } //start wNetConfig.dhcpMode = DHCP_Server; wNetConfig.wifi_mode = Soft_AP; micoWlanStart(&wNetConfig); return 0; }