Metratec devices library 3.1.1.0
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Events | List of all members
MetraTecDevices.MetratecReader< T > Class Template Referenceabstract

The reader class for all Metratec reader. More...

Inheritance diagram for MetraTecDevices.MetratecReader< T >:
MetraTecDevices.MetratecReaderGen1< T > MetraTecDevices.MetratecReaderGen2< T >

Public Member Functions

 MetratecReader (ICommunicationInterface connection)
 The reader class for all Metratec reader.
 
 MetratecReader (ICommunicationInterface connection, ILogger logger)
 The reader class for all Metratec reader.
 
 MetratecReader (ICommunicationInterface connection, string id)
 The reader class for all Metratec reader.
 
 MetratecReader (ICommunicationInterface connection, string id, ILogger logger)
 The reader class for all Metratec reader.
 
void Connect ()
 Connect the reader.
 
void Connect (int timeout)
 Connect the reader and wait for the connection established.
 
void Disconnect ()
 Disconnect the reader.
 
abstract string ExecuteCommand (string command, int timeout=10000)
 Send a command and returns the response.
 
abstract void SetPower (int power)
 Set the reader power.
 
abstract void SetAntenna (int antennaPort)
 Sets the current antenna to use.
 
abstract void SetAntennaMultiplex (int antennasToUse)
 Sets the number of antennas to be multiplexed.
 
abstract List< T > GetInventory ()
 Scan for the current inventory.
 
abstract void StartInventory ()
 Starts the continuous inventory scan. If the inventory event handler is set, any transponder found will be delivered via it. If the event handler is not set, the found transponders can be fetched via the method FetchInventory
 
abstract void StopInventory ()
 Stops the continuous inventory scan.
 
abstract bool GetInput (int pin)
 Returns true if the input pin is high, otherwise false.
 
abstract void SetOutput (int pin, bool value)
 Sets a output pin.
 
List< T > FetchInventory ()
 Can be called when an inventory has been started and no inventory callback is set. Returns a list with the currently found transponders.
 

Protected Member Functions

void SetEndOfFrame (String endOfFrame)
 Set the connection end of frame string.
 
virtual void SendCommand (string command)
 Send a command.
 
virtual string GetResponse ()
 Returns the next response.
 
List< string > ClearResponseBuffer ()
 Deletes the currently waiting responses from the buffer and returns them.
 
virtual void SetHeartBeatInterval (int intervalInSec)
 Set the HeartBeatInterval ... override for send the heartbeat command. The base implementation must be called after success.
 
virtual void PrepareReader ()
 Configure the reader. The base implementation must be called after success.
 
abstract void ConfigureReader ()
 Configure the reader. The base implementation must be called after success.
 
abstract void UpdateDeviceRevisions ()
 Update the the firmware name and version ({firmware} {version})
 
virtual void HandleResponse (string response)
 Process the reader response...override for event check The base implementation adds the response to the responses queue.
 
void FireInventoryEvent (List< T > tags, bool continuous)
 Fire a inventory event.
 

Protected Attributes

string id
 Reader id.
 
readonly ILogger Logger
 Logger.
 

Properties

bool FireEmptyInventories [get, set]
 If the event handler for new inventory is set and this value is true, an empty inventory also triggers the event handler.
 
int ResponseTimeout [get, set]
 Reader response timeout.
 
string? FirmwareName [get, protected set]
 Reader firmware name.
 
string? HardwareName [get, protected set]
 Reader hardware name.
 
string? FirmwareVersion [get, protected set]
 Reader firmware version.
 
int? FirmwareMajorVersion [get, set]
 Reader major firmware version.
 
int? FirmwareMinorVersion [get, set]
 Firmware minor firmware version.
 
string? HardwareVersion [get, protected set]
 Reader hardware version.
 
string? SerialNumber [get, protected set]
 Reader serial number.
 
bool Connected [get]
 The reader connection state.
 

Events

EventHandler< StatusEventArgs >? StatusChanged
 Status change event handler.
 
EventHandler< NewInventoryEventArgs< T > >? NewInventory
 new inventory event handler
 

Detailed Description

The reader class for all Metratec reader.

Type Constraints
T :RfidTag 

Constructor & Destructor Documentation

◆ MetratecReader() [1/4]

The reader class for all Metratec reader.

Parameters
connectionThe connection interface

◆ MetratecReader() [2/4]

MetraTecDevices.MetratecReader< T >.MetratecReader ( ICommunicationInterface  connection,
ILogger  logger 
)

The reader class for all Metratec reader.

Parameters
connectionThe connection interface
loggerThe connection interface

◆ MetratecReader() [3/4]

The reader class for all Metratec reader.

Parameters
connectionThe connection interface

///

Parameters
idThe reader id

◆ MetratecReader() [4/4]

MetraTecDevices.MetratecReader< T >.MetratecReader ( ICommunicationInterface  connection,
string  id,
ILogger  logger 
)

The reader class for all Metratec reader.

Parameters
connectionThe connection interface
idThe reader id
loggerThe connection interface

Member Function Documentation

◆ ClearResponseBuffer()

List< string > MetraTecDevices.MetratecReader< T >.ClearResponseBuffer ( )
protected

Deletes the currently waiting responses from the buffer and returns them.

Returns
The currently waiting responses

◆ ConfigureReader()

abstract void MetraTecDevices.MetratecReader< T >.ConfigureReader ( )
protectedpure virtual

Configure the reader. The base implementation must be called after success.

Implemented in MetraTecDevices.MetratecReaderGen2< T >.

◆ Connect()

void MetraTecDevices.MetratecReader< T >.Connect ( int  timeout)

Connect the reader and wait for the connection established.

Parameters
timeoutthe connection timeout

◆ ExecuteCommand()

abstract string MetraTecDevices.MetratecReader< T >.ExecuteCommand ( string  command,
int  timeout = 10000 
)
pure virtual

Send a command and returns the response.

Parameters
commandthe command
timeoutthe response timeout, defaults to 2000ms
Returns
Exceptions
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

Implemented in MetraTecDevices.MetratecReaderGen1< T >, and MetraTecDevices.MetratecReaderGen2< T >.

◆ FetchInventory()

List< T > MetraTecDevices.MetratecReader< T >.FetchInventory ( )

Can be called when an inventory has been started and no inventory callback is set. Returns a list with the currently found transponders.

Returns
A list with the currently found transponders

◆ FireInventoryEvent()

void MetraTecDevices.MetratecReader< T >.FireInventoryEvent ( List< T >  tags,
bool  continuous 
)
protected

Fire a inventory event.

Parameters
tagsthe founded tags
continuousset to true if it came from a continuous scan

◆ GetInput()

abstract bool MetraTecDevices.MetratecReader< T >.GetInput ( int  pin)
pure virtual

Returns true if the input pin is high, otherwise false.

Parameters
pinThe requested input pin number
Returns
True if the input pin is high, otherwise false
Exceptions
T:System.InvalidOperationExceptionIf the reader return an error
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

Implemented in MetraTecDevices.MetratecReaderGen1< T >, and MetraTecDevices.MetratecReaderGen2< T >.

◆ GetInventory()

abstract List< T > MetraTecDevices.MetratecReader< T >.GetInventory ( )
pure virtual

Scan for the current inventory.

Exceptions
T:System.InvalidOperationExceptionIf the reader return an error
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

◆ GetResponse()

virtual string MetraTecDevices.MetratecReader< T >.GetResponse ( )
protectedvirtual

Returns the next response.

Returns
Exceptions
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

◆ HandleResponse()

virtual void MetraTecDevices.MetratecReader< T >.HandleResponse ( string  response)
protectedvirtual

Process the reader response...override for event check The base implementation adds the response to the responses queue.

Parameters
responsea reader response

Reimplemented in MetraTecDevices.MetratecReaderGen1< T >, and MetraTecDevices.MetratecReaderGen2< T >.

◆ PrepareReader()

virtual void MetraTecDevices.MetratecReader< T >.PrepareReader ( )
protectedvirtual

Configure the reader. The base implementation must be called after success.

Reimplemented in MetraTecDevices.MetratecReaderGen1< T >, and MetraTecDevices.MetratecReaderGen2< T >.

◆ SendCommand()

virtual void MetraTecDevices.MetratecReader< T >.SendCommand ( string  command)
protectedvirtual

Send a command.

Parameters
commandthe command
Exceptions
T:System.ObjectDisposedExceptionThrown if the reader is not connected

Reimplemented in MetraTecDevices.MetratecReaderGen1< T >.

◆ SetAntenna()

abstract void MetraTecDevices.MetratecReader< T >.SetAntenna ( int  antennaPort)
pure virtual

Sets the current antenna to use.

Parameters
antennaPortthe antenna to use
Exceptions
T:System.InvalidOperationExceptionIf the reader return an error
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

Implemented in MetraTecDevices.MetratecReaderGen1< T >, and MetraTecDevices.MetratecReaderGen2< T >.

◆ SetAntennaMultiplex()

abstract void MetraTecDevices.MetratecReader< T >.SetAntennaMultiplex ( int  antennasToUse)
pure virtual

Sets the number of antennas to be multiplexed.

Parameters
antennasToUsethe antenna count to use
Exceptions
T:System.InvalidOperationExceptionIf the reader return an error
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

Implemented in MetraTecDevices.MetratecReaderGen1< T >, and MetraTecDevices.MetratecReaderGen2< T >.

◆ SetEndOfFrame()

void MetraTecDevices.MetratecReader< T >.SetEndOfFrame ( String  endOfFrame)
protected

Set the connection end of frame string.

Parameters
endOfFramethe new end of frame string

◆ SetHeartBeatInterval()

virtual void MetraTecDevices.MetratecReader< T >.SetHeartBeatInterval ( int  intervalInSec)
protectedvirtual

Set the HeartBeatInterval ... override for send the heartbeat command. The base implementation must be called after success.

Parameters
intervalInSecHeartbeat interval in seconds. 0 for disable
Exceptions
T:System.InvalidOperationExceptionIf the reader return an error
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

Reimplemented in MetraTecDevices.MetratecReaderGen1< T >, and MetraTecDevices.MetratecReaderGen2< T >.

◆ SetOutput()

abstract void MetraTecDevices.MetratecReader< T >.SetOutput ( int  pin,
bool  value 
)
pure virtual

Sets a output pin.

Parameters
pinThe output pin number
valueTrue for set the pin high
Exceptions
T:System.InvalidOperationExceptionIf the reader return an error
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

Implemented in MetraTecDevices.MetratecReaderGen1< T >, and MetraTecDevices.MetratecReaderGen2< T >.

◆ SetPower()

abstract void MetraTecDevices.MetratecReader< T >.SetPower ( int  power)
pure virtual

Set the reader power.

Parameters
powerthe reader power
Exceptions
T:System.InvalidOperationExceptionIf the reader return an error
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

◆ StartInventory()

abstract void MetraTecDevices.MetratecReader< T >.StartInventory ( )
pure virtual

Starts the continuous inventory scan. If the inventory event handler is set, any transponder found will be delivered via it. If the event handler is not set, the found transponders can be fetched via the method FetchInventory

Exceptions
T:System.InvalidOperationExceptionIf the reader return an error
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

◆ StopInventory()

abstract void MetraTecDevices.MetratecReader< T >.StopInventory ( )
pure virtual

Stops the continuous inventory scan.

Exceptions
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

Implemented in MetraTecDevices.MetratecReaderGen1< T >, and MetraTecDevices.MetratecReaderGen2< T >.

◆ UpdateDeviceRevisions()

abstract void MetraTecDevices.MetratecReader< T >.UpdateDeviceRevisions ( )
protectedpure virtual

Update the the firmware name and version ({firmware} {version})

Exceptions
T:System.InvalidOperationExceptionIf the reader return an error
T:System.TimeoutExceptionThrown if the reader does not responding in time
T:System.ObjectDisposedExceptionIf the reader is not connected or the connection is lost

Implemented in MetraTecDevices.MetratecReaderGen1< T >, and MetraTecDevices.MetratecReaderGen2< T >.

Property Documentation

◆ FireEmptyInventories

bool MetraTecDevices.MetratecReader< T >.FireEmptyInventories
getset

If the event handler for new inventory is set and this value is true, an empty inventory also triggers the event handler.

Fire also empty inventories. Defaults to false

◆ FirmwareName

string? MetraTecDevices.MetratecReader< T >.FirmwareName
getprotected set

Reader firmware name.

◆ FirmwareVersion

string? MetraTecDevices.MetratecReader< T >.FirmwareVersion
getprotected set

Reader firmware version.

◆ HardwareName

string? MetraTecDevices.MetratecReader< T >.HardwareName
getprotected set

Reader hardware name.

◆ HardwareVersion

string? MetraTecDevices.MetratecReader< T >.HardwareVersion
getprotected set

Reader hardware version.

◆ ResponseTimeout

int MetraTecDevices.MetratecReader< T >.ResponseTimeout
getset

Reader response timeout.

Response timeout in millisecond. Defaults to 2000

◆ SerialNumber

string? MetraTecDevices.MetratecReader< T >.SerialNumber
getprotected set

Reader serial number.


The documentation for this class was generated from the following file: