Options
All
  • Public
  • Public/Protected
  • All
Menu

Base class for connection methods to extend

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

Private configId

configId: number

Randomly generated number to ensure confiuration lockstep

Protected deviceStatus

deviceStatus: DeviceStatusEnum

Describes the current state of the device

Protected isConfigured

isConfigured: boolean

Describes the current state of the device

Private myNodeInfo

myNodeInfo: MyNodeInfo

Device's node number

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

Private responseQueue

responseQueue: responseQueue
todo

desc

Private userPreferences

Device's preferences

Methods

complete

  • complete(): void
  • Completes all SubEvents

    Returns void

configure

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

    Returns Promise<void>

confirmSetChannel

  • confirmSetChannel(callback?: (id: number) => Promise<void>): Promise<void>
  • Confirms the currently set channels, and prevents changes from reverting after 10 minutes.

    Parameters

    • Optional callback: (id: number) => Promise<void>

      If wantAck is true, callback is called when the ack is received

        • (id: number): Promise<void>
        • Parameters

          • id: number

          Returns Promise<void>

    Returns Promise<void>

confirmSetPreferences

  • confirmSetPreferences(callback?: (id: number) => Promise<void>): Promise<void>
  • Confirms the currently set preferences, and prevents changes from reverting after 10 minutes.

    Parameters

    • Optional callback: (id: number) => Promise<void>

      If wantAck is true, callback is called when the ack is received

        • (id: number): Promise<void>
        • Parameters

          • id: number

          Returns Promise<void>

    Returns Promise<void>

Protected Abstract connect

  • Abstract method that connects to the radio

    Parameters

    Returns Promise<void>

deleteChannel

  • deleteChannel(index: number, callback?: (id: number) => Promise<void>): Promise<void>
  • Deletes specific channel via index

    Parameters

    • index: number

      Channel index to be deleted

    • Optional callback: (id: number) => Promise<void>

      If wantAck is true, callback is called when the ack is received

        • (id: number): Promise<void>
        • Parameters

          • id: number

          Returns Promise<void>

    Returns Promise<void>

Protected Abstract disconnect

  • disconnect(): void
  • Abstract method that disconnects from the radio

    Returns void

Private generateRandId

  • generateRandId(): number
  • Generates random packet identifier

    Returns number

getChannel

  • getChannel(index: number, callback?: (id: number) => Promise<void>): Promise<void>
  • Gets devices ChannelSettings

    Parameters

    • index: number

      Channel index to be retrieved

    • Optional callback: (id: number) => Promise<void>

      If wantAck is true, callback is called when the ack is received

        • (id: number): Promise<void>
        • Parameters

          • id: number

          Returns Promise<void>

    Returns Promise<void>

getPreferences

  • getPreferences(): Promise<void>
  • Gets devices RadioConfig

    Returns Promise<void>

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>

Private handleMeshPacket

  • handleMeshPacket(meshPacket: MeshPacket): Promise<void>
  • Gets called when a MeshPacket is received from device

    Parameters

    Returns Promise<void>

Protected Abstract ping

  • ping(): Promise<boolean>
  • Abstract method that pings the radio

    Returns Promise<boolean>

sendPacket

  • sendPacket(byteData: Uint8Array, portNum: PortNum, destinationNum?: number, wantAck?: boolean, wantResponse?: boolean, echoResponse?: boolean, callback?: (id: number) => Promise<void>): 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

    • Optional callback: (id: number) => Promise<void>

      If wantAck is true, callback is called when the ack is received

        • (id: number): Promise<void>
        • Parameters

          • id: number

          Returns Promise<void>

    Returns Promise<void>

sendText

  • sendText(text: string, destinationNum?: number, wantAck?: boolean, callback?: (id: number) => Promise<void>): 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

    • Optional callback: (id: number) => Promise<void>

      If wantAck is true, callback is called when the ack is received

        • (id: number): Promise<void>
        • Parameters

          • id: number

          Returns Promise<void>

    Returns Promise<void>

setChannel

  • setChannel(channel: Channel, callback?: (id: number) => Promise<void>): Promise<void>
  • Sets devices ChannelSettings

    Parameters

    • channel: Channel

      Channel data to be set

    • Optional callback: (id: number) => Promise<void>

      If wantAck is true, callback is called when the ack is received

        • (id: number): Promise<void>
        • Parameters

          • id: number

          Returns Promise<void>

    Returns Promise<void>

setOwner

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

    Parameters

    Returns Promise<void>

setPreferences

  • Writes radio config to device

    Parameters

    • preferences: Partial<RadioConfig_UserPreferences>

      Radio UserPreferences

    • Optional callback: (id: number) => Promise<void>

      If wantAck is true, callback is called when the ack is received

        • (id: number): Promise<void>
        • Parameters

          • id: number

          Returns Promise<void>

    Returns Promise<void>

updateDeviceStatus

  • Updates the device status eliminating duplicate status events

    Parameters

    Returns void

Protected Abstract writeToRadio

  • writeToRadio(data: Uint8Array): Promise<void>
  • Abstract method that writes data to the radio

    Parameters

    • data: Uint8Array

    Returns Promise<void>

Generated using TypeDoc