Metratec Devices SDK for .net 6.0 (core)
Install the library
This library also requires for the serial connection the System.IO.Ports package.
To add the required libraries, you can do this via the Visual Studio UI: Right-click on Dependencies->Add Project Reference->Browse
and select the external MetratecDevices.dll
. For the serial connection add the required package System.IO.Ports
via the Visual Studio UI. Right-click on Dependencies->Manage NuGet Packages
and locate and install the System.IO.Ports
package.
This library uses the Microsoft Logging System, for which at least the Microsoft.Extensions.Logging.Abstraction
package is necessary. Add this package as well.
Or you can alternatively edit your .csproj
file:
<ItemGroup>
<Reference Include="MetratecDevices, Version=3.1.1.0">
<HintPath>path\to\MetratecDevices.dll</HintPath>
</Reference>
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstraction" Version="7.0.0" />
</ItemGroup>
Usage
namespace Tests
{
class Program
{
static void Main(string[] args)
{
try
{
reader.StatusChanged += (s, e) => Console.WriteLine($"Reader status changed to {e.Message} ({e.Status})");
reader.NewInventory += (s, e) =>
{
Console.WriteLine($"New inventory event! {e.Tags.Count} Tag(s) found");
foreach (
HfTag tag
in e.Tags)
{
Console.WriteLine($" {tag.TID}");
}
};
try
{
reader.Connect(2000);
}
catch (TimeoutException)
{
Console.WriteLine($"Can not connect to reader. Program exits");
return;
}
List<HfTag> tags = reader.GetInventory();
Console.WriteLine($"Current inventory: {tags.Count} Tag(s) found");
foreach (
HfTag tag
in tags)
{
Console.WriteLine($" {tag.TID}");
}
reader.StartInventory();
Console.WriteLine("Continuous inventory scan started - Press any key to stop");
Console.ReadKey();
reader.StopInventory();
reader.Disconnect();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
}
}
The DeskID ISO is a compact HF RFID Reader/Writer for RFID applications in the office or factory....
Definition: DeskID_ISO.cs:12
Hf transponder.
Definition: Transponder.cs:85
Definition: DeskID_ISO.cs:5
License
MIT License