You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, thank you for the fantastic library! Having TS built as standard into the library without relying on an external [at]Types definition is wonderful.
Onto the main issue. With node-serialport and node-usb, both support 'on' events, such as 'on data', 'on error', etc. These are usually handled as callbacks - e.g. serialport.on("data", (data: any) => callback(data)) - which triggers each time the serialport device sends data.
At present, this library doesn't provide such functionality. I have tried to implement such functionality myself, but I believe I may be implementing it incorrectly into the library.
One such use case for this is retrieving printer status (usually returned as a stream of bytes of n length). By sending certain thermal printers certain bytes (e.g. 0x10, 0x14, 0x07, 0x01), the device will respond with a stream of bytes (e.g. 0x14, 0x00, 0x00, 0x0f) which can be interpreted as multiple possible statuses such as 'ready', or 'cutter error', or 'paper being fed', etc, or a combination of statuses. The bytes to be sent and the bytes returned vary from printer to printer, so the ability to write bytes, and receive a callback when data is sent from the device would be highly beneficial.
Is it possible for such functionality to be added into this library?
The text was updated successfully, but these errors were encountered:
Firstly, thank you for the fantastic library! Having TS built as standard into the library without relying on an external [at]Types definition is wonderful.
Onto the main issue. With node-serialport and node-usb, both support 'on' events, such as 'on data', 'on error', etc. These are usually handled as callbacks - e.g.
serialport.on("data", (data: any) => callback(data))
- which triggers each time the serialport device sends data.At present, this library doesn't provide such functionality. I have tried to implement such functionality myself, but I believe I may be implementing it incorrectly into the library.
One such use case for this is retrieving printer status (usually returned as a stream of bytes of n length). By sending certain thermal printers certain bytes (e.g.
0x10, 0x14, 0x07, 0x01
), the device will respond with a stream of bytes (e.g.0x14, 0x00, 0x00, 0x0f
) which can be interpreted as multiple possible statuses such as 'ready', or 'cutter error', or 'paper being fed', etc, or a combination of statuses. The bytes to be sent and the bytes returned vary from printer to printer, so the ability to write bytes, and receive a callback when data is sent from the device would be highly beneficial.Is it possible for such functionality to be added into this library?
The text was updated successfully, but these errors were encountered: