2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

73_AMADCommBridge: fix bug Undefined subroutine

git-svn-id: https://svn.fhem.de/fhem/trunk@19673 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
LeonGaultier 2019-06-20 20:34:51 +00:00
parent 7a94132003
commit 8fd0e82fe3
3 changed files with 20 additions and 43 deletions

View File

@ -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.
- bugfix: 73_AMADCommBridge: fix bug Undefined subroutine
- change: GPUtils: add modul header - change: GPUtils: add modul header
- feature: GPUtils: change Maintainer, add Export Fn - feature: GPUtils: change Maintainer, add Export Fn
- feature: 73_AMADCommBridge: change version code - feature: 73_AMADCommBridge: change version code

View File

@ -64,12 +64,10 @@ use strict;
use warnings; use warnings;
use POSIX; use POSIX;
use FHEM::Meta; use FHEM::Meta;
use GPUtils qw(GP_Import); use GPUtils qw(GP_Import GP_Export);
use HttpUtils; use HttpUtils;
use TcpServerUtils; use TcpServerUtils;
my $flowsetversion = '4.4.1';
my $missingModul = ''; my $missingModul = '';
eval "use Encode qw(encode encode_utf8);1" or $missingModul .= 'Encode '; eval "use Encode qw(encode encode_utf8);1" or $missingModul .= 'Encode ';
@ -176,22 +174,10 @@ BEGIN {
); );
} }
# _Export - Export references to main context using a different naming schema
sub _Export {
no strict qw/refs/; ## no critic
my $pkg = caller(0);
my $main = $pkg;
$main =~ s/^(?:.+::)?([^:]+)$/main::$1\_/g;
foreach (@_) {
*{ $main . $_ } = *{ $pkg . '::' . $_ };
}
}
#-- Export to main context with different name #-- Export to main context with different name
_Export( GP_Export(
qw( qw(
Initialize Initialize
Flowsetversion
) )
); );
@ -249,7 +235,7 @@ sub Define($$) {
$hash->{BRIDGE} = 1; $hash->{BRIDGE} = 1;
$hash->{PORT} = $port; $hash->{PORT} = $port;
$hash->{VERSION} = version->parse($VERSION)->normal; $hash->{VERSION} = version->parse($VERSION)->normal;
$hash->{VERSIONFLOWSET} = $flowsetversion; $hash->{VERSIONFLOWSET} = FHEM::Meta::Get( $hash, 'x_flowsetversion' );
CommandAttr( undef, $name . ' room AMAD' ) CommandAttr( undef, $name . ' room AMAD' )
if ( AttrVal( $name, 'room', 'none' ) eq 'none' ); if ( AttrVal( $name, 'room', 'none' ) eq 'none' );
@ -890,6 +876,8 @@ sub ProcessRead($$) {
my ( $hash, $buf ) = @_; my ( $hash, $buf ) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $flowsetversion =
$modules{AMADCommBridge}{defptr}{BRIDGE}->{VERSIONFLOWSET};
my @data = split( '\R\R', $buf ); my @data = split( '\R\R', $buf );
my $data = $data[0]; my $data = $data[0];
@ -1286,10 +1274,6 @@ sub ParseMsg($$) {
return ( $msg, $tail ); return ( $msg, $tail );
} }
sub Flowsetversion() {
return $flowsetversion;
}
##### bleibt zu Anschauungszwecken erhalten ##### bleibt zu Anschauungszwecken erhalten
#sub Header2Hash($) { #sub Header2Hash($) {
# #
@ -1478,7 +1462,8 @@ sub Flowsetversion() {
], ],
"release_status": "stable", "release_status": "stable",
"license": "GPL_2", "license": "GPL_2",
"version": "v4.4.2", "version": "v4.4.3",
"x_flowsetversion": "4.4.1",
"author": [ "author": [
"Marko Oldenburg <leongaultier@gmail.com>" "Marko Oldenburg <leongaultier@gmail.com>"
], ],

View File

@ -52,9 +52,9 @@ use warnings;
use POSIX; use POSIX;
use FHEM::Meta; use FHEM::Meta;
use Data::Dumper; #only for Debugging use Data::Dumper; #only for Debugging
use GPUtils qw(GP_Import); use GPUtils qw(GP_Import GP_Export);
require FHEM::73_AMADCommBridge; require '73_AMADCommBridge.pm';
my $missingModul = ''; my $missingModul = '';
eval "use Encode qw(encode encode_utf8);1" or $missingModul .= 'Encode '; eval "use Encode qw(encode encode_utf8);1" or $missingModul .= 'Encode ';
@ -165,19 +165,8 @@ BEGIN {
); );
} }
# _Export - Export references to main context using a different naming schema
sub _Export {
no strict qw/refs/; ## no critic
my $pkg = caller(0);
my $main = $pkg;
$main =~ s/^(?:.+::)?([^:]+)$/main::$1\_/g;
foreach (@_) {
*{ $main . $_ } = *{ $pkg . '::' . $_ };
}
}
#-- Export to main context with different name #-- Export to main context with different name
_Export( GP_Export(
qw( qw(
Initialize Initialize
) )
@ -251,12 +240,11 @@ sub Define($$) {
my $amad_id = $a[3]; my $amad_id = $a[3];
my $remoteServer = $a[4]; my $remoteServer = $a[4];
$hash->{HOST} = $host; $hash->{HOST} = $host;
$hash->{AMAD_ID} = $amad_id; $hash->{AMAD_ID} = $amad_id;
$hash->{VERSION} = version->parse($VERSION)->normal; $hash->{VERSION} = version->parse($VERSION)->normal;
$hash->{VERSIONFLOWSET} = AMADCommBridge_Flowsetversion(); $hash->{NOTIFYDEV} = 'global,' . $name;
$hash->{NOTIFYDEV} = 'global,' . $name; $hash->{MODEL} = $remoteServer;
$hash->{MODEL} = $remoteServer;
$hash->{PORT} = 8090 if ( $remoteServer eq 'Automagic' ); $hash->{PORT} = 8090 if ( $remoteServer eq 'Automagic' );
$hash->{PORT} = 1817 if ( $remoteServer eq 'Autoremote' ); $hash->{PORT} = 1817 if ( $remoteServer eq 'Autoremote' );
@ -289,6 +277,9 @@ sub Define($$) {
$iodev = $hash->{IODev}->{NAME}; $iodev = $hash->{IODev}->{NAME};
# $hash->{VERSIONFLOWSET} = FHEM::Meta::Get( $defs{$iodev}, 'x_flowsetversion' );
$hash->{VERSIONFLOWSET} = $defs{$iodev}->{VERSIONFLOWSET};
my $d = $modules{AMADDevice}{defptr}{$amad_id}; my $d = $modules{AMADDevice}{defptr}{$amad_id};
return return
@ -1689,7 +1680,7 @@ sub CreateChangeBtDeviceValue($$) {
], ],
"release_status": "stable", "release_status": "stable",
"license": "GPL_2", "license": "GPL_2",
"version": "v4.4.2", "version": "v4.4.3",
"author": [ "author": [
"Marko Oldenburg <leongaultier@gmail.com>" "Marko Oldenburg <leongaultier@gmail.com>"
], ],