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

The reader class for the ASCII based metratec reader. More...

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

Public Member Functions

 MetratecReaderGen2 (ICommunicationInterface connection)
 The reader class for all Metratec reader.
 
 MetratecReaderGen2 (ICommunicationInterface connection, ILogger logger)
 The reader class for all Metratec reader.
 
 MetratecReaderGen2 (ICommunicationInterface connection, string id)
 The reader class for all Metratec reader.
 
 MetratecReaderGen2 (ICommunicationInterface connection, string id, ILogger logger)
 The reader class for all Metratec reader.
 
override string ExecuteCommand (string command, int timeout=10000)
 Send a command and returns the response.
 
override bool GetInput (int pin)
 Returns true if the input pin is high, otherwise false.
 
void EnableInputEvents (bool enable=true)
 Enable or disable input events.
 
override void SetOutput (int pin, bool value)
 Sets a output pin.
 
bool GetOutput (int pin)
 Returns true if the output pin is high, otherwise false.
 
override void SetAntenna (int antennaPort)
 Sets the current antenna to use.
 
int GetAntenna ()
 Gets the current used single antenna.
 
override void SetAntennaMultiplex (int antennasToUse)
 Sets the number of antennas to be multiplexed.
 
void SetAntennaMultiplex (List< int > antennaSequence)
 Sets the antenna multiplex sequence. Set the order in which the antennas are activated.
 
virtual List< int > GetAntennaMultiplex ()
 Gets the number of antennas to be multiplexed.
 
override void StopInventory ()
 Stops the continuous inventory scan.
 
- Public Member Functions inherited from MetraTecDevices.MetratecReader< T >
 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 SetCommand (String command)
 Send a command and check if the response contains "OK".
 
String GetCommand (String command)
 Send a command and check if the response contains "OK".
 
string[] SplitResponse (string response)
 Split a multiline response (and check the crc)
 
string[] SplitLine (string responseLine)
 Split a line response (and check the crc)
 
void FireInputChangeEvent (int inputPin, bool isHigh)
 Fire a inventory event.
 
override void HandleResponse (string response)
 Process the reader response...override for event check The base implementation must be called after success.
 
abstract void HandleInventoryEvent (string response)
 Parse the inventory event (+CINV, +CMINV, +CINVR)
 
override void PrepareReader ()
 Configure the reader. The base implementation must be called after success.
 
override void ConfigureReader ()
 Configure the reader. The base implementation must be called after success.
 
InvalidOperationException ParseErrorResponse (String response)
 Parse the error response and throw a InvalidOperationException with a detailed message.
 
override void SetHeartBeatInterval (int intervalInSec)
 Set the HeartBeatInterval ... override for send the heartbeat command. The base implementation must be called after success.
 
override void UpdateDeviceRevisions ()
 Returns the firmware revision ({firmware} {version})
 
- Protected Member Functions inherited from MetraTecDevices.MetratecReader< T >
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.
 

Properties

int CurrentAntennaPort [get, set]
 Current antenna port.
 
bool SingleAntennaInUse [get, set]
 True, if a single antenna is in use.
 
- Properties inherited from MetraTecDevices.MetratecReader< T >
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< InputChangedEventArgs >? InputChanged
 Input change event handler.
 
- Events inherited from MetraTecDevices.MetratecReader< T >
EventHandler< StatusEventArgs >? StatusChanged
 Status change event handler.
 
EventHandler< NewInventoryEventArgs< T > >? NewInventory
 new inventory event handler
 

Additional Inherited Members

- Protected Attributes inherited from MetraTecDevices.MetratecReader< T >
string id
 Reader id.
 
readonly ILogger Logger
 Logger.
 

Detailed Description

The reader class for the ASCII based metratec reader.

Type Constraints
T :RfidTag 

Constructor & Destructor Documentation

◆ MetratecReaderGen2() [1/4]

The reader class for all Metratec reader.

Parameters
connectionThe connection interface

◆ MetratecReaderGen2() [2/4]

The reader class for all Metratec reader.

Parameters
connectionThe connection interface
loggerThe connection interface

◆ MetratecReaderGen2() [3/4]

The reader class for all Metratec reader.

Parameters
connectionThe connection interface

///

Parameters
idThe reader id

◆ MetratecReaderGen2() [4/4]

MetraTecDevices.MetratecReaderGen2< T >.MetratecReaderGen2 ( 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

◆ ConfigureReader()

override void MetraTecDevices.MetratecReaderGen2< T >.ConfigureReader ( )
protectedvirtual

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

Implements MetraTecDevices.MetratecReader< T >.

◆ EnableInputEvents()

void MetraTecDevices.MetratecReaderGen2< T >.EnableInputEvents ( bool  enable = true)

Enable or disable input events.

Parameters
enableenable/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

◆ ExecuteCommand()

override string MetraTecDevices.MetratecReaderGen2< T >.ExecuteCommand ( string  command,
int  timeout = 10000 
)
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

Implements MetraTecDevices.MetratecReader< T >.

◆ FireInputChangeEvent()

void MetraTecDevices.MetratecReaderGen2< T >.FireInputChangeEvent ( int  inputPin,
bool  isHigh 
)
protected

Fire a inventory event.

Parameters
inputPinthe changed input pin
isHighthe new value

◆ GetAntenna()

int MetraTecDevices.MetratecReaderGen2< T >.GetAntenna ( )

Gets the current used single antenna.

Returns
the current used single antenna
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

◆ GetAntennaMultiplex()

virtual List< int > MetraTecDevices.MetratecReaderGen2< T >.GetAntennaMultiplex ( )
virtual

Gets the number of antennas to be multiplexed.

Returns
the number of antennas to be multiplexed
Exceptions
T:System.InvalidOperationExceptionIf the reader return an error

◆ GetCommand()

String MetraTecDevices.MetratecReaderGen2< T >.GetCommand ( String  command)
protected

Send a command and check if the response contains "OK".

Parameters
commandthe command to send
Returns
the command response

◆ GetInput()

override bool MetraTecDevices.MetratecReaderGen2< T >.GetInput ( int  pin)
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.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

Implements MetraTecDevices.MetratecReader< T >.

◆ GetOutput()

bool MetraTecDevices.MetratecReaderGen2< T >.GetOutput ( int  pin)

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

Parameters
pinThe requested input pin number
Returns
True if the output pin is high, otherwise false
Exceptions
T:System.InvalidOperationExceptionIf the reader return an error
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

◆ HandleInventoryEvent()

abstract void MetraTecDevices.MetratecReaderGen2< T >.HandleInventoryEvent ( string  response)
protectedpure virtual

Parse the inventory event (+CINV, +CMINV, +CINVR)

Parameters
response

Implemented in MetraTecDevices.UhfReaderGen2.

◆ HandleResponse()

override void MetraTecDevices.MetratecReaderGen2< T >.HandleResponse ( string  response)
protectedvirtual

Process the reader response...override for event check The base implementation must be called after success.

Parameters
responsea reader response

Reimplemented from MetraTecDevices.MetratecReader< T >.

◆ ParseErrorResponse()

InvalidOperationException MetraTecDevices.MetratecReaderGen2< T >.ParseErrorResponse ( String  response)
protected

Parse the error response and throw a InvalidOperationException with a detailed message.

Parameters
response
Returns
the InvalidOperationException

◆ PrepareReader()

override void MetraTecDevices.MetratecReaderGen2< T >.PrepareReader ( )
protectedvirtual

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

Reimplemented from MetraTecDevices.MetratecReader< T >.

◆ SetAntenna()

override void MetraTecDevices.MetratecReaderGen2< T >.SetAntenna ( int  antennaPort)
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

Implements MetraTecDevices.MetratecReader< T >.

◆ SetAntennaMultiplex() [1/2]

override void MetraTecDevices.MetratecReaderGen2< T >.SetAntennaMultiplex ( int  antennasToUse)
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

Implements MetraTecDevices.MetratecReader< T >.

◆ SetAntennaMultiplex() [2/2]

void MetraTecDevices.MetratecReaderGen2< T >.SetAntennaMultiplex ( List< int >  antennaSequence)

Sets the antenna multiplex sequence. Set the order in which the antennas are activated.

Parameters
antennaSequencethe antenna sequence
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

◆ SetCommand()

void MetraTecDevices.MetratecReaderGen2< T >.SetCommand ( String  command)
protected

Send a command and check if the response contains "OK".

Parameters
commandthe command to send

◆ SetHeartBeatInterval()

override void MetraTecDevices.MetratecReaderGen2< T >.SetHeartBeatInterval ( int  intervalInSec)
protectedvirtual

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

Parameters
intervalInSec
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 from MetraTecDevices.MetratecReader< T >.

◆ SetOutput()

override void MetraTecDevices.MetratecReaderGen2< T >.SetOutput ( int  pin,
bool  value 
)
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

Implements MetraTecDevices.MetratecReader< T >.

◆ SplitLine()

string[] MetraTecDevices.MetratecReaderGen2< T >.SplitLine ( string  responseLine)
protected

Split a line response (and check the crc)

Parameters
responseLinea line in the reader response
Returns

◆ SplitResponse()

string[] MetraTecDevices.MetratecReaderGen2< T >.SplitResponse ( string  response)
protected

Split a multiline response (and check the crc)

Parameters
responsethe reader response
Returns

◆ StopInventory()

override void MetraTecDevices.MetratecReaderGen2< T >.StopInventory ( )
virtual

Stops the continuous inventory scan.

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

Implements MetraTecDevices.MetratecReader< T >.

◆ UpdateDeviceRevisions()

override void MetraTecDevices.MetratecReaderGen2< T >.UpdateDeviceRevisions ( )
protectedvirtual

Returns the firmware revision ({firmware} {version})

Returns
The firmware revision ({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

Implements MetraTecDevices.MetratecReader< T >.

Property Documentation

◆ CurrentAntennaPort

int MetraTecDevices.MetratecReaderGen2< T >.CurrentAntennaPort
getsetprotected

Current antenna port.

◆ SingleAntennaInUse

bool MetraTecDevices.MetratecReaderGen2< T >.SingleAntennaInUse
getsetprotected

True, if a single antenna is in use.


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