title: Using cordova bluetoothSerial plug-in with a BLE device
body: <p>I am working on a app to send very simple message to a Bluetooth Low Energy device. </p>
  
  <p>I tested using my development platform (Galaxy S5 Android 4.4) that a correct communication could be established between the device (Arduino board and nRF8001 shield) thanks to the nRF UART v2.0 app from Nordic Semi. It worked pretty well as I could send and receive messages from one device to the other, so I am very confident in this side of the product.</p>
  
  <p>My app, which is based on bluetoothSerial plugin for Cordova does not succeed to do the connection with the BLE device. Here is the code:</p>
  
  <pre><code>var app = {
      initialize: function() {
          this.bindEvents();
      },
      bindEvents: function() {
          document.addEventListener('deviceready', this.onDeviceReady, false);
      },
      onDeviceReady: function() {
          document.getElementById('messagebox').innerHTML = "Device Ready";
          app.isBluetoothEnabled();
      },
      isBluetoothEnabled: function()  {
          document.getElementById('messagebox').innerHTML = "is Bluetooth Enabled";
          bluetoothSerial.isEnabled(
            function() {
                document.getElementById('messagebox').innerHTML = "Bluetooth is enabled";
                app.deviceConnect();
            },
            app.bluetoothEnable()
        );
      },
      bluetoothEnable: function() {
          bluetoothSerial.enable(app.deviceConnect(),
            function() {
              document.getElementById('messagebox').innerHTML = "User did not want to connect.";
            });
      },
      deviceConnect: function() {
          bluetoothSerial.connect('DB:A2:49:84:F9:32',
            function() {
              document.getElementById('messagebox').innerHTML = "Connected to device";
            },
            function() {
              document.getElementById('messagebox').innerHTML = "Not connected to device";
            });
      }
  };
  
  app.initialize();
  </code></pre>
  
  <p>The 'messagebox' element is only here to check at each step where the app stopped.</p>
  
  <p>I tried the method .list and .discoverUnpaired. Both are working (the .list only lists already paired device) and with the discoverPaired method I can see my device with its MAC address, but the .connect never worked, even in connectInsecure mode and I did not succeed to pair my device by the Android OS in the bluetooth parameters (I don't know if it is required prior to attempting any connection with the app).</p>
  
  <p>Could someone tell me if I am misunderstanding the way bluetootSerial works or (even BLE)? Do I have to pass an other argument than MAC address to connect method?.</p>
  
  <p>Many thanks</p>