Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a GATT Characteristic.

Hierarchy

Index

Constructors

constructor

Properties

Readonly descriptors

descriptors: Map<string, GattDescriptor> = ...

The descriptors that belong to this characteristic, mapped by UUID. If this is a remote characteristic use discoverDescriptors to discover them.

Readonly isRemote

isRemote: boolean

True if this is a remote characteristic, false otherwise.

Readonly properties

A list of all the properties that are enabled/supported for this characteristic.

Readonly propertyFlag

propertyFlag: number

The list of properties supported by this characteristic as a byte flag per the Bluetooth Core spec.

Readonly secure

A list of all the properties on this characteristic that are secured.

Readonly secureFlag

secureFlag: number

The list of all secured properties of this characteristic as a byte flag per the Bluetooth Core spec.

Readonly service

service: GattService

The GATT service that this characteristic belongs to.

Readonly uuid

uuid: string

The UUID of this characteristic, no dashes (-).

Static defaultMaxListeners

defaultMaxListeners: number

Methods

Abstract addDescriptor

addListener

  • Type parameters

    • U: "notification"

    Parameters

    Returns GattCharacteristic

Abstract broadcast

  • broadcast(broadcast: boolean): Promise<void>
  • Remote only: Enable or disable broadcasts.

    Parameters

    • broadcast: boolean

      True to enable broadcasts, false otherwise.

    Returns Promise<void>

Abstract discoverDescriptors

emit

  • Type parameters

    • U: "notification"

    Parameters

    Returns boolean

eventNames

  • eventNames<U>(): U[]
  • Type parameters

    • U: "notification"

    Returns U[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

handleRead

  • handleRead(offset: number): Promise<Buffer>
  • Local only: Handles an incoming read request for this characteristic.

    Parameters

    • offset: number

      The offset to start at

    Returns Promise<Buffer>

    The read data.

handleWrite

  • handleWrite(offset: number, data: Buffer, withoutResponse: boolean): Promise<number>
  • Local only: Handles an incoming write request for this characteristic.

    Parameters

    • offset: number

      The offset to start at.

    • data: Buffer

      The data to write.

    • withoutResponse: boolean

      True to not produce a response code, false otherwise.

    Returns Promise<number>

    The result code.

listenerCount

  • listenerCount(type: "notification"): number
  • Parameters

    • type: "notification"

    Returns number

listeners

  • Type parameters

    • U: "notification"

    Parameters

    • type: U

    Returns GattCharacteristicEvents[U][]

Abstract notify

  • notify(notify: boolean): Promise<void>

off

on

once

prependListener

  • Type parameters

    • U: "notification"

    Parameters

    Returns GattCharacteristic

prependOnceListener

  • Type parameters

    • U: "notification"

    Parameters

    Returns GattCharacteristic

rawListeners

  • Type parameters

    • U: "notification"

    Parameters

    • type: U

    Returns GattCharacteristicEvents[U][]

Abstract read

  • read(): Promise<Buffer>

removeAllListeners

  • Parameters

    • Optional event: "notification"

    Returns GattCharacteristic

removeListener

  • Type parameters

    • U: "notification"

    Parameters

    Returns GattCharacteristic

setMaxListeners

  • Parameters

    • n: number

    Returns GattCharacteristic

subscribe

  • subscribe(): Promise<void>

toJSON

  • toJSON(): Record<string, unknown>

toString

  • toString(): string

unsubscribe

  • unsubscribe(): Promise<void>

Abstract write

  • write(data: Buffer, withoutResponse: boolean): Promise<void>
  • Remote only: Write the specified data to this characteristic.

    Parameters

    • data: Buffer

      The data to write.

    • withoutResponse: boolean

      Do not require a response from the remote GATT server for this write.

    Returns Promise<void>

Generated using TypeDoc