UniPRT SDK v1.0.0.0-pyd (Python)
 
Loading...
Searching...
No Matches
JsonSDK.JsonSDK Class Reference

Public Member Functions

 __init__ (self)
 
 MessengerGet (self, Any ptrComm, COMM_TYP commTyp, int maxInputMsgCapacity, bool usingDataPort)
 Creates a channel for sending/receiving management messages with a maximum capacity specified.
 
 MessengerRelease (self)
 Release the Messenger resource.
 
 MessengerSendMsg (self, str strCommand, str strContent)
 Send a management command and data/content to printer.
 
 MessengerReadNextMsg (self, strNextMsg)
 Read next message that may have been received asynchronously from printer.
 
 MessengerSendMsgAndWaitForResponse (self, strCommand, strContent, maxWaitTimeSecs, strResponse)
 Send a management command and data/content to printer and wait for response maxWaitTimeSecs time.
 
 MessengerUnreadMsgCount (self)
 Get the count for the unread messages.
 
 RfidMonitorConnection (self, lpAddress)
 Use NET I/F to connect the printer for RFID monitor function.
 
 OdvMonitorConnection (self, lpAddress)
 Use NET I/F to connect the printer for ODV monitor function.
 
 PrinterMonitorConnection (self, lpAddress, InfoTyp)
 Use NET I/F to connect the printer for the status of printer monitor.
 
 GetPrinterInfo (self, pPrtInfo, InfoTyp)
 Get the information for printer function.
 
 GetRfidReportListening (self)
 Get the flag of RFID report listening.
 
 SetRfidReportListening (self, value)
 Set the flag of RFID report listening.
 
 GetOdvReportListening (self)
 Get the flag of ODV report listening.
 
 SetOdvReportListening (self, value)
 Set the flag of ODV report listening.
 
 RfidMonitorDispose (self)
 Release RFID monitor resource.
 
 OdvMonitorDispose (self)
 Release ODV monitor resource.
 
 PrinterMonitorDispose (self, InfoTyp)
 Release printer monitor resource.
 
 SetRfidReportCallback (self, callback)
 Set a callback function to get RFID report.
 
 SetOdvReportCallback (self, callback)
 Set a callback function to get ODV report.
 
 SetEngineStatusListening (self, value)
 Set the flag of printer report listening for engine status.
 
 SetDisplayStatusListening (self, value)
 Set the flag of printer report listening for display status.
 
 SetAlertStatusListening (self, value)
 Set the flag of printer report listening for alert status.
 
 GetEngineStatusListening (self)
 Get the flag of engine status listening.
 
 GetDisplayStatusListening (self)
 Get the flag of display status listening.
 
 GetAlertStatusListening (self)
 Get the flag of alert status listening.
 
 SetEngineStatusCallback (self, callback)
 Set a callback function to get engine status.
 
 SetDisplayStatusCallback (self, callback)
 Set a callback function to get display status.
 
 SetAlertStatusCallback (self, callback)
 Set a callback function to get alert status.
 
 GetPrinterAllValues (self, ptrComm, COMM_TYP commTyp, bool usingDataPort)
 Get all settings of printer.
 
 GetPrinterValue (self, ptrComm, COMM_TYP commTyp, bool usingDataPort, key)
 Get a single setting of printer.
 
 GetPrinterValues (self, ptrComm, COMM_TYP commTyp, bool usingDataPort, keys)
 Get multiple settings of printer.
 
 SetPrinterValue (self, ptrComm, COMM_TYP commTyp, bool usingDataPort, key, value)
 Set a single setting of printer.
 
 SetPrinterValues (self, ptrComm, COMM_TYP commTyp, bool usingDataPort, keysToSet)
 Set multiple settings of printer.
 
 GetPrinterProperties (self, ptrComm, COMM_TYP commTyp, bool usingDataPort, key)
 Get a single property of printer.
 
 GetPrinterPropertiesEx (self, ptrComm, COMM_TYP commTyp, bool usingDataPort, keys)
 Get multiple properties of printer.
 
 GetPrinterAllProperties (self, ptrComm, COMM_TYP commTyp, bool usingDataPort)
 Get all properties of printer.
 
 GetPrinterConfig (self, ptrComm, COMM_TYP commTyp, bool usingDataPort, CfgNumber)
 Get a single configuration of printer.
 
 SetPrinterConfig (self, ptrComm, COMM_TYP commTyp, bool usingDataPort, Config)
 Set a single configuration of printer.
 
 GetPrinterAllConfig (self, ptrComm, COMM_TYP commTyp, bool usingDataPort)
 Get all configurations of printer.
 

Public Attributes

 AllMsg
 

Constructor & Destructor Documentation

◆ __init__()

JsonSDK.JsonSDK.__init__ ( self)

Member Function Documentation

◆ GetAlertStatusListening()

JsonSDK.JsonSDK.GetAlertStatusListening ( self)

Get the flag of alert status listening.

Returns
bool

◆ GetDisplayStatusListening()

JsonSDK.JsonSDK.GetDisplayStatusListening ( self)

Get the flag of display status listening.

Returns
bool

◆ GetEngineStatusListening()

JsonSDK.JsonSDK.GetEngineStatusListening ( self)

Get the flag of engine status listening.

Returns
bool

◆ GetOdvReportListening()

JsonSDK.JsonSDK.GetOdvReportListening ( self)

Get the flag of ODV report listening.

Returns
bool

◆ GetPrinterAllConfig()

JsonSDK.JsonSDK.GetPrinterAllConfig ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort )

Get all configurations of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
Returns
str
Sample
AllConfig = GetPrinterAllConfig(comm_ptr, COMM_TYP.TCP_COMM, False)

◆ GetPrinterAllProperties()

JsonSDK.JsonSDK.GetPrinterAllProperties ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort )

Get all properties of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
Returns
str
Sample
AllProperties = GetPrinterAllProperties(comm_ptr, COMM_TYP.TCP_COMM, False)

◆ GetPrinterAllValues()

JsonSDK.JsonSDK.GetPrinterAllValues ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort )

Get all settings of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
Returns
str
Sample
AllValues = GetPrinterAllValues(comm_ptr, COMM_TYP.TCP_COMM, False)

◆ GetPrinterConfig()

JsonSDK.JsonSDK.GetPrinterConfig ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort,
CfgNumber )

Get a single configuration of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
[in]CfgNumber: an index of the configuration, the range is 0 ~ 8
Returns
str
Sample
Config = GetPrinterConfig(comm_ptr, COMM_TYP.TCP_COMM, False, 2)

◆ GetPrinterInfo()

JsonSDK.JsonSDK.GetPrinterInfo ( self,
pPrtInfo,
InfoTyp )

Get the information for printer function.

Parameters
[out]pPrtInfo: a struct to storage the printer information
[in]InfoTyp: Set the type for RFID or ODV information
Returns
None
Sample
prt_info = PrinterInfo()
GetPrinterInfo(prt_info, INFO_TYP.RFID_TYP)

◆ GetPrinterProperties()

JsonSDK.JsonSDK.GetPrinterProperties ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort,
key )

Get a single property of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
[in]keya key value for properties of printer
Returns
str
Sample
key_ = "Speed.Print-mmps"
properties = GetPrinterProperties(comm_ptr, COMM_TYP.TCP_COMM, False, key_)

◆ GetPrinterPropertiesEx()

JsonSDK.JsonSDK.GetPrinterPropertiesEx ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort,
keys )

Get multiple properties of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
[in]keyskey values for properties of printer
Returns
str
Sample
keys = ["Speed", "Label.Sensor"]
properties = GetPrinterPropertiesEx(comm_ptr, COMM_TYP.TCP_COMM, False, keys)

◆ GetPrinterValue()

JsonSDK.JsonSDK.GetPrinterValue ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort,
key )

Get a single setting of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
[in]keya key value for setting of printer
Returns
str
Sample
key = "Ethernet.MAC";
value = GetPrinterValue(commPtr, commTyp, false, key.c_str());

◆ GetPrinterValues()

JsonSDK.JsonSDK.GetPrinterValues ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort,
keys )

Get multiple settings of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
[in]keysmultiple key values for setting of printer
Returns
str
Sample
keys = ["Ethernet.IP", "Ethernet.MAC", "Ethernet.Speed"]
values = GetPrinterValues(comm_ptr, COMM_TYP.TCP_COMM, False, keys)

◆ GetRfidReportListening()

JsonSDK.JsonSDK.GetRfidReportListening ( self)

Get the flag of RFID report listening.

Returns
bool

◆ MessengerGet()

JsonSDK.JsonSDK.MessengerGet ( self,
Any ptrComm,
COMM_TYP commTyp,
int maxInputMsgCapacity,
bool usingDataPort )

Creates a channel for sending/receiving management messages with a maximum capacity specified.

Parameters
[out]ptrComma pointer to storage communicating I/F
[in]commTypSet the type of interface
[in]maxInputMsgCapacityThe default value is MAX_INPUT_MSG_CAPACITY(20)
[in]usingDataPortThe default value is False
Returns
None
Sample
comm_typ = COMM_TYP.TCP_COMM
commPtr = None
MessengerGet(commPtr, comm_typ, MAX_INPUT_MSG_CAPACITY, False)

◆ MessengerReadNextMsg()

JsonSDK.JsonSDK.MessengerReadNextMsg ( self,
strNextMsg )

Read next message that may have been received asynchronously from printer.

Parameters
[out]strNextMsg: a buffer to storage the next returned message
Returns
None
Sample
str_next_msg = (c_char_p * 1)()
MessengerReadNextMsg(str_next_msg)

◆ MessengerRelease()

JsonSDK.JsonSDK.MessengerRelease ( self)

Release the Messenger resource.

Returns
None
Sample
MessengerRelease();

◆ MessengerSendMsg()

JsonSDK.JsonSDK.MessengerSendMsg ( self,
str strCommand,
str strContent )

Send a management command and data/content to printer.

Parameters
[in]strCommand: a management command string
[in]strContent: a management data/content string
Returns
None
Sample
pCmdStr = "Cfg.Item"
content = "{\r\n"
content += "\"Speed\" : null,\r\n"
content += "\"ODV.Symbol\" : null,\r\n"
content += "\"Label.Sensor\":null\r\n"
content += "}\r\n"
pContentStr = content
MessengerSendMsg(pCmdStr, pContentStr)

◆ MessengerSendMsgAndWaitForResponse()

JsonSDK.JsonSDK.MessengerSendMsgAndWaitForResponse ( self,
strCommand,
strContent,
maxWaitTimeSecs,
strResponse )

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

Parameters
[in]strCommand: a management command string
[in]strContent: a management data/content string
[in]maxWaitTimeSecs: a maximum waiting time
[out]strResponse: a buffer to storage for JSON string response
Returns
None
Sample
MAX_WAIT_TIME_SECS = 5
pCmdStr = "Cfg.Item"
content = "{\r\n"
content += "\"Speed\" : null,\r\n"
content += "\"ODV.Symbol\" : null,\r\n"
content += "\"Label.Sensor\":null\r\n"
content += "}\r\n"
pContentStr = content
strResponse = None
MessengerSendMsgAndWaitForResponse(pCmdStr, pContentStr, MAX_WAIT_TIME_SECS, strResponse)

◆ MessengerUnreadMsgCount()

JsonSDK.JsonSDK.MessengerUnreadMsgCount ( self)

Get the count for the unread messages.

Returns
int
Sample
int iUnreadMsgCount = MessengerUnreadMsgCount();

◆ OdvMonitorConnection()

JsonSDK.JsonSDK.OdvMonitorConnection ( self,
lpAddress )

Use NET I/F to connect the printer for ODV monitor function.

Parameters
[in]lpAddress: IP address
Returns
None
Sample
ptr_ip_odv = "10.0.10.171"
OdvMonitorConnection(ptr_ip_odv)

◆ OdvMonitorDispose()

JsonSDK.JsonSDK.OdvMonitorDispose ( self)

Release ODV monitor resource.

Returns
None

◆ PrinterMonitorConnection()

JsonSDK.JsonSDK.PrinterMonitorConnection ( self,
lpAddress,
InfoTyp )

Use NET I/F to connect the printer for the status of printer monitor.

Parameters
[in]lpAddress: IP address
[in]InfoTyp: Set the type for RFID or ODV information
Returns
None
Sample
ptr_ip_rfid = "10.0.10.178"
rfid_monitor_connection(ptr_ip_rfid)
PrinterMonitorConnection(ptr_ip_rfid, INFO_TYP.RFID_TYP)

◆ PrinterMonitorDispose()

JsonSDK.JsonSDK.PrinterMonitorDispose ( self,
InfoTyp )

Release printer monitor resource.

Parameters
[in]InfoTyp: Set the type for RFID/ODV/printer status information
Returns
None

◆ RfidMonitorConnection()

JsonSDK.JsonSDK.RfidMonitorConnection ( self,
lpAddress )

Use NET I/F to connect the printer for RFID monitor function.

Parameters
[in]lpAddress: IP address
Returns
None
Sample
ptr_ip_rfid = "10.0.10.178"
RfidMonitorConnection(ptr_ip_rfid)

◆ RfidMonitorDispose()

JsonSDK.JsonSDK.RfidMonitorDispose ( self)

Release RFID monitor resource.

Returns
None

◆ SetAlertStatusCallback()

JsonSDK.JsonSDK.SetAlertStatusCallback ( self,
callback )

Set a callback function to get alert status.

Parameters
[in]callback:a callback function
Returns
None
Sample
SetAlertStatusCallback(PtrAlertNoticeListener);

◆ SetAlertStatusListening()

JsonSDK.JsonSDK.SetAlertStatusListening ( self,
value )

Set the flag of printer report listening for alert status.

Parameters
[in]value: a flag to set printer report listening
Returns
None
Sample
SetAlertStatusListening(True);

◆ SetDisplayStatusCallback()

JsonSDK.JsonSDK.SetDisplayStatusCallback ( self,
callback )

Set a callback function to get display status.

Parameters
[in]callback:a callback function
Returns
None
Sample
SetDisplayStatusCallback(PtrDisplayStatusNoticeListener);

◆ SetDisplayStatusListening()

JsonSDK.JsonSDK.SetDisplayStatusListening ( self,
value )

Set the flag of printer report listening for display status.

Parameters
[in]value: a flag to set printer report listening
Returns
None
Sample
SetDisplayStatusListening(True);

◆ SetEngineStatusCallback()

JsonSDK.JsonSDK.SetEngineStatusCallback ( self,
callback )

Set a callback function to get engine status.

Parameters
[in]callback:a callback function
Returns
None
Sample
SetEngineStatusCallback(PtrEngineStatusNoticeListener);

◆ SetEngineStatusListening()

JsonSDK.JsonSDK.SetEngineStatusListening ( self,
value )

Set the flag of printer report listening for engine status.

Parameters
[in]value: a flag to set printer report listening
Returns
None
Sample
SetEngineStatusListening(True);

◆ SetOdvReportCallback()

JsonSDK.JsonSDK.SetOdvReportCallback ( self,
callback )

Set a callback function to get ODV report.

Parameters
[in]callback:a callback function
Returns
None
Sample
SetOdvReportCallback(OdvReportCallback);

◆ SetOdvReportListening()

JsonSDK.JsonSDK.SetOdvReportListening ( self,
value )

Set the flag of ODV report listening.

Parameters
[in]value: a flag to set ODV report listening
Returns
None
Sample
SetOdvReportListening(True);

◆ SetPrinterConfig()

JsonSDK.JsonSDK.SetPrinterConfig ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort,
Config )

Set a single configuration of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
[in]Config: a configuration
Returns
bool
Sample
result = SetPrinterConfig(comm_ptr, COMM_TYP.TCP_COMM, False, Config)

◆ SetPrinterValue()

JsonSDK.JsonSDK.SetPrinterValue ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort,
key,
value )

Set a single setting of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
[in]keya key value for setting of printer
[in]valuea setting of printer
Returns
bool
Sample
key = "Ethernet.Speed"
value = "eAutomatic"
result = SetPrinterValue(comm_ptr, COMM_TYP.TCP_COMM, False, key, value)
if result:
print(f"Successfully set {key} to {value}")
else:
print(f"Failed to set {key}")

◆ SetPrinterValues()

JsonSDK.JsonSDK.SetPrinterValues ( self,
ptrComm,
COMM_TYP commTyp,
bool usingDataPort,
keysToSet )

Set multiple settings of printer.

Parameters
[in]ptrComm: a pointer to storage communicating I/F
[in]commTyp: set the type of interface
[in]usingDataPort: a flag to use data port
[in]keysToSetmultiple key values for setting of printer
Returns
bool
Sample
key_values = {
"Ethernet.Speed": "eAutomatic",
"Image.Width-in": "3.5"
}
result = SetPrinterValues(comm_ptr, COMM_TYP.TCP_COMM, False, key_values)
if result:
print("Successfully set values.")
else:
print("Failed to set values.")

◆ SetRfidReportCallback()

JsonSDK.JsonSDK.SetRfidReportCallback ( self,
callback )

Set a callback function to get RFID report.

Parameters
[in]callback:a callback function
Returns
None
Sample
SetRfidReportCallback(RfidReportCallback);

◆ SetRfidReportListening()

JsonSDK.JsonSDK.SetRfidReportListening ( self,
value )

Set the flag of RFID report listening.

Parameters
[in]value: a flag to set RFID report listening
Returns
None
Sample
SetRfidReportListening(True);

Member Data Documentation

◆ AllMsg

JsonSDK.JsonSDK.AllMsg