Options
All
  • Public
  • Public/Protected
  • All
Menu

It represents a Classic Bluetooth comm at the client side.

Hierarchy

  • BTComm

Index

Constructors

  • new BTComm(address: string, channel: number): BTComm
  • Creates an instance of the BTComm class wiht the specified information.

    Parameters

    • address: string

      The Bluetooth device address in the format 00:00:00:00:00:00

    • channel: number

      The channel number.

    Returns BTComm

Accessors

  • get receiveBufferSize(): number
  • set receiveBufferSize(value: number): void
  • Gets or sets the size of the receive buffer, in bytes. Default value is 1024

    Returns number

  • Gets or sets the size of the receive buffer, in bytes. Default value is 1024

    Parameters

    • value: number

    Returns void

  • get timeout(): number
  • set timeout(value: number): void
  • Gets or sets the milliseconds to wait to receive data once a read operation is initiated. Default value is 1000

    Returns number

  • Gets or sets the milliseconds to wait to receive data once a read operation is initiated. Default value is 1000

    Parameters

    • value: number

    Returns void

Methods

  • close(): void
  • Closes the Bluetooth connection

    Returns void

  • connect(): Promise<unknown>
  • Connects to a Bluetooth device using the specified address and channel number.

    Returns Promise<unknown>

  • onClose(data: any): void
  • Occurs when communication is close.

    Parameters

    • data: any

      The callback function

    Returns void

  • onDataReceived(data: any): void
  • Occurs when data is received.

    Parameters

    • data: any

      The callback function

    Returns void

  • onError(data: any, critical: any): void
  • Occurs when an error is thrown.

    Parameters

    • data: any

      The callback function

    • critical: any

    Returns void

  • propertiesJSON(): { type: string }
  • Returns { type: string }

    • type: string
  • send(utf8string: string): void
  • Sends the specified string to the Bluetooth device.

    Parameters

    • utf8string: string

      The string to send to the Bluetooth device.

    Returns void