2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 20:57:11 +00:00

49_SSCam: fix version numbering

git-svn-id: https://svn.fhem.de/fhem/trunk@18411 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2019-01-25 13:17:13 +00:00
parent 8599dd7bfb
commit 6379fbe86d
2 changed files with 29 additions and 3 deletions

View File

@ -1,5 +1,6 @@
# 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.
- bugfix: 49_SSCam: fix version numbering
- bugfix: 93_DbRep: fix version numbering
- feature: 98_livetracking: added events for OwnTrack zones
- feature: 93_DbRep: command exportToFile or attribute "expimpfile" accept

View File

@ -47,6 +47,7 @@ use Encode;
# Versions History intern
our %SSCam_vNotesIntern = (
"8.6.2" => "25.01.2019 fix version numbering ",
"8.6.1" => "21.01.2019 time format in readings and galleries depends from global language attribute, minor bug fixes ",
"8.6.0" => "20.01.2019 new attribute snapReadingRotate ",
"8.5.0" => "17.01.2019 SVS device has \"snapCams\" command ",
@ -120,6 +121,7 @@ our %SSCam_vNotesIntern = (
# Versions History extern
our %SSCam_vNotesExtern = (
"8.6.2" => "25.01.2019 fix version numbering ",
"8.6.1" => "21.01.2019 new attribute \"snapReadingRotate\" to activate versioning of snap data, ".
"time format in readings and galleries depends from global language attribute ",
"8.5.0" => "17.01.2019 SVS device has \"snapCams\" command. Now are able to take snapshots of all defined cameras and may ".
@ -399,7 +401,7 @@ sub SSCam_Define($@) {
$hash->{SERVERADDR} = $serveraddr;
$hash->{SERVERPORT} = $serverport;
$hash->{CAMNAME} = $camname;
$hash->{VERSION} = (reverse sort(keys %SSCam_vNotesIntern))[0];
$hash->{VERSION} = (SSCam_sortVersion("desc",keys %SSCam_vNotesIntern))[0];
$hash->{MODEL} = ($camname =~ m/^SVS$/i)?"SVS":"CAM"; # initial, CAM wird später ersetzt durch CamModel
$hash->{PROTOCOL} = $proto;
$hash->{COMPATIBILITY} = $compstat; # getestete SVS-version Kompatibilität
@ -1513,7 +1515,7 @@ sub SSCam_Get($@) {
}
}
$i = 0;
foreach my $key (reverse sort(keys %hs)) {
foreach my $key (SSCam_sortVersion("desc",keys %hs)) {
$val0 = $hs{$key};
$ret .= sprintf("<td style=\"vertical-align:top\"><b>$key</b> </td><td style=\"vertical-align:top\">$val0</td>" );
$ret .= "</tr>";
@ -1538,7 +1540,7 @@ sub SSCam_Get($@) {
$ret .= "<tbody>";
$ret .= "<tr class=\"even\">";
$i = 0;
foreach my $key (reverse sort(keys %SSCam_vNotesExtern)) {
foreach my $key (SSCam_sortVersion("desc",keys %SSCam_vNotesExtern)) {
($val0,$val1) = split(/\s/,$SSCam_vNotesExtern{$key},2);
$ret .= sprintf("<td style=\"vertical-align:top\"><b>$key</b> </td><td style=\"vertical-align:top\">$val0 </td><td>$val1</td>" );
$ret .= "</tr>";
@ -7300,6 +7302,29 @@ sub SSCam_experror ($$) {
return ($error);
}
################################################################
# sortiert eine Liste von Versionsnummern x.x.x
# Schwartzian Transform and the GRT transform
# Übergabe: "asc | desc",<Liste von Versionsnummern>
################################################################
sub SSCam_sortVersion (@){
my ($sseq,@versions) = @_;
my @sorted = map {$_->[0]}
sort {$a->[1] cmp $b->[1]}
map {[$_, pack "C*", split /\./]} @versions;
@sorted = map {join ".", unpack "C*", $_}
sort
map {pack "C*", split /\./} @versions;
if($sseq eq "desc") {
@sorted = reverse @sorted;
}
return @sorted;
}
##############################################################################
# Zusätzliche Redings in Rotation erstellen
# Sub ($hash,<readingName>,<Wert>,<Rotationszahl>,<Trigger[0|1]>)