GPC  v1.0.0-2516
Gorman Print Control
BinaryProtocol Class Referencefinal

The IncJet devices can communicate using several different methods. More...

Collaboration diagram for BinaryProtocol:

Public Types

enum  ECode {
  kInvalid = 0xff,
  kPowerUpMsg = 0x01,
  kAcknowledgeMsg = 0x09,
  kKeepAlive = 0x30,
  kReportIOStates = 0x65,
  kIOStates = 0x66,
  kDoneWithFiles = 0x70,
  kSendIjsFile = 0x72,
  kSendIjbFile = 0x7d,
  kRequestStatus = 0x8d,
  kImagerStatus = 0x8e
}
 These are the 1-byte "MsgID" values described in section 6.0 of the document. More...
 

Public Member Functions

 BinaryProtocol (void)
 Constructor. More...
 
 ~BinaryProtocol (void)
 Destructor. More...
 
 BinaryProtocol (const VBytes &v, const size_t number_of_bytes)
 Parse the data in the vector. More...
 
BinaryProtocolparse (const VBytes &v, const size_t number_of_bytes)
 Parse the data in the vector. More...
 
VBytes message_data (void) const
 Extract just the message data bytes from the content. Will return an empty vector if there are no data bytes. More...
 
std::string describe (void) const
 Describe in English text the message contained within content. More...
 
BinaryProtocolcreate (const ECode new_code)
 Create a new sequence of bytes to send out to the imager device. More...
 
BinaryProtocolappend (const VBytes &file_contents)
 Append the vector to the existing content buffer. Automatically updates the "NumBytes" value. More...
 

Public Attributes

uint8_t sequence_number
 SeqNum, 5th byte into the data vector. More...
 
ECode code
 The message ID extracted from the parsed content, 7th byte into the data vector. More...
 
VBytes content
 A full copy of the bytes that were parsed. More...
 

Detailed Description

The IncJet devices can communicate using several different methods.

The document "IJM017B OnBoardRIP Software Integration Guide" describes a method called "binary protocol".

The message format is described in section 4.2, "Binary Protocol Command Structure":

Offset Field Description
0x00 STX Start of transmission. Should be 0x02.
0x01-0x04 NumBytes Number of bytes following this parameter, beginning with Checksum field and ending with the ETX.
0x05 Checksum Unused.
0x06 SeqNum Message sequence number. Possibly unused?
0x07 MsgID Message ID.
0x08-... TBuff Message data goes here.
... + 1 ETX End of transmission. Should be 0x03.
Note
Don't get confused with section 4.3 of the document, which describes the "simple ASCII" protocol versus the binary protocol from section 4.2!

The SeqNum field is not described in the document. Start with 1 and keep increasing it.

The MsgID field is the "code" in section 6, starting on page 18. Not all codes are described in the document, some had to be reverse engineered. See BinaryProtocol::ECode.

Member Enumeration Documentation

◆ ECode

enum BinaryProtocol::ECode
strong

These are the 1-byte "MsgID" values described in section 6.0 of the document.

Constructor & Destructor Documentation

◆ BinaryProtocol() [1/2]

BinaryProtocol::BinaryProtocol ( void  )

Constructor.

◆ ~BinaryProtocol()

BinaryProtocol::~BinaryProtocol ( void  )

Destructor.

◆ BinaryProtocol() [2/2]

BinaryProtocol::BinaryProtocol ( const VBytes &  v,
const size_t  number_of_bytes 
)

Parse the data in the vector.

References parse().

Here is the call graph for this function:

Member Function Documentation

◆ parse()

BinaryProtocol & BinaryProtocol::parse ( const VBytes &  v,
const size_t  number_of_bytes 
)

Parse the data in the vector.

Exceptions
Lox::Exceptionif the data cannot be parsed

References code, content, describe(), and sequence_number.

Referenced by BinaryProtocol().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ message_data()

VBytes BinaryProtocol::message_data ( void  ) const

Extract just the message data bytes from the content. Will return an empty vector if there are no data bytes.

References code, and content.

Referenced by describe(), and BinaryProtocolConnection::write_and_expect_ack().

Here is the caller graph for this function:

◆ describe()

std::string BinaryProtocol::describe ( void  ) const

Describe in English text the message contained within content.

References code, and message_data().

Referenced by parse(), and BinaryProtocolConnection::write_and_expect_ack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create()

BinaryProtocol & BinaryProtocol::create ( const ECode  new_code)

Create a new sequence of bytes to send out to the imager device.

References code, content, and sequence_number.

Referenced by BinaryProtocolConnection::initiate_communications(), BinaryProtocolConnection::send_eof(), and BinaryProtocolConnection::send_file().

Here is the caller graph for this function:

◆ append()

BinaryProtocol & BinaryProtocol::append ( const VBytes &  file_contents)

Append the vector to the existing content buffer. Automatically updates the "NumBytes" value.

Exceptions
Lox::Exceptionif the binary protocol message is invalid (too small)
Lox::Exceptionif the binary protocol message does not end with ETX (0x03)

References content.

Referenced by BinaryProtocolConnection::send_file().

Here is the caller graph for this function:

Member Data Documentation

◆ sequence_number

uint8_t BinaryProtocol::sequence_number

SeqNum, 5th byte into the data vector.

Referenced by create(), and parse().

◆ code

ECode BinaryProtocol::code

The message ID extracted from the parsed content, 7th byte into the data vector.

Referenced by create(), describe(), BinaryProtocolConnection::initiate_communications(), message_data(), parse(), and BinaryProtocolConnection::write_and_expect_ack().

◆ content

VBytes BinaryProtocol::content