Difference between revisions of "User Ardirtbiker"
From LinuxMCE
Ardirtbiker (Talk | contribs) |
Ardirtbiker (Talk | contribs) |
||
Line 24: | Line 24: | ||
---- | ---- | ||
+ | |||
+ | == Ruby Codes == | ||
+ | |||
+ | |||
+ | '''#373 Private Method Listing''' | ||
+ | # Private - Date: 2011-01-17 | ||
+ | def SendIrCommand(command) | ||
+ | for i in 0...1 | ||
+ | conn_.Send("\x01" + command + "\x02\x0D\x0D\x0A") | ||
+ | reply = conn_.RecvDelimited("\x04", 2000) | ||
+ | if( !reply.nil? && reply.length()>4 ) | ||
+ | log("Received good reply: " + reply + "\n") | ||
+ | return reply | ||
+ | else | ||
+ | buf = conn_.Recv(1000,1000); | ||
+ | log("Flushed buffer: " + buf + "\n") | ||
+ | end | ||
+ | end | ||
+ | return "Invalid" | ||
+ | end | ||
+ | |||
+ | def log(word) | ||
+ | $logFile.print( 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 | ||
+ | end | ||
+ | |||
+ | |||
+ | == #350 Process Incoming Data == | ||
+ | |||
+ | buf = conn_.Recv(1000,1000) | ||
+ | log("Received '" + buf + "' data from Receiver") | ||
+ | |||
+ | |||
+ | == #355 Process Initialize == | ||
+ | |||
+ | # Kenwood VR5x00 Receiver initialization | ||
+ | |||
+ | $logFile = File.new("/var/log/pluto/VR5x00.log", "w") | ||
+ | |||
+ | for iRetry in 0...4 | ||
+ | print "Initializing unit\n" | ||
+ | conn_.Send("\x01PWR?\x02\x0D\x0D\x0A") | ||
+ | buf = conn_.RecvDelimited("\x04", 2000) | ||
+ | if( !buf.nil? && !buf.index("PWR").nil? ) | ||
+ | log("Data from Receiver: " + buf + "\n") | ||
+ | # see if any more data from receiver | ||
+ | buf = conn.Recv(1000,1000) | ||
+ | log("is this data trash? " + buf + "\n") | ||
+ | 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") |
Revision as of 23:04, 23 January 2011
Version | Status | Date Updated | Updated By |
---|---|---|---|
710 | Unknown | N/A | N/A |
810 | Unknown | N/A | N/A |
1004 | Unknown | N/A | N/A |
1204 | Unknown | N/A | N/A |
1404 | Unknown | N/A | N/A |
Usage Information |
This article is a stub and requires expansion |
Contents
Using the Kenwood Sovereign with RS232 Control
UNDER DEVELOPMENT
Current features supported:
- On/Off
- Mute
- Volume control (Up/Down)
Defined but not tested:
- Input selection
- DSP Modes
- THX contols
Also, Logging events is not up to par either.
Ruby Codes
#373 Private Method Listing
- Private - Date: 2011-01-17
def SendIrCommand(command)
for i in 0...1 conn_.Send("\x01" + command + "\x02\x0D\x0D\x0A") reply = conn_.RecvDelimited("\x04", 2000) if( !reply.nil? && reply.length()>4 ) log("Received good reply: " + reply + "\n") return reply else buf = conn_.Recv(1000,1000); log("Flushed buffer: " + buf + "\n") end end return "Invalid"
end
def log(word) $logFile.print( 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
end
#350 Process Incoming Data
buf = conn_.Recv(1000,1000) log("Received '" + buf + "' data from Receiver")
#355 Process Initialize
- Kenwood VR5x00 Receiver initialization
$logFile = File.new("/var/log/pluto/VR5x00.log", "w")
for iRetry in 0...4
print "Initializing unit\n" conn_.Send("\x01PWR?\x02\x0D\x0D\x0A") buf = conn_.RecvDelimited("\x04", 2000) if( !buf.nil? && !buf.index("PWR").nil? ) log("Data from Receiver: " + buf + "\n") # see if any more data from receiver buf = conn.Recv(1000,1000) log("is this data trash? " + buf + "\n") 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")