luis901101 / honeywell_scanner

BSD 3-Clause "New" or "Revised" License
22 stars 9 forks source link

Is there a way that I can control scanning sounds? #7

Closed ayavuz-erbakir closed 2 years ago

ayavuz-erbakir commented 2 years ago

I want to control scanning sounds like device is giving on success and error. Can I reach them or what is the way of it?

luis901101 commented 2 years ago

You can control the scanning sounds by using properties. In the plugin's README.md there is a reference to a BarcodeReader.html and a BarcodeReaderProperties.java that describes each property allowed by honey well scanner. It's important to always read the documentation. Anyway for this sound control you can use: NTF_GOOD_READ_ENABLED and NTF_BAD_READ_ENABLED both properties are bool. Something like this:

Map<String, dynamic> properties = {
      'NTF_GOOD_READ_ENABLED': false,
      'NTF_BAD_READ_ENABLED': false,
    };
honeywellScanner.setProperties(properties);
ayavuz-erbakir commented 2 years ago

@luis901101 I was not meant to enable or disable them actually. I mean how can I make a scanning or error sound by myself in some situation. For example, I want to get error sound when type 93 barcode is scanned. I tried to call onError() method but sound is not coming. Bad scan is enabled both in my device and app.

luis901101 commented 2 years ago

It was not clear enough in your first question. AFAIK the honeywell scanners doesn’t allow to customize sounds by type of code, I mean you can’t configure to make the scanner emit an error beep when specific type code is scanned. The behavior you want is something beyond the scanner properties and configurations and therefore this plugin. One thing you could do is to comfigure scanner to avoid scanning some types of codes, that way you dont have to deal with the error sound for some specific scanned codes. Anyway what you want can be made easily by using a plugin for playing audio. You could do the following:

  1. Disable NTF_GOOD_READ_ENABLED and NTF_BAD_READ_ENABLED properties.
  2. Override onDecoded(…) and play custom sound according to you business logic by using a play audio plugin.
  3. Also override onError() and play custom sound there too.
ayavuz-erbakir commented 2 years ago

@luis901101 Yes, it was my bad. As I see in java codes there is a method like BarcodeReader.BAD_READ_NOTIFICATION which is giving error sound, so I wanted to ask if you have that method in package, too. If not, I will make it like you mentioned. Thanks.

luis901101 commented 2 years ago

@luis901101 Yes, it was my bad. As I see in java codes there is a method like BarcodeReader.BAD_READ_NOTIFICATION which is giving error sound, so I wanted to ask if you have that method in package, too. If not, I will make it like you mentioned. Thanks.

Nope, currently there is no way to call scanner notify(...) function. BAD_READ_NOTIFICATION and GOOD_READ_NOTIFICATION are just constants for the properties badRead and goodRead respectively, which are the ones that receive the notify(...) function, but currently it's not implemented a way to call this function from this plugin.