This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
app-hotes:wifi-switcher [2023/10/31 15:02] – cakir | app-hotes:wifi-switcher [2023/12/12 12:21] (current) – [Goal] cakir | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Wifi Switcher ====== | ====== Wifi Switcher ====== | ||
- | ===== Goal ===== | + | ===== Goal and benefit for the costumer |
- | In this guide we will describe how to setup the WiFi Switcher SDK script on a Netmodule router. This script will take care of automatically connecting to a WiFi Access Point when it is part of a List we defined. The list is in a seperate file and consists of SSIDs and associated Password. | + | In this guide we will describe how to setup the WiFi Switcher SDK script on a Netmodule router. This script will take care of automatically connecting to a WiFi Access Point when it is part of a list we defined. The list is in a seperate file and consists of SSIDs and associated Password. |
===== Application example ===== | ===== Application example ===== | ||
- | Background for this script is a customer who uses our routers in railway applications. The router in the train is supposed to connect to a WiFi network on each respective train station. Only WiFi access points that can be found in the list of defined networks should be used to connect to. | + | Background for this script is a customer who uses our routers in railway applications. The router in the train is supposed to connect to a WiFi network on each respective train station. Only WiFi access points that can be found in the list are used to connect to. |
| | ||
+ | | ||
+ | <code c application-example> | ||
+ | TRAIN TRAIN TRAIN TRAIN | ||
+ | STATION A STATION B STATION C STATION X | ||
+ | +--------+ | ||
+ | |WIFI AP1| |WIFI AP2| |WIFI AP3| |WIFI APX| | ||
+ | | | | ||
+ | +--------+ | ||
+ | |||
+ | TRAIN WIFI CLIENT | ||
+ | +--------+ | ||
+ | +----------------------------------------------> | ||
+ | </ | ||
+ | |||
===== Setup ===== | ===== Setup ===== | ||
- | Here we will describe step-by-step how to setup the router with the wifi switcher | + | Here we will describe step-by-step how to setup the router with the wifi switcher |
==== WAN in Link Manager ==== | ==== WAN in Link Manager ==== | ||
- | First we need to pay attention | + | First we need to make sure that, after setting up our WiFi client, WLAN1 is supposed to be in position 2 in link manager. This is neccessary so that the script queries the correct interface for it's status. The order of WAN interfaces can be changed under "INTERFACES -> WAN -> Link Management". Also we set WLAN1 to permanent. |
{{: | {{: | ||
- | === Setup Trigger === | + | ==== Setup Trigger |
- | Here we setup a trigger that will start our SDK script later on. Since the script is supposed to run at all times we will set our trigger to event-based -> sdk-startup. As soon as SDK is enabled our wifi switcher script will be running. | + | Here we setup a trigger that will start our SDK script later on. Since the script is supposed to run at all times we will set our trigger to "event-based -> sdk-startup". As soon as SDK is enabled our wifi switcher script will be running. |
{{: | {{: | ||
Line 30: | Line 45: | ||
{{: | {{: | ||
- | ==== Setup Wifi Networks List ==== | + | ==== Setup WiFi Networks List ==== |
- | Unlike the wifi-switcher script the list of allowed wifi networks | + | Unlike the wifi-switcher script the list of allowed wifi access points |
- | It is important to use the correct name " | + | It is important to use the correct name " |
{{: | {{: | ||
Line 44: | Line 59: | ||
==== wifi-switcher.are ==== | ==== wifi-switcher.are ==== | ||
- | Hier eine kurze Erklärung wie das Script funktioniert. | + | Here is a short description of the funtionality of the script. |
- | DEBUG kann optional auf 1 gesetzt werden um Output im tail-log | + | You have the option to set DEBUG=1, this will give you some debug output visible in tail-log. |
- | Das Script fragt in der while Schleife immer wieder den status vom WLAN Uplink | + | First the scirpt will import the list of access points it is supposed to connect to. Then the scirpt will keep on looking up the state of the WiFi (WLAN1 which is setup as WANLINK2). |
- | Wenn hier " | + | |
- | Falls das WLAN down sein sollte und bereits mehr als 30 Sekunden seit dem letzten Scan vergangen sind machen wir jetzt einen neuen Scan der uns die aktuell sichtbaren WLAN NEtzwerke liefern wird. | + | In case of the state being " |
- | Nachdem der Scan abgeschlossen holen wir und die Daten der Access Points und schauen in der Liste nach ob dort dieser AP vorhanden ist. Falls ja wird das WLAN umkonfiguriert jedoch nur wenn mehr als 120 Sekunden seit der letzten konfiguration vergangen sind. | + | After the scan is finished we take the data and compare it to the list we imported earlier. When a known access point is found and the last WiFi config update is at least 120 seconds in the past, we update the wifi config so we can connect to the now available WiFi AP. |
<code c wifi-switcher.are> | <code c wifi-switcher.are> |