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

Support for building json msgs sent to printer. More...

Static Public Member Functions

static String CreateMsgFrame_Json (String fromId, String trackId, String command, String content, String toId, boolean usingDataPort)
 Create JSON object message that can be sent to printer. More...
 
static String CreateMsgFrame_Json (String fromId, String trackId, String command, String content, String toId)
 
static String CreateMsgFrame_Json (String fromId, String trackId, String command, String content)
 
static String CreateMsgFrame_Json (String fromId, String trackId, String command)
 
static String CreateMsgFrame (String fromId, String trackId, String command, String content, String toId)
 Create JSON object message that can be sent to printer. More...
 
static String GetRandomId_Json ()
 Returns random integer simply used to make sure each msg has unique ID. Use this to identify any msgs that will be sent infrequent. More...
 
static String GetRandomObjectId_Json ()
 Returns random integer in case want to use a dedicated object ID that can also be used to send/receive json messages with that ID as "TrackNo". More...
 

Static Public Attributes

static final String DataPortPrefix = "!PTR_SETUP\nUPMC\n"
 
static final String DataPortSuffix = "PTR_END\n"
 
static final int MIN_RAND_MSG_ID = 1
 Min. ID that will be randomly generated when calling GetRandomId() that can be used for ID's sent on solicited msgs. More...
 
static final int MAX_RAND_MSG_ID = 4_000_000
 Max. ID that will be randomly generated when calling GetRandomId() that can be used for ID's sent on solicited msgs. More...
 
static final int MIN_RAND_OBJ_ID = 4_000_001
 Min. ID that will be randomly generated when calling GetRandomObjectId().
Useful for classes/objects that want to use an "object id" for their solicited msgs. More...
 
static final int MAX_RAND_OBJ_ID = 6_000_000
 Max. ID that will be randomly generated when calling GetRandomObjectId().
Useful for classes/objects that want to use an "object id" for their solicited msgs. More...
 

Static Private Attributes

static final Random rand = new Random()
 

Detailed Description

Support for building json msgs sent to printer.

Member Function Documentation

◆ CreateMsgFrame()

static String com.UniPRT.Sdk.Json.JsonStringBuilder.CreateMsgFrame ( String  fromId,
String  trackId,
String  command,
String  content,
String  toId 
)
static

Create JSON object message that can be sent to printer.

fromId: required identifier of sender. Note this is used to route responses. This should be unique to each class/Object sending messages.
trackId: required identifier that can be used to track messages within the class/object sending the message.
command: required command value
content: optional content value. This could be a JSON object. Note that no check is made to ensure proper JSON format.
Note that since content could be a JSON object or a string, caller responsible for adding quotes if sending a JSON string value toId: optional identifier to differentiate intended recipient.

Referenced by com.UniPRT.Sdk.Json.JsonStringBuilder.CreateMsgFrame_Json(), and com.UniPRT.Sdk.Mgmt.MgmtMsg.toString().

◆ CreateMsgFrame_Json() [1/4]

static String com.UniPRT.Sdk.Json.JsonStringBuilder.CreateMsgFrame_Json ( String  fromId,
String  trackId,
String  command 
)
static

◆ CreateMsgFrame_Json() [2/4]

static String com.UniPRT.Sdk.Json.JsonStringBuilder.CreateMsgFrame_Json ( String  fromId,
String  trackId,
String  command,
String  content 
)
static

◆ CreateMsgFrame_Json() [3/4]

static String com.UniPRT.Sdk.Json.JsonStringBuilder.CreateMsgFrame_Json ( String  fromId,
String  trackId,
String  command,
String  content,
String  toId 
)
static

◆ CreateMsgFrame_Json() [4/4]

static String com.UniPRT.Sdk.Json.JsonStringBuilder.CreateMsgFrame_Json ( String  fromId,
String  trackId,
String  command,
String  content,
String  toId,
boolean  usingDataPort 
)
static

Create JSON object message that can be sent to printer.

fromId: required identifier of sender. Note this is used to route responses. This should be unique to each class/Object sending messages.
trackId: required identifier that can be used to track messages within the class/object sending the message.
command: required command value
content: optional content value. This could be a JSON object. Note that no check is made to ensure proper JSON format.
Note that since content could be a JSON object or a string, caller responsible for adding quotes if sending a JSON string value toId: optional identifier to differentiate intended recipient.

References com.UniPRT.Sdk.Json.JsonStringBuilder.CreateMsgFrame(), com.UniPRT.Sdk.Json.JsonStringBuilder.DataPortPrefix, and com.UniPRT.Sdk.Json.JsonStringBuilder.DataPortSuffix.

Referenced by com.UniPRT.Sdk.Json.JsonStringBuilder.CreateMsgFrame_Json(), 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.Mgmt.Messenger.SendMsg(), 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().

◆ GetRandomId_Json()

◆ GetRandomObjectId_Json()

static String com.UniPRT.Sdk.Json.JsonStringBuilder.GetRandomObjectId_Json ( )
static

Returns random integer in case want to use a dedicated object ID that can also be used to send/receive json messages with that ID as "TrackNo".

Random values returned between range MIN_RAND_OBJ_ID and MAX_RAND_OBJ_ID
Use this if intent is to assign a msg id to an object for sending/receiving msgs. e.g. Object to send/receive ODV or RFID only msgs to/from printer

References com.UniPRT.Sdk.Json.JsonStringBuilder.MAX_RAND_OBJ_ID, com.UniPRT.Sdk.Json.JsonStringBuilder.MIN_RAND_OBJ_ID, and com.UniPRT.Sdk.Json.JsonStringBuilder.rand.

Referenced by com.UniPRT.Sdk.Mgmt.Messenger.Messenger(), com.UniPRT.Sdk.Json.OdvMonitor.OdvMonitor(), com.UniPRT.Sdk.Json.PrinterMonitor.PrinterMonitor(), and com.UniPRT.Sdk.Json.RfidMonitor.RfidMonitor().

Member Data Documentation

◆ DataPortPrefix

final String com.UniPRT.Sdk.Json.JsonStringBuilder.DataPortPrefix = "!PTR_SETUP\nUPMC\n"
static

◆ DataPortSuffix

final String com.UniPRT.Sdk.Json.JsonStringBuilder.DataPortSuffix = "PTR_END\n"
static

◆ MAX_RAND_MSG_ID

final int com.UniPRT.Sdk.Json.JsonStringBuilder.MAX_RAND_MSG_ID = 4_000_000
static

Max. ID that will be randomly generated when calling GetRandomId() that can be used for ID's sent on solicited msgs.

Referenced by com.UniPRT.Sdk.Json.JsonStringBuilder.GetRandomId_Json().

◆ MAX_RAND_OBJ_ID

final int com.UniPRT.Sdk.Json.JsonStringBuilder.MAX_RAND_OBJ_ID = 6_000_000
static

Max. ID that will be randomly generated when calling GetRandomObjectId().
Useful for classes/objects that want to use an "object id" for their solicited msgs.

Referenced by com.UniPRT.Sdk.Json.JsonStringBuilder.GetRandomObjectId_Json().

◆ MIN_RAND_MSG_ID

final int com.UniPRT.Sdk.Json.JsonStringBuilder.MIN_RAND_MSG_ID = 1
static

Min. ID that will be randomly generated when calling GetRandomId() that can be used for ID's sent on solicited msgs.

Referenced by com.UniPRT.Sdk.Json.JsonStringBuilder.GetRandomId_Json().

◆ MIN_RAND_OBJ_ID

final int com.UniPRT.Sdk.Json.JsonStringBuilder.MIN_RAND_OBJ_ID = 4_000_001
static

Min. ID that will be randomly generated when calling GetRandomObjectId().
Useful for classes/objects that want to use an "object id" for their solicited msgs.

Referenced by com.UniPRT.Sdk.Json.JsonStringBuilder.GetRandomObjectId_Json().

◆ rand

final Random com.UniPRT.Sdk.Json.JsonStringBuilder.rand = new Random()
staticprivate

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