Author Topic: Easy question  (Read 10524 times)

brent2009

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
Re: Easy question
« Reply #15 on: November 13, 2012, 05:58:16 am »
New log...I'm getting somewhere. When I reload the router the template initializes and successfully sets the volume and umutes if mute is on. But after that i cannot do anything else. Test send commands still do nothing. Any ideas anyone?

Return code: 2
2   11/12/12 22:53:17   33 (spawning-device)   Device requests restart... count=1/50 dev=33
Mon Nov 12 22:53:17 CST 2012 Restart
1   11/12/12 22:53:25   33 (spawning-device)   Starting... 1
1   11/12/12 22:53:25   33 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
05   11/12/12 22:53:26.834      Note: Device manager has attached a device of type 2125 that this has no custom event handler for.  It will not fire events. <0xb771d6d0>
05   11/12/12 22:53:26.834      Note: Device manager has attached a device of type 2125 that this has no custom handler for.  This is normal for IR. <0xb771d6d0>
05   11/12/12 22:53:26.834      Creating child 35 <0xb771d6d0>
05   11/12/12 22:53:26.834      Note: Device manager has attached a device of type 2166 that this has no custom event handler for.  It will not fire events. <0xb771d6d0>
05   11/12/12 22:53:26.834      Note: Device manager has attached a device of type 2166 that this has no custom handler for.  This is normal for IR. <0xb771d6d0>
01   11/12/12 22:53:26.927      TranslateSerialUSB pci0000:00/0000:00:1d.1+2 result /dev/ttyUSB0 <0xb5919b70>
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_33 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
   4:#### 97 ####################################################################
   5:def cmd_97(cmd=nil)
   6:@returnParamArray.clear
   7:if @mute

   8:conn_.Send("ke 01 00\r")
   9:
  10:else

  11:conn_.Send("ke 01 01\r")
  12:
  13:end

  14:@mute=!@mute
  15:return @returnParamArray
  16:end
  17:#### 193 ####################################################################
  18:def cmd_193(pk_pipe, cmd=nil)
  19:@returnParamArray.clear
  20:log('Sending OFF Command')

  21:conn_.Send("ka 01 00\r")
  22:
  23:return @returnParamArray
  24:end
  25:#### 313 ####################################################################
  26:def cmd_313(level, cmd=nil)
  27:@returnParamArray.clear
  28:@volume=level.to_i()

  29:ilevel = @volume.to_i

  30:log( 'setting volume to '+ ilevel.to_s)

  31:log('Sending the Following Command: kf 01 '+ilevel.to_s(16)+'\r')

  32:conn_.Send("kf 01 "+ilevel.to_s(16)+"\r")
  33:
  34:SetDeviceDataInDB( device_.devid_, 33, ilevel.to_s)

  35:# 158 = DEVICEDATA_Volume_Level_CONST # "volume and corresponding device data set\n"
  36:return @returnParamArray
  37:end
  38:#### 350 ####################################################################
  39:def cmd_350(cmd=nil)
  40:@returnParamArray.clear
  41:buff = ''

  42:loop do

  43:buff=conn_.Recv(30,200)

  44:if buff.empty?

  45:log('Nothing Received')

  46:break

  47:end

  48:log('Received: ' + Regexp.escape(buff.to_s))

  49:if buff.include?("OK")

  50:log(Regexp.escape(buff.to_s) + ': Command Processed Successfully')

  51:elsif buff.include?("NG")

  52:log(Regexp.escape(buff.to_s) +': Command Processed Unsuccessfully')

  53:end

  54:end
  55:return @returnParamArray
  56:end
  57:#### 355 ####################################################################
  58:def cmd_355(cmd=nil)
  59:@returnParamArray.clear
  60:for iRetry in 0...4

  61:print "Initializing unit\n"

  62:conn_.Send("ke 01 01\r") # Send UnMute Command

  63:buf = conn_.Recv(30,200) # Expected Return # ke 01 01\r\ne 00 OK01x\r\n

  64:if !buf.nil? && buf.include?("OK")

  65:print "Initialized ok\n"

  66:print "Setting volume to 30%\n"

  67:cmd_313(15)

  68:SetDeviceDataInDB( device_.devid_, 33, "15" )

  69:# 158 = DEVICEDATA_Volume_Level_CONST

  70:return

  71:end

  72:print "Failed to initialize. Wait 1 secs and try again\n"

  73:sleep(1)

  74:end
  75:return @returnParamArray
  76:end
  77:#### PRIVATE METHODS ####################################################################
  78:def log(line)

  79:$log = File.open("/var/log/pluto/" + device_.devid_.to_s + "_Generic_Serial_Device.log", "a")

  80:$log.puts "(***):" + line.to_s

  81:$log.close

  82:end
  83:#### START SETTERS ####################################################################
  84:def initialize()
  85:super
  86:@returnParamArray=Array.new
  87:end
  88:####  END  SETTERS ####################################################################
  89:end
 91:(***):setting volume to 15
(***):Sending the Following Command: kf 01 f\r
(***):Received: f\ 01\ OK0fx
(***):f\ 01\ OK0fx: Command Processed Successfully
(***):Nothing Received
05   11/12/12 22:53:59.432      #### Pre-Process Queue = 1 <0xb5919b70>
05   11/12/12 22:53:59.434      _QueueProc Pre - 192 : 0 <0xb771cb70>
05   11/12/12 22:53:59.434      GSD-Sleep Pre 192 : 0 <0xb771cb70>
05   11/12/12 22:53:59.434      Process Queue = 1 <0xb771cb70>
01   11/12/12 22:53:59.434      For obscure reasons could not handle the message <0xb4f18b70>
05   11/12/12 22:53:59.462      GSDMessageTranslator isCmdImplemented = false <0xb5919b70>
05   11/12/12 22:53:59.462      GSDMessageTranslator isCmdImplemented = false <0xb5919b70>
05   11/12/12 22:53:59.462      #### Pre-Process Queue = 1 <0xb5919b70>
05   11/12/12 22:54:03.437      _QueueProc Post - 192 : 4000 <0xb771cb70>
05   11/12/12 22:54:03.437      _QueueProc Pre - 984 : 0 <0xb771cb70>
05   11/12/12 22:54:03.437      GSD-Sleep Pre 984 : 0 <0xb771cb70>
05   11/12/12 22:54:03.437      Process Queue = 1 <0xb771cb70>
01   11/12/12 22:54:03.453      For obscure reasons could not handle the message <0xb4f18b70>
05   11/12/12 22:54:05.455      _QueueProc Post - 984 : 2000 <0xb771cb70>