UniPRT SDK  v1.0.0.0
UniPRT.Sdk.Monitor.RfidMonitor Class Reference

Provide support for RFID related services. Module to facilitate listening/retrieval of printer unsolicited messaging related to RFID. More...

Inheritance diagram for UniPRT.Sdk.Monitor.RfidMonitor:
UniPRT.Sdk.Monitor.IRfidMonitor

Public Member Functions

 RfidMonitor (string commDescriptor)
 Constructor called when creating a connection managed by the SDK. More...
 
void Dispose ()
 

Protected Member Functions

virtual void Dispose (bool disposing)
 

Properties

RfidReportNotice RfidReportCallback [get, set]
 Inherited from IRfidMonitor.RfidReportCallback.
 
bool RfidReportListening [get, set]
 Selects verson 1 report type from printer. Version 1 only sends reports when EPC data written. Otherwise reports sent when read/writes of EPC, USR, TID.
‍/ // For simplicity. Make this private for now. Use only version 2 and if end user needs reporting only when EPC written (version 1), we can add back. public bool RfidReportingUsingVersionOne { get { return _rfidReportSelectVersion_1; } set { if (value != _rfidReportSelectVersion_1) { _rfidReportSelectVersion_1 = value;. More...
 

Detailed Description

Provide support for RFID related services. Module to facilitate listening/retrieval of printer unsolicited messaging related to RFID.

Unsolicited messages, if enabled on printer, can be sent at any time. This module requires a constant "status" connection to the printer's management port in order to listen for any messaging sent out by printer.

Remarks

  • For RFID reports to be sent out by printer the following settings must be present:
    • On printer RFID menus: "UniPRT Mgr Rpt = Enable"

Examples

using System;
namespace Snippets
{
public class MyRfidMonitoring
{
private static RfidMonitor _rfidReportListener = null;
public static void MainRfidMonitor(string[] args)
{
Console.WriteLine("Listening for RFID reports.");
try
{
_rfidReportListener = new RfidMonitor("127.0.0.1");
_rfidReportListener.RfidReportListening = true; // enable parsing of unsolicited barcode report msgs from printer
_rfidReportListener.RfidReportCallback = myReportProcessing; // set the callback/delegate to call when reports received
while (true) // wait for something to happen
{
// pretend to be busy doing some other work here...
}
}
catch (Exception e)
{
Console.WriteLine($"Exception Msg: {e.Message}");
}
finally
{
_rfidReportListener?.Dispose();
}
}
public static void myReportProcessing(RfidReport report)
{
// this function called when RFID reports received.
// Here we can read and use any part of the report as needed.
// In our case, simply printing report contents to console but could write to file for archiving if needed
if (report.Failed)
{
Console.WriteLine("\nRFID Failed.");
}
else
{
string memoryType = "";
switch (report.DataType)
{
case RfidReport.RfidDataType.USR:
memoryType = "USR";
break;
case RfidReport.RfidDataType.TID:
memoryType = "TID";
break;
case RfidReport.RfidDataType.UNKNOWN:
memoryType = "UNKNOWN";
break;
}
Console.WriteLine("\nRFID Passed.");
Console.WriteLine($"Write Action: {((report.IsWriteOperation) ? "yes" : "no")}");
Console.WriteLine($"Operation on EPC Memory: {((report.DataType == RfidReport.RfidDataType.EPC) ? "yes" : "no")}");
if (report.DataType != RfidReport.RfidDataType.EPC)
{
Console.WriteLine($" memory accessed: {memoryType}");
}
Console.WriteLine($"Data: \n {report.Data}");
}
}
}
}

Output

Result after sending print job that writes to EPC, USR and reads USR memory.

Output

Constructor & Destructor Documentation

◆ RfidMonitor()

UniPRT.Sdk.Monitor.RfidMonitor.RfidMonitor ( string  commDescriptor)

Constructor called when creating a connection managed by the SDK.

commDescriptor is descriptor for the communication used to connect with printer.
TCP descriptor format: "ip" or "ip:port"
e.g. "127.0.0.1" or "127.0.0.1:3007"
If port is not provided, default value is used.

Property Documentation

◆ RfidReportListening

bool UniPRT.Sdk.Monitor.RfidMonitor.RfidReportListening
getset

Selects verson 1 report type from printer. Version 1 only sends reports when EPC data written. Otherwise reports sent when read/writes of EPC, USR, TID.
‍/ // For simplicity. Make this private for now. Use only version 2 and if end user needs reporting only when EPC written (version 1), we can add back. public bool RfidReportingUsingVersionOne { get { return _rfidReportSelectVersion_1; } set { if (value != _rfidReportSelectVersion_1) { _rfidReportSelectVersion_1 = value;.

// refresh the report listening so that correct version gets sent to printer. if (_rfidReportListening) { RfidReportListening = _rfidReportListening; } } } }

    /**      
       \~English @brief
          Inherited from IRfidMonitor.RfidReportListening.

        \~Chinese-Traditional @brief
          繼承自 IRfidMonitor.RfidReportListening。

        \~Chinese @brief
          继承自 IRfidMonitor.RfidReportListening。
UniPRT.Sdk.Reports
Definition: OdvReport.cs:5
UniPRT
Provide support for different communication interfaces/ports.
Definition: Communication.cs:9
UniPRT.Sdk
Definition: Communication.cs:9
UniPRT.Sdk.Monitor
Definition: OdvMonitor.cs:14