Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get serialnumber from usb #3

Merged
merged 4 commits into from
Mar 17, 2021
Merged

Get serialnumber from usb #3

merged 4 commits into from
Mar 17, 2021

Conversation

JesperBadstue
Copy link
Contributor

  • Added parameter for getting serial number from usb during discovery.
  • Formatting updates.

@tr3v3r
Copy link
Owner

tr3v3r commented Mar 16, 2021

Could you please give me an example of serial number of the device?
I'm asking because it seems that we already have it in target returned by the discovery listener.

image

I suppose numbers after USB: is the serial number. Isn't it?

@tr3v3r
Copy link
Owner

tr3v3r commented Mar 16, 2021

Moreover, I think we should have a possibility to get SN using any type of connection.
I think I'll add the corresponding method this week

@JesperBadstue
Copy link
Contributor Author

I agree that it would be best to get the serialnumber from the getPrinterInformationunfortunately it seemed to be unstable on my devices. It only returned data approx every 2. time and the data was empty .eg. "SerialNumber:" "".
Therefore I used the UsbManagerto get the serialnumber as it seemes to be more reliable.

An example output of this PR is:
[{"bt": "", "ip": "", "mac": "", "name": "TM Printer", "serial": "513650463513220000", "target": "USB:/dev/bus/usb/004/005", "usb": "/dev/bus/usb/004/005"}]

Options for the discover would be EscPosPrinter.discover({ serialNumber: true, });

I dont think the DiscoveryListener returns the serial number. From what I can see from you screenshot it means that we can connect to a usb device by using the serial. The serial seems to only be available from getPrinterInformation() og the UsbManager as I think that you have to open/connect to the device to get the serial and the discoverprocess does not open the device.

@tr3v3r
Copy link
Owner

tr3v3r commented Mar 17, 2021

Ok. I've got your point. Since your task is too specific, I suppose we need to make some changes before merging.
See comments

…tion from serialNumber to usbSerialNumber. Updated documentation
@JesperBadstue
Copy link
Contributor Author

If you still want to implement the usage og getPrinterInformation() you are welcome to ping me and I will test it on my device (An Epson TM-88V)

@tr3v3r
Copy link
Owner

tr3v3r commented Mar 17, 2021

I'm afraid your printer is not supported by this method

image

@tr3v3r
Copy link
Owner

tr3v3r commented Mar 17, 2021

But anyway if we really need it I'll add it.

@JesperBadstue
Copy link
Contributor Author

Aaah, that explains why the function did not really work for me :) I was sure that I checked that it was supported but apparently I did not.

@tr3v3r
Copy link
Owner

tr3v3r commented Mar 17, 2021

It's strange for me that this method works on limited printer series.

Could you please resolve conversations after you make corresponding changes?

I'll test it on iOS as well soon ( I don't remember if it's OK to pass params without declaring it on the native side - it may cause crash )

@tr3v3r tr3v3r merged commit b6ddb2b into tr3v3r:main Mar 17, 2021
@tr3v3r
Copy link
Owner

tr3v3r commented Mar 17, 2021

Merged. I'll test on iOS today later on and push a new version to npm. Thanks

@tr3v3r tr3v3r linked an issue Mar 17, 2021 that may be closed by this pull request
tr3v3r added a commit that referenced this pull request Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serial Number from Discovery
2 participants