Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

  • 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);
    

    Parameters

    Returns BleDescriptor

Properties

characteristic

characteristic: BleCharacteristic

Characteristic instance

uuid

uuid: UUID

It is uuid as string.

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

Methods

readWait

  • readWait(): Promise<number[]>
  • 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 );

    Returns Promise<number[]>

writeWait

  • writeWait(data: any): Promise<boolean>
  • This writes dataArray. It throws an error when failed.

    // Javascript Example
    await attr.writeWait([0xf0,0x27]);
    console.log("write success");

    Parameters

    • data: any

    Returns Promise<boolean>

Generated using TypeDoc