Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a peripheral that was found during scanning.

Hierarchy

  • Peripheral

Index

Constructors

constructor

  • new Peripheral(adapter: Adapter, uuid: string, name: string, addressType: AddressType, address: string, advertisement?: Buffer, rssi?: number): Peripheral

Properties

Readonly adapter

adapter: Adapter

The adapter that this peripheral was found by.

Readonly address

address: string

The MAC address of this peripheral. All lowercase, with colon separator between bytes, e.g. 11:22:33:aa:bb:cc

Readonly addressType

addressType: AddressType

The MAC address type of this peripheral.

manufacturerData

manufacturerData: Buffer

Any manufacturer advertisement data received from the peripheral. Includes the company identifier.

name

name: string

The advertised name of the peripheral.

rssi

rssi: number

The current RSSI signal strength of the peripheral.

Readonly uuid

uuid: string

The unique identifier for this peripheral.

Accessors

gatt

state

Methods

Abstract connect

  • Connect to this peripheral and setup GATT. Throws an error when connecting fails. Some connection settings may not be supported on certain platforms and wil be ignored.

    Parameters

    Returns Promise<GattRemote>

Abstract disconnect

  • disconnect(): Promise<void>
  • Disconnect from this peripheral. Does nothing if not connected. This method never throws an error. When connecting to a peripheral you should always wrap your calls in try-catch-finally and call this method at the end.

    try { peripheral.connect() } catch (err) { ... } finally { peripheral.disconnect(); }

    Returns Promise<void>

toJSON

  • toJSON(): Record<string, unknown>

toString

  • toString(): string

Generated using TypeDoc