Bluetooth class

Hierarchy

  • EventDispatcher<BluetoothEvents>
    • BluetoothImpl

Implements

  • Bluetooth

Constructors

Properties

emitter: EventEmitter<DefaultEventMap> = ...
referringDevice?: BluetoothDevice

Referring device for the bluetooth instance

Accessors

  • set onadvertisementreceived(fn): void
  • Parameters

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

          • ev: Event

          Returns void

    Returns void

  • set onavailabilitychanged(fn): void
  • Parameters

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

          • ev: Event

          Returns void

    Returns void

  • set oncharacteristicvaluechanged(fn): void
  • Parameters

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

          • ev: Event

          Returns void

    Returns void

  • set ongattserverdisconnected(fn): void
  • Parameters

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

          • ev: Event

          Returns void

    Returns void

  • set onserviceadded(fn): void
  • Parameters

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

          • ev: Event

          Returns void

    Returns void

  • set onservicechanged(fn): void
  • Parameters

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

          • ev: Event

          Returns void

    Returns void

  • set onserviceremoved(fn): void
  • Parameters

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

          • ev: Event

          Returns void

    Returns void

Methods

  • Type Parameters

    • K extends keyof BluetoothEvents

    Parameters

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

          • this: this
          • ev: BluetoothEvents[K]

          Returns 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)
        • (this, ev): void
        • Parameters

          • this: this
          • ev: BluetoothEvents[K]

          Returns 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