diff --git a/src/KNXLib/KnxConnection.cs b/src/KNXLib/KnxConnection.cs
index aadbe5d..b56be33 100644
--- a/src/KNXLib/KnxConnection.cs
+++ b/src/KNXLib/KnxConnection.cs
@@ -190,6 +190,15 @@ internal void Status(string address, string state)
Logger.Debug(ClassName, "Device {0} has status {1}", address, state);
}
+ ///
+ /// Set the lock interval between requests sent to the network (in ms)
+ ///
+ /// time in ms for the interval
+ public void SetLockIntervalMs(int interval)
+ {
+ _lockManager.IntervalMs = interval;
+ }
+
///
/// Send a bit value as data to specified address
///
diff --git a/src/KNXLib/KnxLockManager.cs b/src/KNXLib/KnxLockManager.cs
index c9dbf75..dfc9257 100644
--- a/src/KNXLib/KnxLockManager.cs
+++ b/src/KNXLib/KnxLockManager.cs
@@ -9,6 +9,8 @@ internal class KnxLockManager
private readonly object _connectedLock = new object();
private bool _isConnected;
+ internal int IntervalMs { get; set; } = 200;
+
public int LockCount
{
get { return _sendLock.CurrentCount; }
@@ -65,13 +67,19 @@ private void SendUnlock()
private void SendUnlockPause()
{
+ if (IntervalMs == 0)
+ {
+ _sendLock.Release();
+ return;
+ }
+
var t = new Thread(SendUnlockPauseThread) { IsBackground = true };
t.Start();
}
private void SendUnlockPauseThread()
{
- Thread.Sleep(200);
+ Thread.Sleep(IntervalMs);
_sendLock.Release();
}
}