esc_pos_printer icon indicating copy to clipboard operation
esc_pos_printer copied to clipboard

USB Driver / Interface

Open broberts-nybble opened this issue 5 years ago • 19 comments

Hi,

Thank you for this amazing library firstly, secondly I am going to pull it tomorrow as I would like to add the usb printing facility.

Given that it is your work, do you have any guidance?

I was looking at using https://pub.dev/packages/usb_serial, then sending the same commands over the usb serial port? are there any specifics that you are aware of that we should take into consideration.

Once we have it working, we will give it right back to you :)

broberts-nybble avatar Aug 26 '19 17:08 broberts-nybble

Hi, Thank you for your feedback, I really appreciate it! I didn't have time yet to dig into USB support but it looks like it's feasible using usb_serial library. Some people already asked about the USB support, so I think it could be really useful to add this feature!

andrey-ushakov avatar Aug 26 '19 20:08 andrey-ushakov

Hi Andrey,

Just to let you know, we have completed the usb driver for this, we are busy testing.

It was really simple enough to get going with very few changes.

broberts-nybble avatar Aug 28 '19 05:08 broberts-nybble

Hi Brandon,

Sounds great! Thank you for your work! I'm waiting for your pull request to test it.

andrey-ushakov avatar Aug 28 '19 12:08 andrey-ushakov

Hi Brandon,

Are you ready to make a pull request? I could include your changes into the next release.

andrey-ushakov avatar Sep 02 '19 14:09 andrey-ushakov

Hi Andrey/Brandon

I would be really interested in testing this too? We were looking at embarking on a similar integration.

kevj121 avatar Sep 04 '19 16:09 kevj121

@broberts-nybble can you share the usb part for this please?

n0tc0ding avatar Sep 09 '19 22:09 n0tc0ding

Any updates on the support for USB Driver? I would like to work if @andrey-ushakov you can provide me some guidance.

AyushBherwani1998 avatar Nov 13 '19 17:11 AyushBherwani1998

Hi @AyushBherwani1998 ,

That will be really helpful!

I expect it shouldn't be too hard to develop using this usb_serial library (android only) but I don't have an appropriate device to which I can connect my POS printer and test.

So it would be great if you could play a bit with an Android device, POS printer and this usb lib. Basically all we need to do is to send same POS commands over USB.

For example, you can create a simple demo app where user will choose an USB device (his POS printer) from a list and after that you can print a test ticket sending commands via USB.

The most interesting part would be how to create a class architecture to support USB and WiFi (and probably Bluetooth in future) connections.

Probably we can create a low-level (abstract) class PrinterAbstract that will generate POS commands and 2 classes - PrinterWifi and PrinterUsb that will send those commands over Wifi or Usb.

andrey-ushakov avatar Nov 13 '19 20:11 andrey-ushakov

Hi @AyushBherwani1998 ,

That will be really helpful!

I expect it shouldn't be too hard to develop using this usb_serial library (android only) but I don't have an appropriate device to which I can connect my POS printer and test.

So it would be great if you could play a bit with an Android device, POS printer and this usb lib. Basically all we need to do is to send same POS commands over USB.

For example, you can create a simple demo app where user will choose an USB device (his POS printer) from a list and after that you can print a test ticket sending commands via USB.

The most interesting part would be how to create a class architecture to support USB and WiFi (and probably Bluetooth in future) connections.

Probably we can create a low-level (abstract) class PrinterAbstract that will generate POS commands and 2 classes - PrinterWifi and PrinterUsb that will send those commands over Wifi or Usb.

Hey, I'm trying to connect the thermal printer but it always throws a Platform Exception. I saw the issue was closed by @broberts-nybble

@broberts-nybble A little help would be appreciated.

AyushBherwani1998 avatar Nov 14 '19 07:11 AyushBherwani1998

Hi @AyushBherwani1998 , That will be really helpful! I expect it shouldn't be too hard to develop using this usb_serial library (android only) but I don't have an appropriate device to which I can connect my POS printer and test. So it would be great if you could play a bit with an Android device, POS printer and this usb lib. Basically all we need to do is to send same POS commands over USB. For example, you can create a simple demo app where user will choose an USB device (his POS printer) from a list and after that you can print a test ticket sending commands via USB. The most interesting part would be how to create a class architecture to support USB and WiFi (and probably Bluetooth in future) connections. Probably we can create a low-level (abstract) class PrinterAbstract that will generate POS commands and 2 classes - PrinterWifi and PrinterUsb that will send those commands over Wifi or Usb.

Hey, I'm trying to connect the thermal printer but it always throws a Platform Exception. I saw the issue was closed by @broberts-nybble

@broberts-nybble A little help would be appreciated.

Hey @AyushBherwani1998, basically the issue was that the device was not set to virtual com, what needed to happen was I had to plug it into my PC, open the sample app they generally provide and set it's comm protocol to Virtual COM, then it connected and did not crash.

broberts-nybble avatar Nov 14 '19 07:11 broberts-nybble

Hi @AyushBherwani1998 , That will be really helpful! I expect it shouldn't be too hard to develop using this usb_serial library (android only) but I don't have an appropriate device to which I can connect my POS printer and test. So it would be great if you could play a bit with an Android device, POS printer and this usb lib. Basically all we need to do is to send same POS commands over USB. For example, you can create a simple demo app where user will choose an USB device (his POS printer) from a list and after that you can print a test ticket sending commands via USB. The most interesting part would be how to create a class architecture to support USB and WiFi (and probably Bluetooth in future) connections. Probably we can create a low-level (abstract) class PrinterAbstract that will generate POS commands and 2 classes - PrinterWifi and PrinterUsb that will send those commands over Wifi or Usb.

Hey, I'm trying to connect the thermal printer but it always throws a Platform Exception. I saw the issue was closed by @broberts-nybble @broberts-nybble A little help would be appreciated.

Hey @AyushBherwani1998, basically the issue was that the device was not set to virtual com, what needed to happen was I had to plug it into my PC, open the sample app they generally provide and set it's comm protocol to Virtual COM, then it connected and did not crash.

Can you show me code plz!!

nguyenphuochai1998 avatar Dec 23 '19 03:12 nguyenphuochai1998

@broberts-nybble any updates in your PR?

ccfiel avatar Dec 31 '19 03:12 ccfiel

I was not able to achieve the functionality using usb_serial library. Instead, I used another package esc-pos-printer-flutter with combination with this package and made an interface to achieve usb and bluetooth. If you are using esc-pos-printer-flutter package you need to add other functionalities by yourself.

AyushBherwani1998 avatar Dec 31 '19 16:12 AyushBherwani1998

esc-pos-printer-flutter this is for usb. What package did you use for bluetooth? @AyushBherwani1998

ccfiel avatar Jan 01 '20 00:01 ccfiel

esc-pos-printer-flutter this is for usb. What package did you use for bluetooth? @AyushBherwani1998

For bluetooth I used blue_thermal_printer plugin. It has all the print options you require.

AyushBherwani1998 avatar Jan 01 '20 05:01 AyushBherwani1998

@AyushBherwani1998 I think this package does not support ios? Have you tried it in ios?

ccfiel avatar Jan 01 '20 06:01 ccfiel

@AyushBherwani1998 I think this package does not support ios? Have you tried it in ios?

Yes, this package only supports Android as of now. You will need to modify the package to support the iOS using PlatformChannel.

AyushBherwani1998 avatar Jan 01 '20 06:01 AyushBherwani1998

Thanks @AyushBherwani1998

ccfiel avatar Jan 01 '20 08:01 ccfiel

any update on this?

komputerboy avatar Feb 04 '20 03:02 komputerboy