3

I am developing a web application that has to be used on Honeywell Dolphin 75e devices running Android 4.4. The integrated barcode reader can operate in "keyboard wedge" mode, but only when a text field has focus.

With desktop browsers I can use that code to capture barcode reader events :

var BarcodesScanner = {
    barcodeData: '',
    deviceId: '',
    symbology: '',
    timestamp: 0,
    dataLength: 0
};

function onScannerNavigate(barcodeData, deviceId, symbology, timestamp, dataLength){
    BarcodesScanner.barcodeData = barcodeData;
    BarcodesScanner.deviceId = deviceId;
    BarcodesScanner.symbology = symbology;
    BarcodesScanner.timestamp = timestamp;
    BarcodesScanner.dataLength = dataLength;
    $(BarcodesScanner).trigger('scan');
}

BarcodesScanner.tmpTimestamp = 0;
BarcodesScanner.tmpData = '';
$(document).on('keypress', function(e){
    e.stopPropagation();
    var keycode = (e.keyCode ? e.keyCode : e.which);
    if (BarcodesScanner.tmpTimestamp < Date.now() - 500){
        BarcodesScanner.tmpData = '';
        BarcodesScanner.tmpTimestamp = Date.now();
    }
    if (keycode == 13 && BarcodesScanner.tmpData.length > 0){
        onScannerNavigate(BarcodesScanner.tmpData, 'FAKE_SCANNER', '', BarcodesScanner.tmpTimestamp, BarcodesScanner.tmpData.length);
        BarcodesScanner.tmpTimestamp = 0;
        BarcodesScanner.tmpData = '';
    } else if (e.charCode && e.charCode > 0) {
        BarcodesScanner.tmpData += String.fromCharCode(e.charCode);
    }
});

$(BarcodesScanner).on('scan', function(e){
    alert();
});

Unfortunately, it does not work on Android. Is there an API allowing me to capture these events? Or another browser that handles this?

EDIT:

I was able to intercept the events of the barcode reader using a text field as a buffer.

But in this case I can not use any controls that require the focus in my application. Which is quite a handicap.

BarcodesScanner.tmpInput = $('<input />', {
    type: 'text',
    style: 'position: fixed; top: 0; right: 0; width: 0; height: 0;'
});
$('body').append(BarcodesScanner.tmpInput);
setInterval(function(){
    BarcodesScanner.tmpInput.focus();
}, 500);
BarcodesScanner.tmpInput.on('input', function(e){
    if (BarcodesScanner.tmpInput.val().length > 0){
        onScannerNavigate(BarcodesScanner.tmpInput.val(), 'FAKE_SCANNER', 'WEDGE', Date.now(), BarcodesScanner.tmpInput.val().length);
        BarcodesScanner.tmpInput.val('')
    }
});

T'lash
  • 552
  • 1
  • 3
  • 15

4 Answers4

7

I finally received a functional response from the Honeywell support:

I suspect that the application wants to receive the data as Keydown / Keyup events.

Can you please test the following?

On Wedge as Keys set: 9,10,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127

Screenshot

As it might take 15 minutes to do it manually, I have created this code that you can read inside the Wedge as keys field:

9,10,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127

After reading the code please wait 10 seconds before saving and check if the data is correctly saved into that field by exiting and reentering the Scanner settings.

Finally, disable and re-enable the scanner (or reboot the device).

The scanner should then work on your application.

Hope this helps.

The terminal must use the latest version of the system to see the "Wedge as keys" field. Don't forget to set "\n" as suffix.

With that, the JS code will be:

var BarcodesScanner = {
    barcodeData: '',
    deviceId: '',
    symbology: '',
    timestamp: 0,
    dataLength: 0
};

function onScannerNavigate(barcodeData, deviceId, symbology, timestamp, dataLength){
    BarcodesScanner.barcodeData = barcodeData;
    BarcodesScanner.deviceId = deviceId;
    BarcodesScanner.symbology = symbology;
    BarcodesScanner.timestamp = timestamp;
    BarcodesScanner.dataLength = dataLength;
    $(BarcodesScanner).trigger('scan');
}

BarcodesScanner.tmpTimestamp = 0;
BarcodesScanner.tmpData = '';
$(document).on('keypress', function(e){
    e.stopPropagation();
    var keycode = (e.keyCode ? e.keyCode : e.which);
    if (BarcodesScanner.tmpTimestamp < Date.now() - 500){
        BarcodesScanner.tmpData = '';
        BarcodesScanner.tmpTimestamp = Date.now();
    }
    if (keycode == 13 && BarcodesScanner.tmpData.length > 0){
        onScannerNavigate(BarcodesScanner.tmpData, 'FAKE_SCANNER', 'WEDGE', BarcodesScanner.tmpTimestamp, BarcodesScanner.tmpData.length);
        BarcodesScanner.tmpTimestamp = 0;
        BarcodesScanner.tmpData = '';
    } else if (e.charCode && e.charCode > 0) {
        BarcodesScanner.tmpData += String.fromCharCode(e.charCode);
    }
});

Now, you could listen the scanning event:

$(BarcodesScanner).on('scan', function(e){
    alert(BarcodesScanner.barcodeData);
});

I hope this will help someone else.

T'lash
  • 552
  • 1
  • 3
  • 15
  • Thank you for sharing, this is great stuff and I was looking into the very same thing. Hower, in my application the keyboard shows up each time I do a scan. Does this happen to you too? any advice on how to get rid of it? – user1051218 May 25 '16 at 20:04
  • Normally, the keyboard shows up only on input fields, so are you using the capture solution exposed in this answer or the text field buffer from the edit of the original question ? You can deactivate it with app like Null Keyboard ( https://play.google.com/store/apps/details?id=com.wparam.nullkeyboard&hl=fr ). What's your device ? – T'lash May 26 '16 at 08:52
  • 1
    For Dolphin 75e users without the "Wedge as keys" option, you will need to contact Honeywell support to obtain the latest firmware, as it is not available on their website due to licensing issues. The relevant file is `PARISAD_56.01.13.0173.zip`. – SystemParadox Jun 13 '16 at 08:40
1

Have you tried to subscribe to different elements $('html,body') and maybe different events keyup, keydown, textInput?

And are you using JQuery mobile or normal?

faster
  • 151
  • 5
  • I'm using JQuery normal. I can capture barcode events as 'input' events on text fields, but not on the body. – T'lash Feb 22 '16 at 11:32
  • I have 2 scanners on my desk (2d/barcode and credit card), developing couple of pages for kiosk. Your code works for both of them on my win7+chrome. I tried document.addEventListener("tap", function(e){alert(e)}); on my SG s5 - works ok. The android keyboard events (document.addEventListener("keydown",...)) is captured as well although I subscribed to document. I would try to connect bluetooth keyboard just to check if you can capture that, so it would mean scanner works not as keyboard. – faster Feb 23 '16 at 23:59
  • The scanner works as a keyboard only when an input field has the focus. – T'lash Feb 24 '16 at 00:45
0

Changing the keyset and using \n suffix works for Android4.4. It's not working on Android 6.0.1. Testing on Dolphin CT50...

  • I'll receive 2 Dolphin 75e with Android 6.0 within 10 days, so I'll tell you if it works or not. – T'lash Mar 11 '17 at 10:16
  • Our Device with Android 6.0 has buildnumber: 71.01.04.0015. http://hsm.force.com/publickb/articles/HSM_Article/CT50-Android-6-0-does-not-jump-to-next-field-in-web-browser-after-scanning-a-barcode/?q=ct50+wedge&l=en_US&fs=Search&pn=1 I didn't find version 71.01.07.0050 on the Honeywell-Website – HoneywellCT50 Mar 16 '17 at 11:37
-1

honeywell has the fix for that issue you will need this file i think: HELSINKIAD_71.01.07.0050

ask honeywell, after that you update it via recovery mode..