7
. Controlling from PC software.
You can control the box from tour own PC-programs via http.
For this there are two “commands”, k0 and k1.
To read status
.
Send a http request for k0 to get current status.
The reply is 4 bytes:
Byte 1 Status of the output. “0” (0x30) means the output is off and “1” (0x31) that it is on.
If you have no rights to read then it is reported as off.
Byte 2 Tells if the output is currently doing a reset sequence. “1” for active reset and “0” else.
Byte 3 Tells if you have rights to read. “1” if you have rights and “0” for no rights.
Byte 4 Tells rights to write in the same way.
Example
:
By sending “GET/k0” via http we get the reply “1011” that means the output is on, reset is not active, we
have rights to read and we have rights to write.
Control
.
To change the box you send a http request for “k1abcd”. Where a,b,c,d are the parameters.
a
Byte for switch on.
One byte with “1” or “0”. ”1” means the output is switched on.
b
Byte for switch off.
One byte with “1” or “0”. ”1” means the output is switched off
Switch on has higher priority than switch off.
If both switch on and switch off is set the output will be on.
c
Byte for reset.
One byte with “1” or “0”. ”1” means the output shall do a reset sequence.
d
Byte to cancel
One byte with “1” or “0”. ”1” means the reset sequence shall be cancelled.
active reset.
Cancel have higher priority than reset.
Example
: By sending "
GET /k11001” via http:
The output is switched on.
The output id not switched off.
No reset is started.
Any running reset is cancelled.
An example in Perl
on how to use these function is on the demo CD Unix\switchbox801.pl.
The output there is switched only to show how to do it.
The code is only meant as an example.
The same thing may of course also be done in other program languages.
You have to change to the IP-address of your box to make the example work.
It is also possible to run the script on Windows with, for example, ActivePerl.