Skip to content

Commit

Permalink
Send KeepAlive OSDP command after receiving Auth Response
Browse files Browse the repository at this point in the history
  • Loading branch information
bytedreamer committed Mar 29, 2024
1 parent 0354bdc commit ec02fb9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/PKOC.Net/PKOCControlPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PKOCDevice> _deviceSettings = new ConcurrentBag<PKOCDevice>();
private readonly ConcurrentBag<PKOCDevice> _deviceSettings = new();

/// <summary>
/// Initialize a new instance of the <see cref="PKOCControlPanel"/> class.
Expand Down Expand Up @@ -66,7 +66,9 @@ public async Task<bool> InitializePKOC(PKOCDevice pkocDevice)
_initializeLock.Release();
}
}




/// <summary>
/// Sends an authentication request to a PKOC control panel.
/// </summary>
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit ec02fb9

Please sign in to comment.