title: Using Evothings JavaScript to read BLE characteristic data
body: <p>I have a BLE (Bluetooth 4.0)pedometer device from which I want to read the characteristic data using Evothings plugin (which uses Javascript API to interact with the device)</p>
  
  <p>I am using following code -
  callback when device is connected =</p>
  
  <pre><code>function deviceConnected(device) {
      console.log('Connected to device: ' + device.name)
      console.log('Reading services... Have patience!')
      device.readServices(
          null, // null means "read all services".
           readAllServicesCharacteristicsAndNotifications,
          // listAllServicesCharacteristicsDescriptors,
          readServicesError)
  }
  </code></pre>
  
  <p>callback code for readAllServicesCharacteristicsAndNotifications -</p>
  
  <pre><code>function readAllServicesCharacteristicsAndNotifications(device) {
      // Get data for each service
     console.log('number of services ' + device.__services.length)
     console.log('number of characteristic ' + device.__services[0].__characteristics.length)
          //var characteristic = service.__characteristics[characteristicUUID]
          device.readCharacteristic(
          device.__services[0].__characteristics[8]['uuid'],
          function (data) {
              var test = new Uint8Array(data);
              var result = "";
              for (var i = 0; i &lt; test.length; i++) {
                  console.log('data  element is ' + test[i]);
                  console.log('data  element string is ' + String.fromCharCode(parseInt(test[i], 2)));
                  result += String.fromCharCode(parseInt(test[i], 2));
              }
  
              console.log('data  is ' + result);
          },
          function (errorCode) {
          console.log('BLE readCharacteristic error: ' + errorCode);
       });
  }
  </code></pre>
  
  <p>I think BLE data formatsuggests that data is exchanged as binary code bytes.
  I see the value in the byte array but I don't know how to interpret it.</p>
  
  <p>Has anyone used Evothings Javascript to interact with BLE device?</p>