Difference between revisions of "GSD - Ruby codes"
Line 4: | Line 4: | ||
− | cmd = Command.new( <device from>, <device to>, <???>, <command type>, <command id>) | + | cmd = Command.new( <device from>, <device to>, <???>, <command type>, <command id>) |
Line 10: | Line 10: | ||
− | cmd.params_[<parameter id>] = <string value for command parameter> | + | cmd.params_[<parameter id>] = <string value for command parameter> |
Line 16: | Line 16: | ||
− | SendCommand(cmd) | + | SendCommand(cmd) |
Revision as of 07:18, 29 September 2006
This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007. In general any information should apply to LinuxMCE. However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto. |
The framework offers an Ruby Command object that is actually a wrapper around the C++ class Command. In order to create an instance of the ruby ocommand use:
cmd = Command.new( <device from>, <device to>, <???>, <command type>, <command id>)
There is a hashmap associated with the comand object that allows setting values for the command parameters:
cmd.params_[<parameter id>] = <string value for command parameter>
And for sending the command you should use the SendCommand function:
SendCommand(cmd)
Directly implementing commands this way may prove un-conveninet. You can use the Private Method dummy commadn for writing helper functions.
Besides from the params_ member, the ruby Command object has members for all the parameters from the constructor. Still, the wrapper offers only simple acces to what a commad really is in the DCE Framework.
The actual translation level is done in the Generic_Serial_Device project, in the RubyCommandWrapper class. Whatever methods, parameters etc this class offers will be found in the Ruby Command class after compilation. This allows easily extending the acces the ruby code has to the framework.