====== Set up and use the SDK skript WLAN-Switching ====== ===== Goal ===== Up to 10 client configurations can be stored under the web interface of the WLAN client. However, if the customer wanted to store additional client configurations, this was not possible. This option should now be made possible by an SDK script. To do this, the storage space for a client configuration should be changed to match the required WLAN. ===== Prerequisites ===== * NetModule Wireless Router with wireless connection * NetModule Software [[https://share.netmodule.com/public/system-software/4.9/|4.9.0.102]] / [[https://share.netmodule.com/public/system-software/5.0/|5.0.0.100]] or newer * Not available for legacy products NB1600, NB2700, NB3700, NB3710 ** The wiki was tested with router software 4.9.0.102 and 5.0.0.100 ** ===== - Set up the SDK script on the router ===== In the first step, the SDK function is activated and further options are specified. ---- {{:app-notes:wlan_sdk_admin.png?950|}} - The function is activated under ''point 1''. - Under ''point 2'', we free up memory for the execution of the script. For this SDK script, 50 MB is sufficient; only a few variables are stored temporarily for the execution of the program. - Under ''point 3'', we activate monitoring to check whether the script is still being processed correctly. We use the router's core function in the program. Monitoring makes sense here. ---- In the second step, we store the SDK script in Job Management. {{:app-notes:wlan_job_manage.png?950|}} First, we store the SDK script under Job Management. Using the plus button under ''point 3'', we add a script. ---- After pressing the plus button, a new window opens with settings. {{:app-notes:wlan_sdk_skript.png?950|}} First, assign a ''name'' to the SDK process. In the second step, you can insert the SDK script using the ''“upload”'' function. You can open the script by clicking on the ''“show code”'' button in the WIKI and then download the ''“WLAN_switching.are”'' file. Once you have saved the file on your computer, you can search for it in step 3 using ''Browse'' and select it. The last step, ''“Apply"'', saves everything to the router. {{:app-notes:wlan_dowlload_skript.png?950|}} ---- ++++show code| ###################################################################### ########### Please only make changes to the script here ########### ###################################################################### ###### Please enter all SSIDs to be searched for here wlan_ssid_field = mkarray ( "", "", "", ""); ###### Please enter the passwords here in the correct order for the SSID! ###### Example: WLAN_SSID_1 for WLAN_Password_1 wlan_passwort_field = mkarray ( "", "", "", ""); ###### Please specify here where this function should be entered, under ###### WLAN Client Configuration. Under WLAN Client, 10 (1 - 10) entries are possible. wlan_client_entry = 10; #### int Value 1 to 10 Possible ###### Which WLAN module should be used (WLAN 1 or WLAN 2)? wlan_interface = 2; #### The one for WLAN 1 or the two for WLAN 2 ############################################################################### DEBUG=false; # Enable debugging with true or disable with false ############################################################################### prio_value = 0; release = 0; if (length(wlan_ssid_field) == length(wlan_passwort_field)){ if(DEBUG)printf("Both fields are the same\n"); } else { if(DEBUG)printf("An SSID:%s or password:%s is missing for execution.\n",length(wlan_ssid_field),length(wlan_passwort_field)); nb_syslog("An SSID:%s or password:%s is missing for execution.",length(wlan_ssid_field),length(wlan_passwort_field)); printf("end of program\n"); exit(1); } if (wlan_client_entry > 0){ if(DEBUG)printf("The value wlan_client_entry is greater than zero: %s\n",wlan_client_entry); if (wlan_client_entry <=10 ){ if(DEBUG)printf("The value wlan_client_entry is less than or equal to ten: %s\n",wlan_client_entry); wlan_client_entry = wlan_client_entry -1; if(DEBUG)printf("The value wlan_client_entry has been changed: %s\n",wlan_client_entry); prio_value = 10 - wlan_client_entry; if(DEBUG)printf("The value prio_value is: %s\n",prio_value); } else { if(DEBUG)printf("The value wlan_client_entry is greater than ten: %s\n",wlan_client_entry); nb_syslog("The value wlan_client_entry is greater than ten: %s",wlan_client_entry); printf("end of program\n"); exit(2); } } else{ if(DEBUG)printf("The value wlan_client_entry is less than or equal to zero: %s\n",wlan_client_entry); nb_syslog("The value wlan_client_entry is less than or equal to zero: %s",wlan_client_entry); printf("end of program\n"); exit(2); } switch (wlan_interface){ case 1: if(DEBUG)printf("The value one for WLAN 1: %s\n",wlan_interface); wlan_interface = wlan_interface - 1; if(DEBUG)printf("The value after the change: %s\n",wlan_interface); wlan_scan = "WLAN1"; if(DEBUG)printf("Output of the WLAN scan interface: %s\n",wlan_scan); break; case 2: if(DEBUG)printf("The value two for WLAN 2: %s\n",wlan_interface); wlan_interface = wlan_interface - 1; if(DEBUG)printf("The value after the change: %s\n",wlan_interface); wlan_scan = "WLAN2"; if(DEBUG)printf("Output of the WLAN scan interface: %s\n",wlan_scan); break; default: if(DEBUG)printf("The value is not WLAN 1 or WLAN 2: %s\n",wlan_interface); nb_syslog("The value is not WLAN 1 or WLAN 2: %s",wlan_interface); printf("end of program\n"); exit(3); break; } while(true){ lan_link = struct_get(nb_status("wan"),"WANLINK1_STATE"); if (lan_link == "up") { /* WAN LINK setup */ if(DEBUG)printf("LAN is up\n"); /* WANLINK1 is LAN2/WAN , WANLINK2 is WLAN2 , WANLINK3 is WWAN1 and WANLINK4 is WWAN2 */ } else { /* Must be adjusted according to customer requirements */ if(DEBUG)printf("LAN is down\n"); wlan_off = struct_get(nb_status("wlan"),"WLAN2_OPER_TYPE"); wlan_link = struct_get(nb_status("wan"),"WANLINK2_STATE"); if (wlan_link == "down" || wlan_off == "off" || wlan_link == "dialing"){ if(DEBUG)printf("WLAN is down\n"); hotlink = struct_get(nb_status("wan"),"WAN_HOTLINK"); if (hotlink == "WANLINK3" || hotlink == "WANLINK4" || release == 1){ if (release != 1){ if(DEBUG)printf("WWAN is currently online\n"); } else { wwan_link = struct_get(nb_status("wan"),"WANLINK1_STATE"); if (wwan_link == "up"){ if(DEBUG)printf("WWAN is currently online\n"); } else { if(DEBUG)printf("WWAN is currently not online\n"); } } if(DEBUG)printf("Search for Wi-Fi now\n"); sleep(1); wlan_networks = nb_scan_networks(sprintf("%s",wlan_scan)); # scan WLAN module wlan_count = struct_get(wlan_networks,"NETWORK_COUNT"); if(DEBUG)printf("%s SSIDs were found during the scan.\n\n", wlan_count); for (i=0; (int)wlan_count > i; ++i){ number_count = i + 1; if(DEBUG)printf("Which number is used: %s\n",number_count); wlan_ssid = struct_get(wlan_networks,sprintf("NETWORK%s_SSID",number_count)); if(DEBUG)printf("The WLAN SSID that is there: %s\n", wlan_ssid); if(DEBUG)printf("The WLAN stored in memory location %s\n\n",wlan_client_entry); ##################################################################### ##### From here, the Wi-Fi networks are stored ##### ##################################################################### for (q=0; ((int)temp = length(wlan_ssid_field)) > q; ++q){ index = q + 1; if(DEBUG)printf("Which ssid field: %s\n",wlan_ssid_field[q]); if(DEBUG)printf("How many SSIDs: %s\n",temp); if(DEBUG)printf("Output the index: %s\n",index); if (wlan_ssid == wlan_ssid_field[q]){ if(DEBUG)printf("The wireless network %s has been found.\n",wlan_ssid); ssid = struct_get(wlan_networks,sprintf("NETWORK%s_SSID",number_count)); cipher = struct_get(wlan_networks,sprintf("NETWORK%s_CIPHER_1",number_count)); if(DEBUG)printf("What parameters do we have: %s \n", cipher); if (cipher == "CCMP"){ cipher = tolower(cipher); } else { cipher = "all"; } encryption = struct_get(wlan_networks,sprintf("NETWORK%s_ENCRYPTION_1",number_count)); if (encryption == "WPA-PSK"){ encryption = "wpa1andwpa2"; } if (encryption == "WPA2-SAE"){ encryption = "wpa2andwpa3"; } if (encryption == "WPA2-PSK"){ encryption = "wpa2"; } ## Scan from Wi-Fi nb_config_set("wlan.1.settings.channel=0"); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter channel 0 is in the execution: %s\n",ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter channel 0 is set to: %s\n",ret); nb_config_set(sprintf("wlan.%s.client.%s.ssid=%s",wlan_interface,wlan_client_entry,ssid)); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter %s is in execution: %s\n",ssid,ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter %s is set to: %s\n",ssid,ret); nb_config_set(sprintf("wlan.%s.client.%s.cipher=%s",wlan_interface,wlan_client_entry,cipher)); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter %s is in execution: %s\n",cipher,ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter %s is set to: %s\n",cipher,ret); nb_config_set(sprintf("wlan.%s.client.%s.secproto=%s",wlan_interface,wlan_client_entry,encryption)); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter %s is in execution: %s\n",encryption,ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter %s is set to: %s\n",encryption,ret); ## Feste Wert nb_config_set(sprintf("wlan.%s.client.%s.secmode=wpa-psk",wlan_interface,wlan_client_entry)); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter secmode is in the execution: %s\n",ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter secmode is set by: %s\n",ret); nb_config_set(sprintf("wlan.%s.client.%s.prio=%s",wlan_interface,wlan_client_entry,prio_value)); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter prio is in the execution: %s\n",ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter prio is set by: %s\n",ret); ## Wi-Fi password nb_config_set(sprintf("wlan.%s.client.%s.psk=%s",wlan_interface,wlan_client_entry,(wlan_passwort_field[q]))); ## Passwort wird aus der Feld gezogen ret = nb_config_done(); while (ret){ if(DEBUG)if(DEBUG)printf("The config parameter psk is in the execution: %s\n",ret); ret = nb_config_done(); sleep(1); } q = length(wlan_ssid_field); if(DEBUG)printf("Value of q: %s\n",q); if(DEBUG)printf("The config parameter psk is set to: %s\n",ret); i = 100; ## for end loop release = 0; } else { if(DEBUG)printf("no\n"); } } } if(DEBUG)printf("The value i is: %s\n",i); if (i <= 100) { if(DEBUG)printf("No suitable Wi-Fi network found\n"); } } else{ if(DEBUG)printf("The status of the hotlink at the moment %s\n", hotlink); for (a=0; 3 > a; ++a){ if(DEBUG)printf("Waiting for WWAN to come online\n"); sleep(60); if(DEBUG)printf("The value a: %s\n",a); wwan_link = struct_get(nb_status("wan"),"WANLINK1_STATE"); if(DEBUG)printf("Is WWAN still down: %s\n",wwan_link); if (wwan_link == "down" || "dialing" && a == 2){ a = 10; release = 1; if(DEBUG)printf("Value release: %s\n",release ); if(DEBUG)printf("The WWAN is still down after 3 minutes.\n"); if(DEBUG)printf("Search for Wi-Fi\n"); } } } } wlan_link = struct_get(nb_status("wan"),"WANLINK2_STATE"); if (wlan_link == "up"){ ret = nb_config_done(); if(DEBUG)printf("The configuration has been completed: %s\n\n",ret); if(DEBUG)printf("WLAN is up\n\n"); } else{ if(DEBUG)printf("WLAN is Down\n\n"); } } printf("New search after 30 seconds\n"); sleep(30); } printf("end of program\n"); nb_syslog("end of program"); exit(0); ++++ ---- Next, set up the trigger that will start the script. {{:app-notes:wlan_trigger.png?950|}} Here, too, pressing the plus button opens a new window with insertion options. {{:app-notes:wlan_trigger_startup.png?950|}} Again, start by assigning a ''name'' to the SDK process. Use the ''“event-based”'' option as the trigger type for this script. Select the ''“sdk-startup”'' event from the list. Why do we use these settings for the script? The script was created as an endless script. The commands are controlled and executed in the script. Errors are output and the program is then terminated. The event starts the script when the daemon of the SDK program is started by the router. This is also advantageous if the watchdog restarts the SDK daemon on the router. In this case, the script is also reactivated. The ''“Apply”'' button saves the changes back to the router. ---- In the last step, we activate the SDK script on the router. {{:app-notes:wlan_job_skript.png?950|}} Again, enter the ''name'' for the SDK process first. If you want to activate the first SDK script on the router, the two fields ''“Trigger”'' and ''"Script"'' are already filled with the options you set up earlier. If you already have multiple scripts, you must select the correct option ''(Trigger and Script)'' from the pull-down menu. As before, click ''“Apply”'' to apply the setting to the router. In this case, the SDK script is also activated. ---- {{:app-notes:wlan_status.png?950|}} Using the Administration option under ''point 1'', you can view information under the Status tab, ''point 2'', to see whether the SDK script has started correctly and is running without errors. ---- ===== - Important settings in the SDK script ===== ** Please only make changes here in the script if additional WLAN clients are to be added. ** What options do you have for modifying the SDK script to suit your needs? {{:app-notes:wlan_skript_einstellung.png?950|}} In the upper section, you can enter the SSID''(WLAN name of the access point)'' under ''point 1''. Four placeholders have been entered in the script. However, these can be expanded as required. The password for the access point is entered under ''point 2''. It is ''very important'' to assign the SSID to the correct password. Both pieces of information ''must be'' entered in the same order in the script. Under ''point 3'', you can determine where the Wi-Fi should be entered. In this setting, ''“wlan_client_entry = 10”'', the Wi-Fi is added as the last entry in the client list. The entered Wi-Fi networks ''“test1 to test9”'' are also given priority by the router. If you enter the Wi-Fi network in the first position, it not only receives priority status 10, but you also use all Wi-Fi networks from your list before those stored permanently in the router. In this example, it is exactly the opposite. First the permanently stored networks and then the Wi-Fi list. Under ''point 4'', you can choose whether you want to use WLAN module 1 or WLAN module 2 for the entire system. {{:app-notes:wlan_clients.png?950|}} ---- ===== - Additional information ===== ++++show code| ###################################################################### ########### Please only make changes to the script here ########### ###################################################################### ###### Please enter all SSIDs to be searched for here wlan_ssid_field = mkarray ( "", "", "", ""); ###### Please enter the passwords here in the correct order for the SSID! ###### Example: WLAN_SSID_1 for WLAN_Password_1 wlan_passwort_field = mkarray ( "", "", "", ""); ###### Please specify here where this function should be entered, under ###### WLAN Client Configuration. Under WLAN Client, 10 (1 - 10) entries are possible. wlan_client_entry = 10; #### int Value 1 to 10 Possible ###### Which WLAN module should be used (WLAN 1 or WLAN 2)? wlan_interface = 2; #### The one for WLAN 1 or the two for WLAN 2 ############################################################################### DEBUG=false; # Enable debugging with true or disable with false ############################################################################### prio_value = 0; release = 0; if (length(wlan_ssid_field) == length(wlan_passwort_field)){ if(DEBUG)printf("Both fields are the same\n"); } else { if(DEBUG)printf("An SSID:%s or password:%s is missing for execution.\n",length(wlan_ssid_field),length(wlan_passwort_field)); nb_syslog("An SSID:%s or password:%s is missing for execution.",length(wlan_ssid_field),length(wlan_passwort_field)); printf("end of program\n"); exit(1); } if (wlan_client_entry > 0){ if(DEBUG)printf("The value wlan_client_entry is greater than zero: %s\n",wlan_client_entry); if (wlan_client_entry <=10 ){ if(DEBUG)printf("The value wlan_client_entry is less than or equal to ten: %s\n",wlan_client_entry); wlan_client_entry = wlan_client_entry -1; if(DEBUG)printf("The value wlan_client_entry has been changed: %s\n",wlan_client_entry); prio_value = 10 - wlan_client_entry; if(DEBUG)printf("The value prio_value is: %s\n",prio_value); } else { if(DEBUG)printf("The value wlan_client_entry is greater than ten: %s\n",wlan_client_entry); nb_syslog("The value wlan_client_entry is greater than ten: %s",wlan_client_entry); printf("end of program\n"); exit(2); } } else{ if(DEBUG)printf("The value wlan_client_entry is less than or equal to zero: %s\n",wlan_client_entry); nb_syslog("The value wlan_client_entry is less than or equal to zero: %s",wlan_client_entry); printf("end of program\n"); exit(2); } switch (wlan_interface){ case 1: if(DEBUG)printf("The value one for WLAN 1: %s\n",wlan_interface); wlan_interface = wlan_interface - 1; if(DEBUG)printf("The value after the change: %s\n",wlan_interface); wlan_scan = "WLAN1"; if(DEBUG)printf("Output of the WLAN scan interface: %s\n",wlan_scan); break; case 2: if(DEBUG)printf("The value two for WLAN 2: %s\n",wlan_interface); wlan_interface = wlan_interface - 1; if(DEBUG)printf("The value after the change: %s\n",wlan_interface); wlan_scan = "WLAN2"; if(DEBUG)printf("Output of the WLAN scan interface: %s\n",wlan_scan); break; default: if(DEBUG)printf("The value is not WLAN 1 or WLAN 2: %s\n",wlan_interface); nb_syslog("The value is not WLAN 1 or WLAN 2: %s",wlan_interface); printf("end of program\n"); exit(3); break; } while(true){ lan_link = struct_get(nb_status("wan"),"WANLINK1_STATE"); if (lan_link == "up") { /* WAN LINK setup */ if(DEBUG)printf("LAN is up\n"); /* WANLINK1 is LAN2/WAN , WANLINK2 is WLAN2 , WANLINK3 is WWAN1 and WANLINK4 is WWAN2 */ } else { /* Must be adjusted according to customer requirements */ if(DEBUG)printf("LAN is down\n"); wlan_off = struct_get(nb_status("wlan"),"WLAN2_OPER_TYPE"); wlan_link = struct_get(nb_status("wan"),"WANLINK2_STATE"); if (wlan_link == "down" || wlan_off == "off" || wlan_link == "dialing"){ if(DEBUG)printf("WLAN is down\n"); hotlink = struct_get(nb_status("wan"),"WAN_HOTLINK"); if (hotlink == "WANLINK3" || hotlink == "WANLINK4" || release == 1){ if (release != 1){ if(DEBUG)printf("WWAN is currently online\n"); } else { wwan_link = struct_get(nb_status("wan"),"WANLINK1_STATE"); if (wwan_link == "up"){ if(DEBUG)printf("WWAN is currently online\n"); } else { if(DEBUG)printf("WWAN is currently not online\n"); } } if(DEBUG)printf("Search for Wi-Fi now\n"); sleep(1); wlan_networks = nb_scan_networks(sprintf("%s",wlan_scan)); # scan WLAN module wlan_count = struct_get(wlan_networks,"NETWORK_COUNT"); if(DEBUG)printf("%s SSIDs were found during the scan.\n\n", wlan_count); for (i=0; (int)wlan_count > i; ++i){ number_count = i + 1; if(DEBUG)printf("Which number is used: %s\n",number_count); wlan_ssid = struct_get(wlan_networks,sprintf("NETWORK%s_SSID",number_count)); if(DEBUG)printf("The WLAN SSID that is there: %s\n", wlan_ssid); if(DEBUG)printf("The WLAN stored in memory location %s\n\n",wlan_client_entry); ##################################################################### ##### From here, the Wi-Fi networks are stored ##### ##################################################################### for (q=0; ((int)temp = length(wlan_ssid_field)) > q; ++q){ index = q + 1; if(DEBUG)printf("Which ssid field: %s\n",wlan_ssid_field[q]); if(DEBUG)printf("How many SSIDs: %s\n",temp); if(DEBUG)printf("Output the index: %s\n",index); if (wlan_ssid == wlan_ssid_field[q]){ if(DEBUG)printf("The wireless network %s has been found.\n",wlan_ssid); ssid = struct_get(wlan_networks,sprintf("NETWORK%s_SSID",number_count)); cipher = struct_get(wlan_networks,sprintf("NETWORK%s_CIPHER_1",number_count)); if(DEBUG)printf("What parameters do we have: %s \n", cipher); if (cipher == "CCMP"){ cipher = tolower(cipher); } else { cipher = "all"; } encryption = struct_get(wlan_networks,sprintf("NETWORK%s_ENCRYPTION_1",number_count)); if (encryption == "WPA-PSK"){ encryption = "wpa1andwpa2"; } if (encryption == "WPA2-SAE"){ encryption = "wpa2andwpa3"; } if (encryption == "WPA2-PSK"){ encryption = "wpa2"; } ## Scan from Wi-Fi nb_config_set("wlan.1.settings.channel=0"); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter channel 0 is in the execution: %s\n",ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter channel 0 is set to: %s\n",ret); nb_config_set(sprintf("wlan.%s.client.%s.ssid=%s",wlan_interface,wlan_client_entry,ssid)); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter %s is in execution: %s\n",ssid,ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter %s is set to: %s\n",ssid,ret); nb_config_set(sprintf("wlan.%s.client.%s.cipher=%s",wlan_interface,wlan_client_entry,cipher)); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter %s is in execution: %s\n",cipher,ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter %s is set to: %s\n",cipher,ret); nb_config_set(sprintf("wlan.%s.client.%s.secproto=%s",wlan_interface,wlan_client_entry,encryption)); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter %s is in execution: %s\n",encryption,ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter %s is set to: %s\n",encryption,ret); ## Feste Wert nb_config_set(sprintf("wlan.%s.client.%s.secmode=wpa-psk",wlan_interface,wlan_client_entry)); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter secmode is in the execution: %s\n",ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter secmode is set by: %s\n",ret); nb_config_set(sprintf("wlan.%s.client.%s.prio=%s",wlan_interface,wlan_client_entry,prio_value)); ret = nb_config_done(); while (ret){ if(DEBUG)printf("The config parameter prio is in the execution: %s\n",ret); ret = nb_config_done(); sleep(1); } if(DEBUG)printf("The config parameter prio is set by: %s\n",ret); ## Wi-Fi password nb_config_set(sprintf("wlan.%s.client.%s.psk=%s",wlan_interface,wlan_client_entry,(wlan_passwort_field[q]))); ## Passwort wird aus der Feld gezogen ret = nb_config_done(); while (ret){ if(DEBUG)if(DEBUG)printf("The config parameter psk is in the execution: %s\n",ret); ret = nb_config_done(); sleep(1); } q = length(wlan_ssid_field); if(DEBUG)printf("Value of q: %s\n",q); if(DEBUG)printf("The config parameter psk is set to: %s\n",ret); i = 100; ## for end loop release = 0; } else { if(DEBUG)printf("no\n"); } } } if(DEBUG)printf("The value i is: %s\n",i); if (i <= 100) { if(DEBUG)printf("No suitable Wi-Fi network found\n"); } } else{ if(DEBUG)printf("The status of the hotlink at the moment %s\n", hotlink); for (a=0; 3 > a; ++a){ if(DEBUG)printf("Waiting for WWAN to come online\n"); sleep(60); if(DEBUG)printf("The value a: %s\n",a); wwan_link = struct_get(nb_status("wan"),"WANLINK1_STATE"); if(DEBUG)printf("Is WWAN still down: %s\n",wwan_link); if (wwan_link == "down" || "dialing" && a == 2){ a = 10; release = 1; if(DEBUG)printf("Value release: %s\n",release ); if(DEBUG)printf("The WWAN is still down after 3 minutes.\n"); if(DEBUG)printf("Search for Wi-Fi\n"); } } } } wlan_link = struct_get(nb_status("wan"),"WANLINK2_STATE"); if (wlan_link == "up"){ ret = nb_config_done(); if(DEBUG)printf("The configuration has been completed: %s\n\n",ret); if(DEBUG)printf("WLAN is up\n\n"); } else{ if(DEBUG)printf("WLAN is Down\n\n"); } } printf("New search after 30 seconds\n"); sleep(30); } printf("end of program\n"); nb_syslog("end of program"); exit(0); ++++