react-native-esc-pos-printer
react-native-esc-pos-printer copied to clipboard
UNKNOWN printer status
I'm using startMonitorPrinter and addPrinterStatusListener to get the current status of the printer (more precisely I need paperFeed information)
This is the response I get:
{"adapter": "UNKNOWN", "autoRecoverErr": "UNKNOWN", "batteryLevel": "UNKNOWN", "connection": "DISCONNECT", "coverOpen": "UNKNOWN", "drawer": "UNKNOWN", "errorStatus": "UNKNOWN", "online": "OFFLINE", "panelSwitch": "UNKNOWN", "paper": "UNKNOWN", "paperFeed": "UNKNOWN"}
I'm using the latest version of the library on Android
Sample:
{
....
await EscPosPrinter.init({
target,
seriesName,
language,
});
const status = await EscPosPrinter.startMonitorPrinter();
console.log(status); // this is ok, start monitoring is success
}
....
.....
useEffect(() => {
const sub = EscPosPrinter.addPrinterStatusListener((status) => {
console.log('current printer status:', status); // here I get the object stated above
});
return () => {
sub();
};
}, [])
I'm facing the same issue also somehow when refreshing the app I've got an actual status for connection and online. I hope the status might help when the printer refuses to print even though you try to safely connect / disconnect again
I'm using with Epson Printer TM-P80II Please if anybody experienced the same issue let me know
I'm currently trying to solve this by converting this library to an expo sdk 49 compatible custom module while I'm at it I will check if this is an issue which appears because something along the lines changed in react native version 0.72.6 after that I will look inside the code if there is something which prevents communication with the printer. I hope it gets fixed by solving the current errors if thats the case I will publish the results also I'm updating the epsonSDK to the latest version.