This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
app-notes:wlan-switching [2025/08/04 15:17] – created gray | app-notes:wlan-switching [2025/08/04 15:25] (current) – gray | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | test | + | |
+ | |||
+ | ++++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(DEBUG)printf(" | ||
+ | sleep(1); | ||
+ | wlan_networks = nb_scan_networks(spriend of programntf(" | ||
+ | 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); | ||
+ | |||
+ | |||
+ | ] | ||
+ | </ | ||
+ | ++++ |