Options
All
  • Public
  • Public/Protected
  • All
Menu

Allows to connect to a Meshtastic device via bluetooth

Hierarchy

Index

Constructors

constructor

Events

Readonly onAdminPacket

onAdminPacket: SubEvent<AdminPacket> = ...

Fires when a new MeshPacket message containing a AndminMessage packet has been received from device

Readonly onDeviceStatus

onDeviceStatus: SubEvent<DeviceStatusEnum> = ...

Fires when the devices connection or configuration status changes

Readonly onFromRadio

onFromRadio: SubEvent<FromRadio> = ...

Fires when a new FromRadio message has been received from the device

Readonly onLogRecord

onLogRecord: SubEvent<LogRecord> = ...

Fires when a new FromRadio message containing a Text packet has been received from device

Readonly onMeshHeartbeat

onMeshHeartbeat: SubEvent<Date> = ...

Fires when the device receives a meshPacket, returns a timestamp

Readonly onMeshPacket

onMeshPacket: SubEvent<MeshPacket> = ...

Fires when a new FromRadio message containing a Data packet has been received from the device

Readonly onNodeInfoPacket

onNodeInfoPacket: SubEvent<NodeInfoPacket> = ...

Fires when a new MeshPacket message containing a NodeInfo packet has been received from device

Readonly onPositionPacket

onPositionPacket: SubEvent<PositionPacket> = ...

Fires when a new MeshPacket message containing a Position packet has been received from device

Readonly onRoutingPacket

onRoutingPacket: SubEvent<RoutingPacket> = ...

Fires when a new MeshPacket message containing a Routing packet has been received from device

Readonly onTextPacket

onTextPacket: SubEvent<TextPacket> = ...

Fires when a new MeshPacket message containing a Text packet has been received from device

Readonly onUserDataPacket

onUserDataPacket: SubEvent<User> = ...

Fires when a new NodeInfo message has been reveived that has the same node number as the device

Properties

connection

connection: void | BluetoothRemoteGATTServer

Connection interface to currently connected BLE device

device

device: void | BluetoothDevice

Currently connected BLE device

Protected deviceStatus

deviceStatus: DeviceStatusEnum

Describes the current state of the device

fromNumCharacteristic

fromNumCharacteristic: undefined | BluetoothRemoteGATTCharacteristic

Short Description

fromRadioCharacteristic

fromRadioCharacteristic: undefined | BluetoothRemoteGATTCharacteristic

Short Description

Protected isConfigured

isConfigured: boolean

Describes the current state of the device

Readonly onMyNodeInfo

onMyNodeInfo: SubEvent<MyNodeInfo> = ...

Fires when a new MyNodeInfo message has been received from the device

Readonly onRadioConfig

onRadioConfig: SubEvent<RadioConfig> = ...

Fires when a new RadioConfig message has been received from the device

pendingRead

pendingRead: boolean

Set when a read promise has yet to be resolved, to prevent simultaneous reads.

service

service: undefined | BluetoothRemoteGATTService

Short Description

toRadioCharacteristic

toRadioCharacteristic: undefined | BluetoothRemoteGATTCharacteristic

Short Description

userInitiatedDisconnect

userInitiatedDisconnect: boolean

States if the device was force disconnected by a user

writeLock

writeLock: boolean

Weather the we should currently write to the device or not, to prevent simultaneous writes

writeQueue

writeQueue: Uint8Array[]

Queue that holds data to be written to the device, to prevent simultaneous writes

Methods

complete

  • complete(): void
  • Completes all SubEvents

    Returns void

configure

  • configure(): Promise<void>
  • Triggers the device configure process

    Returns Promise<void>

connect

  • Initiates the connect process to a Meshtastic device via Bluetooth

    Parameters

    Returns Promise<void>

disconnect

  • disconnect(): void
  • Disconnects from the Meshtastic device

    Returns void

getDevices

  • getDevices(): Promise<BluetoothDevice[]>
  • Gets list of bluetooth devices that can be passed to connect

    Returns Promise<BluetoothDevice[]>

Protected handleFromRadio

  • handleFromRadio(fromRadio: Uint8Array): Promise<void>
  • Gets called whenever a fromRadio message is received from device, returns fromRadio data

    Parameters

    • fromRadio: Uint8Array

      Uint8Array containing raw radio data

    Returns Promise<void>

ping

  • ping(): Promise<boolean>
  • Pings device to check if it is avaliable

    todo

    implement

    Returns Promise<boolean>

Protected readFromRadio

  • readFromRadio(): Promise<void>
  • Short description

    Returns Promise<void>

sendPacket

  • sendPacket(byteData: Uint8Array, portNum: PortNum, destinationNum?: number, wantAck?: boolean, wantResponse?: boolean, echoResponse?: boolean): Promise<void>
  • Sends packet over the radio

    Parameters

    • byteData: Uint8Array
    • portNum: PortNum

      dataType Enum of protobuf data type

    • Optional destinationNum: number

      Node number of the destination node

    • wantAck: boolean = false

      Whether or not acknowledgement is wanted

    • wantResponse: boolean = false

      Used for testing, requests recpipient to respond in kind with the same type of request

    • echoResponse: boolean = false

      Sends event back to client

    Returns Promise<void>

sendText

  • sendText(text: string, destinationNum?: number, wantAck?: boolean): Promise<void>
  • Sends a text over the radio

    Parameters

    • text: string
    • Optional destinationNum: number

      Node number of the destination node

    • wantAck: boolean = false

      Whether or not acknowledgement is wanted

    Returns Promise<void>

setChannelSettings

  • setChannelSettings(channel: Channel): Promise<void>

setOwner

  • setOwner(owner: User): Promise<void>
  • Sets devices owner data

    Parameters

    Returns Promise<void>

setPreferences

updateDeviceStatus

Protected writeToRadio

  • writeToRadio(data: Uint8Array): Promise<void>
  • Sends supplied protobuf message to the radio

    Parameters

    • data: Uint8Array

    Returns Promise<void>

Generated using TypeDoc