Switch to enable WAN connection

For a machine builder or integrator, contacting remotely a machine via the Internet connection of the Customer LAN is very confortable.
For a Customer, having an "exotic" IP device on its network, it is nice to be able, when this device is authorized, to use the Corporate LAN to go on Internet.

To satisfy both, a simple solution is to place a physical switch on the digital input of the eWON to program the connection (or disconnection) of the eWON from the Corporate LAN.

When the switch is ON, the eWON pass through the Corporate LAN to go on Internet (using Talk2M for example).
When the switch is OFF, the eWON closes its WAN interface and is completely isolated from the Corporate LAN.

Explanation

A switch is placed on the digital input connector of the eWON and the a Tag called Switch is configured on this digital input.

The eWON is configured to connect on Internet "ON WAN".

Rem --- eWON start section: Init Section
ewon_init_section:
	Rem --- eWON user (start)
	ONCHANGE "Switch","goto DoSwitch"
	goto DoSwitch
	Rem --- eWON user (end)
End
Rem --- eWON end section: Init Section
Rem --- eWON start section: Switch
Rem --- eWON user (start)
DoSwitch:
	If (Switch@<>0) Then
		rem Open Internet connection
		Setsys COM,"load"
		Setsys COM,"WANCnx","2"
		Setsys COM,"WANPermCnx","1"
		Setsys COM,"save"
		Print Time$;" Connection opened"
	else
		rem Close Internet connection
		Setsys COM,"load"
		Setsys COM,"WANCnx","0"
		Setsys COM,"save"
		Print Time$;" Connection closed"
		endif
	end
	Rem --- eWON user (end)
End
Rem --- eWON end section: Switch