Auto ID SDK v1.00 (beta) 5/15/2022
PrinterMonitor Class Reference

Module to facilitate listening/retrieval of printer unsolicited messaging or retrieval of printer status/information. More...

Inheritance diagram for PrinterMonitor:

Public Member Functions

delegate void AlertStatusNotice (string[] alert)
 Delegate function signature type for setting the callback for fault/alert change notice. More...
 
delegate void DisplayStatusNotice (string[] displayLines)
 Delegate function signature type for setting the callback for front panel change notice. More...
 
void Dispose ()
 
delegate void EngineStatusNotice (string engineState)
 Delegate function signature type for setting the callback for engine status change notice. More...
 
string GetEngineStatus ()
 Query the printer for the engine status. More...
 
string[] GetFaultStatus ()
 Query the printer for fault status. More...
 
PrinterInfo GetPrinterInfo ()
 Get printer information. More...
 

Protected Member Functions

virtual void Dispose (bool disposing)
 

Properties

AlertStatusNotice AlertStatusCallback [getset]
 Holds the function to call when fault/alert msgs received from printer. Function must match signature of AlertStatusNotice.
 
bool? AlertStatusListening [getset]
 enable/disable listening/parsing unsolicited fault status alerts from printer More...
 
DisplayStatusNotice DisplayStatusCallback [getset]
 Holds the function to call when display text msgs received from printer. Function must match signature of DisplayStatusNotice.
 
bool? DisplayStatusListening [getset]
 enable/disable listening/parsing unsolicited front panel display text from printer More...
 
EngineStatusNotice EngineStatusCallback [getset]
 Holds the function to call when engine status received from printer. Function must match signature of EngineStatusNotice.
 
bool? EngineStatusListening [getset]
 enable/disable listening/parsing unsolicited engine status from printer More...
 

Detailed Description

Module to facilitate listening/retrieval of printer unsolicited messaging or retrieval of printer status/information.

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

Examples

using System;
namespace Snippets
{
public class MyPrinterMonitoring
{
// setup a comm and xml parser for listening to xml msgs from printer
private static PrinterMonitor _PrinterMntr = null;
public static void MainPrinterMonitor(string[] args)
{
Console.WriteLine("Monitoring Printer.");
try
{
_PrinterMntr = new PrinterMonitor("192.168.1.53");
// setup for listening for alerts
_PrinterMntr.AlertStatusListening = true; // enable unsolicited alert status msgs from printer
_PrinterMntr.AlertStatusCallback = PtrAlertNoticeListener;
// setup for listening for Engine Status
_PrinterMntr.EngineStatusListening = true; // enable unsolicited engine status msgs from printer
_PrinterMntr.EngineStatusCallback = PtrEngineStatusNoticeListener;
// setup for listening for display text msgs
_PrinterMntr.DisplayStatusListening = true; // enable unsolicited display text msgs from printer
_PrinterMntr.DisplayStatusCallback = PtrDisplayStatusNoticeListener;
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
{
_PrinterMntr?.Dispose();
}
}
private static void PtrAlertNoticeListener(string[] newAlertText)
{
// Print out alerts: e.g. "2418" ("Print Head Open" fault/alert)
Console.WriteLine($"Printer Alert #: \r\n {newAlertText[0]} - {newAlertText[1]}\r\n");
}
private static void PtrEngineStatusNoticeListener(string newEngineStatus)
{
// Print out engine status: e.g. "idle", "offline", "online", "printing"...
Console.WriteLine($"Engine Status: \r\n {newEngineStatus} \r\n");
}
private static void PtrDisplayStatusNoticeListener(string[] newDisplayText)
{
// Print display msgs: e.g. "ONLINE" "ETHERNET/PGL/LP+" or "PRINT HEAD UP" "Close Print Head"
Console.WriteLine("Printer Display: ");
foreach (string txtLine in newDisplayText)
{
Console.WriteLine($" {txtLine}");
}
}
}
}
Definition: PrinterMonitor.cs:20
Definition: TcpComm.cs:14
Definition: TcpComm.cs:14

Output

Result after causing fault by opening/closing print head, and pressing the pause button on printer to place printer "offline"/"online".

Output


Member Function Documentation

◆ AlertStatusNotice()

delegate void AlertStatusNotice ( string[]  alert)

Delegate function signature type for setting the callback for fault/alert change notice.

The alert string array passsed in represents the alert number sent by printer at alert[0] and brief description at alert[1]
e.g. "2418" represents a "Print Head Open" alert.
alert[0] = "2418"; alert[1] = "Print Head Open";

◆ DisplayStatusNotice()

delegate void DisplayStatusNotice ( string[]  displayLines)

Delegate function signature type for setting the callback for front panel change notice.

The displayLines passsed is a string array with each entry representing a text line on display.
e.g. displayLines[0] = 1st text line on display, displayLines[1] = 2nd text line on display

◆ EngineStatusNotice()

delegate void EngineStatusNotice ( string  engineState)

Delegate function signature type for setting the callback for engine status change notice.

The engineState passsed in is any of the "fault", "idle", "offline", "pause", "printing", "present" (Label Present).

◆ GetEngineStatus()

string GetEngineStatus ( )
inline

Query the printer for the engine status.

Engine status is useful to check if printer is in a state that can print before sending a print job.
The string returned is any of the "fault", "idle", "offline", "pause", "printing", "present" (Label Present).

◆ GetFaultStatus()

string[] GetFaultStatus ( )
inline

Query the printer for fault status.

Fault status is used to check if printer is in a fault state that needs attention or may prevent processing of any print job.

The alert string array returned represents the alert number sent by printer at alert[0] and brief description at alert[1]
e.g. "2418" represents a "Print Head Open" alert. alert[0] = "2418"; alert[1] = "Print Head Open";

◆ GetPrinterInfo()

PrinterInfo GetPrinterInfo ( )
inline

Get printer information.

Useful for cases where want to check model, firmware version, options installed and other hardware specific details.

Property Documentation

◆ AlertStatusListening

bool? AlertStatusListening
getset

enable/disable listening/parsing unsolicited fault status alerts from printer

Note that this must be enabled in order to receive any notifications, AlertStatusCallback, from printer.

◆ DisplayStatusListening

bool? DisplayStatusListening
getset

enable/disable listening/parsing unsolicited front panel display text from printer

Note that this must be enabled in order to receive any notifications, DisplayStatusCallback, from printer.

◆ EngineStatusListening

bool? EngineStatusListening
getset

enable/disable listening/parsing unsolicited engine status from printer

Note that this must be enabled in order to receive any notifications, EngineStatusCallback, from printer.