UniPRT SDK v1.0.0.0
 
Loading...
Searching...
No Matches
PrinterMonitor Class Reference

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

#include <PrinterMonitor.h>

Inheritance diagram for PrinterMonitor:

Public Types

typedef void(^ EngineStatusCallback) (NSString *newEngineState)
 A callback type for engine status changes.
 
typedef void(^ DisplayStatusCallback) (NSArray< NSString * > *panelText)
 A callback type for display status changes.
 
typedef void(^ AlertStatusCallback) (NSArray< NSString * > *alertText)
 A callback type for alert status changes.
 

Instance Methods

(instancetype) - initWithTcpComm:
 Initializes a new instance with the given TCP communication object.
 
(instancetype) - initWithJsonComm:
 Initializes a new instance with the given JSON communication object.
 
(instancetype) - initWithCommDescriptor:
 Constructor called when creating a connection managed by the SDK.
 
(PrinterInfo *) - getPrinterInfo
 Get printer information.
 
(NSString *) - getEngineStatus
 Query the printer for the engine status.
 
(NSArray< NSString * > *) - getFaultStatus
 Query the printer for fault status.
 
(void) - SetEngineStatusListening:
 Sets whether engine status listening is enabled.
 
(void) - SetDisplayStatusListening:
 Sets whether display status listening is enabled.
 
(void) - SetAlertStatusListening:
 Sets whether alert status listening is enabled.
 

Properties

BOOL engineStatusListening
 Enable/disable listening/parsing unsolicited engine status from printer.
 
BOOL displayStatusListening
 Enable/disable listening/parsing unsolicited front panel display text from printer.
 
BOOL alertStatusListening
 Enable/disable listening/parsing unsolicited fault status alerts from printer.
 
EngineStatusCallback engineStatusCallback
 Holds the function to call when engine status received from printer. Function must match signature of EngineStatusNotice.
 
DisplayStatusCallback displayStatusCallback
 Holds the function to call when display text messages are received from printer. Function must match signature of DisplayStatusNotice.
 
AlertStatusCallback alertStatusCallback
 Holds the function to call when fault/alert messages are received from printer. Function must match signature of AlertStatusNotice.
 

Detailed Description

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

Unsolicited 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.

Member Typedef Documentation

◆ AlertStatusCallback

- AlertStatusCallback

A callback type for alert status changes.

Parameters
alertTextThe new alert text.

◆ DisplayStatusCallback

- DisplayStatusCallback

A callback type for display status changes.

Parameters
panelTextThe new panel text.

◆ EngineStatusCallback

- EngineStatusCallback

A callback type for engine status changes.

Parameters
newEngineStateThe new engine state.

Method Documentation

◆ getEngineStatus

- (NSString *) getEngineStatus

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).

Implemented in PrinterMonitor.

Returns
A string representing the engine status.

◆ getFaultStatus

- (NSArray< NSString * > *) getFaultStatus

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";

Implemented in PrinterMonitor.

Returns
An array of strings representing the fault status.

◆ getPrinterInfo

- (PrinterInfo *) getPrinterInfo

Get printer information.

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

Implemented in PrinterMonitor.

Returns
A PrinterInfo object containing the printer information.

◆ initWithCommDescriptor:

- (instancetype) initWithCommDescriptor: (NSString *) 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.

Parameters
commDescriptorThe communication descriptor.
Returns
An initialized instance of PrinterMonitor, or nil if the object could not be created.

◆ initWithJsonComm:

- (instancetype) initWithJsonComm: (JsonComm *) mgmtComm

Initializes a new instance with the given JSON communication object.

Parameters
mgmtCommThe JSON communication object.
Returns
An initialized instance of PrinterMonitor, or nil if the object could not be created.

◆ initWithTcpComm:

- (instancetype) initWithTcpComm: (TcpComm *) connection

Initializes a new instance with the given TCP communication object.

Parameters
connectionThe TCP communication object.
Returns
An initialized instance of PrinterMonitor, or nil if the object could not be created.

◆ SetAlertStatusListening:

- (void) SetAlertStatusListening: (BOOL) value

Sets whether alert status listening is enabled.

Parameters
valueYES to enable listening, NO to disable.

◆ SetDisplayStatusListening:

- (void) SetDisplayStatusListening: (BOOL) value

Sets whether display status listening is enabled.

Parameters
valueYES to enable listening, NO to disable.

◆ SetEngineStatusListening:

- (void) SetEngineStatusListening: (BOOL) value

Sets whether engine status listening is enabled.

Parameters
valueYES to enable listening, NO to disable.

Property Documentation

◆ alertStatusCallback

- (AlertStatusCallback) alertStatusCallback
readwritenonatomiccopy

Holds the function to call when fault/alert messages are received from printer. Function must match signature of AlertStatusNotice.

◆ alertStatusListening

- (BOOL) alertStatusListening
readwritenonatomicassign

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.

◆ displayStatusCallback

- (DisplayStatusCallback) displayStatusCallback
readwritenonatomiccopy

Holds the function to call when display text messages are received from printer. Function must match signature of DisplayStatusNotice.

◆ displayStatusListening

- (BOOL) displayStatusListening
readwritenonatomicassign

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.

◆ engineStatusCallback

- (EngineStatusCallback) engineStatusCallback
readwritenonatomiccopy

Holds the function to call when engine status received from printer. Function must match signature of EngineStatusNotice.

◆ engineStatusListening

- (BOOL) engineStatusListening
readwritenonatomicassign

Enable/disable listening/parsing unsolicited engine status from printer.

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


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