brasizza / sunmi_printer

BSD 3-Clause "New" or "Revised" License
39 stars 46 forks source link

Not working on Sunmi K2 #23

Closed david-qios closed 2 years ago

david-qios commented 2 years ago

Hello, I currently have a problem using this package on Sunmi K2.

The K2's printer seems to be connected through USB and when I use getPrinterStatus it returns "NO_PRINTER_DETECTED". So far my workaround has been using a package called flutter_usb_printer with esc_pos_utils_plus to generate the esc pos commands. However I can't utilize the printer buffer nor detect when paper is out and need the help of this package (I have tested with Sunmi K2 Mini and can confirm that it's working perfectly there).

Edit: My mistake - Sunmi K2 actually uses another .aidl file and will not work using this package.

bashiryousufy commented 2 years ago

Yes I have also tried on Sunmi K2 mini and it works perfectly fine. But in case of Sunmi K2, it can't detect the builtin printer which is connected by USB.

I have used the same work arround as @david-qios .

@brasizza Hopefully we can see a working version for Sunmi K2.

brasizza commented 2 years ago

Hmmmmm, i think this package will not work for you, because it will use the builtin printers inside some screen, you can use some serial port writer i made a null safety upgrate in this package here

serial_port_flutter: git: https://github.com/brasizza/serial_port_flutter.git

you can use some escpos data to print in this USB printer!

david-qios commented 2 years ago

Yes I have also tried on Sunmi K2 mini and it works perfectly fine. But in case of Sunmi K2, it can't detect the builtin printer which is connected by USB.

I have used the same work arround as @david-qios .

@brasizza Hopefully we can see a working version for Sunmi K2.

You couldn't detect the printer because it uses another interface from the one used in this package. However you could write your own platform channel from flutter if you really needed the native interface. I was able to copy what @brasizza did by carefully following along these links. Hope it helps!

https://file.cdn.sunmi.com/SUNMIDOCS/Sunmi-k2-Print-Service-Development-Documentation.pdf https://docs.flutter.dev/development/platform-integration/platform-channels?tab=android-channel-kotlin-tab