| PK_InfraredGroup_Command | FK_InfraredGroup | FK_Command | FK_DeviceTemplate | IRData | OriginalKey | psc_id | psc_batch | psc_user | psc_frozen | psc_mod | psc_toc | psc_restrict | | 6056 | 373 | | def SendUserCommand(command)
log("Sending Command Prefix and Command ID to STB.")
conn_.Send("\xFA\xA5")
reply = conn_.Recv(1,65)
if( !reply.nil? && reply[0] = "\xF0")
log("STB reply: Command Acknowledged.")
# Got Command Acknowledge from STB
log("Sending Command '" + command[0].to_s + "' to STB")
conn_.Send("\x00\x01" + command)
conn_.Recv(1,64) # if \xF2 then STB received correct number of parameters
log("STB reply: Received the correct number of parameters.")
conn_.Recv(1,64) # if \xF4 then command completed successfully
log("STB reply: Service command completed successfully.")
else
return
end
end
def log(word)
logTime = Time.now
timeStr = logTime.strftime("%d-%m-%Y %H:%M:%S ")
$logFile.print( timeStr + word + "\n" )
$logFile.flush()
print(word + "\n")
end | | 169404 | -92 | 39176 | | 2011-06-19 03:57:19 | 0 | |
| 6056 | 351 | | | | 169405 | -92 | 39176 | | 2011-06-19 03:57:20 | 0 | |
| 6056 | 350 | | | | 169406 | -92 | 39176 | | 2011-06-19 03:57:20 | 0 | |
| 6056 | 355 | | # DirecTV STB initialization
$logFile = File.new("/var/log/pluto/DirecTV_STB.log", "w")
for iRetry in 0...4
log("Initializing DirecTV STB...")
# send GetCurrentChannel (0x87) command to STB
conn_.Send("\xFA")
conn_.Send("\x87")
buf = conn_.Recv(1,64)
if( !buf.nil? && !buf.index("\xF0").nil? )
log("Command Acknowledge from STB.")
# STB sending current channel information
buf = conn_.Recv(10,1000)
if ( !buf.nil? )
cur_channel = (buf[0].to_s(16).hex) * 256 + buf[1].to_s(16).hex
log("Current Channel on STB: " + cur_channel.to_s )
log("Initialized ok.\n")
return
end
else
log("Failed to initialize. Wait 1 secs and try again.\n")
sleep(1)
end
end
#DisableDevice( device_.devid_, true )
log("The device wouldn't respond. Disabling it.\n") | | 169407 | -92 | 39176 | | 2011-06-19 03:57:21 | 0 | |
| 6056 | 384 | | | | 169408 | -92 | 39176 | | 2011-06-19 03:57:22 | 0 | |
| 6056 | 356 | | | | 169409 | -92 | 39176 | | 2011-06-19 03:57:22 | 0 | |
| 6056 | 240 | | SendUserCommand("\xA4") | | 169410 | -92 | 39176 | | 2011-06-19 03:57:23 | 0 | |
| 6056 | 225 | | | | 169411 | -92 | 39176 | | 2011-06-19 03:57:23 | 0 | |
| 6056 | 190 | | SendUserCommand("\xA0") | | 169412 | -92 | 39176 | | 2011-06-19 03:57:24 | 0 | |
| 6056 | 86 | | SendUserCommand("\xF7") | | 169413 | -92 | 39176 | | 2011-06-19 03:57:24 | 0 | |
| 6056 | 201 | | SendUserCommand("\x9D") | | 169414 | -92 | 39176 | | 2011-06-19 03:57:25 | 0 | |
| 6056 | 202 | | SendUserCommand("\x9B") | | 169415 | -92 | 39176 | | 2011-06-19 03:57:25 | 0 | |
| 6056 | 203 | | SendUserCommand("\x9A") | | 169416 | -92 | 39176 | | 2011-06-19 03:57:26 | 0 | |
| 6056 | 200 | | SendUserCommand("\x9C") | | 169417 | -92 | 39176 | | 2011-06-19 03:57:26 | 0 | |
| 6056 | 192 | | SendUserCommand("\xC5") | | 169418 | -92 | 39176 | | 2011-06-19 03:57:27 | 0 | |
| 6056 | 193 | | SendUserCommand("\xD0") | | 169419 | -92 | 39176 | | 2011-06-19 03:57:27 | 0 | |
| 6056 | 364 | | SendUserCommand("\xA5") | | 169420 | -92 | 39176 | | 2011-06-19 03:57:28 | 0 | |
| 6056 | 204 | | SendUserCommand("\xE0") | | 169421 | -92 | 39176 | | 2011-06-19 03:57:28 | 0 | |
| 6056 | 205 | | SendUserCommand("\xE1") | | 169422 | -92 | 39176 | | 2011-06-19 03:57:29 | 0 | |
| 6056 | 206 | | SendUserCommand("\xE2") | | 169423 | -92 | 39176 | | 2011-06-19 03:57:29 | 0 | |
| 6056 | 207 | | SendUserCommand("\xE3") | | 169424 | -92 | 39176 | | 2011-06-19 03:57:30 | 0 | |
| 6056 | 208 | | SendUserCommand("\xE4") | | 169425 | -92 | 39176 | | 2011-06-19 03:57:30 | 0 | |
| 6056 | 209 | | SendUserCommand("\xE5") | | 169426 | -92 | 39176 | | 2011-06-19 03:57:31 | 0 | |
| 6056 | 210 | | SendUserCommand("\xE6") | | 169427 | -92 | 39176 | | 2011-06-19 03:57:31 | 0 | |
| 6056 | 211 | | SendUserCommand("\xE7") | | 169428 | -92 | 39176 | | 2011-06-19 03:57:32 | 0 | |
| 6056 | 212 | | SendUserCommand("\xE8") | | 169429 | -92 | 39176 | | 2011-06-19 03:57:32 | 0 | |
| 6056 | 213 | | SendUserCommand("\xE9") | | 169430 | -92 | 39176 | | 2011-06-19 03:57:33 | 0 | |
| 6056 | 763 | | SendUserCommand("\xD4") | | 169431 | -92 | 39176 | | 2011-06-19 03:57:33 | 0 | |
| 6056 | 126 | | SendUserCommand("\xD3") | | 169432 | -92 | 39176 | | 2011-06-19 03:57:34 | 0 | |
| 6056 | 123 | | SendUserCommand("\xA1") | | 169433 | -92 | 39176 | | 2011-06-19 03:57:34 | 0 | |
| 6056 | 528 | | SendUserCommand("\xB6") | | 169434 | -92 | 39176 | | 2011-06-19 03:57:35 | 0 | |
| 6056 | 1099 | | SendUserCommand("0xA2") | | 169435 | -92 | 39176 | | 2011-06-19 03:57:35 | 0 | |
| 6056 | 455 | | SendUserCommand("\xED") | | 169436 | -92 | 39176 | | 2011-06-19 03:57:36 | 0 | |
| 6056 | 518 | | SendUserCommand("\xEC") | | 169437 | -92 | 39176 | | 2011-06-19 03:57:36 | 0 | |
| 6056 | 1100 | | SendUserCommand("0xA3") | | 169438 | -92 | 39176 | | 2011-06-19 03:57:37 | 0 | |
| 6056 | 682 | | SendUserCommand("\xEB") | | 169439 | -92 | 39176 | | 2011-06-19 03:57:37 | 0 | |
| 6056 | 605 | | SendUserCommand("\xEA") | | 169440 | -92 | 39176 | | 2011-06-19 03:57:38 | 0 | |
| 6056 | 965 | | SendUserCommand("\xD2") | | 169441 | -92 | 39176 | | 2011-06-19 03:57:38 | 0 | |
| 6056 | 964 | | SendUserCommand("\xD1") | | 169442 | -92 | 39176 | | 2011-06-19 03:57:39 | 0 | |
| 6056 | 136 | | SendUserCommand("\xD6") | | 169443 | -92 | 39176 | | 2011-06-19 03:57:39 | 0 | |
| 6056 | 512 | | SendUserCommand("\xF8") | | 169444 | -92 | 39176 | | 2011-06-19 03:57:40 | 0 | |
| 6056 | 954 | | SendUserCommand("\xC3") | | 169445 | -92 | 39176 | | 2011-06-19 03:57:41 | 0 | |
| | 192 | | | | 169446 | -92 | 39176 | | 2011-06-19 03:57:41 | 0 | |
| | 193 | | | | 169447 | -92 | 39176 | | 2011-06-19 03:57:42 | 0 | |
| 6097 | 192 | | # Power On
SendCmd("PWR1")
| | 169448 | -92 | 39176 | | 2011-06-19 03:57:42 | 0 | |
| 6097 | 193 | | SendCmd("PWR0") | | 169449 | -92 | 39176 | | 2011-06-19 03:57:43 | 0 | |
| 6097 | 373 | | # Private - Date: 2011-01-17
def SendCmd(command)
log("Sending Command code '" + command.strip + "' to the Receiver.")
conn_.Send("\x01" + command + "\x02\x0D\x0D\x0A")
reply = conn_.RecvDelimited("\x04", 2000)
if ( !reply.nil? && reply.length() > 4 )
return reply
else
log("****ERROR**** : No reply from Receiver")
return nil
end
end
def log(word)
logTime = Time.now
timeStr = logTime.strftime("%d-%m-%Y %H:%M:%S -- ")
$logFile.print( timeStr + word + "\n")
$logFile.flush()
print(word + "\n")
end
def GetRadioStations()
# would like to implement reading from a table in pluto_media that
# is populated from a screen in web admin... that queries a website for
# local radio stations based on latitude & longitude or zip code.
# for now.. populate an array manually
$stations[0] = ["KARN", "FM", 102.9, "Sheridan, AR", "News/Talk"]
$stations[1] = ["KKPT", "FM", 94.1, "Little Rock, AR", "Classic Rock"]
$stations[2] = ["KHKN", "FM", 94.9, "Maumelle, AR", "Adult Hits"]
$stations[3] = ["KOLL", "FM", 106.7, "Lonoke, AR", "Oldied"]
$stations[4] = ["KARN", "AM", 920, "Little Rock, AR", "Sports"]
$stations[5] = ["KAAY", "AM", 1090, "Little Rock, AR", "Religious"]
end
#def GetRadioStations()
# begin
# db_stations = Mysql.real_connect(\\\"dcerouter\\\", \\\"root\\\", \\\"\\\", \\\"pluto_media\\\")
# log(\\\"Server version: \\\" + db_stations.get_server_info)
# rescue Mysql::Error => e
# log(\\\"Error code: #[e.errno]\\\")
# ensure
# db_stations.close if db_stations
# end
#end | | 169450 | -92 | 39176 | | 2011-06-19 03:57:43 | 0 | |
| 6097 | 351 | | | | 169451 | -92 | 39176 | | 2011-06-19 03:57:44 | 0 | |
| 6097 | 350 | | buf = conn_.RecvDelimited("\x04", 64)
if !(buf.empty?)
msg = buf.strip
case msg[1,3]
when "PWR"
log("Receiver sent PWR Status - " + msg)
when "INP" # INPUT
log("Receiver sent INPUTS Status - " + msg)
when "MUT" # MUTE
log("Receiver sent MUTE Status - " + msg)
when "VOL"
$Current_Volume = msg[4,2].hex
log("Receiver Volume is " + $Current_Volume.to_s + " (" + ($Current_Volume - 83).to_s + "dB).")
when "SEL"
log("Receiver sent SEL Status - " + msg)
when "FRE" # FREQ
log("Receiver sent FREQ Status - " + msg)
when "LST" # LSTN
log("Receiver sent LSTN Status - " + msg)
else
log("Receiver sent '" + msg + "' Status")
end
end | | 169452 | -92 | 39176 | | 2011-06-19 03:57:44 | 0 | |
| 6097 | 355 | | # Kenwood VR5x00 Receiver initialization
$logFile = File.new("/var/log/pluto/VR5x00.log", "w")
@cmd = Command.new(device_.devid_, device_.devid_, 1, 2, 158)
for iRetry in 0...4
log("Initializing unit, Try " + (iRetry + 1).to_s + " of 4")
conn_.Send("\x01PWR?\x02\x0D\x0D\x0A")
buf = conn_.RecvDelimited("\x04", 2000)
if( !buf.empty? && !buf.index("PWR").nil? )
log("Receiver Power State is " + buf.strip)
conn_.Send("\x01VOL?\x02\x0D\x0D\x0A")
receiver_vol = conn_.RecvDelimited("\x04", 2000)
log("Receiver Volume Level is " + receiver_vol + ".")
$Current_Volume = receiver_vol[4,2].hex
log("Receiver Volume is " + $Current_Volume.to_s + " (" + ($Current_Volume - 83).to_s + "dB).")
@cmd.params_[30] = $Current_Volume.to_s
SendCommand(@cmd)
log("Initialized ok.\n")
return
end
log("Failed to initialize. Wait 1 secs and try again.\n")
sleep(1)
end
DisableDevice( device_.devid_, true )
log("The device wouldn't respond. Disabling it.\n") | | 169453 | -92 | 39176 | | 2011-06-19 03:57:45 | 0 | |
| 6097 | 384 | | | | 169454 | -92 | 39176 | | 2011-06-19 03:57:45 | 0 | |
| 6097 | 356 | | | | 169455 | -92 | 39176 | | 2011-06-19 03:57:46 | 0 | |
| 6097 | 316 | | SendCmd("SEL0A") | | 169456 | -92 | 39176 | | 2011-06-19 03:57:46 | 0 | |
| 6097 | 162 | | SendCmd("SEL02") | | 169457 | -92 | 39176 | | 2011-06-19 03:57:47 | 0 | |
| 6097 | 420 | | SendCmd("SEL04") | | 169458 | -92 | 39176 | | 2011-06-19 03:57:47 | 0 | |
| 6097 | 165 | | SendCmd("SEL05") | | 169459 | -92 | 39176 | | 2011-06-19 03:57:48 | 0 | |
| 6097 | 163 | | SendCmd("SEL00") | | 169460 | -92 | 39176 | | 2011-06-19 03:57:48 | 0 | |
| 6097 | 873 | | SendCmd("SEL01") | | 169461 | -92 | 39176 | | 2011-06-19 03:57:49 | 0 | |
| 6097 | 160 | | SendCmd("SEL03") | | 169462 | -92 | 39176 | | 2011-06-19 03:57:49 | 0 | |
| 6097 | 155 | | SendCmd("SEL05") | | 169463 | -92 | 39176 | | 2011-06-19 03:57:50 | 0 | |
| 6097 | 156 | | SendCmd("SEL06") | | 169464 | -92 | 39176 | | 2011-06-19 03:57:50 | 0 | |
| 6097 | 157 | | SendCmd("SEL07") | | 169465 | -92 | 39176 | | 2011-06-19 03:57:51 | 0 | |
| 6097 | 1098 | | SendCmd("LSTN05") | | 169466 | -92 | 39176 | | 2011-06-19 03:57:51 | 0 | |
| 6097 | 148 | | SendCmd("LSTN08") | | 169467 | -92 | 39176 | | 2011-06-19 03:57:52 | 0 | |
| 6097 | 1102 | | SendCmd("LSTN0A") | | 169468 | -92 | 39176 | | 2011-06-19 03:57:52 | 0 | |
| 6097 | 292 | | SendCmd("LSTN02") | | 169469 | -92 | 39176 | | 2011-06-19 03:57:53 | 0 | |
| 6097 | 149 | | SendCmd("LSTN07") | | 169470 | -92 | 39176 | | 2011-06-19 03:57:53 | 0 | |
| 6097 | 1097 | | SendCmd("LSTN11") | | 169471 | -92 | 39176 | | 2011-06-19 03:57:54 | 0 | |
| 6097 | 1007 | | SendCmd("LSTN0F") | | 169472 | -92 | 39176 | | 2011-06-19 03:57:54 | 0 | |
| 6097 | 1008 | | SendCmd("LSTN10") | | 169473 | -92 | 39176 | | 2011-06-19 03:57:55 | 0 | |
| 6097 | 1006 | | SendCmd("LSTN01") | | 169474 | -92 | 39176 | | 2011-06-19 03:57:56 | 0 | |
| 6097 | 1000 | | SendCmd("LSTN0D") | | 169475 | -92 | 39176 | | 2011-06-19 03:57:57 | 0 | |
| 6097 | 1002 | | SendCmd("LSTN0E") | | 169476 | -92 | 39176 | | 2011-06-19 03:57:57 | 0 | |
| 6097 | 312 | | SendCmd("LSTN06") | | 169477 | -92 | 39176 | | 2011-06-19 03:57:58 | 0 | |
| 6097 | 1099 | | SendCmd("LSTN0B") | | 169478 | -92 | 39176 | | 2011-06-19 03:57:58 | 0 | |
| 6097 | 311 | | SendCmd("LSTN00") | | 169479 | -92 | 39176 | | 2011-06-19 03:57:59 | 0 | |
| 6097 | 1101 | | SendCmd("LSTN09") | | 169480 | -92 | 39176 | | 2011-06-19 03:57:59 | 0 | |
| 6097 | 1100 | | SendCmd("LSTN0C") | | 169481 | -92 | 39176 | | 2011-06-19 03:58:00 | 0 | |
| 6097 | 97 | | # Mute
mute_state = SendCmd("MUTE?")
case mute_state[5]
when 48
SendCmd("MUTE1")
log("Mute is On.")
when 49
SendCmd("MUTE0")
log("Mute is OFF.")
else
log("Did not receive proper response for MUTE change command")
end | | 169482 | -92 | 39176 | | 2011-06-19 03:58:00 | 0 | |
| 6097 | 90 | | # Volume Down
if $Current_Volume > 0
$Current_Volume -= 1
newvol = ("VOL" + "%02x" % $Current_Volume.to_s).upcase
log("Requesting decrease of VOLUME to: " + ($Current_Volume - 83).to_s + "dB.")
log("Receiver confirms VOLUME at " + (SendCmd(newvol).strip[4,2].hex - 83).to_s + "dB.")
else
log("Volume at Minimum!")
end | | 169483 | -92 | 39176 | | 2011-06-19 03:58:01 | 0 | |
| 6097 | 89 | | # Volume Up
if $Current_Volume < 96 #(maximum for receiver, this is +13db)
$Current_Volume += 1
newvol = ("VOL" + "%02x" % $Current_Volume.to_s).upcase
log("Requesting increase of VOLUME to: " + ($Current_Volume - 83).to_s + "dB.")
log("Receiver confirms VOLUME at " + (SendCmd(newvol).strip[4,2].hex -83).to_s + "dB.")
else
log("Volume at Maximum!")
end | | 169484 | -92 | 39176 | | 2011-06-19 03:58:01 | 0 | |
| 6097 | 1103 | | SendCmd("INPUTM3") | | 169485 | -92 | 39176 | | 2011-06-19 03:58:02 | 0 | |
| 6097 | 1104 | | SendCmd("INPUTM2") | | 169486 | -92 | 39176 | | 2011-06-19 03:58:02 | 0 | |
| 6097 | 1105 | | SendCmd("INPUTM1") | | 169487 | -92 | 39176 | | 2011-06-19 03:58:03 | 0 | |
| 6097 | 1096 | | SendCmd("INPUTM0") | | 169488 | -92 | 39176 | | 2011-06-19 03:58:03 | 0 | |
| 6097 | 296 | | SendCmd("LSTN03") | | 169489 | -92 | 39176 | | 2011-06-19 03:58:04 | 0 | |
| 6097 | 297 | | SendCmd("LSTN14") | | 169490 | -92 | 39176 | | 2011-06-19 03:58:04 | 0 | |
| 6071 | 192 | | | | 169491 | -92 | 39176 | | 2011-06-19 03:58:05 | 0 | |
| 6071 | 193 | | | | 169492 | -92 | 39176 | | 2011-06-19 03:58:05 | 0 | |