UniPRT SDK  v1.0.0.0
UniPRT.Sdk.Mgmt.IMgmtMessenger Interface Reference

Channel for receiving JSON messages from printer. More...

Inheritance diagram for UniPRT.Sdk.Mgmt.IMgmtMessenger:
UniPRT.Sdk.Mgmt.Messenger

Public Member Functions

MgmtMsg ReadNextMsg ()
 Read next message that may have been received asynchronously from printer.
 
string SendMsg (string command, string content, string TrackNo="")
 Send a management command and data/content to printer. More...
 
MgmtMsg SendMsgAndWaitForResponse (string command, string content, int maxWaitTimeSecs=6)
 Send a management command and data/content to printer and wait for response maxWaitTimeSecs time. More...
 
void SendMsgRaw (string dataToSend)
 Sends contents without any message formatting directly to printer. More...
 

Properties

int UnreadMsgCount [get]
 Get number of unread messages received and waiting to be read.
 

Detailed Description

Channel for receiving JSON messages from printer.

Allows for creation or releasing of bounded channel for listening to management messages.
This is useful for listening to management messages sent from printer. Note that only the readable half of the channel should be used by data consumer.

For more details refer to Channels

For more details refer to Readable Half of Channel ‍/ public interface IMgmtMsgListenerChannel { // ToDo: Use a "reader" to get enforce read only policy. public Channel<MgmtMsg> ListenerChannelCreate(MgmtChannelFilterType chnlType, int capacity, string solicitedMsgId = "");

public void ListenerChannelRelease(Channel<MgmtMsg> chnlToRelease);
}

/** \~English @brief
    Interface for sending/receiving JSON management messages.

    @details
    Useful if want to maintain a constant connection for device management.
    \n\n
    For JSON command format refer to: [JSON data-interchange with printer](@ref JsonDataInterchangeWithPrinter)\n

    \~Chinese-Traditional @brief
    用於發送/接收 JSON 管理訊息的介面。

    @details
    適合需要保持連續連接進行設備管理的情況。
    \n\n
    For JSON command format refer to: [JSON data-interchange with printer](@ref JsonDataInterchangeWithPrinter)\n

    \~Chinese @brief
    用于发送/接收 JSON 管理讯息的接口。

    @details
    适合需要保持连续连接进行设备管理的情况。
    \n\n
    For JSON command format refer to: [JSON data-interchange with printer](@ref JsonDataInterchangeWithPrinter)\n

Member Function Documentation

◆ SendMsg()

string UniPRT.Sdk.Mgmt.IMgmtMessenger.SendMsg ( string  command,
string  content,
string  TrackNo = "" 
)

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.

Implemented in UniPRT.Sdk.Mgmt.Messenger.

◆ SendMsgAndWaitForResponse()

MgmtMsg UniPRT.Sdk.Mgmt.IMgmtMessenger.SendMsgAndWaitForResponse ( string  command,
string  content,
int  maxWaitTimeSecs = 6 
)

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.

Implemented in UniPRT.Sdk.Mgmt.Messenger.

◆ SendMsgRaw()

void UniPRT.Sdk.Mgmt.IMgmtMessenger.SendMsgRaw ( string  dataToSend)

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.

Implemented in UniPRT.Sdk.Mgmt.Messenger.