Quick note: look up the PLCBUS code in the wiki:
That code has all my ThreadedRuby (I didn't find out until AFTER I coded it that PLCBUS can't handle threaded messages :/)
I did comment the code, and it's a bit alpha-ish, but that might help.
Bulek, a note for your if-then-else,
the threadedruby code is designed so you can put all your protocol dependant code in a seperate object. because of this, there are certain parts you need to implement:
eg: sending a command to insteon, here's the steps:
First, each command is an object consisting of a complete structure of data, and flags.
threadedruby intercepts the message from DCE
checks to see if its a response the other way around (eg: a command originating from GSD)
when it does this, it passes the message to the device's object (to determine if it's a proper response)
if not, it moves on to the next command object, etc, etc.
if all that failes, (eg: it's not a proper response to any existing messages) then it creates a new command object, sets the direction, etc, and queues the command for transmission.
The nice thing about threadedruby is that the code for processing data is the same in both directions, ie DCE->GSD, and GSD->DCE.
Both GSD and DCE have data to return to each other, and may not be particularly sync'ed up.
The goal of threadedruby was to allow multiple commands/responses to and from GSD/DCE.
ThreadedRuby tracks all messages for you.http://wiki.linuxmce.org/index.php/PLCBUScmd373
(this has all the details)http://wiki.linuxmce.org/index.php/PLCBUS
(this has all the rest)
Best holiday wishes to all!
Sorry I haven't been around much lately, I've got other issues to deal with atm.