mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
71_YAMAHA_NP.pm: Code clean-up after 'perlcritic' check.
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@7674 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
81633d26a7
commit
4142b556de
1
CHANGED
1
CHANGED
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- chamged: 71_YAMAHA_NP.pm: Perl code clean-up after 'perlcritic' check.
|
||||||
- feature: 71_YAMAHA_NP.pm: New readings: tunerModeDAB, tunerBitrateDAB, tunerAudioModeDAB, tunerFrequencyDAB. New internals: NP_ICON_x, UDN, Friendly_Name
|
- feature: 71_YAMAHA_NP.pm: New readings: tunerModeDAB, tunerBitrateDAB, tunerAudioModeDAB, tunerFrequencyDAB. New internals: NP_ICON_x, UDN, Friendly_Name
|
||||||
- changed: 73_km200.pm: More services found.
|
- changed: 73_km200.pm: More services found.
|
||||||
- bugfix: FB_CALLMONITOR: read phonebooks after all attributes are set
|
- bugfix: FB_CALLMONITOR: read phonebooks after all attributes are set
|
||||||
|
@ -46,15 +46,15 @@ use Time::Piece;
|
|||||||
use POSIX qw{strftime};
|
use POSIX qw{strftime};
|
||||||
use HttpUtils;
|
use HttpUtils;
|
||||||
|
|
||||||
sub YAMAHA_NP_Get($@);
|
#sub YAMAHA_NP_Get($@);
|
||||||
sub YAMAHA_NP_Define($$);
|
#sub YAMAHA_NP_Define($$);
|
||||||
sub YAMAHA_NP_GetStatus($;$);
|
#sub YAMAHA_NP_GetStatus($;$);
|
||||||
sub YAMAHA_NP_Attr(@);
|
#sub YAMAHA_NP_Attr(@);
|
||||||
sub YAMAHA_NP_ResetTimer($;$);
|
#sub YAMAHA_NP_ResetTimer($;$);
|
||||||
sub YAMAHA_NP_Undefine($$);
|
#sub YAMAHA_NP_Undefine($$);
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
sub YAMAHA_NP_Initialize($)
|
sub YAMAHA_NP_Initialize
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ sub YAMAHA_NP_Initialize($)
|
|||||||
}
|
}
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
sub YAMAHA_NP_GetStatus($;$)
|
sub YAMAHA_NP_GetStatus
|
||||||
{
|
{
|
||||||
my ($hash, $local) = @_;
|
my ($hash, $local) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
@ -104,7 +104,7 @@ sub YAMAHA_NP_GetStatus($;$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
sub YAMAHA_NP_Get($@)
|
sub YAMAHA_NP_Get
|
||||||
{
|
{
|
||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
my $what;
|
my $what;
|
||||||
@ -140,7 +140,7 @@ sub YAMAHA_NP_Get($@)
|
|||||||
|
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
sub YAMAHA_NP_Set($@)
|
sub YAMAHA_NP_Set
|
||||||
{
|
{
|
||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
@ -613,7 +613,7 @@ sub YAMAHA_NP_Set($@)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
sub YAMAHA_NP_Define($$)
|
sub YAMAHA_NP_Define
|
||||||
{
|
{
|
||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
@ -666,12 +666,12 @@ sub YAMAHA_NP_Define($$)
|
|||||||
$hash->{helper}{DISABLED} = 0 unless(exists($hash->{helper}{DISABLED}));
|
$hash->{helper}{DISABLED} = 0 unless(exists($hash->{helper}{DISABLED}));
|
||||||
YAMAHA_NP_ResetTimer($hash,0);
|
YAMAHA_NP_ResetTimer($hash,0);
|
||||||
|
|
||||||
return undef;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
sub YAMAHA_NP_Attr(@)
|
sub YAMAHA_NP_Attr
|
||||||
{
|
{
|
||||||
my @a = @_;
|
my @a = @_;
|
||||||
my $hash = $defs{$a[1]};
|
my $hash = $defs{$a[1]};
|
||||||
@ -697,18 +697,17 @@ sub YAMAHA_NP_Attr(@)
|
|||||||
# Start/Stop Timer according to new disabled-Value
|
# Start/Stop Timer according to new disabled-Value
|
||||||
YAMAHA_NP_ResetTimer($hash);
|
YAMAHA_NP_ResetTimer($hash);
|
||||||
|
|
||||||
return undef;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
sub
|
sub YAMAHA_NP_Undefine
|
||||||
YAMAHA_NP_Undefine($$)
|
|
||||||
{
|
{
|
||||||
my($hash, $name) = @_;
|
my($hash, $name) = @_;
|
||||||
|
|
||||||
# Stop the internal GetStatus-Loop and exit
|
# Stop the internal GetStatus-Loop and exit
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
return undef;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -722,7 +721,7 @@ YAMAHA_NP_Undefine($$)
|
|||||||
|
|
||||||
#############################
|
#############################
|
||||||
# sends a command to the receiver via HTTP
|
# sends a command to the receiver via HTTP
|
||||||
sub YAMAHA_NP_SendCommand($@)
|
sub YAMAHA_NP_SendCommand
|
||||||
{
|
{
|
||||||
my ($hash, $data,$cmd,$arg,$blocking) = @_;
|
my ($hash, $data,$cmd,$arg,$blocking) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
@ -787,7 +786,7 @@ sub YAMAHA_NP_SendCommand($@)
|
|||||||
|
|
||||||
#############################
|
#############################
|
||||||
# parses the receiver response
|
# parses the receiver response
|
||||||
sub YAMAHA_NP_ParseResponse ($$$)
|
sub YAMAHA_NP_ParseResponse
|
||||||
{
|
{
|
||||||
my ( $param, $err, $data ) = @_;
|
my ( $param, $err, $data ) = @_;
|
||||||
|
|
||||||
@ -1162,7 +1161,7 @@ sub YAMAHA_NP_ParseResponse ($$$)
|
|||||||
|
|
||||||
YAMAHA_NP_ResetTimer($hash, 5);
|
YAMAHA_NP_ResetTimer($hash, 5);
|
||||||
|
|
||||||
return undef;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif($cmd eq "off")
|
elsif($cmd eq "off")
|
||||||
@ -1176,7 +1175,7 @@ sub YAMAHA_NP_ParseResponse ($$$)
|
|||||||
|
|
||||||
YAMAHA_NP_ResetTimer($hash, 3);
|
YAMAHA_NP_ResetTimer($hash, 3);
|
||||||
|
|
||||||
return undef;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif($cmd eq "mute")
|
elsif($cmd eq "mute")
|
||||||
@ -1187,8 +1186,7 @@ sub YAMAHA_NP_ParseResponse ($$$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif($cmd eq "volume" or $cmd eq "volumeStraight" or $cmd eq "volumeUp" or $cmd eq "volumeDown")
|
elsif($cmd eq "volume" or $cmd eq "volumeStraight" or $cmd eq "volumeUp" or $cmd eq "volumeDown")
|
||||||
{
|
{
|
||||||
|
|
||||||
if($data =~ /RC="0"/)
|
if($data =~ /RC="0"/)
|
||||||
{
|
{
|
||||||
readingsBulkUpdate($hash, "volumeStraight", $hash->{helper}{targetVolume});
|
readingsBulkUpdate($hash, "volumeStraight", $hash->{helper}{targetVolume});
|
||||||
@ -1207,7 +1205,7 @@ sub YAMAHA_NP_ParseResponse ($$$)
|
|||||||
|
|
||||||
#############################
|
#############################
|
||||||
# Converts all Values to FHEM usable command lists
|
# Converts all Values to FHEM usable command lists
|
||||||
sub YAMAHA_NP_Param2Fhem($$)
|
sub YAMAHA_NP_Param2Fhem
|
||||||
{
|
{
|
||||||
my ($param, $replace_pipes) = @_;
|
my ($param, $replace_pipes) = @_;
|
||||||
|
|
||||||
@ -1223,28 +1221,27 @@ sub YAMAHA_NP_Param2Fhem($$)
|
|||||||
|
|
||||||
#############################
|
#############################
|
||||||
# Returns the Yamaha Parameter Name for the FHEM like equivalent
|
# Returns the Yamaha Parameter Name for the FHEM like equivalent
|
||||||
sub YAMAHA_NP_getParamName($$$)
|
sub YAMAHA_NP_getParamName
|
||||||
{
|
{
|
||||||
my ($hash, $name, $list) = @_;
|
my ($hash, $name, $list) = @_;
|
||||||
my $item;
|
|
||||||
|
return if(not defined($list));
|
||||||
return undef if(not defined($list));
|
|
||||||
|
|
||||||
my @commands = split("\\|", $list);
|
my @commands = split("\\|", $list);
|
||||||
|
|
||||||
foreach $item (@commands)
|
foreach my $item (@commands)
|
||||||
{
|
{
|
||||||
if(YAMAHA_NP_Param2Fhem($item, 0) eq $name)
|
if(YAMAHA_NP_Param2Fhem($item, 0) eq $name)
|
||||||
{
|
{
|
||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return undef;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
# queries the receiver model, system-id, version and all available zones
|
# queries the receiver model, system-id, version and all available zones
|
||||||
sub YAMAHA_NP_getModel($)
|
sub YAMAHA_NP_getModel
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
@ -1254,7 +1251,7 @@ sub YAMAHA_NP_getModel($)
|
|||||||
|
|
||||||
#############################
|
#############################
|
||||||
# queries the receiver model, system-id, version and all available zones
|
# queries the receiver model, system-id, version and all available zones
|
||||||
sub YAMAHA_NP_getMediaRendererDesc($)
|
sub YAMAHA_NP_getMediaRendererDesc
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
@ -1278,7 +1275,7 @@ sub YAMAHA_NP_getMediaRendererDesc($)
|
|||||||
|
|
||||||
#############################
|
#############################
|
||||||
# converts straight volume in percentage volume (volumestraightmin .. volumestraightmax => 0 .. 100%)
|
# converts straight volume in percentage volume (volumestraightmin .. volumestraightmax => 0 .. 100%)
|
||||||
sub YAMAHA_NP_volume_rel2abs($$)
|
sub YAMAHA_NP_volume_rel2abs
|
||||||
{
|
{
|
||||||
my ($hash, $percentage) = @_;
|
my ($hash, $percentage) = @_;
|
||||||
|
|
||||||
@ -1287,7 +1284,7 @@ sub YAMAHA_NP_volume_rel2abs($$)
|
|||||||
|
|
||||||
#############################
|
#############################
|
||||||
# converts percentage volume in decibel volume (0 .. 100% => volumestraightmin .. volumestraightmax)
|
# converts percentage volume in decibel volume (0 .. 100% => volumestraightmin .. volumestraightmax)
|
||||||
sub YAMAHA_NP_volume_abs2rel($$)
|
sub YAMAHA_NP_volume_abs2rel
|
||||||
{
|
{
|
||||||
my ($hash, $absolute) = @_;
|
my ($hash, $absolute) = @_;
|
||||||
|
|
||||||
@ -1304,7 +1301,7 @@ sub YAMAHA_NP_volume_abs2rel($$)
|
|||||||
|
|
||||||
#############################
|
#############################
|
||||||
# queries all available inputs and scenes
|
# queries all available inputs and scenes
|
||||||
sub YAMAHA_NP_getInputs($)
|
sub YAMAHA_NP_getInputs
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
@ -1316,7 +1313,7 @@ sub YAMAHA_NP_getInputs($)
|
|||||||
|
|
||||||
#############################
|
#############################
|
||||||
# Restarts the internal status request timer according to the given interval or current receiver state
|
# Restarts the internal status request timer according to the given interval or current receiver state
|
||||||
sub YAMAHA_NP_ResetTimer($;$)
|
sub YAMAHA_NP_ResetTimer
|
||||||
{
|
{
|
||||||
my ($hash, $interval) = @_;
|
my ($hash, $interval) = @_;
|
||||||
|
|
||||||
@ -1337,12 +1334,12 @@ sub YAMAHA_NP_ResetTimer($;$)
|
|||||||
InternalTimer(gettimeofday() + $hash->{helper}{OFF_INTERVAL}, "YAMAHA_NP_GetStatus", $hash, 0);
|
InternalTimer(gettimeofday() + $hash->{helper}{OFF_INTERVAL}, "YAMAHA_NP_GetStatus", $hash, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return undef;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
# convert all HTML entities into UTF-8 equivalent
|
# convert all HTML entities into UTF-8 equivalent
|
||||||
sub YAMAHA_NP_html2txt($)
|
sub YAMAHA_NP_html2txt
|
||||||
{
|
{
|
||||||
my ($string) = @_;
|
my ($string) = @_;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user