Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.93 KB | None | 0 0
  1. Complete log
  2. Device LG RS232 (newer models), # 64
  3. Device Template LG RS232 (newer models), device category TVs/Plasmas/LCD's/Projectors, manufacturer LG.
  4.  
  5. 883 lines, displaying from 0 to 883
  6. 1
  7.  
  8. == ATTEMPT FRESH START ==
  9. 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,
  10. == FRESH START ==
  11. 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
  12. 0 04/06/11 18:04:10 64 (spawning-device) Entering 64
  13. ========== NEW LOG SECTION ==========
  14. 1 04/06/11 18:04:10 64 (spawning-device) Starting... 1
  15. 1 04/06/11 18:04:11 64 (spawning-device) Found /usr/pluto/bin/Generic_Serial_Device
  16. 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>
  17. 05 04/06/11 18:04:11.123 The router must be reloaded before this device is fully functional <0xb71138d0>
  18. 05 04/06/11 18:04:11.128 void ClientSocket::Disconnect() on this socket: 0xa068d78 (m_Socket: 5) <0xb71138d0>
  19. 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>
  20. 05 04/06/11 18:04:11.148 Running without DeviceData, will try to add device <0xb58cfb90>
  21. 01 04/06/11 18:04:11.188 GSD Port is not specified. Instantiating non-IO Wrapper. <0xb58cfb90>
  22. RCODE:
  23. 0:require 'Ruby_Generic_Serial_Device'
  24. 1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
  25. 2:end
  26. 3:class Device_64 < Ruby_Generic_Serial_Device::RubySerialWrapper
  27. 4:#### 63 ####################################################################
  28. 5:def cmd_63(streamid, cmd=nil)
  29. 6:@returnParamArray.clear
  30. 7:SendKey("8E")
  31. 8:return @returnParamArray
  32. 9:end
  33. 10:#### 64 ####################################################################
  34. 11:def cmd_64(streamid, cmd=nil)
  35. 12:@returnParamArray.clear
  36. 13:SendKey("8F")
  37. 14:return @returnParamArray
  38. 15:end
  39. 16:#### 86 ####################################################################
  40. 17:def cmd_86(cmd=nil)
  41. 18:@returnParamArray.clear
  42. 19:SendKey("43")
  43. 20:return @returnParamArray
  44. 21:end
  45. 22:#### 89 ####################################################################
  46. 23:def cmd_89(repeat_command, cmd=nil)
  47. 24:@returnParamArray.clear
  48. 25:SetVolume("up")
  49. 26:return @returnParamArray
  50. 27:end
  51. 28:#### 90 ####################################################################
  52. 29:def cmd_90(repeat_command, cmd=nil)
  53. 30:@returnParamArray.clear
  54. 31:SetVolume("down")
  55. 32:return @returnParamArray
  56. 33:end
  57. 34:#### 92 ####################################################################
  58. 35:def cmd_92(streamid, cmd=nil)
  59. 36:@returnParamArray.clear
  60. 37:SendKey("BA")
  61. 38:return @returnParamArray
  62. 39:end
  63. 40:#### 95 ####################################################################
  64. 41:def cmd_95(streamid, eject, cmd=nil)
  65. 42:@returnParamArray.clear
  66. 43:SendKey("B1")
  67. 44:return @returnParamArray
  68. 45:end
  69. 46:#### 97 ####################################################################
  70. 47:def cmd_97(cmd=nil)
  71. 48:@returnParamArray.clear
  72. 49:if(@mute)
  73. 50: Command("ke","00")
  74. 51:else
  75. 52: Command("ke","01")
  76. 53:end
  77. 54:@mute=!@mute
  78. 55:return @returnParamArray
  79. 56:end
  80. 57:#### 136 ####################################################################
  81. 58:def cmd_136(cmd=nil)
  82. 59:@returnParamArray.clear
  83. 60:SendKey("1A")
  84. 61:return @returnParamArray
  85. 62:end
  86. 63:#### 139 ####################################################################
  87. 64:def cmd_139(streamid, cmd=nil)
  88. 65:@returnParamArray.clear
  89. 66:SendKey("B0")
  90. 67:return @returnParamArray
  91. 68:end
  92. 69:#### 154 ####################################################################
  93. 70:def cmd_154(cmd=nil)
  94. 71:@returnParamArray.clear
  95. 72:Command("xb","60")
  96. 73:return @returnParamArray
  97. 74:end
  98. 75:#### 166 ####################################################################
  99. 76:def cmd_166(cmd=nil)
  100. 77:@returnParamArray.clear
  101. 78:EmbeddedTuner("10")
  102. 79:return @returnParamArray
  103. 80:end
  104. 81:#### 192 ####################################################################
  105. 82:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
  106. 83:@returnParamArray.clear
  107. 84:Command("ka","01",5)
  108. 85:SetVolume(@volume)
  109. 86:return @returnParamArray
  110. 87:end
  111. 88:#### 193 ####################################################################
  112. 89:def cmd_193(pk_pipe, cmd=nil)
  113. 90:@returnParamArray.clear
  114. 91:SendCommand("ka","00",1)
  115. 92:return @returnParamArray
  116. 93:end
  117. 94:#### 200 ####################################################################
  118. 95:def cmd_200(streamid, cmd=nil)
  119. 96:@returnParamArray.clear
  120. 97:SendKey("40")
  121. 98:return @returnParamArray
  122. 99:end
  123. 100:#### 201 ####################################################################
  124. 101:def cmd_201(streamid, cmd=nil)
  125. 102:@returnParamArray.clear
  126. 103:SendKey("41")
  127. 104:return @returnParamArray
  128. 105:end
  129. 106:#### 202 ####################################################################
  130. 107:def cmd_202(streamid, cmd=nil)
  131. 108:@returnParamArray.clear
  132. 109:SendKey("07")
  133. 110:return @returnParamArray
  134. 111:end
  135. 112:#### 203 ####################################################################
  136. 113:def cmd_203(streamid, cmd=nil)
  137. 114:@returnParamArray.clear
  138. 115:SendKey("06")
  139. 116:return @returnParamArray
  140. 117:end
  141. 118:#### 204 ####################################################################
  142. 119:def cmd_204(cmd=nil)
  143. 120:@returnParamArray.clear
  144. 121:SendKey("10")
  145. 122:return @returnParamArray
  146. 123:end
  147. 124:#### 205 ####################################################################
  148. 125:def cmd_205(cmd=nil)
  149. 126:@returnParamArray.clear
  150. 127:SendKey("11")
  151. 128:return @returnParamArray
  152. 129:end
  153. 130:#### 206 ####################################################################
  154. 131:def cmd_206(cmd=nil)
  155. 132:@returnParamArray.clear
  156. 133:SendKey("12")
  157. 134:return @returnParamArray
  158. 135:end
  159. 136:#### 207 ####################################################################
  160. 137:def cmd_207(cmd=nil)
  161. 138:@returnParamArray.clear
  162. 139:SendKey("13")
  163. 140:return @returnParamArray
  164. 141:end
  165. 142:#### 208 ####################################################################
  166. 143:def cmd_208(cmd=nil)
  167. 144:@returnParamArray.clear
  168. 145:SendKey("14")
  169. 146:return @returnParamArray
  170. 147:end
  171. 148:#### 209 ####################################################################
  172. 149:def cmd_209(cmd=nil)
  173. 150:@returnParamArray.clear
  174. 151:SendKey("15")
  175. 152:return @returnParamArray
  176. 153:end
  177. 154:#### 210 ####################################################################
  178. 155:def cmd_210(cmd=nil)
  179. 156:@returnParamArray.clear
  180. 157:SendKey("16")
  181. 158:return @returnParamArray
  182. 159:end
  183. 160:#### 211 ####################################################################
  184. 161:def cmd_211(cmd=nil)
  185. 162:@returnParamArray.clear
  186. 163:SendKey("17")
  187. 164:return @returnParamArray
  188. 165:end
  189. 166:#### 212 ####################################################################
  190. 167:def cmd_212(cmd=nil)
  191. 168:@returnParamArray.clear
  192. 169:SendKey("18")
  193. 170:return @returnParamArray
  194. 171:end
  195. 172:#### 213 ####################################################################
  196. 173:def cmd_213(cmd=nil)
  197. 174:@returnParamArray.clear
  198. 175:SendKey("19")
  199. 176:return @returnParamArray
  200. 177:end
  201. 178:#### 240 ####################################################################
  202. 179:def cmd_240(streamid, cmd=nil)
  203. 180:@returnParamArray.clear
  204. 181:SendKey("28")
  205. 182:return @returnParamArray
  206. 183:end
  207. 184:#### 313 ####################################################################
  208. 185:def cmd_313(level, cmd=nil)
  209. 186:@returnParamArray.clear
  210. 187:@volume=level.to_i()
  211. 188:SetVolume(@volume)
  212. 189:return @returnParamArray
  213. 190:end
  214. 191:#### 316 ####################################################################
  215. 192:def cmd_316(cmd=nil)
  216. 193:@returnParamArray.clear
  217. 194:Command("xb","20")
  218. 195:return @returnParamArray
  219. 196:end
  220. 197:#### 317 ####################################################################
  221. 198:def cmd_317(cmd=nil)
  222. 199:@returnParamArray.clear
  223. 200:Command("xb","21")
  224. 201:return @returnParamArray
  225. 202:end
  226. 203:#### 355 ####################################################################
  227. 204:def cmd_355(cmd=nil)
  228. 205:@returnParamArray.clear
  229. 206:# Initialize --- Date: 28.02.2008
  230. 207:# all responses should be terminated by 'x'.
  231. 208:# some sets won't respond to ka 01 ff when the tv is off. others do.
  232. 209:@mute = false;
  233. 210:# read in our device data now since it will never change
  234. 211:@SetID = device_.devdata_[1] # Get the "Set ID" from device data
  235. 212:@volume = device_.devdata_[208] # 208 = DEVICEDATA_Initial_Volume_CONST
  236. 213:@TunerType = device_.devdata_[230] # 230 = DEVICEDATA_Source_CONST
  237. 214:
  238. 215:result = InitVolume()
  239. 216:if (result == true)
  240. 217: return
  241. 218:end
  242. 219:
  243. 220:DisableDevice( device_.devid_, true )
  244. 221:log "The device wouldn't respond. Disabling it.\n"
  245. 222:return @returnParamArray
  246. 223:end
  247. 224:#### 364 ####################################################################
  248. 225:def cmd_364(cmd=nil)
  249. 226:@returnParamArray.clear
  250. 227:SendKey("4C")
  251. 228:return @returnParamArray
  252. 229:end
  253. 230:#### PRIVATE METHODS ####################################################################
  254. 231:def log(line)
  255. 232: $log = File.open("/var/log/pluto/" + device_.devid_.to_s + "_Generic_Serial_Device.log", "a")
  256. 233: $log.puts "(***):" + line.to_s
  257. 234: $log.close
  258. 235:end
  259. 236:
  260. 237:def SendKey(key)
  261. 238: SendCommand("mc",key,1)
  262. 239:end
  263. 240:
  264. 241:def Command(command,data,*extraargs)
  265. 242: out = SendCommand(command,"ff",1)
  266. 243: # only actually send the command if the device isn't already in that mode/setting
  267. 244: if (out[0] == true && out[1] != data)
  268. 245: if (extraargs[0] == nil)
  269. 246: timeout = 1
  270. 247: else
  271. 248: timeout = extraargs[0]
  272. 249: end
  273. 250: out = SendCommand(command,data,timeout)
  274. 251: end
  275. 252: return out
  276. 253:end
  277. 254:
  278. 255:def SendCommand(command,data,timeout)
  279. 256: $cmd = [command,@SetID,data].join(" ")
  280. 257: conn_.Send($cmd + "\r")
  281. 258: # wait up to 8 seconds since it may be very slow if this is an 'on' command
  282. 259: buf = conn_.RecvDelimited("x", timeout * 1000)
  283. 260: if( !buf.nil? && (!buf.index("01 OK").nil? || !buf.index("01 NG").nil?))
  284. 261: #print "Received good reply in less than ", timeout, "ms: ", buf, "\n"
  285. 262: if (buf.index("OK"))
  286. 263: data = buf[buf.index("OK") + 2, 2]
  287. 264: result = true
  288. 265: else
  289. 266: result = false
  290. 267: end
  291. 268: return [result, data]
  292. 269: else
  293. 270: buf = conn_.Recv(1000,1000);
  294. 271: #print "Flushed buffer: ", buf, "invalid response in ", timeout, "seconds\n"
  295. 272: return [false]
  296. 273: end
  297. 274:end
  298. 275:
  299. 276:def EmbeddedTuner(data)
  300. 277: # select the embedded tuner. use device data to determine cable vs antenna
  301. 278: # add 1 for cable
  302. 279: data = data.to_i()
  303. 280: if (@TunerType != nil)
  304. 281: data += @TunerType.to_i()
  305. 282: end
  306. 283: Command("xb","%02d" % data)
  307. 284:end
  308. 285:
  309. 286:def SetVolume(level)
  310. 287: #if (!level.is_a? Integer)
  311. 288: if (@volume == nil || (!@volume.is_a? Integer))
  312. 289: InitVolume()
  313. 290: end
  314. 291:
  315. 292: if (level == "up")
  316. 293: @volume += 1
  317. 294: elsif (level == "down")
  318. 295: @volume -= 1
  319. 296: else
  320. 297: @volume = level.to_i()
  321. 298: end
  322. 299: # set the volume
  323. 300: Command("kf","" + "%02X" % @volume)
  324. 301:end
  325. 302:
  326. 303:def InitVolume()
  327. 304: # need to check if we know the volume before setting it. if we dont, get it
  328. 305: # check if we already have it in memory first
  329. 306: if (@volume == nil || (!@volume.is_a? Integer))
  330. 307: # no volume info in the db, get it from the tv
  331. 308: #check if tv is on
  332. 309: unless (SendCommand("ka","ff",1))
  333. 310: # turn the tv on
  334. 311: SendCommand("ka","01",3)
  335. 312: tvon = true # so we can turn it off later
  336. 313: end
  337. 314: # ask for the volume
  338. 315: result = SendCommand("kf","ff",1)
  339. 316: if (result[1] != nil)
  340. 317: @volume = result[1].to_i(16) # TV uses hex values
  341. 318: if (tvon == true)
  342. 319: # be nice and turn the TV off now that we are done with it, if it was off to begin with
  343. 320: SendCommand("ka","00",1)
  344. 321: end
  345. 322: log "returning true"
  346. 323: return true
  347. 324: else
  348. 325: # could not get volume, use a sane default and let the init function know that we could not turn the tv on
  349. 326: @volume = 10
  350. 327: return false
  351. 328: end
  352. 329:
  353. 330: else
  354. 331: return true
  355. 332: end
  356. 333:end
  357. 334:#### 548 ####################################################################
  358. 335:def cmd_548(text, streamid, cmd=nil)
  359. 336:@returnParamArray.clear
  360. 337:SendKey("43")
  361. 338:return @returnParamArray
  362. 339:end
  363. 340:#### 712 ####################################################################
  364. 341:def cmd_712(cmd=nil)
  365. 342:@returnParamArray.clear
  366. 343:Command("xb","40")
  367. 344:return @returnParamArray
  368. 345:end
  369. 346:#### 713 ####################################################################
  370. 347:def cmd_713(cmd=nil)
  371. 348:@returnParamArray.clear
  372. 349:Command("xb"," 41")
  373. 350:return @returnParamArray
  374. 351:end
  375. 352:#### 763 ####################################################################
  376. 353:def cmd_763(cmd=nil)
  377. 354:@returnParamArray.clear
  378. 355:SendKey("5B")
  379. 356:return @returnParamArray
  380. 357:end
  381. 358:#### 767 ####################################################################
  382. 359:def cmd_767(cmd=nil)
  383. 360:@returnParamArray.clear
  384. 361:Command("xb","91")
  385. 362:return @returnParamArray
  386. 363:end
  387. 364:#### 873 ####################################################################
  388. 365:def cmd_873(cmd=nil)
  389. 366:@returnParamArray.clear
  390. 367:EmbeddedTuner("00")
  391. 368:return @returnParamArray
  392. 369:end
  393. 370:#### 930 ####################################################################
  394. 371:def cmd_930(cmd=nil)
  395. 372:@returnParamArray.clear
  396. 373:Command("xb","92")
  397. 374:return @returnParamArray
  398. 375:end
  399. 376:#### 937 ####################################################################
  400. 377:def cmd_937(cmd=nil)
  401. 378:@returnParamArray.clear
  402. 379:SendKey("AA")
  403. 380:return @returnParamArray
  404. 381:end
  405. 382:#### 964 ####################################################################
  406. 383:def cmd_964(cmd=nil)
  407. 384:@returnParamArray.clear
  408. 385:SendKey("00")
  409. 386:return @returnParamArray
  410. 387:end
  411. 388:#### 965 ####################################################################
  412. 389:def cmd_965(cmd=nil)
  413. 390:@returnParamArray.clear
  414. 391:SendKey("01")
  415. 392:return @returnParamArray
  416. 393:end
  417. 394:#### 984 ####################################################################
  418. 395:def cmd_984(cmd=nil)
  419. 396:@returnParamArray.clear
  420. 397:Command("xb","90")
  421. 398:return @returnParamArray
  422. 399:end
  423. 400:#### 985 ####################################################################
  424. 401:def cmd_985(cmd=nil)
  425. 402:@returnParamArray.clear
  426. 403:Command("xb","93")
  427. 404:return @returnParamArray
  428. 405:end
  429. 406:#### 1086 ####################################################################
  430. 407:def cmd_1086(cmd=nil)
  431. 408:@returnParamArray.clear
  432. 409:Command("xb","42")
  433. 410:return @returnParamArray
  434. 411:end
  435. 412:#### START SETTERS ####################################################################
  436. 413:def initialize()
  437. 414:super
  438. 415:@returnParamArray=Array.new
  439. 416:end
  440. 417:#### END SETTERS ####################################################################
  441. 418:end
  442. 420:01 04/06/11 18:04:11.527 Error while calling method: Cannot call class method: cmd_355
  443. error: undefined local variable or method `conn_' for #, line: 257
  444. backtrace:
  445. in: (eval): 257
  446. from (eval):257:in `SendCommand'
  447. from (eval):309:in `InitVolume'
  448. from (eval):215:in `cmd_355'
  449. <0xb50ceb90>
  450. 05 04/06/11 18:05:08.092 Got a reload command from 0 <0xb58cfb90>
  451. 05 04/06/11 18:05:08.377 void ClientSocket::Disconnect() on this socket: 0xa063e70 (m_Socket: 8) <0xb71138d0>
  452. Return code: 2
  453. 2 04/06/11 18:05:08 64 (spawning-device) Device requests restart... count=1/50 dev=64
  454. 2 04/06/11 18:05:08 64 (spawning-device) Device was disabled or removed. Stopping and marking as not running.
  455. == ATTEMPT FRESH START ==
  456. 1 04/06/11 19:08:39 /usr/pluto/bin/Spawn_Device.sh 64 (spawning-device) 22869 Dev: 64; Already Running list: 41,42,44,43,49,45,47,46,48,
  457. == FRESH START ==
  458. 1 04/06/11 19:08:39 /usr/pluto/bin/Spawn_Device.sh 64 (spawning-device) device: 64 ip: dcerouter cmd_line: Generic_Serial_Device
  459. 0 04/06/11 19:08:39 64 (spawning-device) Entering 64
  460. ========== NEW LOG SECTION ==========
  461. 1 04/06/11 19:08:40 64 (spawning-device) Starting... 1
  462. 1 04/06/11 19:08:40 64 (spawning-device) Found /usr/pluto/bin/Generic_Serial_Device
  463. 05 04/06/11 19:08:40.310 Creating child 65 <0xb70378d0>
  464. 05 04/06/11 19:08:40.311 Note: Device manager has attached a device of type 2125 that this has no custom event handler for. It will not fire events. <0xb70378d0>
  465. 05 04/06/11 19:08:40.311 Note: Device manager has attached a device of type 2125 that this has no custom handler for. This is normal for IR. <0xb70378d0>
  466. 05 04/06/11 19:08:40.311 Creating child 66 <0xb70378d0>
  467. 05 04/06/11 19:08:40.311 Note: Device manager has attached a device of type 2166 that this has no custom event handler for. It will not fire events. <0xb70378d0>
  468. 05 04/06/11 19:08:40.311 Note: Device manager has attached a device of type 2166 that this has no custom handler for. This is normal for IR. <0xb70378d0>
  469. 01 04/06/11 19:08:41.102 TranslateSerialUSB pci0000:00/0000:00:06.0+1 result /dev/ttyUSB0 <0xb55ffb90>
  470. RCODE:
  471. 0:require 'Ruby_Generic_Serial_Device'
  472. 1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
  473. 2:end
  474. 3:class Device_64 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
  475. 4:#### 63 ####################################################################
  476. 5:def cmd_63(streamid, cmd=nil)
  477. 6:@returnParamArray.clear
  478. 7:SendKey("8E")
  479. 8:return @returnParamArray
  480. 9:end
  481. 10:#### 64 ####################################################################
  482. 11:def cmd_64(streamid, cmd=nil)
  483. 12:@returnParamArray.clear
  484. 13:SendKey("8F")
  485. 14:return @returnParamArray
  486. 15:end
  487. 16:#### 86 ####################################################################
  488. 17:def cmd_86(cmd=nil)
  489. 18:@returnParamArray.clear
  490. 19:SendKey("43")
  491. 20:return @returnParamArray
  492. 21:end
  493. 22:#### 89 ####################################################################
  494. 23:def cmd_89(repeat_command, cmd=nil)
  495. 24:@returnParamArray.clear
  496. 25:SetVolume("up")
  497. 26:return @returnParamArray
  498. 27:end
  499. 28:#### 90 ####################################################################
  500. 29:def cmd_90(repeat_command, cmd=nil)
  501. 30:@returnParamArray.clear
  502. 31:SetVolume("down")
  503. 32:return @returnParamArray
  504. 33:end
  505. 34:#### 92 ####################################################################
  506. 35:def cmd_92(streamid, cmd=nil)
  507. 36:@returnParamArray.clear
  508. 37:SendKey("BA")
  509. 38:return @returnParamArray
  510. 39:end
  511. 40:#### 95 ####################################################################
  512. 41:def cmd_95(streamid, eject, cmd=nil)
  513. 42:@returnParamArray.clear
  514. 43:SendKey("B1")
  515. 44:return @returnParamArray
  516. 45:end
  517. 46:#### 97 ####################################################################
  518. 47:def cmd_97(cmd=nil)
  519. 48:@returnParamArray.clear
  520. 49:if(@mute)
  521. 50: Command("ke","00")
  522. 51:else
  523. 52: Command("ke","01")
  524. 53:end
  525. 54:@mute=!@mute
  526. 55:return @returnParamArray
  527. 56:end
  528. 57:#### 136 ####################################################################
  529. 58:def cmd_136(cmd=nil)
  530. 59:@returnParamArray.clear
  531. 60:SendKey("1A")
  532. 61:return @returnParamArray
  533. 62:end
  534. 63:#### 139 ####################################################################
  535. 64:def cmd_139(streamid, cmd=nil)
  536. 65:@returnParamArray.clear
  537. 66:SendKey("B0")
  538. 67:return @returnParamArray
  539. 68:end
  540. 69:#### 154 ####################################################################
  541. 70:def cmd_154(cmd=nil)
  542. 71:@returnParamArray.clear
  543. 72:Command("xb","60")
  544. 73:return @returnParamArray
  545. 74:end
  546. 75:#### 166 ####################################################################
  547. 76:def cmd_166(cmd=nil)
  548. 77:@returnParamArray.clear
  549. 78:EmbeddedTuner("10")
  550. 79:return @returnParamArray
  551. 80:end
  552. 81:#### 192 ####################################################################
  553. 82:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
  554. 83:@returnParamArray.clear
  555. 84:Command("ka","01",5)
  556. 85:SetVolume(@volume)
  557. 86:return @returnParamArray
  558. 87:end
  559. 88:#### 193 ####################################################################
  560. 89:def cmd_193(pk_pipe, cmd=nil)
  561. 90:@returnParamArray.clear
  562. 91:SendCommand("ka","00",1)
  563. 92:return @returnParamArray
  564. 93:end
  565. 94:#### 200 ####################################################################
  566. 95:def cmd_200(streamid, cmd=nil)
  567. 96:@returnParamArray.clear
  568. 97:SendKey("40")
  569. 98:return @returnParamArray
  570. 99:end
  571. 100:#### 201 ####################################################################
  572. 101:def cmd_201(streamid, cmd=nil)
  573. 102:@returnParamArray.clear
  574. 103:SendKey("41")
  575. 104:return @returnParamArray
  576. 105:end
  577. 106:#### 202 ####################################################################
  578. 107:def cmd_202(streamid, cmd=nil)
  579. 108:@returnParamArray.clear
  580. 109:SendKey("07")
  581. 110:return @returnParamArray
  582. 111:end
  583. 112:#### 203 ####################################################################
  584. 113:def cmd_203(streamid, cmd=nil)
  585. 114:@returnParamArray.clear
  586. 115:SendKey("06")
  587. 116:return @returnParamArray
  588. 117:end
  589. 118:#### 204 ####################################################################
  590. 119:def cmd_204(cmd=nil)
  591. 120:@returnParamArray.clear
  592. 121:SendKey("10")
  593. 122:return @returnParamArray
  594. 123:end
  595. 124:#### 205 ####################################################################
  596. 125:def cmd_205(cmd=nil)
  597. 126:@returnParamArray.clear
  598. 127:SendKey("11")
  599. 128:return @returnParamArray
  600. 129:end
  601. 130:#### 206 ####################################################################
  602. 131:def cmd_206(cmd=nil)
  603. 132:@returnParamArray.clear
  604. 133:SendKey("12")
  605. 134:return @returnParamArray
  606. 135:end
  607. 136:#### 207 ####################################################################
  608. 137:def cmd_207(cmd=nil)
  609. 138:@returnParamArray.clear
  610. 139:SendKey("13")
  611. 140:return @returnParamArray
  612. 141:end
  613. 142:#### 208 ####################################################################
  614. 143:def cmd_208(cmd=nil)
  615. 144:@returnParamArray.clear
  616. 145:SendKey("14")
  617. 146:return @returnParamArray
  618. 147:end
  619. 148:#### 209 ####################################################################
  620. 149:def cmd_209(cmd=nil)
  621. 150:@returnParamArray.clear
  622. 151:SendKey("15")
  623. 152:return @returnParamArray
  624. 153:end
  625. 154:#### 210 ####################################################################
  626. 155:def cmd_210(cmd=nil)
  627. 156:@returnParamArray.clear
  628. 157:SendKey("16")
  629. 158:return @returnParamArray
  630. 159:end
  631. 160:#### 211 ####################################################################
  632. 161:def cmd_211(cmd=nil)
  633. 162:@returnParamArray.clear
  634. 163:SendKey("17")
  635. 164:return @returnParamArray
  636. 165:end
  637. 166:#### 212 ####################################################################
  638. 167:def cmd_212(cmd=nil)
  639. 168:@returnParamArray.clear
  640. 169:SendKey("18")
  641. 170:return @returnParamArray
  642. 171:end
  643. 172:#### 213 ####################################################################
  644. 173:def cmd_213(cmd=nil)
  645. 174:@returnParamArray.clear
  646. 175:SendKey("19")
  647. 176:return @returnParamArray
  648. 177:end
  649. 178:#### 240 ####################################################################
  650. 179:def cmd_240(streamid, cmd=nil)
  651. 180:@returnParamArray.clear
  652. 181:SendKey("28")
  653. 182:return @returnParamArray
  654. 183:end
  655. 184:#### 313 ####################################################################
  656. 185:def cmd_313(level, cmd=nil)
  657. 186:@returnParamArray.clear
  658. 187:@volume=level.to_i()
  659. 188:SetVolume(@volume)
  660. 189:return @returnParamArray
  661. 190:end
  662. 191:#### 316 ####################################################################
  663. 192:def cmd_316(cmd=nil)
  664. 193:@returnParamArray.clear
  665. 194:Command("xb","20")
  666. 195:return @returnParamArray
  667. 196:end
  668. 197:#### 317 ####################################################################
  669. 198:def cmd_317(cmd=nil)
  670. 199:@returnParamArray.clear
  671. 200:Command("xb","21")
  672. 201:return @returnParamArray
  673. 202:end
  674. 203:#### 355 ####################################################################
  675. 204:def cmd_355(cmd=nil)
  676. 205:@returnParamArray.clear
  677. 206:# Initialize --- Date: 28.02.2008
  678. 207:# all responses should be terminated by 'x'.
  679. 208:# some sets won't respond to ka 01 ff when the tv is off. others do.
  680. 209:@mute = false;
  681. 210:# read in our device data now since it will never change
  682. 211:@SetID = device_.devdata_[1] # Get the "Set ID" from device data
  683. 212:@volume = device_.devdata_[208] # 208 = DEVICEDATA_Initial_Volume_CONST
  684. 213:@TunerType = device_.devdata_[230] # 230 = DEVICEDATA_Source_CONST
  685. 214:
  686. 215:result = InitVolume()
  687. 216:if (result == true)
  688. 217: return
  689. 218:end
  690. 219:
  691. 220:DisableDevice( device_.devid_, true )
  692. 221:log "The device wouldn't respond. Disabling it.\n"
  693. 222:return @returnParamArray
  694. 223:end
  695. 224:#### 364 ####################################################################
  696. 225:def cmd_364(cmd=nil)
  697. 226:@returnParamArray.clear
  698. 227:SendKey("4C")
  699. 228:return @returnParamArray
  700. 229:end
  701. 230:#### PRIVATE METHODS ####################################################################
  702. 231:def log(line)
  703. 232: $log = File.open("/var/log/pluto/" + device_.devid_.to_s + "_Generic_Serial_Device.log", "a")
  704. 233: $log.puts "(***):" + line.to_s
  705. 234: $log.close
  706. 235:end
  707. 236:
  708. 237:def SendKey(key)
  709. 238: SendCommand("mc",key,1)
  710. 239:end
  711. 240:
  712. 241:def Command(command,data,*extraargs)
  713. 242: out = SendCommand(command,"ff",1)
  714. 243: # only actually send the command if the device isn't already in that mode/setting
  715. 244: if (out[0] == true && out[1] != data)
  716. 245: if (extraargs[0] == nil)
  717. 246: timeout = 1
  718. 247: else
  719. 248: timeout = extraargs[0]
  720. 249: end
  721. 250: out = SendCommand(command,data,timeout)
  722. 251: end
  723. 252: return out
  724. 253:end
  725. 254:
  726. 255:def SendCommand(command,data,timeout)
  727. 256: $cmd = [command,@SetID,data].join(" ")
  728. 257: conn_.Send($cmd + "\r")
  729. 258: # wait up to 8 seconds since it may be very slow if this is an 'on' command
  730. 259: buf = conn_.RecvDelimited("x", timeout * 1000)
  731. 260: if( !buf.nil? && (!buf.index("01 OK").nil? || !buf.index("01 NG").nil?))
  732. 261: #print "Received good reply in less than ", timeout, "ms: ", buf, "\n"
  733. 262: if (buf.index("OK"))
  734. 263: data = buf[buf.index("OK") + 2, 2]
  735. 264: result = true
  736. 265: else
  737. 266: result = false
  738. 267: end
  739. 268: return [result, data]
  740. 269: else
  741. 270: buf = conn_.Recv(1000,1000);
  742. 271: #print "Flushed buffer: ", buf, "invalid response in ", timeout, "seconds\n"
  743. 272: return [false]
  744. 273: end
  745. 274:end
  746. 275:
  747. 276:def EmbeddedTuner(data)
  748. 277: # select the embedded tuner. use device data to determine cable vs antenna
  749. 278: # add 1 for cable
  750. 279: data = data.to_i()
  751. 280: if (@TunerType != nil)
  752. 281: data += @TunerType.to_i()
  753. 282: end
  754. 283: Command("xb","%02d" % data)
  755. 284:end
  756. 285:
  757. 286:def SetVolume(level)
  758. 287: #if (!level.is_a? Integer)
  759. 288: if (@volume == nil || (!@volume.is_a? Integer))
  760. 289: InitVolume()
  761. 290: end
  762. 291:
  763. 292: if (level == "up")
  764. 293: @volume += 1
  765. 294: elsif (level == "down")
  766. 295: @volume -= 1
  767. 296: else
  768. 297: @volume = level.to_i()
  769. 298: end
  770. 299: # set the volume
  771. 300: Command("kf","" + "%02X" % @volume)
  772. 301:end
  773. 302:
  774. 303:def InitVolume()
  775. 304: # need to check if we know the volume before setting it. if we dont, get it
  776. 305: # check if we already have it in memory first
  777. 306: if (@volume == nil || (!@volume.is_a? Integer))
  778. 307: # no volume info in the db, get it from the tv
  779. 308: #check if tv is on
  780. 309: unless (SendCommand("ka","ff",1))
  781. 310: # turn the tv on
  782. 311: SendCommand("ka","01",3)
  783. 312: tvon = true # so we can turn it off later
  784. 313: end
  785. 314: # ask for the volume
  786. 315: result = SendCommand("kf","ff",1)
  787. 316: if (result[1] != nil)
  788. 317: @volume = result[1].to_i(16) # TV uses hex values
  789. 318: if (tvon == true)
  790. 319: # be nice and turn the TV off now that we are done with it, if it was off to begin with
  791. 320: SendCommand("ka","00",1)
  792. 321: end
  793. 322: log "returning true"
  794. 323: return true
  795. 324: else
  796. 325: # could not get volume, use a sane default and let the init function know that we could not turn the tv on
  797. 326: @volume = 10
  798. 327: return false
  799. 328: end
  800. 329:
  801. 330: else
  802. 331: return true
  803. 332: end
  804. 333:end
  805. 334:#### 548 ####################################################################
  806. 335:def cmd_548(text, streamid, cmd=nil)
  807. 336:@returnParamArray.clear
  808. 337:SendKey("43")
  809. 338:return @returnParamArray
  810. 339:end
  811. 340:#### 712 ####################################################################
  812. 341:def cmd_712(cmd=nil)
  813. 342:@returnParamArray.clear
  814. 343:Command("xb","40")
  815. 344:return @returnParamArray
  816. 345:end
  817. 346:#### 713 ####################################################################
  818. 347:def cmd_713(cmd=nil)
  819. 348:@returnParamArray.clear
  820. 349:Command("xb"," 41")
  821. 350:return @returnParamArray
  822. 351:end
  823. 352:#### 763 ####################################################################
  824. 353:def cmd_763(cmd=nil)
  825. 354:@returnParamArray.clear
  826. 355:SendKey("5B")
  827. 356:return @returnParamArray
  828. 357:end
  829. 358:#### 767 ####################################################################
  830. 359:def cmd_767(cmd=nil)
  831. 360:@returnParamArray.clear
  832. 361:Command("xb","91")
  833. 362:return @returnParamArray
  834. 363:end
  835. 364:#### 873 ####################################################################
  836. 365:def cmd_873(cmd=nil)
  837. 366:@returnParamArray.clear
  838. 367:EmbeddedTuner("00")
  839. 368:return @returnParamArray
  840. 369:end
  841. 370:#### 930 ####################################################################
  842. 371:def cmd_930(cmd=nil)
  843. 372:@returnParamArray.clear
  844. 373:Command("xb","92")
  845. 374:return @returnParamArray
  846. 375:end
  847. 376:#### 937 ####################################################################
  848. 377:def cmd_937(cmd=nil)
  849. 378:@returnParamArray.clear
  850. 379:SendKey("AA")
  851. 380:return @returnParamArray
  852. 381:end
  853. 382:#### 964 ####################################################################
  854. 383:def cmd_964(cmd=nil)
  855. 384:@returnParamArray.clear
  856. 385:SendKey("00")
  857. 386:return @returnParamArray
  858. 387:end
  859. 388:#### 965 ####################################################################
  860. 389:def cmd_965(cmd=nil)
  861. 390:@returnParamArray.clear
  862. 391:SendKey("01")
  863. 392:return @returnParamArray
  864. 393:end
  865. 394:#### 984 ####################################################################
  866. 395:def cmd_984(cmd=nil)
  867. 396:@returnParamArray.clear
  868. 397:Command("xb","90")
  869. 398:return @returnParamArray
  870. 399:end
  871. 400:#### 985 ####################################################################
  872. 401:def cmd_985(cmd=nil)
  873. 402:@returnParamArray.clear
  874. 403:Command("xb","93")
  875. 404:return @returnParamArray
  876. 405:end
  877. 406:#### 1086 ####################################################################
  878. 407:def cmd_1086(cmd=nil)
  879. 408:@returnParamArray.clear
  880. 409:Command("xb","42")
  881. 410:return @returnParamArray
  882. 411:end
  883. 412:#### START SETTERS ####################################################################
  884. 413:def initialize()
  885. 414:super
  886. 415:@returnParamArray=Array.new
  887. 416:end
  888. 417:#### END SETTERS ####################################################################
  889. 418:end
  890. 420:(***):returning true
  891.  
  892.  
  893. 883 lines, displaying from 0 to 883
  894. 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement