UniPRT SDK  v1.0.0.0
com.UniPRT.Sdk.Json.JsonComm Class Reference

Management (Mgmt) Comm using JSON format. Concerned with full/well formed Mgmt/JSON msg frames and forwards to any listeners via channels. More...

Inheritance diagram for com.UniPRT.Sdk.Json.JsonComm:

Public Member Functions

IMgmtMsgListenerChannels< String > ChannelListenerJson ()
 
IMgmtMsgListenerChannels< MgmtMsgChannelListenerMgmtMsg ()
 
 JsonComm (IComm commToPtr)
 Start a JSON communication using the connection passed in. More...
 
void Send (String mgmtMsgToSend)
 Sends JSON mgmtMsgToSend using the connection that was passed in when object was created. More...
 
String SendAndWaitForResponse (String mgmtMsg, int respTimeoutMs)
 Send JSON msg mgmtMsg and wait respTimeoutMs before returning response. If no response received after timeout, empty string "" returned. More...
 
void Dispose ()
 
void close ()
 

Static Public Member Functions

static String ReplaceJsonArrayValues (String json)
 

Protected Member Functions

void Dispose (boolean disposing)
 
void finalize () throws Throwable
 

Private Member Functions

void Start ()
 
void MsgFrameSplitterAsync ()
 
void SendAndWaitForMsgFrame (byte[] outmsg, int responseStartTimeout, int responseEndTimeout)
 
String GetMsgFrame (StringBuilder strUnframed)
 

Private Attributes

ListenerChannelsJson _listenersJsonChnls = new ListenerChannelsJson()
 
ListenerChannelsMgmtMsg _listenersMgmtMsgChnls = null
 
StringBuilder _jsonReceived = new StringBuilder()
 
IComm _jsonComm
 
ExecutorService _executor
 
Channel< String > _msgOut
 
boolean _usingDataPort = false
 
boolean _disposed = false
 

Static Private Attributes

static final Logger LOGGER = Logger.getLogger(JsonComm.class.getName())
 

Detailed Description

Management (Mgmt) Comm using JSON format. Concerned with full/well formed Mgmt/JSON msg frames and forwards to any listeners via channels.

Requires a communication connection for sending and listening for fully formed Mgmt messages.
This class also uses the communication connection to send and listen for JSON msgs.
Note that this class will read all data received from the communication connection as it is received in order to
listen and parse fully formed JSON messages.

Constructor & Destructor Documentation

◆ JsonComm()

com.UniPRT.Sdk.Json.JsonComm.JsonComm ( IComm  commToPtr)

Start a JSON communication using the connection passed in.

Connection must be opened and maintained opened by caller/user.

References com.UniPRT.Sdk.Json.JsonComm.Start().

Member Function Documentation

◆ ChannelListenerJson()

◆ ChannelListenerMgmtMsg()

◆ close()

◆ Dispose() [1/2]

◆ Dispose() [2/2]

◆ finalize()

void com.UniPRT.Sdk.Json.JsonComm.finalize ( ) throws Throwable
protected

◆ GetMsgFrame()

String com.UniPRT.Sdk.Json.JsonComm.GetMsgFrame ( StringBuilder  strUnframed)
private

◆ MsgFrameSplitterAsync()

◆ ReplaceJsonArrayValues()

static String com.UniPRT.Sdk.Json.JsonComm.ReplaceJsonArrayValues ( String  json)
static

◆ Send()

void com.UniPRT.Sdk.Json.JsonComm.Send ( String  mgmtMsgToSend)

◆ SendAndWaitForMsgFrame()

◆ SendAndWaitForResponse()

String com.UniPRT.Sdk.Json.JsonComm.SendAndWaitForResponse ( String  mgmtMsg,
int  respTimeoutMs 
)

Send JSON msg mgmtMsg and wait respTimeoutMs before returning response. If no response received after timeout, empty string "" returned.

References com.UniPRT.Sdk.Json.JsonComm._listenersJsonChnls, com.UniPRT.Sdk.Json.JsonComm._msgOut, com.UniPRT.Sdk.Mgmt.MgmtChannelFilterType.ALL_MSGS, com.UniPRT.Sdk.Json.JsonComm.ChannelListenerJson(), com.UniPRT.Sdk.Json.JsonStringBuilder.DataPortPrefix, com.UniPRT.Sdk.Json.JsonStringBuilder.DataPortSuffix, com.UniPRT.Sdk.Json.JsonStringTokenizer.GetMsgId_Json(), com.UniPRT.Sdk.Json.JsonStringTokenizer.GetMsgIdExpectedOnResponse_Json(), com.UniPRT.Sdk.Mgmt.AMgmtListenerChannels< T >.ListenerChannelGetNew(), com.UniPRT.Sdk.Json.JsonComm.LOGGER, com.UniPRT.Sdk.Mgmt.Channel< T >.Poll(), com.UniPRT.Sdk.Json.JsonComm.ReplaceJsonArrayValues(), and com.UniPRT.Sdk.Mgmt.Channel< T >.Write().

Referenced by com.UniPRT.Sdk.Json.SettingsReadWrite.GetAllProperties(), com.UniPRT.Sdk.Json.SettingsReadWrite.GetAllValues(), com.UniPRT.Sdk.Settings.Configs.GetConfig(), com.UniPRT.Sdk.Json.PrinterMonitor.GetEngineStatus(), com.UniPRT.Sdk.Json.PrinterMonitor.GetFaultStatus(), com.UniPRT.Sdk.Json.PrinterMonitor.GetPrinterInfo(), com.UniPRT.Sdk.Json.SettingsReadWrite.GetProperties(), com.UniPRT.Sdk.Json.SettingsReadWrite.GetValue(), com.UniPRT.Sdk.Json.SettingsReadWrite.GetValues(), com.UniPRT.Sdk.Json.PrinterMonitor.SetAlertStatusListening(), com.UniPRT.Sdk.Settings.Configs.SetConfig(), com.UniPRT.Sdk.Json.PrinterMonitor.SetDisplayStatusListening(), com.UniPRT.Sdk.Json.PrinterMonitor.SetEngineStatusListening(), com.UniPRT.Sdk.Json.OdvMonitor.SetOdvReportListening(), com.UniPRT.Sdk.Json.RfidMonitor.SetRfidReportListening(), com.UniPRT.Sdk.Json.SettingsReadWrite.SetValue(), and com.UniPRT.Sdk.Json.SettingsReadWrite.SetValues().

◆ Start()

Member Data Documentation

◆ _disposed

boolean com.UniPRT.Sdk.Json.JsonComm._disposed = false
private

◆ _executor

ExecutorService com.UniPRT.Sdk.Json.JsonComm._executor
private

◆ _jsonComm

IComm com.UniPRT.Sdk.Json.JsonComm._jsonComm
private

◆ _jsonReceived

StringBuilder com.UniPRT.Sdk.Json.JsonComm._jsonReceived = new StringBuilder()
private

◆ _listenersJsonChnls

◆ _listenersMgmtMsgChnls

ListenerChannelsMgmtMsg com.UniPRT.Sdk.Json.JsonComm._listenersMgmtMsgChnls = null
private

◆ _msgOut

◆ _usingDataPort

boolean com.UniPRT.Sdk.Json.JsonComm._usingDataPort = false
private

◆ LOGGER

final Logger com.UniPRT.Sdk.Json.JsonComm.LOGGER = Logger.getLogger(JsonComm.class.getName())
staticprivate

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