UniPRT SDK v1.0.0.0
 
Loading...
Searching...
No Matches
JsonMng.JsonMessenger Class Reference

Public Member Functions

 __init__ (self, comm_to_ptr, comm_type, max_input_msg_capacity, using_data_port)
 Initializes a new instance with the given communication pointer, communication type, maximum input message capacity, and data port usage flag.
 
 send_msg_raw_with_data_to_send (self, data_to_send)
 Sends contents without any message formatting directly to printer.
 
 send_msg_with_command (self, command, content, track_no)
 Send a management command and data/content to printer.
 
 send_msg_and_wait_for_response_with_command (self, command, content, max_wait_time_secs)
 Send a management command and data/content to printer and wait for response maxWaitTimeSecs time.
 

Public Attributes

 my_mgmt_id
 

Constructor & Destructor Documentation

◆ __init__()

JsonMng.JsonMessenger.__init__ ( self,
comm_to_ptr,
comm_type,
max_input_msg_capacity,
using_data_port )

Initializes a new instance with the given communication pointer, communication type, maximum input message capacity, and data port usage flag.

The oldest message is dropped if messages not read before more messages received from printer.

Set usingDataPort to true if the communication to printer commToPtr is through the same port that print data is sent through.

This is important in order to properly format management messages so that printer differentiates the messages from print data.

Parameters
comm_to_ptrThe pointer to the communication instance.
comm_typeThe type of communication.
max_input_msg_capacityThe maximum input message capacity.
using_data_portA flag indicating whether to use the data port.
Returns
An initialized instance of JsonMessenger, or nil if the object could not be created.

Member Function Documentation

◆ send_msg_and_wait_for_response_with_command()

JsonMng.JsonMessenger.send_msg_and_wait_for_response_with_command ( self,
command,
content,
max_wait_time_secs )

Send a management command and data/content to printer and wait for response maxWaitTimeSecs time.

Null object returned if no response received before timeout expired.

All messages are discarded until the response to the specific message sent is received. The discarded messages may include any unread/old messages waiting to be read prior to the call to this method.

Parameters
commandThe command of the message.
contentThe content of the message.
max_wait_time_secsThe maximum wait time in seconds.
Returns
A JsonMng instance representing the response.

◆ send_msg_raw_with_data_to_send()

JsonMng.JsonMessenger.send_msg_raw_with_data_to_send ( self,
data_to_send )

Sends contents without any message formatting directly to printer.

This is for cases where data needs to be sent without any added management message formatting.

If there is a special management message or data need to be sent in a port that is shared for both data and management, this would be used to send data directly to printer.

Parameters
data_to_sendThe data to send.

◆ send_msg_with_command()

JsonMng.JsonMessenger.send_msg_with_command ( self,
command,
content,
track_no )

Send a management command and data/content to printer.

The optional TrackNo is the field used in the JSON command structure sent to printer and can be used by caller to check for response from printer. If no TrackNo is provided, one is generated.

The return string is the TrackNo field used in the JSON message sent to the printer to allow caller to differentiate any response associated with the message sent by comparing the TrackNo field of any response received from printer.

Parameters
commandThe command of the message.
contentThe content of the message.
track_noThe track number of the message.
Returns
A string representing the result of the send operation.

Member Data Documentation

◆ my_mgmt_id

JsonMng.JsonMessenger.my_mgmt_id

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