BLE Characteristic


This driver provides a simple read/write/notify interface to any BLE service/chacteristic pair. It is intended to help prototype or explore BLE characteristics easily.

How To Connect

For information on how to connect to BLE devices, please see the BLE platform page.

How To Use

A simple example of reading data from a Bluetooth LE device, using the BLE characteristic driver:

var Cylon = require("cylon");

Cylon.robot({
  connections: {
    bluetooth: {
      adaptor: "central", uuid: "207377654321",
      module: "cylon-ble"
    }
  },

  devices: {
    wiced: {
      driver: "ble-characteristic",
      serviceId: "180f", characteristicId: "2a19",
      connection: "bluetooth"
    }
  },

  work: function(my) {
    my.wiced.readCharacteristic(function(err, data) {
      if (err) { return console.error("Error: ", err); }
      console.log("Data: ", data);
    });
  }
}).start();

This example connects and then reads the characteristic ID 2a19 for the service ID 180f. This happens to be the "Battery" information, which is a well-known BLE service/characteristic.

Commands

readCharacteristic

Reads the current value of characteristic of the BLE device

Params

  • callback (Function) to be triggered when characteristic data is read

Returns

  • (undefined)

notifyCharacteristic

Gets notifications from the BLE device

Params

  • callback (Function) to be triggered when data is retrieved

Returns

  • (undefined)

Compatibility