BLE Central Service

service.uuid

It is uuid as string.

console.log(service.uuid); // => '4C84'

service.characteristics

It contains characteristics in a service.
It was discovered when connection automatically.

// Javascript Example

await obniz.ble.initWait(); 
var target = {
    uuids: ["fff0"],
};
var peripheral = await obniz.ble.scan.startOneWait(target);
if(!peripheral) {
    console.log('no such peripheral')
    return;
}
try {
  await peripheral.connectWait();
  console.log("connected");
  var service = peripheral.getService("1800")
  for (var c of service.characteristics) {
    console.log(c.uuid)
  }
} catch(e) {
  console.error(e);
}

service.getCharacteristic(uuid: string)

It returns a characteristic which having specified uuid in a service.
Return value is null when not matched.

Case is ignored. So aa00 and AA00 are the same.

// Javascript Example

await obniz.ble.initWait(); 
var target = {
    uuids: ["fff0"],
};
var peripheral = await obniz.ble.scan.startOneWait(target);
if(!peripheral) {
    console.log('no such peripheral')
    return;
}
try {
  await peripheral.connectWait();
  console.log("connected");
  var service = peripheral.getService("1800")
  var c = service.getCharacteristic("fff0")
  console.log(c.uuid)
} catch(e) {
  console.error(e);
}

You will Get in Few Days

Circuit for Starter “obniz Board” is available on Amazon and other online stores.
You can get it at below

Our products and resellers

Forum

Visit our developer’s forum to discuss and discover technologies.

Forum

Contact

Feel free to contact out support and technical team.

Contact us