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:20] – [Setup] 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 are 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 functionality. | Here we will describe step-by-step how to setup the router with the wifi switcher functionality. | ||
==== 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 46: | Line 61: | ||
Here is a short description of the funtionality of the script. | Here is a short description of the funtionality of the script. | ||
- | You have the option to set DEBUG=1, this will give you some output visible in tail-log. | + | You have the option to set DEBUG=1, this will give you some debug output visible in tail-log. |
- | + | ||
- | First the scirpt will read in 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 setup as WANLINK2). | + | 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 |
- | In case of the state being " | + | |
- | In caste the state is " | + | In case of the state being " |
- | After the scan is finished we take the data and compare it to the list we created | + | After the scan is finished we take the data and compare it to the list we imported |
<code c wifi-switcher.are> | <code c wifi-switcher.are> |