tr3v3r / react-native-esc-pos-printer

An unofficial React Native library for printing on an EPSON TM printer with the Epson ePOS SDK for iOS and Epson ePOS SDK for Android
MIT License
137 stars 64 forks source link

UNKNOWN printer status #120

Open sindiAsx opened 8 months ago

sindiAsx commented 8 months ago

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();
         };
        }, [])
YasinAkimura commented 8 months ago

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

sindiAsx commented 8 months ago

I'm using with Epson Printer TM-P80II Please if anybody experienced the same issue let me know

YasinAkimura commented 8 months ago

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.