When browsing from an external (resolvable) address to G4 Web Control panels on an internal (non-resolvable) address, a link must be made with the external address, and the port must be forwarded in the router to the internal address. Remember, the G4 Web Control links that show up in the browser are for the internal address and will only work from browsers that are physically on the internal network (LAN). Links that work from the external network (WAN), or Internet, can be created with send commands to create them. These commands are sent to the master in DEFINE_START or an event for the panel(s) themselves.
Use G4WC Send command (to master 0:1:0) to add G4 Web Control devices to Web Control list, displayed in the browser. Command format is: " 'G4WC "Name/Description",IPAddress/URL,IP Port,Enabled' "
EXAMPLE:
SEND_COMMAND 0:1:0,'G4WC "Bedroom",12.5.139.15,5900,1'
MAKE SURE TO INCLUDE A SINGLE SPACE AFTER THE G4WC, BEFORE THE DOUBLE QUOTE!!!!
Explanation:
- Bedroom - A unique name representing the touch panel that the customer will seewhen they browse to the master.
- 12.5.139.15 - The external resolvable IP address of the router.
- 1 - Means that this link is enabled…Can also be made a 0 in order to disable the link.
The combination of Name/Description, IP Address/URL, and IP Port are used to determine each unique listing. The internal link is still there, it is sent by the panel to the master. There is a way to remove that link. Below is a code snippet for the easy way to parse the incoming G4WC link, then disable it. It then sends the new link as well.
(***********************************************************)
(* DEVICE NUMBER DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_DEVICE
dvTP = 10001:1:0
(***********************************************************)
(* CONSTANT DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_CONSTANT
//ADD YOUR PANEL NAME AND ADDRESS HERE
WAN_PANEL_NAME = 'WAN PANEL'
WAN_ADDRESS = '192.168.244.33'
WAN_PORT = '5900'
(***********************************************************)
(* THE EVENTS GO BELOW *)
(***********************************************************)
DEFINE_EVENT
DATA_EVENT[dvTP]
{
COMMAND:
{
STACK_VAR CHAR TRASH[25] CHAR TEMP[100]
IF(FIND_STRING(DATA.TEXT,'G4WC-',1)) //FINDS G4WC COMMAND FROM PANEL
{
TRASH = REMOVE_STRING(DATA.TEXT,'G4WC-',1)
TEMP = DATA.TEXT
SET_LENGTH_STRING(TEMP,(LENGTH_STRING(TEMP) - 1))
SEND_COMMAND 0:1:0,"'G4WC ',TEMP,'0'" //TURNS OFF PANEL GENERATED
G4WC
WAIT 40
SEND_COMMAND 0:1:0,"'G4WC
"',WAN_PANEL_NAME,'",',WAN_ADDRESS,',',WAN_PORT,',1'" //CREATES NEW LINK
USING WAN ADDRESS
}
}
}
Multiple Touch Panels:
If you want to have an external link for multiple touch panels then the Name/Description and IP Port fields will need to be modified for each touch panel.
EXAMPLE:
SEND_COMMAND 0:1:0,'G4WC "Bedroom",12.5.139.15,5900,1'
SEND_COMMAND 0:1:0,'G4WC "Living",12.5.139.15,5901,1'
SEND_COMMAND 0:1:0,'G4WC "Kitchen",12.5.139.15,5902,1'
Router Setup:
Ports will need to be forwarded on your router in order for G4WC to work. It is a good idea to give your touch panel's static IP addresses when using the external link for G4WC. Otherwise, if the panel changed IP addresses the external link would not work. If your router only does port forwarding then you will need to change the Web Control Port on the panel to match the external port. If your router will do port shifting then you can leave the panels port at 5900.
PORT FORWARDING EXAMPLE:
External Port | Internal Port | Device |
80 | 80 | master's IP address |
5900 | 5900 | first touch panel's IP |
5901 | 5901 | second touch panel's IP (optional) |
5902 | 5902 | third touch panel's IP (optional) |
PORT SHIFTING EXAMPLE:
External Port | Internal Port | Device |
80 | 80 | master's IP address |
5900 | 5900 | first touch panel's IP |
5901 | 5900 | second touch panel's IP (optional) |
5902 | 5900 | third touch panel's IP (optional) |
If you need to know how to do port forwarding for your router, the website, www.portforward.com, is a good resource