Datalogic Falcon X3 - Barcode Scanner

♀尐吖头ヾ 提交于 2021-02-05 09:43:45

问题


I just got the Datalogic Falcon X3+ Barcode Device and got asked, if I could make a javascript application which reads the barcode and send it via sql to a database.

Since I'm not really into C++/C# and the Windows SDK in Visual Studio 2008, I don't know exactly how to start. On the homepage of datalogic I found some ActiveX API examples which are written in javascript for scanning (Memor X3 SDK).

5 files:

  • BARCODE_Identifiers.js
  • SCAN_PARAMENTERS.js
  • jsBarcodeIdDemo.htm
  • jsScanDemo.htm
  • jsScanSetupDemo.htm

BARCODE_Identifiers.js - Excerpt

    var BARCODE_ID_CODE_UNDEFINED=-1;
    var BARCODE_ID_CODE_25_CIP_HR=0;
    var BARCODE_ID_CODE_25_INTERLEAVED=1;
    var BARCODE_ID_CODE_25_INDUSTRIAL=2;

SCAN_PARAMETERS.js - Excerpt

    var SCAN_PARAM_WAVE_FILE=67108864;
    var SCAN_PARAM_TIMEOUT=67108865;
    var SCAN_PARAM_BEEPER_DURATION=67108866;
    var SCAN_PARAM_KEYBOARD_EMULATION=67108871;

jsScanDemo.htm - Excerpt

    //ScanEnable...
    function ScanEnable(sAction)
    {
        if (sAction=="ENABLE")
        {
            DatalogicScanner1.bScanEnabled = true;

            //ENABLE Continuous Mode PARAM ONLY IF READER == PORT REDIRECTOR
            var nReaderType = oScannerSetup.getReaderIdentifier();
            if (nReaderType==SE_READER_PR_CLASS_ID) 
            {
                        oScannerSetup.setParameter(SCAN_PARAM_CONTINUOUS_MODE,SCAN_PARAM_ENABLE);
            }
        }
        else
        {
            //DISABLE Continuous Mode PARAM ONLY IF READER == PORT REDIRECTOR
            var nReaderType = oScannerSetup.getReaderIdentifier();
            if (nReaderType==SE_READER_PR_CLASS_ID) 
            {
                          oScannerSetup.setParameter(SCAN_PARAM_CONTINUOUS_MODE,SCAN_PARAM_DISABLE);
            }

            DatalogicScanner1.bScanEnabled = false;
         }  

        if (DatalogicScanner1.bScanEnabled == true)
        {
            btnSoftTrigger.disabled = false;
            return("DISABLE");
        }

        btnSoftTrigger.disabled = true;
        return("ENABLE");
    }

The initial situation

When scanning a barcode with the Falcon X3+ being in any kind of text form, it doesn't send the decoded barcode as text. Means, that I can't grab the barcode with a keypress event. The Falcon has an application called "decoding" in it's control panel. Only in this application you can see the decoded data.

I couldn't find a setting where you can switch modes into keyboard_emulation = true, or something similar.

What I just tried is putting the example javascript onto a web server and then visiting that .htm-file with the Internet Explorer of the Falcon X3+ (which is included on the Windows CE 6.5). But here I have the same problem - there is no decoded data transmitted.

The Question

Is there anyone out there who already has something simple for the datalogic falcon x3 (maybe even based on javascript?) which I could work with?

Thanks!


回答1:


You probably don't want to use ActiveX.

You could proably make it a normal html textbox and setup the scanner to input the decoded barcode into the textbox on scan.

Then, submit to a web-service running somewhere externally.




回答2:


Although this is an old question, and not particularly well presented, it still has no accepted answer (as of 2020-01-28). I've come up with the followihg remarkably simple solution, with a couple of important caveats discussed after the code:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Scanner Test</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>The following form accepts input from a barcode scanner.</p>
    <hr>
    <form method='post' action='scan.php'>
      <table>
        <tr>
          <td>Scanner Input:</td>
          <td><input id='scanval' name='scanval' value=''></td>
        </tr>
      </table>
      <input type='submit' name='submit' value='Submit'>
    </form>
    <script>
      window.onload = function() { document.getElementById('scanval').focus(); }
    </script>
  </body>
</html>

Naturally, this works fine within all major browsers. The trick was getting it to work in the IE browser on a Windows CE device (in my case, a Datalogic Falcon X3+ barcode scanner). The requirement is for the focus to be on the input field at page load, so that a user can immediately start scanning bar codes without having to click or tap, etc.

Of course, there are many ways to set the focus, but the only way that seemed to work in this specific environment was to use window.onload, and have it appear after the closing </form> tag.

We expect most browsers to submit a form automatically when the enter/return key is pressed. Fortunately this works in IE on Windows CE. So, strictly speaking, we don't need the Submit button on the form. The scanner apparently includes either a <cr> or a <cr><lf> to terminate each scan, so the form is automatically submitted.

HOWEVER... oddly, when auto-submit is invoked on this device, the submit input value is not transmitted to the server. I use PHP on the server to handle the incoming form data, and the $_POST data structure received from the scanner contains only the scanval input field value, NOT the submit value.

As one might expect, I normally look for the submit button input as confirmation that a form has been successfully posted to the server. It took a while, and a lot of head scratching, to determine that the scanner was sending only the scanval and nothing else.

Finally, there is a User Agent configuration option within the IE browser's settings in Windows CE that allows you to choose from among: Windows CE, Pocket PC, or Same as Windows XP. I found that it seems to work best when set to Windows XP. That was not obvious.

Anyway, I hope this maybe helps someone else in the future!



来源:https://stackoverflow.com/questions/29415757/datalogic-falcon-x3-barcode-scanner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!