Create descriptor.
await obniz.ble.initWait();
var descriptor = new obniz.ble.characteristic({
"uuid" : "2901", //Characteristic User Description
"text" : "hello world characteristic",
});
var characteristic = new obniz.ble.characteristic({
"uuid" : "FFF1",
"text" : "Hi",
"descriptors" : [ descriptor ]
});
var service = new obniz.ble.service({
"uuid" : "fff0",
"characteristics" : [ characteristic ]
});
obniz.ble.peripheral.addService(service);
Characteristic instance
It is uuid as string.
console.log(attr.uuid); // => '4C84'
It reads data.
Even you wrote string or number, it returns binary array. It throws an error when failed.
// Javascript Example
let data = await attr.readWait()
console.log("data: " , data );
This writes dataArray. It throws an error when failed.
// Javascript Example
await attr.writeWait([0xf0,0x27]);
console.log("write success");
Generated using TypeDoc