Skip to content

Commit ec02fb9

Browse files
committed
Send KeepAlive OSDP command after receiving Auth Response
1 parent 0354bdc commit ec02fb9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/PKOC.Net/PKOCControlPanel.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class PKOCControlPanel : IDisposable
2121
private readonly SemaphoreSlim _initializeLock = new SemaphoreSlim(1, 1);
2222
private readonly SemaphoreSlim _lock = new SemaphoreSlim(0, 1);
2323
private readonly ControlPanel _panel;
24-
private readonly ConcurrentBag<PKOCDevice> _deviceSettings = new ConcurrentBag<PKOCDevice>();
24+
private readonly ConcurrentBag<PKOCDevice> _deviceSettings = new();
2525

2626
/// <summary>
2727
/// Initialize a new instance of the <see cref="PKOCControlPanel"/> class.
@@ -66,7 +66,9 @@ public async Task<bool> InitializePKOC(PKOCDevice pkocDevice)
6666
_initializeLock.Release();
6767
}
6868
}
69-
69+
70+
71+
7072
/// <summary>
7173
/// Sends an authentication request to a PKOC control panel.
7274
/// </summary>
@@ -152,6 +154,11 @@ private void OnPanelOnManufacturerSpecificReplyReceived(object _,
152154
ProcessAuthenticationResponse(
153155
DataFragmentResponse.ParseData(eventArgs.ManufacturerSpecific.Data.Skip(1).ToArray()),
154156
deviceSettings);
157+
Task.Run(async () =>
158+
{
159+
await _panel.KeepReaderActive(deviceSettings.ConnectionId, deviceSettings.Address,
160+
(ushort)deviceSettings.CardReadTimeout.TotalMilliseconds);
161+
});
155162
}
156163
else if (IdentifyMessage(eventArgs.ManufacturerSpecific.Data) == PKOCMessageIdentifier.ReaderErrorResponse)
157164
{

0 commit comments

Comments
 (0)