[Name]
Enable/disable Automatic Status Back (ASB)
[Format]
ASCII GS a n
Hex 1D 61 n
Decimal 29 97 n
[Range]
n = 0 – 255
[Default]
n: different depending on the printers
Queries the printer for its status, and returns an array of integers containing it.
Parameters: mode – Integer that sets the status mode queried to the printer. - RT_STATUS_ONLINE: Printer status. - RT_STATUS_PAPER: Paper sensor.
Return type: array(integer)
def query_status(self, mode):
"""
Queries the printer for its status, and returns an array of integers containing it.
:param mode: Integer that sets the status mode queried to the printer.
- RT_STATUS_ONLINE: Printer status.
- RT_STATUS_PAPER: Paper sensor.
:rtype: array(integer)
"""
self._raw(mode)
time.sleep(1)
status = self._read()
return status
def _raw(self, msg):
""" Print any command sent in raw format
:param msg: arbitrary code to be printed
:type msg: bytes
"""
self.device.write(self.out_ep, msg, self.timeout)
请尝试将
GS a
命令指定为query_status()
方法中的参数并调用它GS a
请通过为
n
指定0xFF进行尝试query_status(mode)
def query_status(self, mode):
def _raw(self, msg):
def _read(self):
# Status Command
相关问题 更多 >
编程相关推荐