News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

GSD syntax error outside of my code

Started by JoakimL, January 24, 2011, 09:52:28 PM

Previous topic - Next topic

JoakimL

I've got a Ruby problem, and I cannot see how to mend it. I get:

(eval):3: syntax error, unexpected $end, line: 3

And since line 3 is outside of my control I really don't know what to do.

Line 3 : class Device_120 < Ruby_Generic_Serial_Device::RubySerialWrapper

I get this for the two device templates I'm experimenting with at the moment.

Any pointers or clues?


/Joakim

Marie.O

If I helped you, feel free to buy me a coffee: [url="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES"]https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES[/url]

JoakimL

It's actually nothing much to it. Strange thing is it worked Sunday morning and without me doing anything (well, at least I'm not aware of changing anything related to this device template) I got the error.

Here's the code:

# #373 Private Method Listing
#
#

def log(line)
# This function logs a line to the log file of the device
log = File.open("/var/log/pluto/" + device_.devid_.to_s + "_Generic_Serial_Device.log", "a")
log.puts Time.now.to_s + " (Ruby script):" + line.to_s
log.close
end

###


# #384 Process Receive Command For Child
#
#

cmdId = cmd.id_ # Command ID: ON, OFF, SET LEVEL
cmdTo = cmd.devidto_ # Device ID in LinuxMCE
devPort = device_.childdevices_[cmdTo].devdata_[12] # 12 contains a port/channel
childType = device_.childdevices_[cmdTo].devtemplid_ # Template ID to know type of device: switch or dimmer
level = 0

log ("Command received for port " + devPort)

case cmdId
when 192 # ON
system('tdtool --on ' + devPort)
log ("Device set to ON")

when 193 # OFF
system('tdtool --off ' + devPort)
log ("Device set to OFF")

when 184 # Change level of dimmer
level = cmd.params_[76].to_i*255/100
system('tdtool --dimlevel ' + level.to_s + ' --dim ' + devPort)
log ("Dim level set to " + level.to_s)
end

###