LinuxMCE Forums
May 22, 2013, 02:38:49 am GMT-1 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
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
 
   Home   Help Search Chat Login Register  
Pages: [1]
  Print  
Author Topic: GSD syntax error outside of my code  (Read 623 times)
JoakimL
Veteran
***
Posts: 149



View Profile
« on: January 24, 2011, 09:52:28 pm »

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
Logged
posde
Administrator
LinuxMCE God
*****
Posts: 2621


Wastes Life On LinuxMCE Since 2007


View Profile WWW
« Reply #1 on: January 24, 2011, 10:39:08 pm »

Please post your GSD code.
Logged

JoakimL
Veteran
***
Posts: 149



View Profile
« Reply #2 on: January 25, 2011, 08:53:34 am »

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

###
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!