mbed BLE API for JerryScript
This library exposes the mbed BLE API to JerryScript targets forked from mbed-js-ble
The following objects are exposed:
- BLEDevice - holds reference to the Bluetooth stack.
- BLEService - references a GATT service.
- BLECharacteristic - references a GATT characteristic.
Usage
// instantiate BLEDevice, only do this oncevar ble = ; // takes in: characteristic UUID (16 bit only), array of properties (r/w/n), data sizevar characteristic = ;// takes in: service UUID (16 bit only), array of BLECharacteristic objectsvar service = ; // ready callback, wait before interacting with the APIble; // connection callbackble; // disconnection callbackble; // is connected? returns Boolean;
Interacting with characteristics
// write to a characteristiccharacteristic; // reading a characteristic (returns an array)var arr = characteristic;; // receiving updates when written over GATTcharacteristic;
Fork Details
Implememted support for 128-bit UUIDs
Examples:
// BLECharacteristic// takes in: characteristic UUID (16 bit or 128 bit), array of properties (r/w/n), data sizecharacteristic = ;characteristic = ; // BLEService// takes in: characteristic UUID (16 bit or 128 bit), array of characteristicsservice = ;service = ;
Implemented Long UUID support in BLEService.GetUUID()
uuid = service
Added Manufacturer info in the startAdveritising method:
// Valid methods// takes: name to advertise, array of UUIDs (strings)BLE ble = ;ble; // takes: name to advertise, array of UUIDs (strings), advertisement interval (default: 1000),ble; // takes: name to advertise, array of UUIDs (strings), advertisement interval (default: 1000), Manufacturer's infoble; // takes: name to advertise, array of UUIDs (strings), Manufacturer's infoble;