UTRONIX logo

UTRONIX
Elektronikutveckling AB

www.utronix.se

Telephone:
+46 13 212 750

Telefax:
+46 13 212 725

e-mail: info@utronix.se

Address:
Landeryd Tallhöjden
585 93 Linköping
SWEDEN


You can send an
order/message/question to us here!

Comments and suggestions would be much appreciated.



Updated 080229.
© UTRONIX 2008.

















Controlling from your own program.
It is possible to control the IP-SwitchBoxes from your own programs. This is done via http. There are two "commands", k0 and k1.

Reading.
To read current status of the box the command k0 is sent. The answer consists of 9 bytes in hexadecimal format:

Byte 1 and 2 Indicates if the outlet is ON or OFF. For example, 31 (0x33, 0x31) means that outlet 1,5 and 6 are ON. Positions where we have no right to read are reported as OFF 
Byte 3 and 4 Indicates if the outlet is making a reset at the moment.
Byte 5 and 6 Indicates rights to read, for example, 0F (0x30, 0x46) means that you have right to read from outlet 1,2,3 and 4.
Byte 7 and 8 Indicates rights to write in the same way.
Byte 9 Is 0 (0x30) if the box is ready for control and 1 (0x31) if the box is reserved for another user.

Example: By sending "GET /k0" via http we get the answer "2100FF0F0" that means that outlet 1,5 and 6 is ON, that we have right to read all 8 outlets, that we have right to write to outlet 1,2,3,4 and that we may write to the box.

Controling.
To change settings of the box the command k1aabbccdd is sent. Where a,b,c,d are the parameters.

aa Bitmask for
switch ON.
Two bytes of hexadecimal values (0..F). A bit set to 1 means that the corresponding outlet shall be switched ON. (For example "F1" means that outlet 1,5,6,7,8 shall be switched ON)
bb Bitmask for
switch OFF.
Two bytes of hexadecimal values (0..F). A bit set to 1 indicates that the corresponding outlet shall be switched OFF. The bitmask for switch on has higher priority than the bitmask for switch off.
If both the bit for switch on and switch off is set then the outlet will be switched ON.
cc Bitmask for reset. Two bytes of hexadecimal values (0..F). A bit set to 1 means that the corresponding outlet shall make a reset sequence.
dd Bitmask to
cancel reset.
Two bytes of hexadecimal values (0..F). A bit set to 1 means that the reset sequence of the corresponding outlet shall be cancelled. The bitmask for cancel has higher priority than the bitmask for reset. 

Example: By sending via http "GET /k1F1FF00FF" we:
Switches ON outlet 1,5,6,7 and 8.
Switches OFF outlets that might been ON before.
Do not start any reset sequence.
Cancel any pending reset sequences.


An  example in Perl on how to use those functions can be found on the supplied CD in Unix\switchbox.pl.
The outlets are there changed in sequence just show how you can do it. 
The code should be modified as required. 

You can of course do the same things in other programming languages.

You have to change to current IP address for the boxen in the file switchbox.pl to make the example work.
It is also possible to run the example in Windows environment with, for example, ActivePerl..

An example in VisualBasic can be found on the supplied CD in VB\VB.zip