Class ReliancePrinter
Reliance Thermal Printer class provides access access to flash updating, configuration, status reporting, and other commands. For best results, we recommend testing against the latest available firmware for Reliance.
Use Reliance Tools for PC to update your printer to the latest firmware through the auto update feature. You may also contact our support team to get the latest firmware file at mailto:support@pyramidacceptors.com
Reliance Tools for PC https://pyramidacceptors.com/app/reliance-tools/
Inheritance
Namespace: PTIRelianceLib
Assembly: PTIRelianceLib.dll
Syntax
public class ReliancePrinter : object, IPyramidDevice, IDisposable
Constructors
| Improve this Doc View SourceReliancePrinter()
Create a new Reliance Printer. The printer will be discovered automatically. If HIDapi or one of its dependencies cannot be found or loaded, PTIException will be thrown.
Declaration
public ReliancePrinter()
Exceptions
| Type | Condition |
|---|---|
| PTIException | Thrown if native HID library cannot be loaded |
Fields
| Improve this Doc View SourceProductId
USB product id for all Reliance USB interfaces
Declaration
public const int ProductId = null
Field Value
| Type | Description |
|---|---|
| System.Int32 | USB PID |
VendorId
USB vendor id for all Reliance USB interfaces
Declaration
public const int VendorId = null
Field Value
| Type | Description |
|---|---|
| System.Int32 | USB VID |
Properties
| Improve this Doc View SourceIsDeviceReady
Returns true if device is ready to be read from or written to
Declaration
public bool IsDeviceReady { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
FlashUpdateTarget(BinaryFile, ProgressMonitor)
Install the specified firmware BinaryFile on
this device. With few exceptions, most any firmware can be installed
using this method. The reporter ProgressMonitor
provides callbacks for messages, progress, and errors.
Declaration
public ReturnCodes FlashUpdateTarget(BinaryFile firmware, ProgressMonitor reporter = null)
Parameters
| Type | Name | Description |
|---|---|---|
| BinaryFile | firmware | Firmware image data |
| ProgressMonitor | reporter | Progress callback instance |
Returns
| Type | Description |
|---|---|
| ReturnCodes |
|
Remarks
Updates target Reliance Thermal printer with this firmware.
This API supports printers with firmware 1.22 or newer. If you
have a printer firmware older than 1.22, you must use the PC
version of Reliance Tools to upgrade your firmware.
GetFirmwareRevision()
Returns the firmware Revlev of this device.
If there is an error reading the firmware revision, a Revlev of
0.0.0 will instead be returned.
Declaration
public Revlev GetFirmwareRevision()
Returns
| Type | Description |
|---|---|
| Revlev | Revision |
GetInstalledCodepages()
Returns a list of installed codepages. This is a list of codepage ids that are installed on the target printer. Only codepages that are installed may be selected for usage.
Declaration
public IEnumerable<ushort> GetInstalledCodepages()
Returns
| Type | Description |
|---|---|
| IEnumerable<System.UInt16> |
|
GetLifetimeTelemetry()
Returns the telemetry data over the lifetime of this printer
Declaration
public LifetimeTelemetry GetLifetimeTelemetry()
Returns
| Type | Description |
|---|---|
| LifetimeTelemetry | LifetimeTelemetry data since printer left factory |
Remarks
Requires firmware 1.28+. Older firmware will result in null result.
GetPowerupTelemetry()
Returns the telemetry data of this printer since last power up
Declaration
public PowerupTelemetry GetPowerupTelemetry()
Returns
| Type | Description |
|---|---|
| PowerupTelemetry | Powerup telemetry or null if read failure or unsupported firmware |
Remarks
Requires firmware 1.28+. Older firmware will result in null result.
GetPrinterType()
Queries the printer type. This command requires firmware 1.46+.
Declaration
public PrinterType? GetPrinterType()
Returns
| Type | Description |
|---|---|
| System.Nullable<PrinterType> | null on error, PrinterType.RelianceOne for Reliance One printers PrinterType.RelianceTwo for Reliance Two printers |
GetSerialNumber()
Returns the serial number for this device
Declaration
public string GetSerialNumber()
Returns
| Type | Description |
|---|---|
| System.String |
|
GetStatus()
Returns the Status for the attached printer. If there
is no device connected, null will be returned.
You can use this method to read the ticket status. See TicketStates,
which are a member of Status.
Declaration
public Status GetStatus()
Returns
| Type | Description |
|---|---|
| Status | Status object or |
Ping()
For printers, all comms are halted while printing (with special exception for ESC/POS realtime status). If Ping() is called during a print, this will block for a small period of time and then return unsuccessfully. The resulting ReturnCode will be ExecutionFailure. It is recommended to try this method multiple times before assuming the printer is offline.
Declaration
public ReturnCodes Ping()
Returns
| Type | Description |
|---|---|
| ReturnCodes |
|
PrintLogo(Int32)
Prints logo from internal bank specified by index. If the specified logo index does not exist, the first logo in the bank will instead be printed. Negative indices and indices larger than 255 will generate a InvalidRequestPayload return code.
Declaration
public ReturnCodes PrintLogo(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | Logo index, zero based |
Returns
| Type | Description |
|---|---|
| ReturnCodes | Return Code |
ReadConfiguration()
Reads current configuration from this device and returns result as a JSON BinaryFile If there is an error reading the configuration, an empty BinaryFile is returned. You can check for an empty result via Empty.
A configuration is a JSON formatted file that contains settings like baud rate, paper width, and print quality.
Declaration
public BinaryFile ReadConfiguration()
Returns
| Type | Description |
|---|---|
| BinaryFile | BinaryFile |
Reboot()
For printers, a reboot (and any power up event) will generate a start up ticket that calibrates the paper path. Rebooting the printer remotely will cause a paper feed and leave this ticket at the front bezel. If you have auto-retract enabled, the ticket will be get pulled back into the kiosk for disposal after a period of time. An exception of type PTIException may be raised if there is an error during reboot.
Declaration
public ReturnCodes Reboot()
Returns
| Type | Description |
|---|---|
| ReturnCodes |
|
Exceptions
| Type | Condition |
|---|---|
| PTIException | Raised if there is an unrecoverable issue during the reboot operation. This usually means that the USB port entered an unexpected state. If this happens, dispose of this ReliancePrinter (e.g. dispose) and then try again. |
ResetTelemetry()
Reset all telemetry counters. This include the lifetime and powerup counters. This operation cannot be undone.
Declaration
public ReturnCodes ResetTelemetry()
Returns
| Type | Description |
|---|---|
| ReturnCodes | Success code |
Remarks
Data will be permanently erased
SendConfiguration(BinaryFile)
Parses config from BinaryFile and
sends to target printer. PTIException is thrown if config file cannot be parsed
Declaration
public ReturnCodes SendConfiguration(BinaryFile config)
Parameters
| Type | Name | Description |
|---|---|---|
| BinaryFile | config | Configuration to send |
Returns
| Type | Description |
|---|---|
| ReturnCodes |
|
Exceptions
| Type | Condition |
|---|---|
| PTIException | Thrown if config file cannot be parsed |
StoreLogos(IList<BinaryFile>, IProgressMonitor, LogoStorageConfig)
Writes the provided logos to internal logo bank. These logos can be accessed
by their index in the list using PrintLogo(Int32). Logos are stored in
non-volatile memory so these only need to be written once. It is not recommended
to call this method excessively (e.g. on every print job) as this is writing to
flash and you will degrade the flash chip.
myLogos = { logoA, logoB, logoC };
StoreLogos(myLogos, monitor, storageConfig);
printer.PrintLogo(0); // Print logo A
printer.PrintLogo(2); // Print logo C
Declaration
public ReturnCodes StoreLogos(IList<BinaryFile> logoData, IProgressMonitor monitor, LogoStorageConfig storageConfig)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<BinaryFile> | logoData | List of raw logo image data |
| PTIRelianceLib.IProgressMonitor | monitor | Progress reporter |
| LogoStorageConfig | storageConfig | Logo alteration and storage options. Uses Default if storageConfig is set to null. You probably want to configure this yourself. |
Returns
| Type | Description |
|---|---|
| ReturnCodes | Return Code |