From ec02fb98db8c283e7b8af4f74df74e1e2b60c620 Mon Sep 17 00:00:00 2001 From: Jonathan Horvath Date: Fri, 29 Mar 2024 14:54:30 -0400 Subject: [PATCH] Send KeepAlive OSDP command after receiving Auth Response --- src/PKOC.Net/PKOCControlPanel.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/PKOC.Net/PKOCControlPanel.cs b/src/PKOC.Net/PKOCControlPanel.cs index 1d5da3d..0d6eb53 100644 --- a/src/PKOC.Net/PKOCControlPanel.cs +++ b/src/PKOC.Net/PKOCControlPanel.cs @@ -21,7 +21,7 @@ public class PKOCControlPanel : IDisposable private readonly SemaphoreSlim _initializeLock = new SemaphoreSlim(1, 1); private readonly SemaphoreSlim _lock = new SemaphoreSlim(0, 1); private readonly ControlPanel _panel; - private readonly ConcurrentBag _deviceSettings = new ConcurrentBag(); + private readonly ConcurrentBag _deviceSettings = new(); /// /// Initialize a new instance of the class. @@ -66,7 +66,9 @@ public async Task InitializePKOC(PKOCDevice pkocDevice) _initializeLock.Release(); } } - + + + /// /// Sends an authentication request to a PKOC control panel. /// @@ -152,6 +154,11 @@ private void OnPanelOnManufacturerSpecificReplyReceived(object _, ProcessAuthenticationResponse( DataFragmentResponse.ParseData(eventArgs.ManufacturerSpecific.Data.Skip(1).ToArray()), deviceSettings); + Task.Run(async () => + { + await _panel.KeepReaderActive(deviceSettings.ConnectionId, deviceSettings.Address, + (ushort)deviceSettings.CardReadTimeout.TotalMilliseconds); + }); } else if (IdentifyMessage(eventArgs.ManufacturerSpecific.Data) == PKOCMessageIdentifier.ReaderErrorResponse) {