title: Subscribe to notifications for BLE with evothings plugin
body: <p>For an Android application with BLE (Bluetooth Low Energy), I am trying to subscribe to a ble device notification for heart rate measurement, using the evothings plugin. Can scan for devices, connect readout services but cannot subscribe.</p>
  
  <p>Here are some code fragments:</p>
  
  <pre><code>app.connect = function(address, name)
  {
      app.stopLeScan();
      console.log('connect('+address+')');
      document.getElementById('deviceName').innerHTML = address + " " + name;
      ble.connect(address, function(r)
      {
          app.deviceHandle = r.deviceHandle;
          console.log('connect '+r.deviceHandle+' state '+r.state);
          document.getElementById('deviceState').innerHTML = r.state;
          if (r.state == 2) // connected
          {
              console.log('connected, requesting services...');
              app.getServices(r.deviceHandle);
              app.subscribe(r.deviceHandle);
          }
  
  
      }, function(errorCode)
      {
          console.log('connect error: ' + errorCode);
      });
  };
  </code></pre>
  
  <p>And the subscribe function:</p>
  
  <pre><code>app.subscribe = function(deviceHandle)
  {
  
      console.log('Write Descriptor..');
      ble.writeDescriptor(deviceHandle,
          "00002a37-0000-1000-8000-00805f9b34fb", // Characteristic
          "00002902-0000-1000-8000-00805f9b34fb", // descriptor
          new Uint8Array([1,0]),
          function()
          {
              console.log('Status: writeDescriptor ok.');
          },
          function(errorCode)
          {
              // This error will happen on iOS, since this descriptor is not
              // listed when requesting descriptors. On iOS you are not allowed
              // to use the configuration descriptor explicitly. It should be
              // safe to ignore this error.
              console.log('Error: writeDescriptor: ' + errorCode + '.');
          });
  
      console.log('Subscribe..');
      ble.enableNotification(deviceHandle,
          "00002a37-0000-1000-8000-00805f9b34fb",
          function(data)
          {
              console.log('byteLength: '+data.byteLength);
          },
          function(errorCode)
          {
              console.log('Error: enableNotification: ' + errorCode + '.');
      });
  
  }
  </code></pre>
  
  <p>The output of the log shows the following:</p>
  
  <pre><code>Write Descriptor.. index.js:44
  Subscribe.. index.js:62
  connected, requesting services... index.js:211
  Error: enableNotification: JSON error. index.js:71
  Status: writeDescriptor ok. index.js:51
  s1: 0 00001800-0000-1000-8000-00805f9b34fb. 2 chars. index.js:231
   c11: 00002a00-0000-1000-8000-00805f9b34fb. 0 desc. index.js:248
    properties: PROPERTY_READ index.js:249
    writeType: WRITE_TYPE_DEFAULT index.js:250
   c12: 00002a01-0000-1000-8000-00805f9b34fb. 0 desc. index.js:248
    properties: PROPERTY_READ index.js:249
    writeType: WRITE_TYPE_DEFAULT index.js:250
  s2: 0 00001801-0000-1000-8000-00805f9b34fb. 1 chars. index.js:231
   c13: 00002a05-0000-1000-8000-00805f9b34fb. 1 desc. index.js:248
    properties: PROPERTY_INDICATE index.js:249
    writeType: WRITE_TYPE_DEFAULT index.js:250
    d26: 00002902-0000-1000-8000-00805f9b34fb index.js:268
  s3: 0 0000180d-0000-1000-8000-00805f9b34fb. 3 chars. index.js:231
   c14: 00002a37-0000-1000-8000-00805f9b34fb. 1 desc. index.js:248
    properties: PROPERTY_NOTIFY index.js:249
    writeType: WRITE_TYPE_DEFAULT index.js:250
    d27: 00002902-0000-1000-8000-00805f9b34fb index.js:268
   c15: 00002a38-0000-1000-8000-00805f9b34fb. 0 desc. index.js:248
    properties: PROPERTY_READ index.js:249
    writeType: WRITE_TYPE_DEFAULT index.js:250
   c16: 00002a39-0000-1000-8000-00805f9b34fb. 0 desc. index.js:248
    properties: PROPERTY_WRITE index.js:249
    writeType: WRITE_TYPE_DEFAULT index.js:250
  </code></pre>
  
  <p>I am interested in the hearth rate service listed as s3. But enabling notifications causes a JSON error. I hope someone could give some pointers.</p>
  
  <p>Thanks in advance</p>
  
  <p>Maverick2k</p>