Enabling/disabling the WAN interface
A common example of controlling the WAN communication through scripting is enabling and disabling the WAN port based on the state of a tag.
In the example below, the boolean tag Switch enables the WAN port when it is high and disables it otherwise.
SysControlBlock SCB = new SysControlBlock(SysControlBlock.COM); if (IOManager.readTag("Switch") == 1) { SCB.setItem("WANCnx", "2"); SCB.setItem("WANPermCnx", "1"); SCB.saveBlock(); System.out.println("Connection opened"); } else { SCB.setItem("WANCnx", "0"); SCB.saveBlock(); System.out.println("Connection closed"); }