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
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - brent2009

#1
Is the dianemo website down? I'm unable to access. Thanks.
#2
Users / Re: Updating IR codes
November 27, 2012, 03:36:44 AM
BIG Thanks to L3mce..........the following link resolved my issue....

http://svn.linuxmce.org/trac.cgi/ticket/1046
#3
Users / Re: Updating IR codes
November 27, 2012, 01:55:31 AM
Gaaahhhhh.... This is happening again and I can't get rid of it. It looks like this was fixed at one point....

Fixes #1046 adding/removing extra slashes when saving IR codes

Any ideas on how it was fixed?

Thanks.
#4
Users / Re: In-wall touch screen
November 27, 2012, 12:36:27 AM
I found this and it might be worth looking into.. Not sure if it is meant to be mounted in the wall but I might give it a try...

http://www.ebay.com/itm/Samsung-S3C2440-ARM9-Board-7-TFT-LCD-Touch-Screen-/110865526317?pt=LH_DefaultDomain_0&hash=item19d019ae2d

It should work well as a linuxmce orbiter... I hope!
#5
Users / In-wall touch screen
November 26, 2012, 11:30:26 PM
Can anyone recommend a cost effective nice touch screen for in wall mounting? similiar to this?

android based
http://store.homeseer.com/store/HomeSeer-HST-IWAR7-In-Wave-Touch-Screen-with-HSTouch-P1403C260.aspx

Also the ipad has some really nice in wall mounting devices that would look really nice and mount flush and the linuxmce orbiter im sure would work great with it but i just cant dish out $1000 for the ipad and a nice ipad mount. Seems like an overkill.

Thanks.
#6
Installation issues / Re: Easy question
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>
#7
Installation issues / Re: Easy question
November 06, 2012, 01:16:55 AM
That is basically what I have been trying:

log('Sending Menu Command')
<$"ka 01 01\r"$>

And the device is definitely started as shown by the log without any errors. Below means that the driver is working correctly right? Are there any other logs I can view to help with troubleshooting this?

Thanks.

/var/log/pluto/39_Generic_Serial_Device.log

05   11/05/12 8:00:37.053      Going to rotate logs... <0xb57b4b90>
05   11/05/12 18:14:51.780      Got a reload command from 0  <0xb57b4b90>
05   11/05/12 18:14:57.276      void ClientSocket::Disconnect() on this socket: 0x933b630 (m_Socket: 8) <0xb6fb88d0>
Return code: 2
2   11/05/12 18:14:57   39 (spawning-device)   Device requests restart... count=1/50 dev=39
Mon Nov  5 18:14:57 CST 2012 Restart
========== NEW LOG SECTION ==========
1   11/05/12 18:15:05   39 (spawning-device)   Starting... 1
1   11/05/12 18:15:05   39 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
05   11/05/12 18:15:05.439      Creating child 40 <0xb71458d0>
05   11/05/12 18:15:05.439      Note: Device manager has attached a device of type 2125 that this has no custom event handler for.  It will not fire events. <0xb71458d0>
05   11/05/12 18:15:05.439      Note: Device manager has attached a device of type 2125 that this has no custom handler for.  This is normal for IR. <0xb71458d0>
05   11/05/12 18:15:05.439      Creating child 41 <0xb71458d0>
05   11/05/12 18:15:05.439      Note: Device manager has attached a device of type 2166 that this has no custom event handler for.  It will not fire events. <0xb71458d0>
05   11/05/12 18:15:05.439      Note: Device manager has attached a device of type 2166 that this has no custom handler for.  This is normal for IR. <0xb71458d0>
RCODE:
  0:require 'Ruby_Generic_Serial_Device'
  1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
  2:end
  3:class Device_39 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
  4:#### 89 ####################################################################
  5:def cmd_89(repeat_command, cmd=nil)
  6:@returnParamArray.clear
  7:print "raising volume from ", @volume, "\n"
  8:cmd_313(@volume+1)
  9:return @returnParamArray
 10:end
 11:#### 90 ####################################################################
 12:def cmd_90(repeat_command, cmd=nil)
 13:@returnParamArray.clear
 14:print "lowering volume from ", @volume, "\n"
 15:cmd_313(@volume-1)
 16:
 17:return @returnParamArray
 18:end
 19:#### 97 ####################################################################
 20:def cmd_97(cmd=nil)
 21:@returnParamArray.clear
 22:if(@mute)
 23:  SendCommand("ke 01 00",10000,4)
 24:else
 25:  SendCommand("ke 01 01",10000,4)
 26:end
 27:@mute=!@mute
 28:return @returnParamArray
 29:end
 30:#### 154 ####################################################################
 31:def cmd_154(cmd=nil)
 32:@returnParamArray.clear
 33:SendCommand("kb 01 60",1000,4)
 34:return @returnParamArray
 35:end
 36:#### 166 ####################################################################
 37:def cmd_166(cmd=nil)
 38:@returnParamArray.clear
 39:SendCommand("kb 01 01",1000,4)
 40:return @returnParamArray
 41:end
 42:#### 192 ####################################################################
 43:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
 44:@returnParamArray.clear
 45:conn_.Send("ka 01 00")
 46:
 47:return @returnParamArray
 48:end
 49:#### 193 ####################################################################
 50:def cmd_193(pk_pipe, cmd=nil)
 51:@returnParamArray.clear
 52:conn_.Send("ka 01 01\r")
 53:
 54:return @returnParamArray
 55:end
 56:#### 313 ####################################################################
 57:def cmd_313(level, cmd=nil)
 58:@returnParamArray.clear
 59:@volume=level.to_i()
 60:ilevel = (@volume * 0.64).to_i
 61:print "setting volume to ", ilevel , "\n"
 62:
 63:if ilevel <10
 64:  SendCommand("kf 01 0" + ilevel.to_s,1000,4)
 65:else
 66:  SendCommand("kf 01 " + ilevel.to_s,1000,4)
 67:end
 68:SetDeviceDataInDB( device_.devid_, 158, ilevel .to_s) # 158 = DEVICEDATA_Volume_Level_CONST
 69:print "volume and corresponding device data set\n"
 70:
 71:return @returnParamArray
 72:end
 73:#### 316 ####################################################################
 74:def cmd_316(cmd=nil)
 75:@returnParamArray.clear
 76:SendCommand("kb 01 02",1000,4)
 77:return @returnParamArray
 78:end
 79:#### 317 ####################################################################
 80:def cmd_317(cmd=nil)
 81:@returnParamArray.clear
 82:SendCommand("kb 01 21",1000,4)
 83:return @returnParamArray
 84:end
 85:#### 355 ####################################################################
 86:def cmd_355(cmd=nil)
 87:@returnParamArray.clear
 88:# Initialize --- Date: 28.02.2008
 89:# the docs are wrong.  they say responses are terminated with a \r.  In reality some sets do, others don't.
 90:# some sets won't respond to ka 01 ff when the tv is off.  others do.
 91:@mute = false;
 92:
 93:# unfortunately we have to turn the device on if it's off to know that it's alive or else it won't respond to anything
 94:@input=-1
 95:for iRetry in 0...4
 96:    print "Initializing unit\n"
 97:    conn_.Send("ka 01 ff\r")
 98:    # wait 2 seconds for the status command, which won't work if the tv is off
 99:    buf = conn_.RecvDelimited("x", 2000)
100:    if( !buf.nil? && !buf.index("01 OK").nil? )
101:        print "Initialized ok - tv is on\n"
102:      volume_level = GetCurrentDeviceData( device_.devid_, 207 ) # 59 = DEVICEDATA_Initial_Volume_CONST
103:      if( !volume_level.empty? && volume_level!="ERR Parameter not found" )
104:         print "Setting volume to ", volume_level, "\n"
105:         cmd_313(volume_level)
106:         SetDeviceDataInDB( device_.devid_, 39, volume_level ) # 39 = DEVICEDATA_Volume_Level_CONST
107:      end
108:        return
109:    end
110:    print "TV is either off or not connected\n"
111:   
112:   # try turning it on
113:    conn_.Send("ka 01 01\r")
114:
115:    # wait 10 seconds for the TV to respond
116:    buf = conn_.RecvDelimited("x", 10000)
117:    if( !buf.nil? && !buf.index("01 OK").nil? )
118:        print "Initialized ok - tv was off\n"
119:        # wait 1 second and turn it off again so it returns to it's prior state
120:        sleep(1)
121:      volume_level = GetCurrentDeviceData( device_.devid_, 207 ) # 59 = DEVICEDATA_Initial_Volume_CONST
122:      if( !volume_level.empty? && volume_level!="ERR Parameter not found" )
123:         print "Setting volume to ", volume_level, "\n"
124:         cmd_313(volume_level)
125:         SetDeviceDataInDB( device_.devid_, 39, volume_level ) # 39 = DEVICEDATA_Volume_Level_CONST
126:      end
127:       conn_.Send("ka 01 00\r")
128:        return
129:    end
130:
131:    print "TV is not connected\n"
132:
133:    sleep(1)
134:end
135:
136:#DisableDevice( device_.devid_, true )
137:print "The device wouldn't respond. Disabling it.\n"
138:return @returnParamArray
139:end
140:#### 361 ####################################################################
141:def cmd_361(cmd=nil)
142:@returnParamArray.clear
143:SendCommand("kb 01 90",1000,4)
144:return @returnParamArray
145:end
146:#### PRIVATE METHODS ####################################################################
147:# Private - Date: 28.02.2008
148:# the docs are wrong.  they say responses are terminated with a \r.  In reality some sets do, others don't.
149:
150:def SendCommand(command,timeout,retransmit)
151:   for i in 0...retransmit
152:      conn_.Send(command + "\r")
153:      # wait up to 8 seconds since it may be very slow if this is an 'on' command
154:      
155:       buf = conn_.RecvDelimited("x", timeout)
156:       
157:       if( !buf.nil? && (!buf.index("01 OK").nil? || !buf.index("01 NG").nil?))
158:         print "Received good reply in less than ", timeout, "ms: ", buf, "\n"
159:         return
160:      else
161:         buf = conn_.Recv(1000,1000);
162:         print "Flushed buffer: ", buf, "invalid resonse in ", timeout, "seconds\n"
163:      end
164:   end
165:end
166:#### 712 ####################################################################
167:def cmd_712(cmd=nil)
168:@returnParamArray.clear
169:SendCommand("kb 01 05",1000,4)
170:return @returnParamArray
171:end
172:#### 767 ####################################################################
173:def cmd_767(cmd=nil)
174:@returnParamArray.clear
175:SendCommand("kb 01 91",1000,4)
176:return @returnParamArray
177:end
178:#### 873 ####################################################################
179:def cmd_873(cmd=nil)
180:@returnParamArray.clear
181:SendCommand("kb 01 00",1000,4)
182:return @returnParamArray
183:end
184:#### 930 ####################################################################
185:def cmd_930(cmd=nil)
186:@returnParamArray.clear
187:SendCommand("kb 01 92",1000,4)
188:return @returnParamArray
189:end
190:#### START SETTERS ####################################################################
191:def initialize()
192:super
193:@returnParamArray=Array.new
194:end
195:####  END  SETTERS ####################################################################
196:end
#8
Installation issues / Re: Easy question
November 05, 2012, 03:50:09 AM
Here is some more info. I tried changing one of my lines and I am getting these messages. any ideas what these mean?

Failed loading code: Error loading code:
error: (eval):196: compile error
(eval):45: syntax error, unexpected tIDENTIFIER, expecting kEND
log('Sending ON Command')conn_.Send("ka 01 01\r")
                              ^
(eval):52: syntax error, unexpected tIDENTIFIER, expecting kEND
log('Sending OFF Command')conn_.Send("ka 01 00\r")
                               ^, line: 196
#9
Users / Re: Updating IR codes
November 05, 2012, 03:43:55 AM
I think I fixed this now... It was my browser cache I think. I cleared it out and it works now.
Thanks.
#10
Installation issues / Re: Easy question
November 05, 2012, 03:13:58 AM
In summary from above:


Works 100%
-LinuxMCE 100% successfully opens and establishes RS232 connection to my LG TV.
-sudo ./TestSerialPort -p /dev/ttyS0 -t "ka 01 01\r"

Does not work at all-
-Doesn't appear to send any commands using "test command" in A/V properties, nothing appears in the "follow log", even with ruby snippets including the log command
#11
Users / Updating IR codes
November 05, 2012, 02:27:16 AM
When I go to update IR codes in linuxmce 8.10 how come there are slashes inserted in every single line similar to what is show below upon hitting the update button? Every time you hit update another slash gets inserted.

SendCommand(\\\"ka 01 00\\\",1000,2)

Thanks.
#12
Installation issues / Re: Easy question
November 05, 2012, 12:45:39 AM
I am now getting this stuff at the end of the log upon restart.

05   11/04/12 17:40:44.573      #### Pre-Process Queue = 1 <0xb5206b70>
05   11/04/12 17:40:44.582      _QueueProc Pre - 192 : 0 <0xb7009b70>
05   11/04/12 17:40:44.582      GSD-Sleep Pre 192 : 0 <0xb7009b70>
05   11/04/12 17:40:44.582      Process Queue = 1 <0xb7009b70>
05   11/04/12 17:40:44.582      Parameter:  <0xb4805b70>
05   11/04/12 17:40:44.582      Parameter:  <0xb4805b70>
05   11/04/12 17:40:44.610      GSDMessageTranslator isCmdImplemented = false <0xb5206b70>
05   11/04/12 17:40:44.648      GSDMessageTranslator isCmdImplemented = false <0xb5206b70>
05   11/04/12 17:40:44.648      #### Pre-Process Queue = 1 <0xb5206b70>
05   11/04/12 17:41:06.007      _QueueProc Post - 192 : 4000 <0xb7009b70>
05   11/04/12 17:41:06.007      _QueueProc Pre - 984 : 0 <0xb7009b70>
05   11/04/12 17:41:06.007      GSD-Sleep Pre 984 : 0 <0xb7009b70>
05   11/04/12 17:41:06.007      Process Queue = 1 <0xb7009b70>
05   11/04/12 17:41:26.004      _QueueProc Post - 984 : 2000 <0xb7009b70>


I haven't changed anything besides trying different templates but still unable to get the test codes buttons to do anything or effect my tv at all. What is the deal?

Thanks.
#13
Installation issues / Re: Easy question
November 04, 2012, 05:17:47 PM
Quote from: iberium on November 04, 2012, 02:42:49 PM
The device will become disabled if it can't start.  It sounds like you are missing some parameters on the device page.  Make sure you have all of the com settings correct.

Ok, I am past the device becoming disabled part now. I am 100% sure linuxmce com port settings are correct and that communication appears to be working. I have been using a com port directly connected to my PC. I have spent countless hours now trying to get this to work.  I decided to buy what I am eventually going to need anyway... a serial to network hub... I have some more info and I am now even more confident that I have configuring the com settings correctly because I can see when data is sent to the hub and that linuxmce is connected to it successfully via a web interface:

Port 1 status: open
from ip address: 192.168.80.1
Baud settings: 9600 8/N/1 (these settings are not set by the serial hub either.. .they are received from linuxmce)


Now that I know communciation is wokring... AND i actually knew this in the first place anyway when I used TestSerialPort (sudo ./TestSerialPort -p /dev/ttyS0 -t "ka 01 01\r") how in the heck can I get the web interface to work and send "ka 01 01\r" (since I know this is the string that works with TestserialPort)

I am still very confused on why "test command" is not logging anything to the follow log and still very confused on what to use for the code. I really believe the code I am using is not correct for my tv since testserialport works. Am i supposed to be using sendcommand or command? What do i need to enter in the code in order for linuxmce web test command to send strictly this string for the tv on command "ka 01 01\r".  I believe this is really what I need answered. thank you.

SendCommand("ka","00",1) ???
Command("ka","00",1) ??
<$"ka 01 01\r"$> ??
#14
Installation issues / Re: Easy question
November 03, 2012, 02:41:15 AM
also When I try this:

log('Sending Menu Command')
<$"ka 01 00r"$>


and then click test code it doesn't add that to the follow log. :(

#15
Installation issues / Re: Easy question
November 03, 2012, 02:25:23 AM
Well I sort of made progress. My logs weren't refreshing and it was because the device somehow got disabled. Now I got the log updated and it isn't showing that above error anymore... Here is the updated log. Any other ideas?

========== NEW LOG SECTION ==========
1       11/02/12 20:12:31       37 (spawning-device)    ^[[1;00mStarting... 1^[[1;00m
1       11/02/12 20:12:31       37 (spawning-device)    ^[[1;00mFound /usr/pluto/bin/Generic_Serial_Device^[[1;00m
05      11/02/12 20:12:31.964           ^[[33;1mCreating child 38^[[0m <0xb6fab6d0>
05      11/02/12 20:12:31.964           ^[[33;1mNote: Device manager has attached a device of type 2125 that this has no custom event handler for.  It will not fire events.^[[0m <0xb6fab6d0>
05      11/02/12 20:12:31.964           ^[[33;1mNote: Device manager has attached a device of type 2125 that this has no custom handler for.  This is normal for IR.^[[0m <0xb6fab6d0>
05      11/02/12 20:12:31.964           ^[[33;1mCreating child 39^[[0m <0xb6fab6d0>
05      11/02/12 20:12:31.964           ^[[33;1mNote: Device manager has attached a device of type 2166 that this has no custom event handler for.  It will not fire events.^[[0m <0xb6fab6d0>
05      11/02/12 20:12:31.964           ^[[33;1mNote: Device manager has attached a device of type 2166 that this has no custom handler for.  This is normal for IR.^[[0m <0xb6fab6d0>
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_37 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
   4:#### 89 ####################################################################
   5:def cmd_89(repeat_command, cmd=nil)
   6:@returnParamArray.clear
   7:print "raising volume from ", @volume, "\n"^M
   8:cmd_313(@volume+1)
   9:return @returnParamArray
  10:end
  11:#### 90 ####################################################################
  12:def cmd_90(repeat_command, cmd=nil)
  13:@returnParamArray.clear
  14:print "lowering volume from ", @volume, "\n"^M
  15:cmd_313(@volume-1)^M
  16:
  17:return @returnParamArray
  18:end
  19:#### 97 ####################################################################
  20:def cmd_97(cmd=nil)
  21:@returnParamArray.clear
  22:if(@mute)^M
  23:  SendCommand("ke 01 00",10000,4)^M
  24:else^M
  25:  SendCommand("ke 01 01",10000,4)^M
  26:end^M
  27:@mute=!@mute
  28:return @returnParamArray
  29:end
  30:#### 154 ####################################################################
  31:def cmd_154(cmd=nil)
  32:@returnParamArray.clear
  33:SendCommand("kb 01 60",1000,4)
  34:return @returnParamArray
  35:end
  36:#### 166 ####################################################################
  37:def cmd_166(cmd=nil)
  38:@returnParamArray.clear
  39:SendCommand("kb 01 01",1000,4)
  40:return @returnParamArray
  41:end
  42:#### 192 ####################################################################
  43:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
  44:@returnParamArray.clear
  45:SendCommand("ka 01 01",10000,4)
  46:return @returnParamArray
  47:end
  48:#### 193 ####################################################################
  49:def cmd_193(pk_pipe, cmd=nil)
  50:@returnParamArray.clear
  51:SendCommand("ka 01 00",1000,2)
  52:return @returnParamArray
  53:end
  54:#### 313 ####################################################################
  55:def cmd_313(level, cmd=nil)
  56:@returnParamArray.clear
  57:@volume=level.to_i()^M
  58:ilevel = (@volume * 0.64).to_i^M
  59:print "setting volume to ", ilevel , "\n"^M
  60:^M
  61:if ilevel <10^M
  62:  SendCommand("kf 01 0" + ilevel.to_s,1000,4) ^M
  63:else^M
  64:  SendCommand("kf 01 " + ilevel.to_s,1000,4) ^M
  65:end^M
  66:SetDeviceDataInDB( device_.devid_, 158, ilevel .to_s) # 158 = DEVICEDATA_Volume_Level_CONST^M
  67:print "volume and corresponding device data set\n"^M
  68:
  69:return @returnParamArray
  70:end
  71:#### 316 ####################################################################
  72:def cmd_316(cmd=nil)
  73:@returnParamArray.clear
  74:SendCommand("kb 01 02",1000,4)
  75:return @returnParamArray
  76:end
  77:#### 317 ####################################################################
  78:def cmd_317(cmd=nil)
  79:@returnParamArray.clear
  80:SendCommand("kb 01 21",1000,4)
  81:return @returnParamArray
  82:end
  83:#### 355 ####################################################################
  84:def cmd_355(cmd=nil)
  85:@returnParamArray.clear
  86:# Initialize --- Date: 28.02.2008^M
  87:# the docs are wrong.  they say responses are terminated with a \r.  In reality some sets do, others don't.^M
  88:# some sets won't respond to ka 01 ff when the tv is off.  others do.^M
  89:@mute = false;^M
  90:^M
  91:# unfortunately we have to turn the device on if it's off to know that it's alive or else it won't respond to anything^M
  92:@input=-1^M
  93:for iRetry in 0...4^M
  94:    print "Initializing unit\n"^M
  95:    conn_.Send("ka 01 ff\r") ^M
  96:    # wait 2 seconds for the status command, which won't work if the tv is off^M
  97:    buf = conn_.RecvDelimited("x", 2000)^M
  98:    if( !buf.nil? && !buf.index("01 OK").nil? )^M
  99:        print "Initialized ok - tv is on\n"^M
100:           volume_level = GetCurrentDeviceData( device_.devid_, 207 ) # 59 = DEVICEDATA_Initial_Volume_CONST^M
101:           if( !volume_level.empty? && volume_level!="ERR Parameter not found" )^M
102:                   print "Setting volume to ", volume_level, "\n"^M
103:                   cmd_313(volume_level)^M
104:                   SetDeviceDataInDB( device_.devid_, 158, volume_level ) # 158 = DEVICEDATA_Volume_Level_CONST^M
105:           end^M
106:        return^M
107:    end^M
108:    print "TV is either off or not connected\n"^M
109:   ^M
110:   # try turning it on^M
111:    conn_.Send("ka 01 01\r") ^M
112:^M
113:    # wait 10 seconds for the TV to respond^M
114:    buf = conn_.RecvDelimited("x", 10000)^M
115:    if( !buf.nil? && !buf.index("01 OK").nil? )^M
116:        print "Initialized ok - tv was off\n"^M
117:        # wait 1 second and turn it off again so it returns to it's prior state^M
118:        sleep(1)^M
119:           volume_level = GetCurrentDeviceData( device_.devid_, 207 ) # 59 = DEVICEDATA_Initial_Volume_CONST^M
120:           if( !volume_level.empty? && volume_level!="ERR Parameter not found" )^M
121:                   print "Setting volume to ", volume_level, "\n"^M
122:                   cmd_313(volume_level)^M
123:                   SetDeviceDataInDB( device_.devid_, 158, volume_level ) # 158 = DEVICEDATA_Volume_Level_CONST^M
124:           end^M
125:       conn_.Send("ka 01 00\r") ^M
126:        return^M
127:    end^M
128:^M
129:    print "TV is not connected\n"^M
130:^M
131:    sleep(1)^M
132:end^M
133:^M
134:#DisableDevice( device_.devid_, true )^M
135:print "The device wouldn't respond. Disabling it.\n"^M
136:
137:return @returnParamArray
138:end
139:#### 361 ####################################################################
140:def cmd_361(cmd=nil)
141:@returnParamArray.clear
142:SendCommand("kb 01 90",1000,4)
143:return @returnParamArray
144:end
145:#### PRIVATE METHODS ####################################################################
146:# Private - Date: 28.02.2008^M
147:# the docs are wrong.  they say responses are terminated with a \r.  In reality some sets do, others don't.^M
148:^M
149:def SendCommand(command,timeout,retransmit)^M
150:   for i in 0...retransmit^M
151:           conn_.Send(command + "\r")^M
152:           # wait up to 8 seconds since it may be very slow if this is an 'on' command^M
153:           ^M
154:       buf = conn_.RecvDelimited("x", timeout)^M
155:       ^M
156:       if( !buf.nil? && (!buf.index("01 OK").nil? || !buf.index("01 NG").nil?))^M
157:                   print "Received good reply in less than ", timeout, "ms: ", buf, "\n"^M
158:                   return^M
159:           else^M
160:                   buf = conn_.Recv(1000,1000);^M
161:                   print "Flushed buffer: ", buf, "invalid resonse in ", timeout, "seconds\n"^M
162:           end^M
163:   end^M
164:end
165:#### 712 ####################################################################
166:def cmd_712(cmd=nil)
167:@returnParamArray.clear
168:SendCommand("kb 01 05",1000,4)
169:return @returnParamArray
170:end
171:#### 767 ####################################################################
172:def cmd_767(cmd=nil)
173:@returnParamArray.clear
174:SendCommand("kb 01 91",1000,4)
175:return @returnParamArray
176:end
177:#### 873 ####################################################################
178:def cmd_873(cmd=nil)
179:@returnParamArray.clear
180:SendCommand("kb 01 00",1000,4)
181:return @returnParamArray
182:end
183:#### 930 ####################################################################
184:def cmd_930(cmd=nil)
185:@returnParamArray.clear
186:SendCommand("kb 01 92",1000,4)
187:return @returnParamArray
188:end
189:#### START SETTERS ####################################################################
190:def initialize()
191:super
192:@returnParamArray=Array.new
193:end
194:####  END  SETTERS ####################################################################
195:end
197: