Generic_Serial_Device can handle devices attached to serial port (/dev/ttyS[0-9]) and network attached devices.
Practically GSD makes an interface between DCERouter and your device.
Your device usually implements some set of commands (like ON and OFF or some other commands) for full list go to Advanced->DCE->Commands.
So you can create a scenario and when you are pressing a button on orbiter, a command will be sent to your device. You should take care to implement in Ruby the code you want to be executed to actually perform requested action (turn the device ON/OFF or whatever else)
GSD exports into Ruby some variables like device configuration data, connection opened to device so you can communicate with it and so on.
In Ruby context you may call following methods:
conn_.Send(<string to send>) => returns number of characters sent
conn_.Recv(<numeric max buffer size>,<numeric timeout in ms>) => returns a string which was read
Some useful variables:
device_.devdata[<a number>] => gives you acces to data you entered in "Device Data" section when you added the device (the number is shown on web interface).
For example on ON command you probably want something like
print "NOT OK"
To receive something there is an internal function Process_Incoming_Data
you can simply put:
buffer = conn_.Recv(100,500);
it will receive a buffer of max 100 characters, waiting 0.5 seconds to receive it, and will print it.
The result can be seen in log (/var/log/pluto/XXXX_Generic_Serial_Device.newlog)
If the buffer you read is very important and you want to trigger some other device you can write something like this
cmd = Command.new(device_.devid_ , <DEVICE TO TRIGGER>,<PRIORITY=1>, <MESSAGETYPE: 1=COMMAND/2=EVENT>, <COMMAND/EVENT ID>);
For more examples of Ruby code for GSD devices try to search the forum.