RelianceCore  1.4.0
Reliance Thermal Printer API
Data Structures | Typedefs | Enumerations | Functions
RelianceCore API

Required header for integration into your project. More...

Data Structures

class  RelianceHID
 Primary interface for interacting with Reliance Thermal Printer. More...
 
struct  RelianceHID::Revision
 Describes a firmware revision levels using semver syntax. More...
 
struct  RelianceHID::Result
 Describes response from all RelianceHID printer commands. More...
 
struct  RelianceHID::RelianceStatus
 Status response from Reliance printer. More...
 

Typedefs

using RelianceHID::ArgList = std::vector< std::string >
 List of string arguments. More...
 

Enumerations

Functions

bool RelianceHID::RelianceStatus::hasSensorFlag (SensorStatus flag)
 Helper function to check if specified flag is set. More...
 
bool RelianceHID::RelianceStatus::hasErrorFlag (ErrorStatus flag)
 Helper function to check if specified flag is set. More...
 
bool RelianceHID::RelianceStatus::hasSensorFlag (SensorStatus flag) const
 Const function method to check if specified flag is set. More...
 
bool RelianceHID::RelianceStatus::hasErrorFlag (ErrorStatus flag) const
 Const function method to check if specified flag is set. More...
 
bool RelianceHID::RelianceStatus::isPaperLow ()
 Helper function returns true if status report indicates paper low. More...
 
bool RelianceHID::RelianceStatus::isPaperOut ()
 Helper function returns true if status report indicates paper is out. More...
 
static float RelianceHID::RelianceStatus::adc2Voltage (uint16_t adc)
 Returns the voltage given a raw ADC reading. This assumes a 12-bit ADC. More...
 
RELIANCECORE_EXPORT Result RelianceHID::initialize ()
 Attempt to connect to device. More...
 
RELIANCECORE_EXPORT Result RelianceHID::getRevision (Revision *rev)
 Read firmware revision from target. More...
 
RELIANCECORE_EXPORT Result RelianceHID::ping ()
 Side effect free command to test for presence of printer. More...
 
RELIANCECORE_EXPORT Result RelianceHID::reboot ()
 Immediately perform a hard reboot of the printer. More...
 
RELIANCECORE_EXPORT Result RelianceHID::getStatus (RelianceStatus *status)
 Get the current status of Reliance printer. More...
 
RELIANCECORE_EXPORT Result RelianceHID::getVirtualCommsEnabled ()
 Gets the state of the USB virtual comm port feature. More...
 
RELIANCECORE_EXPORT Result RelianceHID::setVirtualCommsEnabled (bool enabled)
 Enable or disable the USB virtual comm port feature. More...
 
RELIANCECORE_EXPORT Result RelianceHID::getStartupTicketEnabled ()
 Gets the state of the startup ticket feature. More...
 
RELIANCECORE_EXPORT Result RelianceHID::setStartupTicketEnabled (bool enabled)
 Sets the state of the startup ticket feature. More...
 
RELIANCECORE_EXPORT Result RelianceHID::getUnknownCommands (std::vector< int > &dst)
 Returns a list of ESC/POS commands the Reliance does not understand. More...
 
RELIANCECORE_EXPORT Result RelianceHID::getPaperWidth ()
 Returns the current configured paper roll width. More...
 
RELIANCECORE_EXPORT Result RelianceHID::setPaperWidth (int width)
 Change the paper roll width configuration. More...
 
RELIANCECORE_EXPORT Result RelianceHID::getMotorGen ()
 Returns the current motor configuration. More...
 
RELIANCECORE_EXPORT Result RelianceHID::setMotorGen (int gen)
 Change the motor configuration to another gen. More...
 
RELIANCECORE_EXPORT Result RelianceHID::getMotorCurrent ()
 Returns the current motor current in milliamps. More...
 
RELIANCECORE_EXPORT Result RelianceHID::setMotorCurrent (int current)
 Change the motor current. More...
 

Detailed Description

Required header for integration into your project.

Author
Cory Todd
Date
9/19/2017

Typedef Documentation

using RelianceHID::ArgList = std::vector<std::string>

List of string arguments.

Enumeration Type Documentation

Bit enumberation describes each error state that can be reported by Reliance.

Enumerator
isJammed 
  • 0: No jam, - 1: Jam has disabled printer
isOverheated 
  • 0: Normal system temp, - 1: Printer is overheated and disabled
isCutterErr 
  • 0: Cutter is okay, - 1: Cutter is in an error staes (e.g. stuck up)
isOverVoltage 
  • 0: System voltage okay, - 1: System over voltage
isUnderVoltage 
  • 0: System voltage okay, - 1: System under voltage
isPlatenOpen 
  • 0: Platen (head) is closed, - 1: Platen (head) open
_reserved 

Reserved.

isUnknownErr 
  • 0: No unknown error, -1: Has an error, we don't know what

Quick return code.

Enumerator
Okay 

Successful command.

Timeout 

No response within timeout period.

BadResp 

Response received but it was corrupt.

BadArg 

Invalid argument provided to command builder.

DeviceNXE 

No device found.

NoInit 

Device is not initialized.

Bit enumeration describes the state of each sensor.

Enumerator
platenOn 
  • 0: Platen off, - 1: Platen on
cutterHome 
  • 0: Cuter not home, - 1: Cutter home
tachOk 
  • 0: Tach okay, - 1: Tach error (ALWAYS 0)
presenterPaperPres 
  • 0: Paper not present - 1: Paper present
pathPaperPres 
  • 0: Paper not present - 1: Paper present
paperPaperPres 
  • 0: Paper not present - 1: Paper present
notchPres 
  • 0: Notch not present - 1: Notch present/detected
armPaperPres 
  • 0: Paper arm not installed - 1: Paper arm installed

Reliance will always be in one of these states.

Enumerator
Idle 

Printer is not moving paper, no ticket in bezel.

Printing 

Printer is actively printing on paper.

Presenting 

Printing is complete and paper is in transit.

Presented 

Printing is complete, transit is complete, paper is at bezel.

Function Documentation

static float RelianceHID::RelianceStatus::adc2Voltage ( uint16_t  adc)
static

Returns the voltage given a raw ADC reading. This assumes a 12-bit ADC.

RELIANCECORE_EXPORT Result RelianceHID::getMotorCurrent ( )

Returns the current motor current in milliamps.

This is the current that is applied to printer motor.

Returns
ret and message fields will be set with additional information. Result::value set to motor current value
RELIANCECORE_EXPORT Result RelianceHID::getMotorGen ( )

Returns the current motor configuration.

There are currently two motors, gen1 and gen2. The returned result will populate the value field with 0, 1, etc. which represent these motor gens.

Returns
ret and message fields will be set with additional information. Result::value set to motor generation code
RELIANCECORE_EXPORT Result RelianceHID::getPaperWidth ( )

Returns the current configured paper roll width.

Reliance supports paper rolls width from 58mm though 80mm. This setting enables proper print margins for your chosen roll width.

Returns
ret and message fields will be set with additional information. Result::value set to paper width in mm
RELIANCECORE_EXPORT Result RelianceHID::getRevision ( Revision rev)

Read firmware revision from target.

Parameters
revout parameter
Returns
ret and message fields will be set with additional information
RELIANCECORE_EXPORT Result RelianceHID::getStartupTicketEnabled ( )

Gets the state of the startup ticket feature.

When enabled, Reliance will print its configuration to a ticket on every power up. When disabled, this behavior is disabled.

Note
This only controls the startup ticket. The ticket that is printed when you feed in paper cannot be disabled.
Returns
ret and message fields will be set with additional information
RELIANCECORE_EXPORT Result RelianceHID::getStatus ( RelianceStatus status)

Get the current status of Reliance printer.

Parameters
statuswill be written with current status
Returns
ret and message fields will be set with additional information
RELIANCECORE_EXPORT Result RelianceHID::getUnknownCommands ( std::vector< int > &  dst)

Returns a list of ESC/POS commands the Reliance does not understand.

The list will be written to dst in the order cmd:arg where cmd is a known ESC/POS prefix such as ESC, FS, or GS (1B, 1C, 1D) and the arg is the first given parmeter. This is useful for legacy applications that send uncommon or customer ESC/POS commands to their printers.

Parameters
dstvector to write log to
Returns
ret and message fields will be set with additional information
RELIANCECORE_EXPORT Result RelianceHID::getVirtualCommsEnabled ( )

Gets the state of the USB virtual comm port feature.

When enabled, Reliance will enumerate an additional USB interface as a CDC comm port. Check device manager or /dev/tty* to find the OS assigned port name.

Returns
Result.value - 0 - Off (disabled) 1 - On (enabled)
bool RelianceHID::RelianceStatus::hasErrorFlag ( ErrorStatus  flag)

Helper function to check if specified flag is set.

Parameters
flagto check
Returns
true if current ErrorStatus contains flag
bool RelianceHID::RelianceStatus::hasErrorFlag ( ErrorStatus  flag) const

Const function method to check if specified flag is set.

Parameters
flagto check
Returns
true if current ErrorStatus contains flag
bool RelianceHID::RelianceStatus::hasSensorFlag ( SensorStatus  flag)

Helper function to check if specified flag is set.

Parameters
flagto check
Returns
true if current SensorStatus contains flag
bool RelianceHID::RelianceStatus::hasSensorFlag ( SensorStatus  flag) const

Const function method to check if specified flag is set.

Parameters
flagto check
Returns
true if current SensorStatus contains flag
RELIANCECORE_EXPORT Result RelianceHID::initialize ( )

Attempt to connect to device.

Warning
This must be called before executing any commands
Returns
ret and message fields will be set with additional information
bool RelianceHID::RelianceStatus::isPaperLow ( )

Helper function returns true if status report indicates paper low.

Warning
If no arm is attached to Reliance, the response will always be true regardless of paper level.
Returns
true if paper low. If false, no paper low warnings are present
bool RelianceHID::RelianceStatus::isPaperOut ( )

Helper function returns true if status report indicates paper is out.

Returns
true if there is no paper. If false, paper is present
RELIANCECORE_EXPORT Result RelianceHID::ping ( )

Side effect free command to test for presence of printer.

Returns
ret and message fields will be set with additional information
RELIANCECORE_EXPORT Result RelianceHID::reboot ( )

Immediately perform a hard reboot of the printer.

Warning
You must call initialize after a reboot
Returns
ret and message fields will be set with additional information
RELIANCECORE_EXPORT Result RelianceHID::setMotorCurrent ( int  current)

Change the motor current.

Warning
This function should not be called under normal conditions. This is for service technicians that may be replacing motors in older units.
Parameters
currentmilliamps to apply to printer motor (min: 50, max: 1500)
Returns
ret and message fields will be set with additional information
RELIANCECORE_EXPORT Result RelianceHID::setMotorGen ( int  gen)

Change the motor configuration to another gen.

Warning
This function should not be called under normal conditions. This is for service technicians that may be replacing motors in older units.
Parameters
gen0 for gen1, 1 for gen 2
Returns
ret and message fields will be set with additional information
RELIANCECORE_EXPORT Result RelianceHID::setPaperWidth ( int  width)

Change the paper roll width configuration.

Parameters
widthvalue between 58 and 80, inclusive
Returns
ret and message fields will be set with additional information
RELIANCECORE_EXPORT Result RelianceHID::setStartupTicketEnabled ( bool  enabled)

Sets the state of the startup ticket feature.

Note
When enabled, Reliance will print its configuration to a ticket on every power up. When disabled, this behavior is disabled.
This only controls the startup ticket. The ticket that is printed when
Parameters
enabledtrue or false
Returns
ret and message fields will be set with additional information
RELIANCECORE_EXPORT Result RelianceHID::setVirtualCommsEnabled ( bool  enabled)

Enable or disable the USB virtual comm port feature.

When enabled, Reliance will enumerate an additional USB interface as a CDC comm port. Check device manager or /dev/tty* to find the OS assigned port name.

Note
A reboot of the printer is required in order for this to take effect
See also
RelianceHID::reboot
Parameters
enabledtrue or false
Returns
ret and message fields will be set with additional information