Appendix I – Advanced WebXpander URL Commands

One method of sending commands via the WebX web server interface is by simulating the functionality of the existing web pages. For example, you can simulate the clicking of "Light A-1 ON" from the lighting page by opening: http://192.168.0.5/mega_x10.cgi?var1=lighting&var2=A&var3=1&var4=On&var5=0

Almost all commands issued through the web pages are visible in the "webxdebug" mode accessible via telnet. Telnet to your Web Xpander, type your username/password, then type "webxdebug" to enter debug mode. Then open a web page and click the action you are interested in. In the telnet window you'll see the traffic between the STARGATE and Web Xpander as well as the URL that was generated by the web page

(i.e. xxxx.cgi?var1=xx&var2=xx&var3=xx...)

A new feature present in firmware version 1.3 is the sendcommand.cgi and sendcommand2.cgi functions. These functions were created to make access from the PocketPC, a custom PC app, or a possible future Flash interface easier. They allow you to specify a command to send to the STARGATE and they return the resulting

data from the STARGATE without any HTML (just clear ascii).

They are used as follows: http://192.168.0.5/sendcommand.cgi?var1=<command>&var2=<stop condition>&var3=<stop param>

ex: sendcommand.cgi?var1=%23%23%2507&var2=str&var3=%23%230

ex: sendcommand.cgi?var1=%23%23%2520&var2=time&var3=1500

The only choices for <stop condition> are "str" or "time". "str" instructs the WebX to wait until the STARGATE returns the value in var3 to signal the end of data. "time" instructs the WebX to wait for var3 number of milliseconds of silence to signal the end of data.

NOTE: The URL must be URL encoded to handle the # and % symbols. The above examples are sending the commands ##%07 and ##%20 respectively and the first example waits for the string ##0.

Improper use of these commands can hang the STARGATE and/or the WebX (although both devices will reset themselves under certain conditions.)

The second command, sendcommand2.cgi, is a variation on the first one with the addition of &var4=<username>&var5=<password>. This method avoids the browser authentication and relies on the username/password passed to the .cgi for authentication. In fact, calls to sendcommand.cgi currently redirect automatically to sendcommand2.cgi and automatically add the username/password to the end.

Page 28
Image 28
JDS Uniphase RS-232 operation manual Appendix I Advanced WebXpander URL Commands