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 - mikeybs

#31
Users / Re: gc100 and rs232 control
December 12, 2013, 08:06:57 AM
if you send me your email I will email you the credentials to get in, I just don't want to post the credentials in the forum for the whole world to see
#32
Users / Re: gc100 and rs232 control
December 12, 2013, 08:04:18 AM
yeah I can get you in remotely, I'll let you use ssh and port forwarding to see the webmin.  Let me know when a good time for you is and I'll do my best to be available...
#33
Users / Re: gc100 and rs232 control
December 11, 2013, 11:52:58 PM
so is there anywhere I can go from here?  Should I try to get my hands on a MD?  I was hoping not to have to use one... I mostly just want to be able to control my AV equipment, I don't have the need for the multimedia features an MD provides.
#34
Users / Re: gc100 and rs232 control
December 11, 2013, 11:47:23 PM
I only have a single EA that I set up myself as a non-pluto TV EA
#35
Users / Re: gc100 and rs232 control
December 11, 2013, 11:35:29 PM
I've done that.  For every AV device I have them set to Manually Configure EA, I have the correct EA checked and I have them placed in the correct room...
#36
Users / Re: gc100 and rs232 control
December 11, 2013, 10:50:51 PM
I've got nothing good to use for an MD right now :(

I suppose I could wrangle something up in a day or two if it's my only option

I do have a raspberry pi, but I am not able to get it to boot up as an MD, I am posting in another thread about that....

If I get that working maybe I'll be able to make some better progress
#37
Installation issues / Re: LinuxMCE on raspberry pi
December 11, 2013, 10:46:30 PM
I am running 1204 right now, is there any working recipe to get a moonpi running on it?  It's pretty much my only option for MD right now...
#38
Users / Re: gc100 and rs232 control
December 11, 2013, 10:44:40 PM
#39
Users / Re: gc100 and rs232 control
December 11, 2013, 10:23:59 PM
I attempted to create two media scenarios called "verizon" and "dvd player".  I am not attempting to control the dvd player in any way, I just want the receiver and tv to respond appropriately.

Choosing either one from my orbiter causes the dce router to reboot and reload my orbiter...

I am happy to post any relevant logs, just let me know what you'd like to see...
#40
Users / Re: gc100 and rs232 control
December 11, 2013, 07:55:41 PM
odd, for some reason the COM Port on PC on the receiver device got blanked...  I changed it back to the virtual gc100 serial port and things have gotten more interesting....

here is some output after a core reboot, I'm thinking it looks healthy...

/var/log/pluto/49_Generic_Serial_Device.log:

05   12/11/13 13:16:25.662      Socket::ReceiveData 0x8e005f8 failed, bytes left 0 start: 5280000 1: 0 1b: 0 2: 0 2b: 0 m_Socket: 8 Command_Impl1 Dev #49 <0xb5dffb40>
05   12/11/13 13:16:25.662      Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Command_Impl1 Dev #49 <0xb5dffb40>
01   12/11/13 13:16:25.662      Receive string failed in HandleRequestSocket 18:ReceiveData failed Command_Impl1 Dev #49 <0xb5dffb40>
05   12/11/13 13:16:25.663      Dumping 1 locks <0xb5dffb40>
05   12/11/13 13:16:25.663      finished check for exceptions <0xb5dffb40>
05   12/11/13 13:16:25.664      OL: (0x8e00744) (>101) MessageQueue Command_Impl.cpp l:852 time: 7:00:00p (1386785785 s) thread: 3061005120 Rel: Y Got: Y <0xb5dffb40>
== ATTEMPT FRESH START ==
1   12/11/13 13:18:59   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   10546 Dev: 49; Already Running list: 15,16,18,19,29,30,31,45,
== FRESH START ==
1   12/11/13 13:18:59   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   device: 49 ip: localhost cmd_line: Generic_Serial_Device
0   12/11/13 13:18:59   49 (spawning-device)   Entering 49
========== NEW LOG SECTION ==========
1   12/11/13 13:18:59   49 (spawning-device)   Starting... 1
1   12/11/13 13:18:59   49 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
RCODE:......



I still don't have any autogenerated scenarios, either that or I just don't know how to use/find them

Messages are definitely being sent to and received from my receiver though, I can see them in /var/log/pluto/socat_ttyS_45_0.log

Right now the only devices defined by me are the verizon STB, the receiver, and the tv:  Verizon STB-> HMDI3 of receiver -> HDMI1 of tv

Now if I change the receiver to HDMI2, then turn the TV off, then turn the TV back on, Linuxmce will change the receiver to HDMI3 after the TV powers up.  I'm guessing it does this because HDMI3 is the only input I have in use for the receiver so it assumes I want to use it.

So far turning the TV off and back on using the TV remote control is the only way I have found that makes Linuxmce send any commands to my devices. 

I would like to create a scenario that will turn the TV on if it's off and change it to HDMI1, turn the receiver on if it's off and change it to HDMI3, and power on the verizon STB

And I would like another scenario that turns everything off.

I'm guessing the verizon STB will prove tricky since it does not have discrete on/off commands.  Hopefully that won't prove too annoying...

Should scenarios like these be automatically generated for me?  Does it mean I still have not configured things properly...

On my orbiter I have tried clicking the Entertainment icon, then selecting my entertainment area, then trying to power it on/off and volume up/down, but nothing happens.

At least I do feel like I am making progress :)
#41
Installation issues / Re: LinuxMCE on raspberry pi
December 11, 2013, 08:44:09 AM
I got those results on 1204...
#42
Users / Re: gc100 and rs232 control
December 11, 2013, 07:06:23 AM
ok I implemented a blank command 350 and now I get the following in my /var/log/pluto/49_Generic_Serial_Device.log

05   12/11/13 1:02:22.377      Got a reload command from 0  <0xb5cffb40>
05   12/11/13 1:02:22.643      void ClientSocket::Disconnect() on this socket: 0x86d95f8 (m_Socket: 8) <0xb76faac0>
Return code: 2
2   12/11/13 01:02:23   49 (spawning-device)   Device requests restart... count=1/50 dev=49
Wed Dec 11 01:02:23 EST 2013 Restart
========== NEW LOG SECTION ==========
1   12/11/13 01:02:32   49 (spawning-device)   Starting... 1
1   12/11/13 01:02:32   49 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
01   12/11/13 1:02:32.975      GSD Port is not specified. Instantiating non-IO Wrapper. <0xb5dffb40>
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_49 < Ruby_Generic_Serial_Device::RubySerialWrapper
   4:#### 89 ####################################################################
   5:def cmd_89(repeat_command, cmd=nil)
   6:@returnParamArray.clear
   7:conn_.Send("x02x00x37x38x31x45x03")
   8:return @returnParamArray
   9:end
  10:#### 90 ####################################################################
  11:def cmd_90(repeat_command, cmd=nil)
  12:@returnParamArray.clear
  13:conn_.Send("x02x00x37x38x31x46x03")
  14:return @returnParamArray
  15:end
  16:#### 97 ####################################################################
  17:def cmd_97(cmd=nil)
  18:@returnParamArray.clear
  19:conn_.Send("x02x00x37x38x39x43x03")
  20:return @returnParamArray
  21:end
  22:#### 151 ####################################################################
  23:def cmd_151(cmd=nil)
  24:@returnParamArray.clear
  25:conn_.Send("x02x00x37x38x44x42x03")
  26:return @returnParamArray
  27:end
  28:#### 192 ####################################################################
  29:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
  30:@returnParamArray.clear
  31:conn_.Send("x02x00x37x38x37x45x03")
  32:return @returnParamArray
  33:end
  34:#### 193 ####################################################################
  35:def cmd_193(pk_pipe, cmd=nil)
  36:@returnParamArray.clear
  37:conn_.Send("x02x00x37x38x37x46x03")
  38:return @returnParamArray
  39:end
  40:#### 361 ####################################################################
  41:def cmd_361(cmd=nil)
  42:@returnParamArray.clear
  43:conn_.Send("x02x00x37x38x34x41x03")
  44:return @returnParamArray
  45:end
  46:#### 716 ####################################################################
  47:def cmd_716(cmd=nil)
  48:@returnParamArray.clear
  49:conn_.Send("x02x00x37x38x44x39x03")
  50:return @returnParamArray
  51:end
  52:#### 767 ####################################################################
  53:def cmd_767(cmd=nil)
  54:@returnParamArray.clear
  55:conn_.Send("x02x00x37x38x44x30x03")
  56:return @returnParamArray
  57:end
  58:#### 900 ####################################################################
  59:def cmd_900(cmd=nil)
  60:@returnParamArray.clear
  61:conn_.Send("x02x00x37x38x44x41x03")
  62:return @returnParamArray
  63:end
  64:#### 930 ####################################################################
  65:def cmd_930(cmd=nil)
  66:@returnParamArray.clear
  67:conn_.Send("x02x00x37x38x32x41x03")
  68:return @returnParamArray
  69:end
  70:#### 985 ####################################################################
  71:def cmd_985(cmd=nil)
  72:@returnParamArray.clear
  73:conn_.Send("x02x00x37x38x34x31x03")
  74:return @returnParamArray
  75:end
  76:#### START SETTERS ####################################################################
  77:def initialize()
  78:super
  79:@returnParamArray=Array.new
  80:end
  81:####  END  SETTERS ####################################################################
  82:end
#43
Users / Re: gc100 and rs232 control
December 11, 2013, 02:39:18 AM
I just created a new group/codeset instead of attempting to use the existing one for yahama receivers rs232 and editing it....

I've defined the ruby codes for:     On/Off/HDMI1-4/Vol+/Vol-/Mute

I'm hoping that's enough to get going...


I rebooted my LMCE core and I'm still getting an error message for command 350...

command 350 is not defined by me in my new codeset, not sure what is going on...


here is the output of /var/log/pluto/49_Generic_Serial_Device.log

   12/10/13 20:28:24.502      Socket::ReceiveData 0x96b85f8 failed, bytes left 0 start: 82690000 1: 0 1b: 0 2: 0 2b: 0 m_Socket: 8 Command_Impl1 Dev #49 <0xb5dffb40>
05   12/10/13 20:28:24.647      Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Command_Impl1 Dev #49 <0xb5dffb40>
01   12/10/13 20:28:24.647      Receive string failed in HandleRequestSocket 18:ReceiveData failed Command_Impl1 Dev #49 <0xb5dffb40>
05   12/10/13 20:28:24.678      Dumping 1 locks <0xb5dffb40>
05   12/10/13 20:28:24.678      finished check for exceptions <0xb5dffb40>
05   12/10/13 20:28:24.678      OL: (0x96b8744) (>145) MessageQueue Command_Impl.cpp l:852 time: 7:00:00p (1386725304 s) thread: 3061021504 Rel: Y Got: Y <0xb5dffb40>
01   12/10/13 20:28:24.618      Error while calling method: Cannot call class method: cmd_350
error: SIGHUP, line: 118
backtrace:
   in: (eval): 118
   from (eval):118:in `cmd_350'
<0xb53ffb40>
== ATTEMPT FRESH START ==
1   12/10/13 20:31:13   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   11505 Dev: 49; Already Running list: 15,16,18,19,29,30,31,45,
== FRESH START ==
1   12/10/13 20:31:13   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   device: 49 ip: localhost cmd_line: Generic_Serial_Device
0   12/10/13 20:31:13   49 (spawning-device)   Entering 49
========== NEW LOG SECTION ==========
1   12/10/13 20:31:13   49 (spawning-device)   Starting... 1
1   12/10/13 20:31:13   49 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_49 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
   4:#### 89 ####################################################################
   5:def cmd_89(repeat_command, cmd=nil)
   6:@returnParamArray.clear
   7:conn_.Send("x02x00x37x38x31x45x03")
   8:return @returnParamArray
   9:end
  10:#### 90 ####################################################################
  11:def cmd_90(repeat_command, cmd=nil)
  12:@returnParamArray.clear
  13:conn_.Send("x02x00x37x38x31x46x03")
  14:return @returnParamArray
  15:end
  16:#### 97 ####################################################################
  17:def cmd_97(cmd=nil)
  18:@returnParamArray.clear
  19:conn_.Send("x02x00x37x38x39x43x03")
  20:return @returnParamArray
  21:end
  22:#### 151 ####################################################################
  23:def cmd_151(cmd=nil)
  24:@returnParamArray.clear
  25:conn_.Send("x02x00x37x38x44x42x03")
  26:return @returnParamArray
  27:end
  28:#### 192 ####################################################################
  29:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
  30:@returnParamArray.clear
  31:conn_.Send("x02x00x37x38x37x45x03")
  32:return @returnParamArray
  33:end
  34:#### 193 ####################################################################
  35:def cmd_193(pk_pipe, cmd=nil)
  36:@returnParamArray.clear
  37:conn_.Send("x02x00x37x38x37x46x03")
  38:return @returnParamArray
  39:end
  40:#### 361 ####################################################################
  41:def cmd_361(cmd=nil)
  42:@returnParamArray.clear
  43:conn_.Send("x02x00x37x38x34x41x03")
  44:return @returnParamArray
  45:end
  46:#### 716 ####################################################################
  47:def cmd_716(cmd=nil)
  48:@returnParamArray.clear
  49:conn_.Send("x02x00x37x38x44x39x03")
  50:return @returnParamArray
  51:end
  52:#### 767 ####################################################################
  53:def cmd_767(cmd=nil)
  54:@returnParamArray.clear
  55:conn_.Send("x02x00x37x38x44x30x03")
  56:return @returnParamArray
  57:end
  58:#### 900 ####################################################################
  59:def cmd_900(cmd=nil)
  60:@returnParamArray.clear
  61:conn_.Send("x02x00x37x38x44x41x03")
  62:return @returnParamArray
  63:end
  64:#### 930 ####################################################################
  65:def cmd_930(cmd=nil)
  66:@returnParamArray.clear
  67:conn_.Send("x02x00x37x38x32x41x03")
  68:return @returnParamArray
  69:end
  70:#### 985 ####################################################################
  71:def cmd_985(cmd=nil)
  72:@returnParamArray.clear
  73:conn_.Send("x02x00x37x38x34x31x03")
  74:return @returnParamArray
  75:end
  76:#### START SETTERS ####################################################################
  77:def initialize()
  78:super
  79:@returnParamArray=Array.new
  80:end
  81:####  END  SETTERS ####################################################################
  82:end
#44
Users / Re: gc100 and rs232 control
December 11, 2013, 02:11:52 AM
command 350 is:
ReceiveReportCommand()
#45
Users / Re: gc100 and rs232 control
December 11, 2013, 01:56:37 AM
here is the GSD log

407:01   12/10/13 17:49:45.524      Error while calling method: Cannot call class method: cmd_350
error: SIGHUP, line: 118
backtrace:
   in: (eval): 118
   from (eval):118:in `cmd_350'
<0xb53ffb40>
05   12/10/13 17:49:45.639      Socket::ReceiveData 0x9f065f8 failed, bytes left 0 start: 5550000 1: 0 1b: 0 2: 0 2b: 0 m_Socket: 8 Command_Impl1 Dev #49 <0xb5dffb40>
05   12/10/13 17:49:45.640      Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Command_Impl1 Dev #49 <0xb5dffb40>
01   12/10/13 17:49:45.640      Receive string failed in HandleRequestSocket 18:ReceiveData failed Command_Impl1 Dev #49 <0xb5dffb40>
05   12/10/13 17:49:45.640      Dumping 1 locks <0xb5dffb40>
05   12/10/13 17:49:45.640      finished check for exceptions <0xb5dffb40>
05   12/10/13 17:49:45.640      OL: (0x9f06744) (>91) MessageQueue Command_Impl.cpp l:852 time: 7:00:00p (1386715785 s) thread: 3061214016 Rel: Y Got: Y <0xb5dffb40>
== ATTEMPT FRESH START ==
1   12/10/13 17:52:37   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   10831 Dev: 49; Already Running list: 15,16,18,19,29,30,31,45,
== FRESH START ==
1   12/10/13 17:52:37   /usr/pluto/bin/Spawn_Device.sh 49 (spawning-device)   device: 49 ip: localhost cmd_line: Generic_Serial_Device
0   12/10/13 17:52:37   49 (spawning-device)   Entering 49
========== NEW LOG SECTION ==========
1   12/10/13 17:52:37   49 (spawning-device)   Starting... 1
1   12/10/13 17:52:38   49 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_49 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
   4:#### 89 ####################################################################
   5:def cmd_89(repeat_command, cmd=nil)
   6:@returnParamArray.clear
   7:SendMyIrCommand("781E")
   8:return @returnParamArray
   9:end
  10:#### 90 ####################################################################
  11:def cmd_90(repeat_command, cmd=nil)
  12:@returnParamArray.clear
  13:SendMyIrCommand("781F")
  14:return @returnParamArray
  15:end
  16:#### 97 ####################################################################
  17:def cmd_97(cmd=nil)
  18:@returnParamArray.clear
  19:# Mute - Date: 2007-02-22 12:41:58
  20:
  21:if(@mute[cmd.devidto_])
  22:  SendMultiZoneCommand(cmd, ["07EA3", "07EA1", "07E66"])
  23:else
  24:  SendMultiZoneCommand(cmd, ["07EA2", "07EA0","07E26"])
  25:end
  26:@mute[cmd.devidto_]=!@mute[cmd.devidto_]
  27:
  28:return @returnParamArray
  29:end
  30:#### 161 ####################################################################
  31:def cmd_161(cmd=nil)
  32:@returnParamArray.clear
  33:SendIrCommand("07A54")
  34:return @returnParamArray
  35:end
  36:#### 162 ####################################################################
  37:def cmd_162(cmd=nil)
  38:@returnParamArray.clear
  39:SendIrCommand("07A15")
  40:
  41:return @returnParamArray
  42:end
  43:#### 163 ####################################################################
  44:def cmd_163(cmd=nil)
  45:@returnParamArray.clear
  46:SendIrCommand("07A14")
  47:return @returnParamArray
  48:end
  49:#### 165 ####################################################################
  50:def cmd_165(cmd=nil)
  51:@returnParamArray.clear
  52:SendMultiZoneCommand(cmd, ["07AC1", "07ACD", "07AFC"])
  53:return @returnParamArray
  54:end
  55:#### 166 ####################################################################
  56:def cmd_166(cmd=nil)
  57:@returnParamArray.clear
  58:SendIrCommand("07A16")
  59:return @returnParamArray
  60:end
  61:#### 174 ####################################################################
  62:def cmd_174(cmd=nil)
  63:@returnParamArray.clear
  64:SendIrCommand("07AC9")
  65:return @returnParamArray
  66:end
  67:#### 192 ####################################################################
  68:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
  69:@returnParamArray.clear
  70:SendMyIrCommand("787E")
  71:return @returnParamArray
  72:end
  73:#### 193 ####################################################################
  74:def cmd_193(pk_pipe, cmd=nil)
  75:@returnParamArray.clear
  76:SendMyIrCommand("787F")
  77:return @returnParamArray
  78:end
  79:#### 228 ####################################################################
  80:def cmd_228(cmd=nil)
  81:@returnParamArray.clear
  82:SendIrCommand("27500") # that if Bass Sel is the same as LFE/Bass
  83:return @returnParamArray
  84:end
  85:#### 281 ####################################################################
  86:def cmd_281(cmd=nil)
  87:@returnParamArray.clear
  88:SendIrCommand("07AC0")
  89:return @returnParamArray
  90:end
  91:#### 282 ####################################################################
  92:def cmd_282(cmd=nil)
  93:@returnParamArray.clear
  94:SendIrCommand("07A0F")
  95:return @returnParamArray
  96:end
  97:#### 285 ####################################################################
  98:def cmd_285(cmd=nil)
  99:@returnParamArray.clear
100:SendIrCommand("07A55")
101:return @returnParamArray
102:end
103:#### 313 ####################################################################
104:def cmd_313(level, cmd=nil)
105:@returnParamArray.clear
106:# Set Volume - Date: 2007-02-22 12:41:58
107:
108:SendMultiZoneCommand( cmd, ["230", "", "", ""], sprintf( "%x", level.to_i * 1.73 + 38) )
109:
110:SetDeviceDataInDB( cmd.devidto_, 158, level ) # 158 = DEVICEDATA_Volume_Level_CONST
111:
112:print "volume and corresponding device data set\n"
113:
114:return @returnParamArray
115:end
116:#### 350 ####################################################################
117:def cmd_350(cmd=nil)
118:@returnParamArray.clear
119:ReceiveReportCommand()
120:return @returnParamArray
121:end
122:#### 355 ####################################################################
123:def cmd_355(cmd=nil)
124:@returnParamArray.clear
125:# Initialize --- Date: 21.02.2007
126:$logFile = File.new("/var/log/pluto/yamaha.log", "w")
127:
128:@mute = [false, false, false, false];
129:
130:@input=-1
131:for iRetry in 0...4
132:    print "Initializing unit\n"
133:    conn_.Send("\x11000\x03")
134:    buf = conn_.RecvDelimited("\x03", 2000)
135:    model_id = GetCurrentDeviceData( device_.devid_, 59 ) # 59 = DEVICEDATA_Configuration_CONST
136:    if( !buf.nil? && !buf.index("\x12").nil? )
137:        print "Initialized ok\n"
138:      volume_level = GetCurrentDeviceData( device_.devid_, 207 ) # 59 = DEVICEDATA_Initial_Volume_CONST
139:      if( !volume_level.empty? && volume_level!="ERR Parameter not found" )
140:         print "Setting volume to ", volume_level, "\n"
141:         cmd_313(volume_level)
142:         SetDeviceDataInDB( device_.devid_, 158, volume_level ) # 158 = DEVICEDATA_Volume_Level_CONST
143:      end
144:        return
145:    end
146:    print "Failed to initialize.  Wait 1 secs and try again\n"
147:    sleep(1)
148:end
149:
150:#DisableDevice( device_.devid_, true )
151:print "The device wouldn't respond. Disabling it.\n"
152:
153:return @returnParamArray
154:end
155:#### 361 ####################################################################
156:def cmd_361(cmd=nil)
157:@returnParamArray.clear
158:SendMyIrCommand("784A")
159:return @returnParamArray
160:end
161:#### PRIVATE METHODS ####################################################################
162:# Private - Date: 2007-02-22 17:43
163:def SendMyIrCommand(command)
164:   for i in 0...4
165:      conn_.Send("\x02\x00" + command + "\x03")
166:      reply = ReceiveReportCommand()
167:      if( !reply.nil? && reply.length()>4 )
168:         print "Received good reply: ", reply, "\n"
169:         return
170:      else
171:         buf = conn_.Recv(1000,1000);
172:         print "Flushed buffer: ", buf, "\n"
173:      end
174:   end
175:end
176:
177:def SendIrCommand(command)
178:   for i in 0...4
179:      conn_.Send("\x02" + command + "\x03")
180:      reply = ReceiveReportCommand()
181:      if( !reply.nil? && reply.length()>4 )
182:         print "Received good reply: ", reply, "\n"
183:         return
184:      else
185:         buf = conn_.Recv(1000,1000);
186:         print "Flushed buffer: ", buf, "\n"
187:      end
188:   end
189:end
190:
191:def ReceiveReportCommand()
192:   for i in 0...200
193:      buf = conn_.Recv(1,3000);
194:      if( buf.length()==0 )
195:         return
196:      end # nothing to do
197:      if( buf[0]==0x02 )
198:         buf = conn_.Recv(7,500);
199:         if( buf[6]!=0x03 )
200:            print "Received malformed status: ", buf,"\n"
201:            return ""
202:         end
203:
204:         ProcessReportCommand(buf)
205:         return buf
206:      else
207:         if( buf[0]==0x12 )
208:            ReceiveConfigurationCommand()
209:         else
210:            print "Received unknown character: ", buf[0],"\n"
211:         end
212:      end
213:   end
214:end
215:
216:def ProcessReportCommand(command)
217:   if( command[0,1]=="1" || command[0,1]=="2" )
218:      print "Received command ", command[2,2], "\n"
219:      if( command[2,2]=="20" )
220:         if( command[4,2]=="00" )
221:               cmd = Command.new(device_.devid_, -1001, 1, 2, 48);
222:               cmd.params_[10] = "0";
223:               SendCommand(cmd);
224:         else
225:            if( command[4,2]=="01" )
226:               cmd = Command.new(device_.devid_, -1001, 1, 2, 48);
227:               cmd.params_[10] = "1";
228:               SendCommand(cmd);
229:            end
230:         end
231:      end
232:      if( command[2,2]=="21" )
233:         if( command[5]<65 )
234:                SwitchInput(command[5]-48)
235:         else
236:            SwitchInput(command[5]-55)
237:         end
238:      end
239:   else
240:      if( command[0,4]=="4026" )
241:         volume = (command[4,2].hex - 38) / 1.73
242:         SetDeviceDataInDB( device_.devid_, 158, volume.to_s ) # 158 = DEVICEDATA_Volume_Level_CONST
243:         cmd = Command.new(device_.devid_, -1001, 1, 2, 71);
244:         cmd.params_[30] = volume.to_s
245:         SendCommand(cmd);
246:      else
247:         print "Incoming report command ", command, " doesn't need handling"
248:      end
249:   end
250:end
251:
252:def ReceiveConfigurationCommand()
253:   # This is called only after we already received the 0x12
254:   print "ReceiveConfigurationCommand\n"
255:   header = conn_.Recv(6,100)
256:   slength = conn_.Recv(2,100)
257:   ilength = hextodecimal(slength)
258:   data = conn_.Recv(ilength,100)
259:   term = conn_.Recv(3,100)
260:   if( term[2]!=3 )
261:      print "Data is malformed\n"
262:      return false
263:   end
264:
265:   if( ilength>=10 )
266:      if( data[9]<65 )
267:            SwitchInput(data[9]-48)
268:      else
269:         SwitchInput(data[9]-55)
270:      end
271:   end
272:end
273:
274:def SwitchInput(input)
275:   if( input==@input )
276:      print "Input didn't change from ", input, "\n"
277:      return
278:   end
279:   input_param = 0
280:   @input = input
281:   print "set to input ", input, "\n"
282:   case input
283:#   multi? dvd?
284:      when 0
285:         input_param = 163 # Phono
286:      when 1
287:         input_param = 162 # CD
288:      when 2
289:         input_param = 166 # Tuner
290:      when 3
291:         input_param = 420 # cd-r
292:      when 4
293:         input_param = 174 # md-tape
294:      when 5
295:         input_param = 165 # dvd
296:      when 6
297:         input_param = 161 # dtv
298:      when 7
299:         input_param = 281 # cbl-sat
300:      when 9
301:         input_param = 282 # vcr1
302:      when 10
303:         input_param = 283 # vcr2
304:      when 12
305:         input_param = 285 # vaux
306:   end
307:   
308:   if( input_param==0 )
309:      print "Unknown input ", input, "\n"
310:      return
311:   end
312:
313:   cmd = Command.new(device_.devid_, -1001, 1, 2, 49);
314:   cmd.params_[41] = input_param.to_s()
315:   SendCommand(cmd);
316:end
317:
318:def hextodecimal(slength)
319:   #slength is a 2 digit hex.  don't know the ruby equivalent of scanf
320:   ilength = 0
321:   if( slength[0]<65 ) # it's less than an A
322:      ilength = (slength[0] - 48) * 16
323:   else
324:      ilength = (slength[0] - 55) * 16
325:   end
326:   if( slength[1]<65 ) # it's less than an A
327:      ilength = ilength + slength[1] - 48
328:   else
329:      ilength = ilength + slength[1] - 55
330:   end
331:end
332:
333:def log(word)
334:   $logFile.print( word + "\n" )
335:   $logFile.flush()
336:   print(word + "\n")
337:end
338:
339:def SendMultiZoneCommand(cmd, commandsArray, commandParam="")
340:   zone = GetZone(cmd.devidto_)
341:   if( zone >= 0 and zone < commandsArray.size )
342:      SendIrCommand(commandsArray[zone] + commandParam.to_s)
343:   else
344:      log("SendMultiZoneCommand: invalid zone " + zone.to_s)
345:   end
346:end
347:
348:def GetZone(deviceDestination)
349:   if( device_.mapDevice_PortChannel_.has_key?(deviceDestination) and
350:      device_.mapDevice_PortChannel_[deviceDestination] != nil and
351:      !device_.mapDevice_PortChannel_[deviceDestination].empty? )
352:      return device_.mapDevice_PortChannel_[deviceDestination].to_i
353:   end
354:   
355:      return 0
356:end
357:
358:def ShowZones()
359:   log("####### Dev 2 PortChanel")
360:   device_.mapDevice_PortChannel_.each do |key, value|
361:      log(key.to_s + " => " + value.to_s)
362:   end
363:   
364:   log("======= PortChanel 2 Dev")
365:   device_.mapPortChannel_Device_.each do |key, value|
366:      log(key.to_s + " => " + value.to_s)
367:   end
368:end
369:#### 420 ####################################################################
370:def cmd_420(cmd=nil)
371:@returnParamArray.clear
372:SendIrCommand("07A19")
373:return @returnParamArray
374:end
375:#### 714 ####################################################################
376:def cmd_714(cmd=nil)
377:@returnParamArray.clear
378:SendIrCommand("07A13")
379:return @returnParamArray
380:end
381:#### 767 ####################################################################
382:def cmd_767(cmd=nil)
383:@returnParamArray.clear
384:SendMyIrCommand("78D0")
385:return @returnParamArray
386:end
387:#### 930 ####################################################################
388:def cmd_930(cmd=nil)
389:@returnParamArray.clear
390:SendMyIrCommand("782A")
391:return @returnParamArray
392:end
393:#### 985 ####################################################################
394:def cmd_985(cmd=nil)
395:@returnParamArray.clear
396:SendMyIrCommand("7841")
397:return @returnParamArray
398:end
399:#### START SETTERS ####################################################################
400:def initialize()
401:super
402:@returnParamArray=Array.new
403:end
404:####  END  SETTERS ####################################################################
405:end