mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-30 12:07:09 +00:00
71_YAMAHA_NP: More secure FM frequency input.
git-svn-id: https://svn.fhem.de/fhem/trunk@10227 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3186414bd3
commit
f1fb1fb0f1
@ -703,45 +703,45 @@ sub YAMAHA_NP_Set
|
||||
}
|
||||
elsif($what eq "tunerFMFrequency")
|
||||
{
|
||||
if(length($a[2]) <= 6 and length($a[2]) >= 5) # Check the string length (x)xx.xx
|
||||
{
|
||||
if ( $a[2] =~ /^[0-9,.E]+$/ ) # Check if value is numeric
|
||||
{
|
||||
if( $a[2] >= 87.50 and $a[2] <= 108.00) # Check if within the value range
|
||||
{
|
||||
if(substr($a[2], -3, 1) eq '.') # Check for decimal point
|
||||
{
|
||||
my $lastDigit = substr($a[2], -1, 1);
|
||||
if(($lastDigit eq "0") or ($lastDigit eq "5"))
|
||||
{
|
||||
my $frequency = $a[2];
|
||||
$frequency =~ s/\.//; # Remove decimal point
|
||||
YAMAHA_NP_SendCommand($hash, "<YAMAHA_AV cmd=\"PUT\"><Tuner><Play_Control><Tuning><FM><Freq>".$frequency."<\/Freq><\/FM><\/Tuning><\/Play_Control><\/Tuner></YAMAHA_AV>", "tunerFMFrequency", $a[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Last digit must be '0' or '5'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Missing decimal point. Accepted format (x)xx.xx"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Frequency value must be in the range 87.50 ... 108.00 of the format (x)xx.xx";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Frequency value must be numeric in the range 87.50 ... 108.00 of the format (x)xx.xx";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Frequency length must be 5 or 6 characters e.g. 89.50 or 108.00";
|
||||
}
|
||||
if(length($a[2]) <= 6 and length($a[2]) >= 5) # Check the string length (x)xx.xx
|
||||
{
|
||||
if ( $a[2] =~ /^[0-9,.E]+$/ ) # Check if value is numeric
|
||||
{
|
||||
if(substr($a[2], -3, 1) eq '.') # Check for decimal point
|
||||
{
|
||||
if( $a[2] >= 87.50 and $a[2] <= 108.00) # Check if within the value range
|
||||
{
|
||||
my $lastDigit = substr($a[2], -1, 1);
|
||||
if(($lastDigit eq "0") or ($lastDigit eq "5"))
|
||||
{
|
||||
my $frequency = $a[2];
|
||||
$frequency =~ s/\.//; # Remove decimal point
|
||||
YAMAHA_NP_SendCommand($hash, "<YAMAHA_AV cmd=\"PUT\"><Tuner><Play_Control><Tuning><FM><Freq>".$frequency."<\/Freq><\/FM><\/Tuning><\/Play_Control><\/Tuner></YAMAHA_AV>", "tunerFMFrequency", $a[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Last digit must be '0' or '5'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Frequency value must be in the range 87.50 ... 108.00 of the format (x)xx.xx";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Missing decimal point. Accepted format (x)xx.xx";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Frequency value must be numeric in the range 87.50 ... 108.00 of the format (x)xx.xx";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Frequency length must be 5 or 6 characters e.g. 89.50 or 108.00";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,12 +1,23 @@
|
||||
attr global userattr cmdIcon devStateIcon devStateStyle icon sortby webCmd widgetOverride
|
||||
attr global autoload_undefined_devices 1
|
||||
attr global logfile ./log/fhem-%Y-%m.log
|
||||
attr global modpath .
|
||||
attr global motd SecurityCheck:\
|
||||
\
|
||||
WEB,WEBphone,WEBtablet has no basicAuth attribute.\
|
||||
telnetPort has no password/globalpassword attribute.\
|
||||
Running with root privileges.\
|
||||
Restart FHEM for a new check if the problem is fixed,\
|
||||
or set the global attribute motd to none to supress this message.\
|
||||
|
||||
attr global statefile ./log/fhem.save
|
||||
attr global updateInBackground 1
|
||||
attr global verbose 3
|
||||
attr global updateInBackground
|
||||
|
||||
define telnetPort telnet 7072 global
|
||||
|
||||
define WEB FHEMWEB 8083 global
|
||||
attr WEB editConfig 1
|
||||
|
||||
define WEBphone FHEMWEB 8084 global
|
||||
attr WEBphone stylesheetPrefix smallscreen
|
||||
@ -17,10 +28,13 @@ attr WEBtablet stylesheetPrefix touchpad
|
||||
# Fake FileLog entry, to access the fhem log from FHEMWEB
|
||||
define Logfile FileLog ./log/fhem-%Y-%m.log fakelog
|
||||
|
||||
|
||||
define autocreate autocreate
|
||||
attr autocreate filelog ./log/%NAME-%Y.log
|
||||
|
||||
define eventTypes eventTypes ./log/eventTypes.txt
|
||||
|
||||
# Disable this to avoid looking for new USB devices on startup
|
||||
define initialUsbCheck notify global:INITIALIZED usb create
|
||||
define initialUsbCheck notify global:INITIALIZED usb create
|
||||
|
||||
define NP_test YAMAHA_NP 192.168.1.15 30 10
|
||||
|
Loading…
x
Reference in New Issue
Block a user