2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-12 22:56:34 +00:00

- feature: new commands fullinit and reopen for FHZ, commandref.html update

git-svn-id: https://svn.fhem.de/fhem/trunk@259 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2008-11-01 13:58:39 +00:00
parent bd3450cb81
commit aaea25da26
3 changed files with 59 additions and 10 deletions

View File

@ -434,3 +434,4 @@
- feature: add timestamp to inform
- feature: The strange stty settings in 00_FHEM.pm are optional
- bugfix: webpgm2 iPhone fix
- feature: fullinit and reopen commands for FHZ added (Boris 2008-11-01)

View File

@ -30,6 +30,8 @@ my %sets = (
"activefor"=> "xx xx",
"raw" => "xx xx",
"initfull" => "xx xx",
"reopen" => "xx xx",
);
my %setnrparam = (
"time" => 0,
@ -38,6 +40,8 @@ my %setnrparam = (
"FHTcode" => 1,
"activefor"=> 1,
"raw" => 2,
"initfull" => 0,
"reopen" => 0,
);
my %codes = (
@ -117,6 +121,21 @@ FHZ_Set($@)
$dhash->{IODev} = $hash;
return undef;
} elsif($a[1] eq "initfull") {
my @init;
push(@init, "get $name init2");
push(@init, "get $name serial");
push(@init, "set $name initHMS");
push(@init, "set $name initFS20");
push(@init, "set $name time");
push(@init, "set $name raw 04 01010100010000");
CommandChain(3, \@init);
} elsif($a[1] eq "reopen") {
FHZ_Reopen($hash);
} elsif($a[1] eq "raw") {
$fn = $a[2];
@ -525,6 +544,31 @@ FHZ_HandleWriteQueue($)
}
}
#####################################
sub
FHZ_Reopen($)
{
my ($hash) = @_;
my $devname = $hash->{DeviceName};
$hash->{PortObj}->close();
Log 1, "USB device $devname closed";
for(;;) {
sleep(5);
if ($^O eq 'MSWin32') {
$hash->{PortObj} = new Win32::SerialPort($devname);
}else{
$hash->{PortObj} = new Device::SerialPort($devname);
}
if($hash->{PortObj}) {
Log 1, "USB device $devname reopened";
$hash->{FD} = $hash->{PortObj}->FILENO if !($^O eq 'MSWin32');
DoInit($hash->{NAME}, $hash->{ttytype}, $hash->{PortObj});
return;
}
}
}
#####################################
sub
FHZ_Read($)

View File

@ -313,3 +313,7 @@ Fri Jul 25 18:14:26 MEST 2008
these are considered "utility" modules and are loaded at the beginning.
Some of the older 99_x modules were renamed (99_SVG, 99_dummy), and most
contrib modules were moved to the main FHEM directory.
- Boris Sat Nov 01 CET 2008
- feature: new commands fullinit and reopen for FHZ, commandref.html update