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 | |
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.
comm_to_ptr | The pointer to the communication instance. |
comm_type | The type of communication. |
max_input_msg_capacity | The maximum input message capacity. |
using_data_port | A flag indicating whether to use the data port. |
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.
command | The command of the message. |
content | The content of the message. |
max_wait_time_secs | The maximum wait time in seconds. |
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.
data_to_send | The data to send. |
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.
command | The command of the message. |
content | The content of the message. |
track_no | The track number of the message. |
JsonMng.JsonMessenger.my_mgmt_id |