mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
10_pilight_ctrl: fix: reset - clear send queue, new: add attribute SendTimeout
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@8811 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d22ddc6e54
commit
85d34bd52b
2
CHANGED
2
CHANGED
@ -1,5 +1,7 @@
|
|||||||
# 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: pilight_ctrl: reset - clear send queue
|
||||||
|
- feature: pilight_ctrl: add attribute SendTimeout for aborting sending commands
|
||||||
- feature: FB_CALLMONITOR: add TR-064 support for remote phonebook reading
|
- feature: FB_CALLMONITOR: add TR-064 support for remote phonebook reading
|
||||||
via official AVM API (by JoWiemann)
|
via official AVM API (by JoWiemann)
|
||||||
- feature: 10_pilight_ctrl.pm: added disconnect
|
- feature: 10_pilight_ctrl.pm: added disconnect
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
##############################################
|
##############################################
|
||||||
# $Id: 10_pilight_ctrl.pm 1.07 2015-06-23 Risiko $
|
# $Id: 10_pilight_ctrl.pm 1.08 2015-06-23 Risiko $
|
||||||
#
|
#
|
||||||
# Usage
|
# Usage
|
||||||
#
|
#
|
||||||
@ -31,6 +31,8 @@
|
|||||||
# V 1.05 2015-06-07 - FIX: Reset
|
# V 1.05 2015-06-07 - FIX: Reset
|
||||||
# V 1.06 2015-06-20 - NEW: set <ctrl> disconnect, checking reading state
|
# V 1.06 2015-06-20 - NEW: set <ctrl> disconnect, checking reading state
|
||||||
# V 1.07 2015-06-23 - FIX: reading state always contains a valid value, checking reading state removed
|
# V 1.07 2015-06-23 - FIX: reading state always contains a valid value, checking reading state removed
|
||||||
|
# V 1.08 2015-06-23 - FIX: clear send queue by reset
|
||||||
|
# V 1.08 2015-06-23 - NEW: attribute SendTimeout for abort sending command non blocking
|
||||||
##############################################
|
##############################################
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
@ -76,7 +78,7 @@ sub pilight_ctrl_Initialize($)
|
|||||||
$hash->{SetFn} = "pilight_ctrl_Set";
|
$hash->{SetFn} = "pilight_ctrl_Set";
|
||||||
$hash->{NotifyFn}= "pilight_ctrl_Notify";
|
$hash->{NotifyFn}= "pilight_ctrl_Notify";
|
||||||
$hash->{StateFn} = "pilight_ctrl_State";
|
$hash->{StateFn} = "pilight_ctrl_State";
|
||||||
$hash->{AttrList}= "ignoreProtocol brands ContactAsSwitch ".$readingFnAttributes;
|
$hash->{AttrList}= "ignoreProtocol brands ContactAsSwitch SendTimeout ".$readingFnAttributes;
|
||||||
|
|
||||||
$hash->{Clients} = ":pilight_switch:pilight_dimmer:pilight_temp:";
|
$hash->{Clients} = ":pilight_switch:pilight_dimmer:pilight_temp:";
|
||||||
#$hash->{MatchList} = \%matchList; #only for autocreate
|
#$hash->{MatchList} = \%matchList; #only for autocreate
|
||||||
@ -176,6 +178,8 @@ sub pilight_ctrl_Close($)
|
|||||||
BlockingKill($hash->{helper}{RUNNING_PID});
|
BlockingKill($hash->{helper}{RUNNING_PID});
|
||||||
delete($hash->{helper}{RUNNING_PID});
|
delete($hash->{helper}{RUNNING_PID});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splice($hash->{helper}->{sendQueue});
|
||||||
|
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
Log3 $me, 5, "$me(Close): close DevIo";
|
Log3 $me, 5, "$me(Close): close DevIo";
|
||||||
@ -448,7 +452,7 @@ sub pilight_ctrl_Send($)
|
|||||||
PeerHost => $remote_ip,
|
PeerHost => $remote_ip,
|
||||||
PeerPort => $remote_port,
|
PeerPort => $remote_port,
|
||||||
Proto => 'tcp',
|
Proto => 'tcp',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$socket) {
|
if (!$socket) {
|
||||||
Log3 $me, 2, "$me(Send): ERROR. Can't open socket to pilight-daemon $remote_ip:$remote_port";
|
Log3 $me, 2, "$me(Send): ERROR. Can't open socket to pilight-daemon $remote_ip:$remote_port";
|
||||||
@ -616,7 +620,7 @@ sub pilight_ctrl_SendNonBlocking($)
|
|||||||
my $blockingFn = "pilight_ctrl_Send";
|
my $blockingFn = "pilight_ctrl_Send";
|
||||||
my $arg = $me."|".$hash->{DeviceName}."|".$data;
|
my $arg = $me."|".$hash->{DeviceName}."|".$data;
|
||||||
my $finishFn = "pilight_ctrl_SendDone";
|
my $finishFn = "pilight_ctrl_SendDone";
|
||||||
my $timeout = 4;
|
my $timeout = AttrVal($me, "SendTimeout",1);
|
||||||
my $abortFn = "pilight_ctrl_SendAbort";
|
my $abortFn = "pilight_ctrl_SendAbort";
|
||||||
|
|
||||||
$hash->{helper}{RUNNING_PID} = BlockingCall($blockingFn, $arg, $finishFn, $timeout, $abortFn, $hash);
|
$hash->{helper}{RUNNING_PID} = BlockingCall($blockingFn, $arg, $finishFn, $timeout, $abortFn, $hash);
|
||||||
@ -625,6 +629,7 @@ sub pilight_ctrl_SendNonBlocking($)
|
|||||||
Log3 $me, 5, "$me(Write): Blocking Call running - will try it later";
|
Log3 $me, 5, "$me(Write): Blocking Call running - will try it later";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$queueSize = @{$hash->{helper}->{sendQueue}};
|
||||||
InternalTimer(gettimeofday()+0.5,"pilight_ctrl_SendNonBlocking", $hash, 0) if ($queueSize > 0);
|
InternalTimer(gettimeofday()+0.5,"pilight_ctrl_SendNonBlocking", $hash, 0) if ($queueSize > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -947,6 +952,9 @@ sub pilight_ctrl_SimpleWrite(@)
|
|||||||
In this case opened will be interpreted as on and closed as off.<br>
|
In this case opened will be interpreted as on and closed as off.<br>
|
||||||
Example: <code>ContactAsSwitch 12345</code>
|
Example: <code>ContactAsSwitch 12345</code>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a name="SendTimeout">SendTimeout</a><br>
|
||||||
|
Timeout [s] for aborting sending commands (non blocking) - default 1s
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user