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

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

Inheritance diagram for UniPRT.Sdk.Monitor.OdvMonitor:
UniPRT.Sdk.Monitor.IOdvMonitor

Public Member Functions

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

Protected Member Functions

virtual void Dispose (bool disposing)
 

Properties

OdvReportNotice OdvReportCallback [get, set]
 Inherited from IOdvMonitor.OdvReportCallback.
 
bool OdvReportListening [get, set]
 Inherited from IOdvMonitor.OdvReportListening.
 

Detailed Description

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

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 ODV reports to be sent out by printer the following settings must be present:
    • On printer OVD menus: "Validator Active = Enable", "Telemetry Path = Network Port", "Telemetry Data = Full Report"

Examples

using System;
using System.Collections.Generic;
namespace Snippets
{
public class MyOdvMonitoring
{
private static OdvMonitor _odvReportListener = null;
public static void MainOdvMonitor(string[] args)
{
Console.WriteLine("Listening for ODV barcode reports.");
try
{
_odvReportListener = new OdvMonitor("127.0.0.1");
_odvReportListener.OdvReportListening = true; // enable parsing of unsolicited barcode report msgs from printer
_odvReportListener.OdvReportCallback = myOdvReportProcessing; // 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
{
// release any resources associated with object
_odvReportListener?.Dispose();
}
}
public static void myOdvReportProcessing(OdvReport odvReport)
{
// Could also customize into CSV format based on needs
string userFriendlyResult = odvReport.Failed ? "failed" : "passed"; // failure output as "failed"/"passed" to make more user friendly
Console.WriteLine("\r\nShort CSV Format (customized ordered list): pass/fail, Grade, Data");
Console.WriteLine($" {userFriendlyResult}, {odvReport.OverallGrade}, {odvReport.Data}");
}
}
}

Output

Result after sending print job with barcode to printer and getting back barcode report.

Output

Constructor & Destructor Documentation

◆ OdvMonitor()

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

Constructor called when creating a connection managed by the SDK.

commDescriptor is the 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.

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