Skip to content

Commit

Permalink
added possibility to get id report
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmaelfaitAT committed Feb 14, 2024
1 parent b00ab5d commit fcef544
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 12 deletions.
53 changes: 42 additions & 11 deletions src/samples/PivDataReader/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ private static async Task Main()
Console.Write(
$"Device is {(eventArgs.IsConnected ? "Online" : "Offline")} in {(eventArgs.IsSecureChannelEstablished ? "Secure" : "Clear Text")} mode");
if (eventArgs.IsConnected)
{
await panel.ACUReceivedSize(_connectionId, deviceAddress, maximumReceiveSize);
}
//if (eventArgs.IsConnected)
//{
// await panel.ACUReceivedSize(_connectionId, deviceAddress, maximumReceiveSize);
//}
};
panel.RawCardDataReplyReceived += (_, eventArgs) =>
{
Console.WriteLine();
Console.WriteLine("Received raw card data");
Console.Write(eventArgs.RawCardData.ToString());
Console.Write(eventArgs.RawCardData.ToString() + eventArgs.RawCardData.HexData + "\n" + eventArgs.RawCardData.AsciiData);
};
panel.NakReplyReceived += (_, args) =>
{
Expand All @@ -71,20 +71,24 @@ private static async Task Main()
while (!exit)
{
Console.WriteLine();
Console.WriteLine("PIV Data Reader");
Console.WriteLine("Data Reader");
Console.WriteLine();

Console.WriteLine("1) Get PIV Data");

Console.WriteLine("1) Get ID Report");
//Console.WriteLine("1) Get PIV Data");

Console.WriteLine();
Console.WriteLine("0) Exit");
Console.WriteLine();
Console.Write("Select an action:");

switch (Console.ReadKey(true).Key)
ConsoleKeyInfo key = default;
switch ((key= Console.ReadKey(true)).Key)
{
case ConsoleKey.D1:
await GetPivData();
case ConsoleKey.NumPad1:
//await GetPivData();
await GetIdReport();
break;
case ConsoleKey.D0:
exit = true;
Expand All @@ -97,7 +101,34 @@ private static async Task Main()
}

await panel.Shutdown();


async Task GetIdReport()
{

Console.WriteLine();
Console.Write("***Attempting to get Id Report***");
Console.WriteLine();

try
{
var data = await panel.IdReport(_connectionId, deviceAddress);

Console.Write(data);
}
catch (TimeoutException)
{
Console.WriteLine("Timeout waiting for Id Report");
}
catch (Exception exception)
{
Console.WriteLine($"Exception: {exception}");
}

Console.WriteLine();
Console.Write("Press enter to continue");
Console.ReadLine();
}

async Task GetPivData()
{
Console.Clear();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Debug</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Debug\net6.0\publish\linux-arm\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/samples/PivDataReader/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}
},
"OSDP": {
"PortName": "/dev/tty.usbserial-AB0MC3MS",
"PortName": "COM4",
"BaudRate": "9600",
"DeviceAddress": "0",
"UseNetwork": "False",
Expand Down

0 comments on commit fcef544

Please sign in to comment.