Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface BlePairingOptions

Pairing options

Hierarchy

  • SmpEncryptOptions
    • BlePairingOptions

Index

Properties

Optional keys

keys: undefined | string

Use pairing keys

// Javascript Example

const keys = "xxxxx";
await obniz.ble.initWait({});
obniz.ble.scan.onfind = function(peripheral){
  if(peripheral.localName == "my peripheral"){
    await peripheral.connectWait({keys});// pairing with stored keys.
  }
}
await obniz.ble.scan.startWait();

Optional onPairedCallback

onPairedCallback: undefined | ((keys: string) => void)

Callback function that call on pairing passkey required.

Optional onPairingFailed

onPairingFailed: undefined | ((e: Error) => void)

Callback function that call on pairing failed internal. Some pairing error may caused internally when peripheral request regardless central side request.

Optional passkeyCallback

passkeyCallback: undefined | (() => Promise<number>)

Callback function that call on pairing passkey required.

// Javascript Example

const keys = "xxxxx";
await obniz.ble.initWait({});
obniz.ble.scan.onfind = function(peripheral){
  if(peripheral.localName == "my peripheral"){
    await peripheral.connectWait({ passkeyCallback: async () => {
     return 123456;
    }});
  }
}
await obniz.ble.scan.startWait();

Generated using TypeDoc