Skip to main content

Structures

All structures used across the RIK API. Select a language tab to see the definition and field types for that language.


ReaderDefinition

Configures reader connection parameters.

Namespace: RikCommon

#pragma pack(push, 1)
struct ReaderDefinition
{
DeviceId DeviceId;
ProtocolType ProtocolType = PROTOCOL_TYPE_INVALID;
SerialPortSettings SerialPortSettings;
};
#pragma pack(pop)
FieldTypeDescription
DeviceIdDeviceIdUSB device identification (VID/PID/path/serial)
ProtocolTypeProtocolType (uint8_t)Communication protocol (default: PROTOCOL_TYPE_INVALID)
SerialPortSettingsSerialPortSettingsSerial port configuration (only for PROTOCOL_TYPE_SERIAL_BINARY)
ReaderDefinition readerDef;
readerDef.DeviceId.VendorId = 0x0C27;
readerDef.DeviceId.ProductId = 0x3BFA;
readerDef.ProtocolType = PROTOCOL_TYPE_FEATURE_REPORT;

auto handle = AbstractReader::CreateReaderInstance(readerDef, 3);

DeviceId

USB device identification. Supports three connection strategies: VID/PID, VID/PID + serial number, or USB path.

Namespace: RikCommon

#pragma pack(push, 1)
struct DeviceId
{
uint16_t VendorId;
uint16_t ProductId;
wchar_t* UsbPath;
wchar_t* SerialNumber;
};
#pragma pack(pop)
FieldTypeDescription
VendorIduint16_tUSB Vendor ID (0x0C27 for rf IDEAS)
ProductIduint16_tUSB Product ID
UsbPathwchar_t*Optional. Topological USB path for port-specific connection
SerialNumberwchar_t*Optional. Distinguishes multiple readers with the same VID/PID
DeviceId id{};
id.VendorId = 0x0C27;
id.ProductId = 0x3BFA;
id.SerialNumber = L"ABC123";

Connection Strategies

RIK selects the connection strategy based on which DeviceId fields are populated:

StrategyFields SetBehavior
VID/PIDVendorId + ProductIdOpens the first matching device. Non-deterministic when duplicates exist.
VID/PID + SerialVendorId + ProductId + SerialNumberFilters by USB serial number. VID/PID narrows the search. On newer rf IDEAS readers, the USB serial number matches the reader's ESN.
USB PathUsbPath (VID/PID ignored)Opens by physical port location. VID/PID and SerialNumber are completely ignored. Most deterministic.
note

When UsbPath is set, it takes full precedence -- the connection is made purely by topological port path and all other DeviceId fields are ignored. The path format is platform-specific:

  • Linux: "B-P" or "B-P.P.P" (e.g., "1-7", "1-7.2")
  • Windows: Location path (e.g., "PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(7)")

See Connection Strategies for full examples in all languages.


SerialPortSettings

Serial port communication configuration.

Namespace: RikCommon

#pragma pack(push, 1)
struct SerialPortSettings
{
SerialPortBaudRate BaudRate;
SerialPortParity Parity;
SerialPortFlowControl FlowControl;
char PortName[256];
uint8_t ByteSize;
SerialPortDataBits DataBits;
SerialPortStopBits StopBits;
};
#pragma pack(pop)
FieldTypeDescription
BaudRateSerialPortBaudRate (uint32_t)Communication speed
ParitySerialPortParity (uint8_t)Parity bit configuration
FlowControlSerialPortFlowControl (uint8_t)Flow control mode
PortNamechar[256]Port name (e.g., "COM3", "/dev/ttyUSB0")
ByteSizeuint8_tByte size
DataBitsSerialPortDataBits (uint8_t)Number of data bits
StopBitsSerialPortStopBits (uint8_t)Number of stop bits
readerDef.SerialPortSettings.BaudRate = SERIAL_PORT_BAUD_9600;
readerDef.SerialPortSettings.Parity = SERIAL_PORT_PARITY_NONE;
std::strcpy(readerDef.SerialPortSettings.PortName, "COM3");

ReaderMetadataStruct

Reader information retrieved from the device. Each field has a corresponding Has* presence flag.

tip

Always check Has* flags before reading the corresponding field. Fields without their Has* flag set may contain empty or stale data.

Namespace: Rik

#pragma pack(push, 1)
struct ReaderMetadataStruct
{
char Processor[512]; unsigned char HasProcessor;
char HardwarePlatform[512]; unsigned char HasHardwarePlatform;
char Product[512]; unsigned char HasProduct;
char PartNumber[512]; unsigned char HasPartNumber;
char ProductLine[512]; unsigned char HasProductLine;
int ConfigurationCount; unsigned char HasConfigurationCount;
char SerialNumber[512]; unsigned char HasSerialNumber;
char ESN[512]; unsigned char HasESN;
char InstalledHardware[512]; unsigned char HasInstalledHardware;
char SupportedHardware[512]; unsigned char HasSupportedHardware;

// Hardware capability flags
unsigned char HwSupportedSamSe;
unsigned char HwSupportedRfAms;
unsigned char HwSupportedRf125;
unsigned char HwSupportedRfLegic;
unsigned char HwSupportedRfBle;
unsigned char HwSupportedNxp;
unsigned char HwSupportedRfHidBle;
unsigned char HwSupportedFelica;
unsigned char HwSupportedBeeper;
unsigned char HwSupportedNano;
unsigned char HwInstalledSamSe;
unsigned char HwInstalledRfAms;
unsigned char HwInstalledRf125;
unsigned char HwInstalledRfLegic;
unsigned char HwInstalledRfBle;
unsigned char HwInstalledNxp;
unsigned char HwInstalledRfHidBle;
unsigned char HwInstalledFelica;
unsigned char HasInstalledHardwareInfo;

char FirmwareFilename[512]; unsigned char HasFirmwareFilename;
char FirmwareVersion[512]; unsigned char HasFirmwareVersion;
// Controller firmware versions
char ControllerApplicationVersion[512]; unsigned char HasControllerApplicationVersion;
char ControllerBootloaderVersion[512]; unsigned char HasControllerBootloaderVersion;
char ControllerRadioVersion[512]; unsigned char HasControllerRadioVersion;
// Radio firmware versions
char RadioApplicationVersion[512]; unsigned char HasRadioApplicationVersion;
char RadioBootloaderVersion[512]; unsigned char HasRadioBootloaderVersion;
char RadioRadioVersion[512]; unsigned char HasRadioRadioVersion;
// Bluetooth / Security modules
char BluetoothVersion[512]; unsigned char HasBluetoothVersion;
char HidSeSamVersion[512]; unsigned char HasHidSeSamVersion;
char NxpSamVersion[512]; unsigned char HasNxpSamVersion;
char FelicaSamVersion[512]; unsigned char HasFelicaSamVersion;

// Protocol and advanced attributes
unsigned char ProtocolType;
unsigned char ReaderSupportsExtendedMode;

struct {
unsigned char ReverseAllBytesSupported;
unsigned char AsciiExtendedSupported;
unsigned char RoswellModeEnabled;
} AdvancedAttributes;
};
#pragma pack(pop)
FieldTypeDescription
Processorchar[512]Processor identifier
PartNumberchar[512]Reader part number
SerialNumberchar[512]Reader serial number
ESNchar[512]Electronic Serial Number
ConfigurationCountintNumber of configuration slots
FirmwareVersionchar[512]Firmware version string
Has*unsigned charPresence flag for string/version fields (1 = present)
HwSupported*unsigned charHardware capability: whether the reader hardware supports this module
HwInstalled*unsigned charHardware capability: whether this module is installed
HasInstalledHardwareInfounsigned char1 if hardware capability fields are populated
ProtocolTypeunsigned charProtocol used by this reader connection
ReaderSupportsExtendedModeunsigned charRead-only hardware capability flag
AdvancedAttributesnested structRead-only hardware capabilities (see below)

AdvancedAttributes

Read-only hardware capabilities derived from the reader's internal configuration. These fields are populated automatically and cannot be changed via SetReaderConfiguration.

FieldTypeDescription
ReverseAllBytesSupportedunsigned charReader hardware supports reverse-all-bytes mode
AsciiExtendedSupportedunsigned charReader hardware supports ASCII extended mode
RoswellModeEnabledunsigned charRoswell mode is enabled on the reader
auto metadata = app->GetMetadataStruct();

if (metadata.HasPartNumber)
std::cout << "Part: " << metadata.PartNumber << std::endl;

if (metadata.HasFirmwareVersion)
std::cout << "Firmware: " << metadata.FirmwareVersion << std::endl;

// Hardware capabilities
if (metadata.HasInstalledHardwareInfo) {
std::cout << "BLE supported: " << (int)metadata.HwSupportedRfBle << std::endl;
std::cout << "Beeper supported: " << (int)metadata.HwSupportedBeeper << std::endl;
}

// Advanced attributes (read-only)
std::cout << "Reverse all bytes: "
<< (int)metadata.AdvancedAttributes.ReverseAllBytesSupported << std::endl;

CardData

Represents credential data read from a card.

Namespace: Rik

class CardData
{
public:
std::vector<uint8_t> Data; // 32 bytes

unsigned int GetBitCount() const;
void SetBitCount(unsigned int bitCount);
bool IsEmpty() const;
std::string AsString();
};
MemberTypeDescription
Datastd::vector<uint8_t>Raw card data (32 bytes)
GetBitCount()unsigned intNumber of valid bits in the data
SetBitCount()voidSet the bit count
IsEmpty()boolReturns true if bit count is zero and all data bytes are zero
AsString()std::stringHex string representation of the data
note

Use IsEmpty() (C++/C#) or is_empty() (Python) to check whether card data was read. The method returns true when bit count is zero and all data bytes are zero, indicating no card is present.


LibraryInfo

ABI-safe struct containing library build and version metadata.

Namespace: Rik

struct LibraryInfo
{
char Name[256];
char InternalName[256];
char Comments[512];
char CompanyName[256];
char CompanyCopyright[512];
char LicenseText[1024];
char FileDescription[1024];
char SemVer[256];
char BuildVer[256];
char VersionString[256];
char BuildDate[256];
char BuildPlatform[256];
char BuildToolchain[256];
// ... additional build metadata fields (28 total)
};
Key FieldsTypeDescription
Namechar[256]Library name
SemVerchar[256]Semantic version string
VersionStringchar[256]Full version string
BuildDatechar[256]Build date
BuildPlatformchar[256]Target platform
BuildToolchainchar[256]Compiler/toolchain used
LibraryInfo info;
auto result = AbstractReader::GetLibraryInfo(info);
if (!result.HasException) {
std::cout << "Version: " << info.SemVer << std::endl;
}

LedConfiguration

LED state configuration.

Namespace: Rik

#pragma pack(push, 1)
struct LedConfiguration
{
LedColor Color;
bool SoftwareControlEnabled;
};
#pragma pack(pop)
FieldTypeDescription
ColorLedColor (unsigned char)Current LED color
SoftwareControlEnabledboolWhether software LED control is active

RikResult

C API error result struct. Returned by C API functions to communicate success or failure across the ABI boundary.

Namespace: Rik

#pragma pack(push, 1)
struct RikResult
{
bool HasException;
char ExceptionType[256];
char Message[2048];
char FileName[2048];
int LineNumber;
char FunctionName[256];

bool HasProtocolException;
char ProtocolExceptionType[256];
char ProtocolMessage[2048];
char ProtocolFileName[2048];
int ProtocolLineNumber;
char ProtocolFunctionName[256];
};
#pragma pack(pop)
FieldTypeDescription
HasExceptionbooltrue if an error occurred
ExceptionTypechar[256]Exception class name
Messagechar[2048]Error description
FileNamechar[2048]Source file where the error originated
LineNumberintSource line number
FunctionNamechar[256]Function name
HasProtocolExceptionbooltrue if a protocol-level error is also present
Protocol* fields(same types)Protocol-level error details (same layout)
RikResult result = Rik_Init(handle);
if (result.HasException) {
std::cerr << "Error: " << result.Message << std::endl;
if (result.HasProtocolException) {
std::cerr << "Protocol: " << result.ProtocolMessage << std::endl;
}
}

LuidResponseInformation

Response data from a LUID query.

Namespace: Rik

struct LuidResponseInformation
{
uint16_t Luid;
uint16_t ApplicationVersionPackedBcd;
uint32_t BootloaderVersionUnpackedBcd;
};
FieldTypeDescription
Luiduint16_tLogical Unit ID
ApplicationVersionPackedBcduint16_tApplication version in packed BCD
BootloaderVersionUnpackedBcduint32_tBootloader version in unpacked BCD

SupportedCardTypesResult

Result of querying supported card types from a reader.

Namespace: Rik

struct SupportedCardTypesResult
{
uint32_t Count;
CardTypeInfo CardTypes[256];
};
FieldTypeDescription
Countuint32_tNumber of valid entries in CardTypes
CardTypesCardTypeInfo[256]Fixed-size array; only the first Count entries are valid

CardTypeInfo

Describes a single card type supported by a reader.

Namespace: Rik

struct CardTypeInfo
{
uint16_t Value;
char Name[128];
char EnumName[64];
};
FieldTypeDescription
Valueuint16_tNumeric card type identifier
Namechar[128]Human-readable card type name
EnumNamechar[64]Enumeration constant name

See Also