Remarks

IDxxLA
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for IDxxLA

Code Example

readonly IRfidReader rfidReader;

public MeadowApp()
{
    Console.WriteLine("Initialize hardware...");

    rfidReader = new IDxxLA(Device, Device.SerialPortNames.Com1);

    // subscribe to event
    rfidReader.RfidRead += RfidReaderOnTagRead;

    // subscribe to IObservable
    rfidReader.Subscribe(new RfidObserver());

    rfidReader.StartReading();

    Console.WriteLine("Ready...");
}

private void RfidReaderOnTagRead(object sender, RfidReadResult e)
{
    if (e.Status == RfidValidationStatus.Ok) {
        Console.WriteLine($"From event - Tag value is {DebugInformation.Hexadecimal(e.RfidTag)}");
        return;
    }

    Console.WriteLine($"From event - Error {e.Status}");
}

private class RfidObserver : IObserver<byte[]>
{
    public void OnCompleted()
    {
        Console.WriteLine("From IObserver - RfidReader has terminated, no more events will be emitted.");
    }

    public void OnError(Exception error)
    {
        Console.WriteLine($"From IObserver - {error}");
    }

    public void OnNext(byte[] value)
    {
        Console.WriteLine($"From IObserver - Tag value is {DebugInformation.Hexadecimal(value)}");
    }
}

Sample project(s) available on GitHub

Characteristic Locus
Inheritance System.Object > IDxxLA
Implements IRfidReader IObservable<System.Byte[]> IDisposable
Namespace Meadow.Foundation.Sensors.Radio.Rfid
Assembly IDxxLA.dll

Syntax

public class IDxxLA : object, IRfidReader, IObservable<byte[]>, IDisposable

Constructors

IDxxLA(ISerialMessageController, SerialPortName)

Create an IDxxLA RFID reader

Declaration
public IDxxLA(ISerialMessageController device, SerialPortName serialPortName)

Parameters

Type Name Description
ISerialMessageController device

Device to use

SerialPortName serialPortName

Port name to use

IDxxLA(ISerialMessagePort)

Create an IDxxLA RFID reader using an existing port.

Declaration
public IDxxLA(ISerialMessagePort serialPort)

Parameters

Type Name Description
ISerialMessagePort serialPort

Remarks

Be sure to use suitable settings when creating the serial port. Default BaudRate and DataBits are exposed as constants.

Fields

BaudRate

Declaration
public const int BaudRate = null

Field Value

Type Description
System.Int32

DataBits

Declaration
public const int DataBits = null

Field Value

Type Description
System.Int32

Properties

LastRead

Declaration
public byte[] LastRead { get; }

Property Value

Type Description
System.Byte[]

SerialPort

Declaration
public ISerialMessagePort SerialPort { get; }

Property Value

Type Description
ISerialMessagePort

Methods

Dispose()

Dispose of this instance.

Declaration
public void Dispose()

StartReading()

Declaration
public void StartReading()

StopReading()

Declaration
public void StopReading()

Subscribe(IObserver<Byte[]>)

Subscribe to RFID tag reads. Observer will only receive valid reads, with invalid reads triggering an OnError call. OnComplete will be called if this instance is disposed. This call is thread-safe.

Declaration
public IDisposable Subscribe(IObserver<byte[]> observer)

Parameters

Type Name Description
IObserver<System.Byte[]> observer

The observer to subscribe

Returns

Type Description
IDisposable

Disposable unsubscriber

Events

RfidRead

Declaration
public event RfidReadEventHandler RfidRead

Event Type

Type Description
RfidReadEventHandler