Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Device LG RS232 (newer models), # 64
- Device Template LG RS232 (newer models), device category TVs/Plasmas/LCD's/Projectors, manufacturer LG.
- 447 lines, displaying from 0 to 447
- 1
- == ATTEMPT FRESH START ==
- 1 04/06/11 18:04:10 /usr/pluto/bin/Spawn_Device.sh 64 (spawning-device) 29146 Dev: 64; Already Running list: 41,42,44,43,48,45,46,47,49,
- == FRESH START ==
- 1 04/06/11 18:04:10 /usr/pluto/bin/Spawn_Device.sh 64 (spawning-device) device: 64 ip: dcerouter cmd_line: Generic_Serial_Device
- 0 04/06/11 18:04:10 64 (spawning-device) Entering 64
- ========== NEW LOG SECTION ==========
- 1 04/06/11 18:04:10 64 (spawning-device) Starting... 1
- 1 04/06/11 18:04:11 64 (spawning-device) Found /usr/pluto/bin/Generic_Serial_Device
- 05 04/06/11 18:04:11.122 Connection for client socket reported NEED RELOAD IP=192.168.80.2 MAC=00:01:2e:2f:39:5e, device 64 last error 2 <0xb71138d0>
- 05 04/06/11 18:04:11.123 The router must be reloaded before this device is fully functional <0xb71138d0>
- 05 04/06/11 18:04:11.128 void ClientSocket::Disconnect() on this socket: 0xa068d78 (m_Socket: 5) <0xb71138d0>
- 05 04/06/11 18:04:11.146 Connection for client socket reported NEED RELOAD IP=192.168.80.2 MAC=00:01:2e:2f:39:5e, device 64 last error 2 <0xb71138d0>
- 05 04/06/11 18:04:11.148 Running without DeviceData, will try to add device <0xb58cfb90>
- 01 04/06/11 18:04:11.188 GSD Port is not specified. Instantiating non-IO Wrapper. <0xb58cfb90>
- RCODE:
- 0:require 'Ruby_Generic_Serial_Device'
- 1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
- 2:end
- 3:class Device_64 < Ruby_Generic_Serial_Device::RubySerialWrapper
- 4:#### 63 ####################################################################
- 5:def cmd_63(streamid, cmd=nil)
- 6:@returnParamArray.clear
- 7:SendKey("8E")
- 8:return @returnParamArray
- 9:end
- 10:#### 64 ####################################################################
- 11:def cmd_64(streamid, cmd=nil)
- 12:@returnParamArray.clear
- 13:SendKey("8F")
- 14:return @returnParamArray
- 15:end
- 16:#### 86 ####################################################################
- 17:def cmd_86(cmd=nil)
- 18:@returnParamArray.clear
- 19:SendKey("43")
- 20:return @returnParamArray
- 21:end
- 22:#### 89 ####################################################################
- 23:def cmd_89(repeat_command, cmd=nil)
- 24:@returnParamArray.clear
- 25:SetVolume("up")
- 26:return @returnParamArray
- 27:end
- 28:#### 90 ####################################################################
- 29:def cmd_90(repeat_command, cmd=nil)
- 30:@returnParamArray.clear
- 31:SetVolume("down")
- 32:return @returnParamArray
- 33:end
- 34:#### 92 ####################################################################
- 35:def cmd_92(streamid, cmd=nil)
- 36:@returnParamArray.clear
- 37:SendKey("BA")
- 38:return @returnParamArray
- 39:end
- 40:#### 95 ####################################################################
- 41:def cmd_95(streamid, eject, cmd=nil)
- 42:@returnParamArray.clear
- 43:SendKey("B1")
- 44:return @returnParamArray
- 45:end
- 46:#### 97 ####################################################################
- 47:def cmd_97(cmd=nil)
- 48:@returnParamArray.clear
- 49:if(@mute)
- 50: Command("ke","00")
- 51:else
- 52: Command("ke","01")
- 53:end
- 54:@mute=!@mute
- 55:return @returnParamArray
- 56:end
- 57:#### 136 ####################################################################
- 58:def cmd_136(cmd=nil)
- 59:@returnParamArray.clear
- 60:SendKey("1A")
- 61:return @returnParamArray
- 62:end
- 63:#### 139 ####################################################################
- 64:def cmd_139(streamid, cmd=nil)
- 65:@returnParamArray.clear
- 66:SendKey("B0")
- 67:return @returnParamArray
- 68:end
- 69:#### 154 ####################################################################
- 70:def cmd_154(cmd=nil)
- 71:@returnParamArray.clear
- 72:Command("xb","60")
- 73:return @returnParamArray
- 74:end
- 75:#### 166 ####################################################################
- 76:def cmd_166(cmd=nil)
- 77:@returnParamArray.clear
- 78:EmbeddedTuner("10")
- 79:return @returnParamArray
- 80:end
- 81:#### 192 ####################################################################
- 82:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
- 83:@returnParamArray.clear
- 84:Command("ka","01",5)
- 85:SetVolume(@volume)
- 86:return @returnParamArray
- 87:end
- 88:#### 193 ####################################################################
- 89:def cmd_193(pk_pipe, cmd=nil)
- 90:@returnParamArray.clear
- 91:SendCommand("ka","00",1)
- 92:return @returnParamArray
- 93:end
- 94:#### 200 ####################################################################
- 95:def cmd_200(streamid, cmd=nil)
- 96:@returnParamArray.clear
- 97:SendKey("40")
- 98:return @returnParamArray
- 99:end
- 100:#### 201 ####################################################################
- 101:def cmd_201(streamid, cmd=nil)
- 102:@returnParamArray.clear
- 103:SendKey("41")
- 104:return @returnParamArray
- 105:end
- 106:#### 202 ####################################################################
- 107:def cmd_202(streamid, cmd=nil)
- 108:@returnParamArray.clear
- 109:SendKey("07")
- 110:return @returnParamArray
- 111:end
- 112:#### 203 ####################################################################
- 113:def cmd_203(streamid, cmd=nil)
- 114:@returnParamArray.clear
- 115:SendKey("06")
- 116:return @returnParamArray
- 117:end
- 118:#### 204 ####################################################################
- 119:def cmd_204(cmd=nil)
- 120:@returnParamArray.clear
- 121:SendKey("10")
- 122:return @returnParamArray
- 123:end
- 124:#### 205 ####################################################################
- 125:def cmd_205(cmd=nil)
- 126:@returnParamArray.clear
- 127:SendKey("11")
- 128:return @returnParamArray
- 129:end
- 130:#### 206 ####################################################################
- 131:def cmd_206(cmd=nil)
- 132:@returnParamArray.clear
- 133:SendKey("12")
- 134:return @returnParamArray
- 135:end
- 136:#### 207 ####################################################################
- 137:def cmd_207(cmd=nil)
- 138:@returnParamArray.clear
- 139:SendKey("13")
- 140:return @returnParamArray
- 141:end
- 142:#### 208 ####################################################################
- 143:def cmd_208(cmd=nil)
- 144:@returnParamArray.clear
- 145:SendKey("14")
- 146:return @returnParamArray
- 147:end
- 148:#### 209 ####################################################################
- 149:def cmd_209(cmd=nil)
- 150:@returnParamArray.clear
- 151:SendKey("15")
- 152:return @returnParamArray
- 153:end
- 154:#### 210 ####################################################################
- 155:def cmd_210(cmd=nil)
- 156:@returnParamArray.clear
- 157:SendKey("16")
- 158:return @returnParamArray
- 159:end
- 160:#### 211 ####################################################################
- 161:def cmd_211(cmd=nil)
- 162:@returnParamArray.clear
- 163:SendKey("17")
- 164:return @returnParamArray
- 165:end
- 166:#### 212 ####################################################################
- 167:def cmd_212(cmd=nil)
- 168:@returnParamArray.clear
- 169:SendKey("18")
- 170:return @returnParamArray
- 171:end
- 172:#### 213 ####################################################################
- 173:def cmd_213(cmd=nil)
- 174:@returnParamArray.clear
- 175:SendKey("19")
- 176:return @returnParamArray
- 177:end
- 178:#### 240 ####################################################################
- 179:def cmd_240(streamid, cmd=nil)
- 180:@returnParamArray.clear
- 181:SendKey("28")
- 182:return @returnParamArray
- 183:end
- 184:#### 313 ####################################################################
- 185:def cmd_313(level, cmd=nil)
- 186:@returnParamArray.clear
- 187:@volume=level.to_i()
- 188:SetVolume(@volume)
- 189:return @returnParamArray
- 190:end
- 191:#### 316 ####################################################################
- 192:def cmd_316(cmd=nil)
- 193:@returnParamArray.clear
- 194:Command("xb","20")
- 195:return @returnParamArray
- 196:end
- 197:#### 317 ####################################################################
- 198:def cmd_317(cmd=nil)
- 199:@returnParamArray.clear
- 200:Command("xb","21")
- 201:return @returnParamArray
- 202:end
- 203:#### 355 ####################################################################
- 204:def cmd_355(cmd=nil)
- 205:@returnParamArray.clear
- 206:# Initialize --- Date: 28.02.2008
- 207:# all responses should be terminated by 'x'.
- 208:# some sets won't respond to ka 01 ff when the tv is off. others do.
- 209:@mute = false;
- 210:# read in our device data now since it will never change
- 211:@SetID = device_.devdata_[1] # Get the "Set ID" from device data
- 212:@volume = device_.devdata_[208] # 208 = DEVICEDATA_Initial_Volume_CONST
- 213:@TunerType = device_.devdata_[230] # 230 = DEVICEDATA_Source_CONST
- 214:
- 215:result = InitVolume()
- 216:if (result == true)
- 217: return
- 218:end
- 219:
- 220:DisableDevice( device_.devid_, true )
- 221:log "The device wouldn't respond. Disabling it.\n"
- 222:return @returnParamArray
- 223:end
- 224:#### 364 ####################################################################
- 225:def cmd_364(cmd=nil)
- 226:@returnParamArray.clear
- 227:SendKey("4C")
- 228:return @returnParamArray
- 229:end
- 230:#### PRIVATE METHODS ####################################################################
- 231:def log(line)
- 232: $log = File.open("/var/log/pluto/" + device_.devid_.to_s + "_Generic_Serial_Device.log", "a")
- 233: $log.puts "(***):" + line.to_s
- 234: $log.close
- 235:end
- 236:
- 237:def SendKey(key)
- 238: SendCommand("mc",key,1)
- 239:end
- 240:
- 241:def Command(command,data,*extraargs)
- 242: out = SendCommand(command,"ff",1)
- 243: # only actually send the command if the device isn't already in that mode/setting
- 244: if (out[0] == true && out[1] != data)
- 245: if (extraargs[0] == nil)
- 246: timeout = 1
- 247: else
- 248: timeout = extraargs[0]
- 249: end
- 250: out = SendCommand(command,data,timeout)
- 251: end
- 252: return out
- 253:end
- 254:
- 255:def SendCommand(command,data,timeout)
- 256: $cmd = [command,@SetID,data].join(" ")
- 257: conn_.Send($cmd + "\r")
- 258: # wait up to 8 seconds since it may be very slow if this is an 'on' command
- 259: buf = conn_.RecvDelimited("x", timeout * 1000)
- 260: if( !buf.nil? && (!buf.index("01 OK").nil? || !buf.index("01 NG").nil?))
- 261: #print "Received good reply in less than ", timeout, "ms: ", buf, "\n"
- 262: if (buf.index("OK"))
- 263: data = buf[buf.index("OK") + 2, 2]
- 264: result = true
- 265: else
- 266: result = false
- 267: end
- 268: return [result, data]
- 269: else
- 270: buf = conn_.Recv(1000,1000);
- 271: #print "Flushed buffer: ", buf, "invalid response in ", timeout, "seconds\n"
- 272: return [false]
- 273: end
- 274:end
- 275:
- 276:def EmbeddedTuner(data)
- 277: # select the embedded tuner. use device data to determine cable vs antenna
- 278: # add 1 for cable
- 279: data = data.to_i()
- 280: if (@TunerType != nil)
- 281: data += @TunerType.to_i()
- 282: end
- 283: Command("xb","%02d" % data)
- 284:end
- 285:
- 286:def SetVolume(level)
- 287: #if (!level.is_a? Integer)
- 288: if (@volume == nil || (!@volume.is_a? Integer))
- 289: InitVolume()
- 290: end
- 291:
- 292: if (level == "up")
- 293: @volume += 1
- 294: elsif (level == "down")
- 295: @volume -= 1
- 296: else
- 297: @volume = level.to_i()
- 298: end
- 299: # set the volume
- 300: Command("kf","" + "%02X" % @volume)
- 301:end
- 302:
- 303:def InitVolume()
- 304: # need to check if we know the volume before setting it. if we dont, get it
- 305: # check if we already have it in memory first
- 306: if (@volume == nil || (!@volume.is_a? Integer))
- 307: # no volume info in the db, get it from the tv
- 308: #check if tv is on
- 309: unless (SendCommand("ka","ff",1))
- 310: # turn the tv on
- 311: SendCommand("ka","01",3)
- 312: tvon = true # so we can turn it off later
- 313: end
- 314: # ask for the volume
- 315: result = SendCommand("kf","ff",1)
- 316: if (result[1] != nil)
- 317: @volume = result[1].to_i(16) # TV uses hex values
- 318: if (tvon == true)
- 319: # be nice and turn the TV off now that we are done with it, if it was off to begin with
- 320: SendCommand("ka","00",1)
- 321: end
- 322: log "returning true"
- 323: return true
- 324: else
- 325: # could not get volume, use a sane default and let the init function know that we could not turn the tv on
- 326: @volume = 10
- 327: return false
- 328: end
- 329:
- 330: else
- 331: return true
- 332: end
- 333:end
- 334:#### 548 ####################################################################
- 335:def cmd_548(text, streamid, cmd=nil)
- 336:@returnParamArray.clear
- 337:SendKey("43")
- 338:return @returnParamArray
- 339:end
- 340:#### 712 ####################################################################
- 341:def cmd_712(cmd=nil)
- 342:@returnParamArray.clear
- 343:Command("xb","40")
- 344:return @returnParamArray
- 345:end
- 346:#### 713 ####################################################################
- 347:def cmd_713(cmd=nil)
- 348:@returnParamArray.clear
- 349:Command("xb"," 41")
- 350:return @returnParamArray
- 351:end
- 352:#### 763 ####################################################################
- 353:def cmd_763(cmd=nil)
- 354:@returnParamArray.clear
- 355:SendKey("5B")
- 356:return @returnParamArray
- 357:end
- 358:#### 767 ####################################################################
- 359:def cmd_767(cmd=nil)
- 360:@returnParamArray.clear
- 361:Command("xb","91")
- 362:return @returnParamArray
- 363:end
- 364:#### 873 ####################################################################
- 365:def cmd_873(cmd=nil)
- 366:@returnParamArray.clear
- 367:EmbeddedTuner("00")
- 368:return @returnParamArray
- 369:end
- 370:#### 930 ####################################################################
- 371:def cmd_930(cmd=nil)
- 372:@returnParamArray.clear
- 373:Command("xb","92")
- 374:return @returnParamArray
- 375:end
- 376:#### 937 ####################################################################
- 377:def cmd_937(cmd=nil)
- 378:@returnParamArray.clear
- 379:SendKey("AA")
- 380:return @returnParamArray
- 381:end
- 382:#### 964 ####################################################################
- 383:def cmd_964(cmd=nil)
- 384:@returnParamArray.clear
- 385:SendKey("00")
- 386:return @returnParamArray
- 387:end
- 388:#### 965 ####################################################################
- 389:def cmd_965(cmd=nil)
- 390:@returnParamArray.clear
- 391:SendKey("01")
- 392:return @returnParamArray
- 393:end
- 394:#### 984 ####################################################################
- 395:def cmd_984(cmd=nil)
- 396:@returnParamArray.clear
- 397:Command("xb","90")
- 398:return @returnParamArray
- 399:end
- 400:#### 985 ####################################################################
- 401:def cmd_985(cmd=nil)
- 402:@returnParamArray.clear
- 403:Command("xb","93")
- 404:return @returnParamArray
- 405:end
- 406:#### 1086 ####################################################################
- 407:def cmd_1086(cmd=nil)
- 408:@returnParamArray.clear
- 409:Command("xb","42")
- 410:return @returnParamArray
- 411:end
- 412:#### START SETTERS ####################################################################
- 413:def initialize()
- 414:super
- 415:@returnParamArray=Array.new
- 416:end
- 417:#### END SETTERS ####################################################################
- 418:end
- 420:01 04/06/11 18:04:11.527 Error while calling method: Cannot call class method: cmd_355
- error: undefined local variable or method `conn_' for #, line: 257
- backtrace:
- in: (eval): 257
- from (eval):257:in `SendCommand'
- from (eval):309:in `InitVolume'
- from (eval):215:in `cmd_355'
- <0xb50ceb90>
- 05 04/06/11 18:05:08.092 Got a reload command from 0 <0xb58cfb90>
- 05 04/06/11 18:05:08.377 void ClientSocket::Disconnect() on this socket: 0xa063e70 (m_Socket: 8) <0xb71138d0>
- Return code: 2
- 2 04/06/11 18:05:08 64 (spawning-device) Device requests restart... count=1/50 dev=64
- 2 04/06/11 18:05:08 64 (spawning-device) Device was disabled or removed. Stopping and marking as not running.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement