|
|
| (4 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| [[Category: Hardware]]
| |
| [[category: Audio]]
| |
| {{versioninfo}}
| |
| {{stub}}
| |
| [[category: Tutorials]]
| |
| == 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 ==
| |
|
| |
|
| |
| ''' '''Internal''' '''
| |
|
| |
|
| |
| '''#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")
| |
|
| |
|
| |
| ''' '''Power''' '''
| |
|
| |
|
| |
| '''#193 Off'''
| |
|
| |
| SendIrCommand("PWR0")
| |
|
| |
|
| |
| '''#192 On'''
| |
|
| |
| SendIrCommand("PWR1")
| |
| sleep(2)
| |
| SendIrCommand("MUTE0")
| |
| @mute=false
| |
|
| |
|
| |
| ''' '''Sound & Volume''' '''
| |
|
| |
|
| |
| '''#97 Mute'''
| |
|
| |
| # Mute
| |
|
| |
| mute_state = SendIrCommand("MUTE?")[-6,5]
| |
| case mute_state
| |
| when "MUTE0"
| |
| SendIrCommand("MUTE1")
| |
| when "MUTE1"
| |
| SendIrCommand("MUTE0")
| |
| end
| |
|
| |
| '''#90 Volume Down'''
| |
|
| |
| # Vol Down
| |
|
| |
| volume_level = (SendIrCommand("VOL?")[-3,2]).hex
| |
| if volume_level > 0
| |
| volume_level -= 1
| |
| newvol = ("VOL" + "%02x" % volume_level.to_s).upcase
| |
| SendIrCommand(newvol)
| |
| log("Volume decreased to : " + newvol)
| |
| else
| |
| log("Volume at Minimum")
| |
| end
| |
|
| |
| '''#89 Vol Up'''
| |
|
| |
| # Volume Up
| |
|
| |
| volume_level = (SendIrCommand("VOL?")[-3,2]).hex
| |
| if volume_level < 100
| |
| volume_level += 1
| |
| newvol = ("VOL" + "%02x" % volume_level.to_s).upcase
| |
| SendIrCommand(newvol)
| |
| log("Volume increase to : " + newvol)
| |
| else
| |
| log("Volume at Maximum")
| |
| end
| |
|
| |
|
| |
| ''' '''Input Selection''' '''
| |
|
| |
|
| |
| '''#163 Phono'''
| |
|
| |
| SendIrCommand("SEL00")
| |
|
| |
| '''#873 Tuner - Digital'''
| |
|
| |
| SendIrCommand("SEL01")
| |
|
| |
| '''#162 CD'''
| |
|
| |
| SendIrCommand("SEL02")
| |
|
| |
| '''#160 Tape/Tape 1'''
| |
|
| |
| SendIrCommand("SEL03")
| |
|
| |
| '''#420 CDR'''
| |
|
| |
| SendIrCommand("SEL04")
| |
|
| |
| '''#155 Video 1'''
| |
|
| |
| SendIrCommand("SEL05")
| |
|
| |
| '''#156 Video 2'''
| |
|
| |
| SendIrCommand("SEL06")
| |
|
| |
| '''#157 Video 3'''
| |
|
| |
| SendIrCommand("SEL07")
| |
|
| |
| '''#158 Video 4'''
| |
|
| |
| SendIrCommand("SEL08")
| |
|
| |
| '''#165 DVD'''
| |
|
| |
| SendIrCommand("SEL09")
| |
|
| |
| '''#316 AV 1'''
| |
|
| |
| SendIrCommand("SEL0A")
| |
|
| |
|
| |
| ''' '''DSP Modes (Audio)''' '''
| |
|
| |
| '''#311 Stereo'''
| |
|
| |
| SendIrCommand("LSTN00")
| |
|
| |
| '''#1006 Pro Logic'''
| |
|
| |
| SendIrCommand("LSTN01")
| |
|
| |
| '''#292 Dolby Digital'''
| |
|
| |
| SendIrCommand("LSTN02")
| |
|
| |
| '''#1086 Arena'''
| |
|
| |
| SendIrCommand("LSTN05")
| |
|
| |
| '''#312 Stadium'''
| |
|
| |
| SendIrCommand("LSTN06")
| |
|
| |
| '''##149 Jazz Club'''
| |
|
| |
| SendIrCommand("LSTN07")
| |
|
| |
| '''#1087 Cathedral''' NOTE: this was defined by myself
| |
|
| |
| SendIrCommand("LSTN08")
| |
|
| |
| '''#1090 Theater''' NOTE: this was defined by myself
| |
|
| |
| SendIrCommand("LSTN09")
| |
|
| |
| '''#1088 Concert Hall''' NOTE: this was defined by myself
| |
|
| |
| SendIrCommand("LSTN0A")
| |
|
| |
| '''#1089 Stadium2''' NOTE: this was defined by myself
| |
|
| |
| SendIrCommand("LSTN0B")
| |
|
| |
| '''#1091 Theater2''' NOTE: this was defined by myself
| |
|
| |
| SendIrCommand("LSTN0C")
| |
|
| |
| '''#1000 Pro Logic2 Movie'''
| |
|
| |
| SendIrCommand("LSTN0D")
| |
|
| |
| '''#1002 Pro Logic2 Music'''
| |
|
| |
| SendIrCommand("LSTN0E")
| |
|
| |
| '''#1007 NEO6 Cinema'''
| |
|
| |
| SendIrCommand("LSTN0F")
| |
|
| |
| '''#1008 NEO6 Music'''
| |
|
| |
| SendIrCommand("LSTN10")
| |
|
| |
| '''#1092 Multi-Channel Music''' NOTE: this was defined by myself
| |
|
| |
| SendIrCommand("LSTN11")
| |
|
| |
|
| |
| ''' '''Receiver''' '''
| |
|
| |
| * These are Input Modes the receivers support for digital or analog input jacks
| |
| * These were also defined by myself
| |
|
| |
| '''#1096 Full Auto'''
| |
|
| |
| SendIrCommand("INPUTM0")
| |
|
| |
| '''#1095 DGTL Manual'''
| |
|
| |
| SendIrCommand("INPUTM1")
| |
|
| |
| '''#1094 Analog'''
| |
|
| |
| SendIrCommand("INPUTM2")
| |
|
| |
| '''#1098 6-Ch Input'''
| |
|
| |
| SendIrCommand("INPUTM3")
| |