Current connected device address
This is a callback function used when an external device gets connected or disconnected.
await obniz.ble.initWait();
obniz.ble.peripheral.onconnectionupdates = function(data){
console.log("remote device ", data.address, data.status)
};
This starts a service as peripheral.
await obniz.ble.initWait();
// Service without characteristics
var service1 = new obniz.ble.service({"uuid" : "fff0"});
obniz.ble.peripheral.addService(service1);
// Service with characteristics/descriptor
var service2 = new obniz.ble.service({"uuid" : "fff0"});
var characteristic = new obniz.ble.characteristic({"uuid" : "FFF1", "text": "Hi"});
var descriptor = new obniz.ble.descriptor({"uuid" : "2901", "text" : "hello world characteristic"});
service2.addCharacteristic(characteristic);
characteristic.addDescriptor(descriptor);
obniz.ble.peripheral.addService(service2); // call this after all descriptors and characteristics added to service.
This ends all the peripheral service
obniz.ble.peripheral.addService(setting);
obniz.ble.peripheral.end();
Get service by UUID
Terminate service by UUID
Generated using TypeDoc