This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| app-notes:wlan-switching [2025/08/05 13:08] – [2. Important settings in the SDK script] gray | app-notes:wlan-switching [2025/11/05 13:40] (current) – [1. Set up the SDK script on the router] gray | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| * NetModule Wireless Router with wireless connection | * NetModule Wireless Router with wireless connection | ||
| - | * NetModule Software | + | * NetModule Software [[https:// |
| * Not available for legacy products NB1600, NB2700, NB3700, NB3710 | * Not available for legacy products NB1600, NB2700, NB3700, NB3710 | ||
| ** | ** | ||
| - | <WRAP center round important | + | <WRAP center round important |
| - | The wiki was tested with router software | + | The wiki was tested with router software 5.0.0.100 |
| </ | </ | ||
| ** | ** | ||
| Line 48: | Line 48: | ||
| ---- | ---- | ||
| - | SDK Skript hier | + | The “WLAN_switching.are” script can be downloaded via the “show code” link. |
| + | |||
| + | ++++show code| | ||
| + | <code – WLAN_switching.are> | ||
| + | ###################################################################### | ||
| + | ########### | ||
| + | ###################################################################### | ||
| + | |||
| + | ###### 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; | ||
| + | ############################################################################### | ||
| + | |||
| + | prio_value = 0; | ||
| + | release = 0; | ||
| + | |||
| + | if (length(wlan_ssid_field) == length(wlan_passwort_field)){ | ||
| + | | ||
| + | } else { | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | } | ||
| + | if (wlan_client_entry > 0){ | ||
| + | if(DEBUG)printf(" | ||
| + | if (wlan_client_entry <=10 ){ | ||
| + | if(DEBUG)printf(" | ||
| + | wlan_client_entry = wlan_client_entry -1; | ||
| + | if(DEBUG)printf(" | ||
| + | prio_value = 10 - wlan_client_entry; | ||
| + | if(DEBUG)printf(" | ||
| + | } else { | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | } | ||
| + | } else{ | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | } | ||
| + | switch (wlan_interface){ | ||
| + | case 1: if(DEBUG)printf(" | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | case 2: if(DEBUG)printf(" | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | default: if(DEBUG)printf(" | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | } | ||
| + | while(true){ | ||
| + | | ||
| + | if (lan_link == " | ||
| + | | ||
| + | } else { /* Must be adjusted according to customer requirements | ||
| + | if(DEBUG)printf(" | ||
| + | wlan_off = struct_get(nb_status(" | ||
| + | wlan_link = struct_get(nb_status(" | ||
| + | if (wlan_link == " | ||
| + | if(DEBUG)printf(" | ||
| + | hotlink = struct_get(nb_status(" | ||
| + | if (hotlink == " | ||
| + | if (release != 1){ | ||
| + | if(DEBUG)printf(" | ||
| + | } else { | ||
| + | | ||
| + | if (wwan_link == " | ||
| + | | ||
| + | } else { | ||
| + | | ||
| + | } | ||
| + | } | ||
| + | if(DEBUG)printf(" | ||
| + | sleep(1); | ||
| + | wlan_networks = nb_scan_networks(sprintf(" | ||
| + | wlan_count = struct_get(wlan_networks," | ||
| + | if(DEBUG)printf(" | ||
| + | for (i=0; (int)wlan_count > i; ++i){ | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | ##################################################################### | ||
| + | ##### 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(" | ||
| + | if(DEBUG)printf(" | ||
| + | if(DEBUG)printf(" | ||
| + | if (wlan_ssid == wlan_ssid_field[q]){ | ||
| + | if(DEBUG)printf(" | ||
| + | ssid = struct_get(wlan_networks, | ||
| + | cipher = struct_get(wlan_networks, | ||
| + | if(DEBUG)printf(" | ||
| + | if (cipher == " | ||
| + | cipher = tolower(cipher); | ||
| + | } else { | ||
| + | | ||
| + | } | ||
| + | encryption = struct_get(wlan_networks, | ||
| + | if (encryption == " | ||
| + | encryption = " | ||
| + | } | ||
| + | if (encryption == " | ||
| + | encryption = " | ||
| + | } | ||
| + | if (encryption == " | ||
| + | encryption = " | ||
| + | } | ||
| + | ## Scan from Wi-Fi | ||
| + | nb_config_set(" | ||
| + | ret = nb_config_done(); | ||
| + | while (ret){ | ||
| + | | ||
| + | ret = nb_config_done(); | ||
| + | | ||
| + | } | ||
| + | if(DEBUG)printf(" | ||
| + | nb_config_set(sprintf(" | ||
| + | ret = nb_config_done(); | ||
| + | while (ret){ | ||
| + | | ||
| + | ret = nb_config_done(); | ||
| + | | ||
| + | } | ||
| + | if(DEBUG)printf(" | ||
| + | nb_config_set(sprintf(" | ||
| + | ret = nb_config_done(); | ||
| + | while (ret){ | ||
| + | | ||
| + | ret = nb_config_done(); | ||
| + | | ||
| + | } | ||
| + | if(DEBUG)printf(" | ||
| + | nb_config_set(sprintf(" | ||
| + | ret = nb_config_done(); | ||
| + | while (ret){ | ||
| + | | ||
| + | ret = nb_config_done(); | ||
| + | | ||
| + | } | ||
| + | if(DEBUG)printf(" | ||
| + | ## Feste Wert | ||
| + | nb_config_set(sprintf(" | ||
| + | ret = nb_config_done(); | ||
| + | while (ret){ | ||
| + | | ||
| + | ret = nb_config_done(); | ||
| + | | ||
| + | } | ||
| + | if(DEBUG)printf(" | ||
| + | nb_config_set(sprintf(" | ||
| + | ret = nb_config_done(); | ||
| + | while (ret){ | ||
| + | | ||
| + | ret = nb_config_done(); | ||
| + | | ||
| + | } | ||
| + | if(DEBUG)printf(" | ||
| + | ## Wi-Fi password | ||
| + | nb_config_set(sprintf(" | ||
| + | ret = nb_config_done(); | ||
| + | while (ret){ | ||
| + | | ||
| + | ret = nb_config_done(); | ||
| + | | ||
| + | } | ||
| + | q = length(wlan_ssid_field); | ||
| + | if(DEBUG)printf(" | ||
| + | if(DEBUG)printf(" | ||
| + | i = 100; ## for end loop | ||
| + | release = 0; | ||
| + | } else { | ||
| + | | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | if(DEBUG)printf(" | ||
| + | if (i <= 100) { | ||
| + | if(DEBUG)printf(" | ||
| + | } | ||
| + | } else{ | ||
| + | | ||
| + | for (a=0; 3 > a; ++a){ | ||
| + | if(DEBUG)printf(" | ||
| + | sleep(60); | ||
| + | if(DEBUG)printf(" | ||
| + | wwan_link = struct_get(nb_status(" | ||
| + | if(DEBUG)printf(" | ||
| + | if (wwan_link == " | ||
| + | a = 10; | ||
| + | release = 1; | ||
| + | if(DEBUG)printf(" | ||
| + | if(DEBUG)printf(" | ||
| + | if(DEBUG)printf(" | ||
| + | } | ||
| + | |||
| + | } | ||
| + | } | ||
| + | } | ||
| + | wlan_link = struct_get(nb_status(" | ||
| + | if (wlan_link == " | ||
| + | ret = nb_config_done(); | ||
| + | if(DEBUG)printf(" | ||
| + | if(DEBUG)printf(" | ||
| + | } else{ | ||
| + | | ||
| + | } | ||
| + | } | ||
| + | | ||
| + | | ||
| + | } | ||
| + | printf(" | ||
| + | nb_syslog(" | ||
| + | exit(0); | ||
| + | </ | ||
| + | ++++ | ||
| ---- | ---- | ||
| Line 92: | Line 344: | ||
| In the upper section, you can enter the SSID'' | In the upper section, you can enter the SSID'' | ||
| + | |||
| + | |||
| + | Under '' | ||
| + | |||
| + | Under '' | ||
| + | |||
| + | |||
| + | {{: | ||
| ---- | ---- | ||
| Line 290: | Line 550: | ||
| if(DEBUG)printf(" | if(DEBUG)printf(" | ||
| ## Wi-Fi password | ## Wi-Fi password | ||
| - | nb_config_set(sprintf(" | + | nb_config_set(sprintf(" |
| ret = nb_config_done(); | ret = nb_config_done(); | ||
| while (ret){ | while (ret){ | ||