Skip to main content

C# API

The C# facade wraps the RIK native library in idiomatic .NET classes with IDisposable support and managed exceptions.

Installation

dotnet add package rfIDEAS.ReaderIntegrationKit
note

The NuGet package includes pre-built native libraries for Windows x64 and Linux x64. No additional native library setup is needed.

Namespace

using rfIDEAS.ReaderIntegrationKit;
using rfIDEAS.ReaderIntegrationKit.Objects;
using rfIDEAS.ReaderIntegrationKit.Enum;

AbstractReader (abstract)

Base class for all reader applications. Implements IDisposable.

Methods

MethodReturnsDescription
Init()voidInitialize connection to the reader
RefreshMetadata()voidForce a metadata refresh from the device
GetMetadata(bool forceRefresh = false)ReaderMetadataStructGet reader metadata (cached unless forceRefresh is true)
GetLibraryInfo()LibraryInfoStatic. Get library version info (no instance required)
Dispose()voidRelease native resources

Reader : AbstractReader

Application class for rf IDEAS readers.

Constructor

new Reader(ReaderDefinition readerDefinition, int retryCount = 3)
ParameterTypeDescription
readerDefinitionReaderDefinitionReader connection parameters
retryCountintConnection retry attempts (default: 3)

Methods

Beeper

MethodReturnsDescription
Beep(int beepCount, BeepDuration duration)voidSound the beeper
GetBeeperVolume()BeepVolumeGet current volume
SetBeeperVolume(BeepVolume volume)voidSet volume

Card Data

MethodReturnsDescription
GetCardData(out CardData cardData)voidRead card data from the reader

Credential Callbacks

MethodReturnsDescription
OnCredentialPresented(CredentialCallback callback)uintSubscribe to credential events. Returns a subscription ID.
UnsubscribeCredentialCallback(uint subscriptionId)voidUnsubscribe a previously registered callback

The CredentialCallback delegate is defined as:

public delegate void CredentialCallback(CardData cardData);
tip

When a card is presented to the reader, the callback fires on a background thread with the card data. Multiple callbacks can be registered simultaneously.

Configuration

MethodReturnsDescription
GetReaderConfiguration(int configurationNumber)(ReaderConfigurationStruct, ExtendedConfiguration)Read configuration slot
SetReaderConfiguration(int configurationNumber, ReaderConfigurationStruct config, ExtendedConfiguration extendedConfig, HashData hashData)voidWrite configuration slot

LED

MethodReturnsDescription
GetLedConfiguration(int configurationNumber)LedConfigurationRead LED configuration
SetLedConfiguration(int configurationNumber, LedConfiguration ledConfig)voidWrite LED configuration

LUID

MethodReturnsDescription
GetLuid()LuidResponseInformationGet Logical Unit ID
SetLuid(int luid)voidSet Logical Unit ID

Module Control

MethodReturnsDescription
GetModuleState(ReaderModuleId moduleId)ReaderModuleStateGet module power state
SetModuleState(ReaderModuleId moduleId, ReaderModuleState state)voidSet module power state

Modes

MethodReturnsDescription
EnableKeystroking(bool enable)voidEnable or disable keystroking
EnableTransparentMode(bool enable, bool writeToFlash)voidEnable or disable transparent mode
GetTransparentModeStatus(out TransparentModeState state, out TransparentModeStatus status)voidGet transparent mode state and readiness

Card Types

MethodReturnsDescription
GetSupportedCardTypes()IEnumerable<CardTypeInfo>List supported card types

BLE Configuration

MethodReturnsDescription
ReadBleConfigurationFromReader(BleDataType dataType, string fileName)voidRead BLE config to file
WriteBleConfigurationToReader(BleDataType dataType, string fileName)voidWrite BLE config from file

HWG Configuration

MethodReturnsDescription
WriteHwgFileToReader(string fileName)voidWrite an HWG configuration file to the reader
ReadHwgFileFromReader(string fileName, bool secureHwgFormat = true)voidRead configuration from the reader and save to an HWG file

Smart Card Configuration

MethodReturnsDescription
WriteSmartCardConfigurationToReader(string filePath)voidWrite smart card configuration from an INI file to the reader
ReadSmartCardConfigurationFromReader(ref SmartCardConfigurationStruct configStruct)voidRead smart card configuration from the reader

Key Types

Defined in rfIDEAS.ReaderIntegrationKit.Objects.

ReaderDefinition

PropertyTypeDescription
DeviceIdDeviceIdVendor and product identifiers
ProtocolTypeProtocolTypeCommunication protocol
SerialPortSettingsSerialPortSettingsSerial port configuration (serial connections only)

DeviceId

PropertyTypeDescription
VendorIdushortUSB vendor ID
ProductIdushortUSB product ID
UsbPathIntPtrUSB device path (optional; use to target a specific USB port)
SerialNumberIntPtrUSB serial number string (optional; use to target a specific reader)

SerialPortSettings

PropertyType
BaudRateSerialPortBaudRate
ParitySerialPortParity
FlowControlSerialPortFlowControl
PortNamestring
ByteSizeint
DataBitsSerialPortDataBits
StopBitsSerialPortStopBits

ReaderMetadataStruct

Contains string fields (part number, serial number, model name, etc.), firmware version structs, hardware capability flags, Has* boolean flags indicating which fields were populated, and an AdvancedAttributes struct with read-only hardware capabilities. See Structures for full details.

CardData

PropertyTypeDescription
Databyte[]Raw card data bytes
BitCountintNumber of valid bits
IsEmpty()boolReturns true if bit count is zero and all data bytes are zero
AsHexString()stringHex representation of the data

LibraryInfo

Contains 27+ string fields with library version and build metadata (version string, build date, compiler, platform, etc.).

LedConfiguration

PropertyTypeDescription
ColorLedColorLED color
SoftwareControlEnabledboolWhether software LED control is active

ReaderException

Thrown on any native library error.

PropertyTypeDescription
MessagestringError description
FileNamestringSource file
LineNumberintSource line
FunctionNamestringSource function
HasProtocolExceptionboolWhether protocol-level details are available
ProtocolMessagestringProtocol error description

Enums

Defined in rfIDEAS.ReaderIntegrationKit.Enum.

ProtocolType

ValueDescription
InvalidNot set
FeatureReportUSB HID feature report
SerialBinarySerial binary protocol
UnknownUnrecognized

BeepDuration

ValueDescription
BeepDurationShortShort beep
BeepDurationLongLong beep

BeepVolume

ValueDescription
OffMuted
LowLow volume
MediumMedium volume
HighHigh volume
UnknownUnknown / unset

LedColor

ValueDescription
InvalidNot set
OffLED off
RedRed
GreenGreen
AmberAmber
UnknownUnknown / unset

ReaderModuleId

ValueDescription
InvalidNot set
LowFrequencyRadio125 kHz radio
HighFrequencyRadio13.56 MHz radio
BleRadioBluetooth Low Energy radio

ReaderModuleState

ValueHexDescription
Invalid0x00Not set
PowerOff0x80Module powered off
PowerOnNormal0x81Module powered on, normal operation

BleDataType

ValueIntDescription
Data1BLE data payload
Key2Encrypted key
UnencryptedKey3Unencrypted key

Examples

Basic Connection

using rfIDEAS.ReaderIntegrationKit;
using rfIDEAS.ReaderIntegrationKit.Objects;
using rfIDEAS.ReaderIntegrationKit.Enum;

var readerDef = new ReaderDefinition
{
DeviceId = new DeviceId { VendorId = 0x0C27, ProductId = 0x3BFA },
ProtocolType = ProtocolType.FeatureReport
};

using var app = new Reader(readerDef);
app.Init();

var metadata = app.GetMetadata();
Console.WriteLine($"Part: {metadata.PartNumber}");
Console.WriteLine($"Serial: {metadata.ESN}");

Beep

using var app = new Reader(readerDef);
app.Init();

app.Beep(2, BeepDuration.Short);
app.SetBeeperVolume(BeepVolume.High);

Read Card Data

using var app = new Reader(readerDef);
app.Init();

var card = app.GetCardData();
if (!card.IsEmpty())
{
Console.WriteLine($"Bits: {card.BitCount}");
Console.WriteLine($"Hex: {card.AsHexString()}");
}

Library Info (No Reader Required)

var info = AbstractReader.GetLibraryInfo();
Console.WriteLine($"Version: {info.VersionString}");

Thread Safety

All methods are thread-safe. Internal locking ensures safe concurrent access.

See Also