Jump to content

User:Bulek: Difference between revisions

From LinuxMCE
New page: Power #193 Off SendMultiZoneCommand(cmd, ["@PWR:1", "@MSP:1", "@MAM:2"]) #SendMultiZoneCommand(cmd, ["@AMT:2", "@MSP:1", "@MAM:2"]) #192 On SendMultiZoneCommand(cmd, ["@PWR:2", "@MSP:...
 
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Power
Temporary copy of LG LCD TV template (based on existing LG_42LB5D template)
#193 Off
SendMultiZoneCommand(cmd, ["@PWR:1", "@MSP:1", "@MAM:2"]) #SendMultiZoneCommand(cmd, ["@AMT:2", "@MSP:1", "@MAM:2"])


#192 On
==== 'Add Ruby snippets to commands'====
SendMultiZoneCommand(cmd, ["@PWR:2", "@MSP:2", "@MAM:1"]) #SendMultiZoneCommand(cmd, ["@AMT:1", "@MSP:2", "@MAM:1"])


Inputs
#169 AM
SendMultiZoneCommand(cmd, ["@SRC:H", "@MSC:H", "@MSC:H"])


#164 Aux
SendMultiZoneCommand(cmd, ["@SRC:9", "@MSC:9", "@MSC:9"])


#172 Aux 2
Simpler commands from Ruby part of template :
SendMultiZoneCommand(cmd, ["@SRC:A", "@MSC:A", "@MSC:A"])
<pre><nowiki>
Power
#193 Off
log('Sending OFF Command') <$"ka 01 00\r"$>


#162 CD
#192 On
SendMultiZoneCommand(cmd, ["@SRC:C", "@MSC:C", "@MSC:C"])
log('Sending ON Command') <$"ka 01 01\r"$>
 
#420 CDR
SendMultiZoneCommand(cmd, ["@SRC:D", "@MSC:D", "@MSC:D"])
 
#178 DSS
SendMultiZoneCommand(cmd, ["@SRC:4", "@MSC:4", "@MSC:4"])


#165 DVD
InputsInput commands not implemented: Antenna, Tuner - Digital (Click to add)
SendMultiZoneCommand(cmd, ["@SRC:2", "@MSC:2", "@MSC:2"])
#316 AV 1
log('Switching Input to AV1') <$"kb 01 02\r"$>


#170 FM
#317 AV 2
SendMultiZoneCommand(cmd, ["@SRC:G", "@MSC:G", "@MSC:G"])
log('Switching Input to AV2') <$"kb 01 03\r"$>


#160 Tape / Tape 1
#712 Component 1
SendMultiZoneCommand(cmd, ["@SRC:E", "@MSC:E", "@MSC:E"])
log('Switching Input to Component 1') <$"kb 01 04\r"$>


#166 Tuner
#361 HDMI
SendMultiZoneCommand(cmd, ["@SRC:F", "@MSC:F", "@MSC:F"])
log('Switching Input to HDMI 1') <$"kb 01 07\r"$>


#161 TV
#154 RGB
SendMultiZoneCommand(cmd, ["@SRC:1", "@MSC:1", "@MSC:1"])
log('Switching Input to RGB/PC') <$"kb 01 06\r"$>


#282 VCR-1
Aspect Ratios
SendMultiZoneCommand(cmd, ["@SRC:3", "@MSC:3", "@MSC:3"])
#879 16:9
log('Aspect Ratio 16:9') <$"kc 01 02\r"$>


DSP Modes (Audio)
#877 4:3
#891 All Ch Stereo
log('Aspect Ratio 4:3') <$"kc 01 01\r"$>
#<$"@SUR:0H\r"$> SendIrCommand("@SUR:0H")


Disk Handle
DSP Modes
#48 Eject Disk
#116 DSP Mode


General
General
#190 Enter/Go
#190 Enter/Go
log('Sending Enter/Go Command') <$"mc 01 44\r"$>


Internal
Internal
#373 Private Method Listing
#373 Private Method Listing
def ReceiveReportCommand() buff = conn_.RecvDelimited("\r", 1000) print "Cmd response from Marantz: " + buff + "\n" log("Cmd response from Marantz: " + buff + "\n") end def SendIrCommand(command) conn_.Send(command+ "\r") log("Sending Command: " + command + "\n") ReceiveReportCommand() end def log(word) logTime = Time.now timeStr = logTime.strftime("%d-%m-%Y %H:%M:%S ") print( timeStr + " " + word) if( $logFile.nil? == false ) then $logFile.print( timeStr + " " + word ) $logFile.flush() end end def SendMultiZoneCommand(cmd, commandsArray, commandParam="") log("Got Command with ID: " + cmd.id_.to_s + " from: " + cmd.devidfrom_.to_s + " to: " + cmd.devidto_.to_s + "\n") zone = GetZone(cmd.devidto_) if( zone >= 0 and zone < commandsArray.size ) log("Determine zone for command : " + zone.to_s + "\n") SendIrCommand(commandsArray[zone] + commandParam.to_s) else log("SendMultiZoneCommand: invalid zone " + zone.to_s) end end def GetZone(deviceDestination) if( device_.mapDevice_PortChannel_.has_key?(deviceDestination) and device_.mapDevice_PortChannel_[deviceDestination] != nil and !device_.mapDevice_PortChannel_[deviceDestination].empty? ) return device_.mapDevice_PortChannel_[deviceDestination].to_i end return 0 end def ShowZones() log("####### Dev 2 PortChanel") device_.mapDevice_PortChannel_.each do |key, value| log(key.to_s + " => " + value.to_s) end log("======= PortChanel 2 Dev") device_.mapPortChannel_Device_.each do |key, value| log(key.to_s + " => " + value.to_s) end end
def log(line) $log = File.open("/var/log/pluto/" + device_.devid_.to_s + "_Generic_Serial_Device.log", "a") $log.puts "(***):" + line.to_s $log.close end


#351 Process IDLE
#351 Process IDLE
Line 63: Line 53:


#350 Process Incoming Data
#350 Process Incoming Data
buff = conn_.RecvDelimited("\r", 1000) print "Info from Marantz: " + buff + "\n" log("Info from Marantz: " + buff + "\n")
buff = '' while(true) buff=conn_.Recv(30,200) if(buff.length() == 0) log('Nothing Received') break end log('Received: ' + Regexp.escape(buff.to_s)) if !buff.index("OK").nil? log(Regexp.escape(buff.to_s) + ': Command Processed Successfully') elsif !buff.index("NG").nil? log(Regexp.escape(buff.to_s) +': Command Processed Unsuccessfully') end end


#355 Process Initialize
#355 Process Initialize
$logFile = File.new("/var/log/pluto/Marantz_SR5600.log", "w") log("Initializing Marantz GSD Device\n") #<$"@AST:F\r"$> # max level of feedback SendIrCommand("@AST:F") #<$"@MPW:2\r"$> # multi room always on SendIrCommand("@MPW:2") #<$"@MSP:1\r"$> # turn multi room speakers off by default SendIrCommand("@MSP:1") #<$"@MAM:2\r"$> # mute multi room line out by default SendIrCommand("MAM:2") #<$"@VOL:0-20\r"$> # default main volume -20 SendIrCommand("@VOL:0-20") #<$"@MSV:0-60\r"$> # default multi speaker volume SendIrCommand("@MSV:0-60") #<$"@MVL:0-60\r"$> # default multi room line out volume SendIrCommand("@MVL:0-60") log("Initialization of Marantz GSD Device finished !!!!\n")
for iRetry in 0...4 print "Initializing unit\n" conn_.Send("ke 01 01\r") # Send UnMute Command buf = conn_.Recv(30,200) # Expected Return # ke 01 01\r\ne 00 OK01x\r\n if !buf.nil? && !buf.index("OK").nil? print "Initialized ok\n" print "Setting volume to 30%\n" cmd_313(15) SetDeviceDataInDB( device_.devid_, 158, "15" ) # 158 = DEVICEDATA_Volume_Level_CONST return end print "Failed to initialize. Wait 1 secs and try again\n" sleep(1) end #DisableDevice( device_.devid_, true ) #print "The device would not respond. Disabling it.\n"


#384 Process Receive Command For Child
#384 Process Receive Command For Child
Line 72: Line 62:


#356 Process Release
#356 Process Release
log("Shutting down Marantz GSD Device\n") SendIrCommand("@MAM:2") SendIrCommand("@MSP:1") log("Sending Marantz : Power Off: PWR:1\n") #<$"@PWR:1\r"</s></s>$> SendIrCommand("@PWR:1")


Misc
Misc
#587 Preset/Prog/Freq
#587 Preset/Prog/Freq
identifier = cmd.params_[216] # Main volume "TFQ:0xxxxx" from 08700 till + 10800 # Multiroom Frequency “MTF:0xxxxx“ from 08700 till + 10800 # Multiroom Speakers “MTF:0xxxxx“ from 08700 till + 10800 # switch to tuner mode first SendMultiZoneCommand(cmd, ["@SRC:G", "@MSC:G", "@MSC:G"]) # tune to desired frequency SendMultiZoneCommand(cmd, ["@TFQ:0"+identifier, "@MTF:0"+identifier, "@MTF:0"+identifier]) log("Sending Marantz : Setting tuner frequency to "+identifier+"\n")


On-Screen Menu Navig
#676 Video Mute
#240 Back / Prior Menu
log('Sending Video Mute Command') <$"kd 01 00\r"$>
 
#683 Zoom
log('Aspect Ratio 16:9') <$"kc 01 05\r"$>
 
Numbers
#204 0
log('Sending 0 ') <$"mc 01 10\r"$>
 
#205 1
log('Sending 1 ') <$"mc 01 11\r"$>
 
#206 2
log('Sending 2 ') <$"mc 01 12r"$>
 
#207 3
log('Sending 3 ') <$"mc 01 13\r"$>
 
#208 4
log('Sending 4 ') <$"mc 01 14\r"$>
 
#209 5
log('Sending 5 ') <$"mc 01 15\r"$>
 
#210 6
log('Sending 6 ') <$"mc 01 16\r"$>
 
#211 7
log('Sending 7 ') <$"mc 01 17\r"$>


#225 Display
#212 8
log('Sending 8 ') <$"mc 01 18\r"$>


#368 Help
#213 9
log('Sending 9 ') <$"mc 01 19\r"$>


On-Screen Menu Navig
#86 Menu (Show Menu)
#86 Menu (Show Menu)
log('Sending Menu Command') <$"mc 01 43\r"$>


#201 Move Down
#201 Move Down
log('Menu Down') <$"mc 01 41\r"$>


#202 Move Left
#202 Move Left
log('Menu Left') <$"mc 01 07\r"$>


#203 Move Right
#203 Move Right
log('Menu Right') <$"mc 01 06\r"$>


#200 Move Up
#200 Move Up
log('Menu Up') <$"mc 01 40\r"$>
Picture Control
#224 Brightness Down


Simple Control
#223 Brightness Up
#92 Pause


#139 Play
#221 Contrast Down


#102 Record
#220 Contrast Up


Simple Control
#64 Skip Back - Channel/Track Lower
#64 Skip Back - Channel/Track Lower


#63 Skip Fwd - Channel/Track Greater
#63 Skip Fwd - Channel/Track Greater
#95 Stop


Sound & Volume
Sound & Volume
#97 Mute
#97 Mute
SendMultiZoneCommand(cmd, ["@AMT:0", "@MSM:0", "@MAM:0"])
if(@mute) <$"ke 01 00\r"$> else <$"ke 01 01\r"$> end @mute=!@mute


#313 Set Volume
#313 Set Volume
level = cmd.params_[76] # Main volume “VOL:0xxx” from - 99 till + 18 # Multiroom Speakers "MSV:0xxx" from - 99 till + 0 # Multiroom Speakers “MVL:0xxx” from - 99 till + 0 SendMultiZoneCommand(cmd, ["@VOL:0"+level, "@MSV:0"+level, "@MVL:0"+level]) log("Sending Marantz : Set Volume Level to "+level+"\n")
@volume=level.to_i() ilevel = @volume.to_i log( 'setting volume to '+ ilevel.to_s) log('Sending the Following Command: kf 01 '+ilevel.to_s(16)+'\r') <$"kf 01 "+ilevel.to_s(16)+"\r"$> SetDeviceDataInDB( device_.devid_, 158, ilevel .to_s) # 158DEVICEDATA_Volume_Level_CONST # "volume and corresponding device data set\n"


#90 Vol Down
#90 Vol Down
SendMultiZoneCommand(cmd, ["@VOL:2", "@MSV:2", "@MVL:2"])
log('lowering volume from ' + @volume.to_s) cmd_313(@volume-1)


#89 Vol Up
#89 Vol Up
SendMultiZoneCommand(cmd, ["@VOL:1", "@MSV:1", "@MVL:1"])
log('Increasing volume from ' + @volume.to_s) cmd_313(@volume+1)
 
Speed Ctrl
#125 Scan Back/Rewind
 
#93 Scan Fwd/Fast Fwd
 
#98 Slow Scan Back
 
#99 Slow Scan Forward
 
DSP ModesDSP Mode commands not implemented: Dolby Digital, DTS Surround, Surround (Click to add)
 
 
 
def ReceiveReportCommand()
buff = conn_.RecvDelimited("\r", 1000)
print "Cmd response from Marantz: " + buff + "\n"
log("Cmd response from Marantz: " + buff + "\n")
end
 
def SendIrCommand(command)
conn_.Send(command+ "\r")
        log("Sending Command: " + command + "\n")
ReceiveReportCommand()
end
 
def log(word)
logTime = Time.now
timeStr = logTime.strftime("%d-%m-%Y  %H:%M:%S  ")
 
print( timeStr + " " + word)
if( $logFile.nil? == false ) then
$logFile.print( timeStr + " " + word )
$logFile.flush()
end
end
 
def SendMultiZoneCommand(cmd, commandsArray, commandParam="")
        log("Got Command with ID: " + cmd.id_.to_s + " from: " + cmd.devidfrom_.to_s + " to: " + cmd.devidto_.to_s + "\n")
zone = GetZone(cmd.devidto_)
if( zone >= 0 and zone < commandsArray.size )
log("Determine zone for command : " + zone.to_s + "\n")
SendIrCommand(commandsArray[zone] + commandParam.to_s)
else
log("SendMultiZoneCommand: invalid zone " + zone.to_s)
end
end
 
def GetZone(deviceDestination)
if( device_.mapDevice_PortChannel_.has_key?(deviceDestination) and
device_.mapDevice_PortChannel_[deviceDestination] != nil and
!device_.mapDevice_PortChannel_[deviceDestination].empty? )
return device_.mapDevice_PortChannel_[deviceDestination].to_i
end
return 0
end
 
def ShowZones()
log("####### Dev 2 PortChanel")
device_.mapDevice_PortChannel_.each do |key, value|
log(key.to_s + " => " + value.to_s)
end
log("======= PortChanel 2 Dev")
device_.mapPortChannel_Device_.each do |key, value|
log(key.to_s + " => " + value.to_s)
end
end
 
 
buff = conn_.RecvDelimited("\r", 1000)
print "Info from Marantz: " + buff + "\n"
log("Info from Marantz: " + buff + "\n")
 
 
$logFile = File.new("/var/log/pluto/Marantz_SR5600.log", "w")
log("Initializing Marantz GSD Device\n")
 
 
#<$"@AST:F\r"$> # max level of feedback
SendIrCommand("@AST:F")
 
 
#<$"@MPW:2\r"$> # multi room always on
SendIrCommand("@MPW:2")
 
#<$"@MSP:1\r"$> # turn multi room speakers off by default
SendIrCommand("@MSP:1")
 
#<$"@MAM:2\r"$> # mute multi room line out by default
SendIrCommand("MAM:2")
 
#<$"@VOL:0-20\r"$> # default main volume -20
SendIrCommand("@VOL:0-20")
#<$"@MSV:0-60\r"$> # default multi speaker volume
SendIrCommand("@MSV:0-60")
#<$"@MVL:0-60\r"$> # default multi room line out volume
SendIrCommand("@MVL:0-60")
 
log("Initialization of Marantz GSD Device finished !!!!\n")
 
 
 
 
 
log("Shutting down Marantz GSD Device\n")
SendIrCommand("@MAM:2")
SendIrCommand("@MSP:1")
log("Sending Marantz : Power Off:  PWR:1\n")
#<$"@PWR:1\r"</s></s>$>
SendIrCommand("@PWR:1")
 
 
 
identifier = cmd.params_[216]
# Main volume "TFQ:0xxxxx"  from 08700 till + 10800
# Multiroom Frequency “MTF:0xxxxx“  from 08700 till + 10800
# Multiroom Speakers “MTF:0xxxxx“  from 08700 till + 10800
 
# switch to tuner mode first
SendMultiZoneCommand(cmd, ["@SRC:G", "@MSC:G", "@MSC:G"])
 
# tune to desired frequency
SendMultiZoneCommand(cmd, ["@TFQ:0"+identifier, "@MTF:0"+identifier, "@MTF:0"+identifier])
log("Sending Marantz : Setting tuner frequency to "+identifier+"\n")
 
 




level = cmd.params_[76]
</nowiki></pre>
# Main volume “VOL:0xxx”  from - 99 till + 18
# Multiroom Speakers "MSV:0xxx"  from - 99 till + 0
# Multiroom Speakers “MVL:0xxx”  from - 99 till + 0
SendMultiZoneCommand(cmd, ["@VOL:0"+level, "@MSV:0"+level, "@MVL:0"+level])
log("Sending Marantz : Set Volume Level to "+level+"\n")

Latest revision as of 21:34, 29 June 2008

Temporary copy of LG LCD TV template (based on existing LG_42LB5D template)

'Add Ruby snippets to commands'

Simpler commands from Ruby part of template :

 Power
#193 Off
	log('Sending OFF Command') <$"ka 01 00\r"$> 	

#192 On
	log('Sending ON Command') <$"ka 01 01\r"$> 	

InputsInput commands not implemented: Antenna, Tuner - Digital (Click to add)
#316 AV 1
	log('Switching Input to AV1') <$"kb 01 02\r"$> 	

#317 AV 2
	log('Switching Input to AV2') <$"kb 01 03\r"$> 	

#712 Component 1
	log('Switching Input to Component 1') <$"kb 01 04\r"$> 	

#361 HDMI
	log('Switching Input to HDMI 1') <$"kb 01 07\r"$> 	

#154 RGB
	log('Switching Input to RGB/PC') <$"kb 01 06\r"$> 	

Aspect Ratios
#879 16:9
	log('Aspect Ratio 16:9') <$"kc 01 02\r"$> 	

#877 4:3
	log('Aspect Ratio 4:3') <$"kc 01 01\r"$> 	

DSP Modes
#116 DSP Mode
		

General
#190 Enter/Go
	log('Sending Enter/Go Command') <$"mc 01 44\r"$> 	

Internal
#373 Private Method Listing
	def log(line) $log = File.open("/var/log/pluto/" + device_.devid_.to_s + "_Generic_Serial_Device.log", "a") $log.puts "(***):" + line.to_s $log.close end 	

#351 Process IDLE
		

#350 Process Incoming Data
	buff = '' while(true) buff=conn_.Recv(30,200) if(buff.length() == 0) log('Nothing Received') break end log('Received: ' + Regexp.escape(buff.to_s)) if !buff.index("OK").nil? log(Regexp.escape(buff.to_s) + ': Command Processed Successfully') elsif !buff.index("NG").nil? log(Regexp.escape(buff.to_s) +': Command Processed Unsuccessfully') end end 	

#355 Process Initialize
	for iRetry in 0...4 print "Initializing unit\n" conn_.Send("ke 01 01\r") # Send UnMute Command buf = conn_.Recv(30,200) # Expected Return # ke 01 01\r\ne 00 OK01x\r\n if !buf.nil? && !buf.index("OK").nil? print "Initialized ok\n" print "Setting volume to 30%\n" cmd_313(15) SetDeviceDataInDB( device_.devid_, 158, "15" ) # 158 = DEVICEDATA_Volume_Level_CONST return end print "Failed to initialize. Wait 1 secs and try again\n" sleep(1) end #DisableDevice( device_.devid_, true ) #print "The device would not respond. Disabling it.\n" 	

#384 Process Receive Command For Child
		

#356 Process Release
		

Misc
#587 Preset/Prog/Freq
		

#676 Video Mute
	log('Sending Video Mute Command') <$"kd 01 00\r"$> 	

#683 Zoom
	log('Aspect Ratio 16:9') <$"kc 01 05\r"$> 	

Numbers
#204 0
	log('Sending 0 ') <$"mc 01 10\r"$> 	

#205 1
	log('Sending 1 ') <$"mc 01 11\r"$> 	

#206 2
	log('Sending 2 ') <$"mc 01 12r"$> 	

#207 3
	log('Sending 3 ') <$"mc 01 13\r"$> 	

#208 4
	log('Sending 4 ') <$"mc 01 14\r"$> 	

#209 5
	log('Sending 5 ') <$"mc 01 15\r"$> 	

#210 6
	log('Sending 6 ') <$"mc 01 16\r"$> 	

#211 7
	log('Sending 7 ') <$"mc 01 17\r"$> 	

#212 8
	log('Sending 8 ') <$"mc 01 18\r"$> 	

#213 9
	log('Sending 9 ') <$"mc 01 19\r"$> 	

On-Screen Menu Navig
#86 Menu (Show Menu)
	log('Sending Menu Command') <$"mc 01 43\r"$> 	

#201 Move Down
	log('Menu Down') <$"mc 01 41\r"$> 	

#202 Move Left
	log('Menu Left') <$"mc 01 07\r"$> 	

#203 Move Right
	log('Menu Right') <$"mc 01 06\r"$> 	

#200 Move Up
	log('Menu Up') <$"mc 01 40\r"$> 	

Picture Control
#224 Brightness Down
		

#223 Brightness Up
		

#221 Contrast Down
		

#220 Contrast Up
		

Simple Control
#64 Skip Back - Channel/Track Lower
		

#63 Skip Fwd - Channel/Track Greater
		

Sound & Volume
#97 Mute
	if(@mute) <$"ke 01 00\r"$> else <$"ke 01 01\r"$> end @mute=!@mute 	

#313 Set Volume
	@volume=level.to_i() ilevel = @volume.to_i log( 'setting volume to '+ ilevel.to_s) log('Sending the Following Command: kf 01 '+ilevel.to_s(16)+'\r') <$"kf 01 "+ilevel.to_s(16)+"\r"$> SetDeviceDataInDB( device_.devid_, 158, ilevel .to_s) # 158DEVICEDATA_Volume_Level_CONST # "volume and corresponding device data set\n" 	

#90 Vol Down
	log('lowering volume from ' + @volume.to_s) cmd_313(@volume-1) 	

#89 Vol Up
	log('Increasing volume from ' + @volume.to_s) cmd_313(@volume+1)