6 Replies Latest reply on Jan 12, 2012 9:21 AM by William Jeyaraj

    Bluetooth scanner (CS3070) not working with ET1 in RhoElements

      I got the Bluetooth scanner CS3070 paired with ET1 successfully.  The status under the device in Bluetooth setting says “Connected to HID based input”.  But, I am not able to get it to work in RhoElements.  I am trying the following sample that I got from the RhoElements help document.  The alert pops up with the scanned barcode if I scan using the camera in ET1.  Am I missing something?  I would appreciate any help.  Thanks.

       

      <HTML>

      <HEAD>

      <!-- Status Updates are received via bluetoothStatusEvent -->

      <META HTTP-Equiv="Scanner" Content="BluetoothStatusEvent:url('Javascript:BTStatusFunc(%json);')">

      <META HTTP-Equiv="Scanner" Content="DecodeEvent:url('Javascript:ScanFunc(%json);')">

      <!-- Enable the Bluetooth Scanner, this will commence the BT pairing -->

      <META HTTP-Equiv="Scanner" Content="Enabled:SCN2">

      </HEAD>

       

      <BODY>

      Barcode Data: <DIV ID="bcode"> </DIV>

      User Message: <DIV ID="message"> </DIV>

      <P><INPUT TYPE="button" VALUE="Change Associated Scanner" ONCLICK="onChangeScanner();"></P>

      </BODY>

      </HTML>

       

       

      <SCRIPT LANGUAGE="JavaScript">

       

       

      //  Whether or not the next barcode data we receive will be the unpairing barcode

      var expectingUnpairingBarcode = false;

       

       

      function ScanFunc(jsonObject)

      {

                //  Output the scanned barcode

      alert(jsonObject.data);

                bcode.innerHTML = jsonObject.data;

      }

       

       

      function BTStatusFunc(jsonObject)

      {

                if (expectingUnpairingBarcode)

                {

                          //  restart the scanner component so it is ready

                          //  to accept a different Bluetooth Scanner

                          expectingUnpairingBarcode = false;

                          scanner.disable();

                          scanner.enabled = 'SCN2';

                          return;

                }

       

                if (jsonObject.status == 'BTScanAssociationBarcode')

                {

                          //  Instruct the User to scan the association barcode

                          alert('Scan Association Barcode');

                }

                else if(jsonObject.status == 'BluetoothConnected')

                {

                          message.innerHTML = "Bluetooth Scanner Connected";

                }

                else if(jsonObject.status == 'BluetoothDisconnected')

                {

                          message.innerHTML = "Bluetooth Disconnected, Please Reconnect";

                }

      }

       

       

      function onChangeScanner()

      {

                //  Change the BT Scanner associated with the device, the logic to do this is handled

                //  once the 'unpairing' barcode is scanned.

                message.innerHTML = "Please Scan Unpairing Barcode";

                expectingUnpairingBarcode = true;

      }

      </SCRIPT>