Bluetooth class

Hierarchy

  • EventDispatcher<BluetoothEvents>
    • BluetoothImpl

Implements

  • Bluetooth

Constructors

Properties

emitter: EventEmitter = ...
referringDevice?: BluetoothDevice

Referring device for the bluetooth instance

Accessors

  • set onadvertisementreceived(fn: (ev: Event) => void): void
  • Parameters

    • fn: (ev: Event) => void

    Returns void

  • set onavailabilitychanged(fn: (ev: Event) => void): void
  • Parameters

    • fn: (ev: Event) => void

    Returns void

  • set oncharacteristicvaluechanged(fn: (ev: Event) => void): void
  • Parameters

    • fn: (ev: Event) => void

    Returns void

  • set ongattserverdisconnected(fn: (ev: Event) => void): void
  • Parameters

    • fn: (ev: Event) => void

    Returns void

  • set onserviceadded(fn: (ev: Event) => void): void
  • Parameters

    • fn: (ev: Event) => void

    Returns void

  • set onservicechanged(fn: (ev: Event) => void): void
  • Parameters

    • fn: (ev: Event) => void

    Returns void

  • set onserviceremoved(fn: (ev: Event) => void): void
  • Parameters

    • fn: (ev: Event) => void

    Returns void

Methods

  • Type Parameters

    • K extends keyof BluetoothEvents

    Parameters

    • type: K
    • listener: (this: this, ev: BluetoothEvents[K]) => void

    Returns void

  • Type Parameters

    • K extends keyof BluetoothEvents

    Parameters

    • type: K
    • listener: EventListener

    Returns void

  • Parameters

    • event: Event

    Returns boolean

  • Gets the availability of a bluetooth adapter

    Returns Promise<boolean>

    Promise containing a flag indicating bluetooth availability

  • Get all bluetooth devices

    Returns Promise<BluetoothDevice[]>

  • Type Parameters

    • K extends keyof BluetoothEvents

    Parameters

    • type: K
    • callback: (this: this, ev: BluetoothEvents[K]) => void

    Returns void

  • Type Parameters

    • K extends keyof BluetoothEvents

    Parameters

    • type: K
    • callback: EventListener

    Returns void

  • Scans for a device matching optional filters

    Parameters

    • options: RequestDeviceOptions = ...

      The options to use when scanning

    Returns Promise<BluetoothDevice>

    Promise containing a device which matches the options