This page last changed on May 08, 2012 by buldo.

I'm trying to write small tcp server that will receive commands from OR.
But now I not understand that OR expect from me.

Example 1:
I made in designer device, that has command LSWON - this command send to localhost:5011 string "LSW1 ON". My server receives this message and close TCP socket.
In this case all work right. Maybe.

Example 2:
Same device have a sensor. This sensor sends string "LSW1 STATUS". How my tcp server should answer?

Is there some reference about how to process answer from server and in which cases OR expect answer?

I read tutorial about using telnet devices and also not understand in which place in controller xml should I insert regexp.

Example 1 sounds ok.
Example 2 should return "on" or "off" depending the status of your device.

For a switch you need three commands (one to perform "on" action, one for the "off" action and one to retrieve the status). You also need a switch sensor which is linked to the status command. And final a switch object which uses the switch sensor and the on and of commands.

Regarding telnet, there are a few forum threads about it.

Posted by mredeker at May 08, 2012 22:47

After some some experiments I found that TCP sensor understands not "on","off" strings but "on\r","off\r" strings.

Posted by buldo at May 16, 2012 20:56
Document generated by Confluence on Jun 05, 2016 09:30