jsax25
    Preparing search index...

    Class IncomingFrame

    A class abstraction around an incoming binary AX25 frame allowing data to be retrieved using getters.

    Hierarchy

    • BaseAbstract
      • IncomingFrame
    Index

    Constructors

    • Create a new IncomingFrame object from an incoming ArrayLike<number> or Iterable<number> from a KISS source such as a TCP port, serial port, etc.

      Parameters

      • encodedKissFrame: ArrayLike<number> | Iterable<number, any, any>

        An ArrayLike<number> or Iterable<number> representing a raw KISS frame.

      • modulo: 8 | 128 = 8

        Determines the number of outstanding information frames allowed per layer 2 connection at one time. Only change this to 128 on supervisory and information frames when you are sure that you are using modulo 128, as setting it incorrectly will cause frames not to decode. Defaults to 8.

      Returns IncomingFrame

    Properties

    _destinationCallsign: string | undefined
    _destinationCommandBit: boolean | undefined
    _destinationReservedBitOne: boolean | undefined
    _destinationReservedBitTwo: boolean | undefined
    _destinationSsid: number | undefined
    _payload: Buffer<ArrayBufferLike> | undefined
    _pid: number | undefined
    _pollOrFinal: boolean | undefined
    _receivedSequence: number | undefined
    _repeaters: Repeater[] | undefined
    _sendSequence: number | undefined
    _sourceCallsign: string | undefined
    _sourceCommandBit: boolean | undefined
    _sourceReservedBitOne: boolean | undefined
    _sourceReservedBitTwo: boolean | undefined
    _sourceSsid: number | undefined
    _subtype: FrameSubtype | undefined
    _type: "information" | "supervisory" | "unnumbered" | undefined
    encoded: number[]

    The raw number array backing the AX25 frame's data.

    modulo: 8 | 128

    Determines the number of outstanding information frames allowed per layer 2 connection at one time.

    Only change this to 128 on supervisory and information frames when you are sure that you are using modulo 128, as setting it incorrectly will cause frames not to decode.

    8
    

    Accessors

    • get commandOrResponse(): "command" | "response" | "legacy"

      Whether the frame is a command frame or a response frame if it is using the latest version of the AX.25 protocol. If not, then it is using the legacy protocol.

      Returns "command" | "response" | "legacy"

      string 'command', 'response', or 'legacy'

    • get destinationCallsign(): string

      The destination station's amateur radio callsign. Valid callsigns are 1 to 6 characters (inclusive), all uppercase.

      Returns string

      InvalidCallsignError on frames where this is mutable and an attempt was made to set an invalid callsign.

    • get destinationCommandBit(): boolean

      Determines in conjunction with the sourceCommandBit if the frame is a command, response, or legacy type frame.

      Returns boolean

    • get destinationReservedBitOne(): boolean

      Reserved bit that may be used in an agreed-upon manner in individual networks.

      Returns boolean

    • get destinationReservedBitTwo(): boolean

      Reserved bit that may be used in an agreed-upon manner in individual networks.

      Returns boolean

    • get destinationSsid(): number

      The destination station's SSID. Valid SSIDs are integers 0 to 15 (inclusive).

      Returns number

      InvalidSsidError on frames where this is mutable and an attempt was made to set an invalid SSID.

    • get isCommand(): boolean

      Whether the frame is a command frame.

      Returns boolean

    • get isLegacy(): boolean

      Whether the frame is a legacy frame.

      Returns boolean

    • get isResponse(): boolean

      Whether the frame is a response frame.

      Returns boolean

    • get payload(): Buffer<ArrayBufferLike> | undefined

      The data or "body" being carried by the frame.

      Only exists on unnumbered information (UI), information (I), Test (TEST), and exchange identification (XID) frames.

      Returns Buffer<ArrayBufferLike> | undefined

      a Buffer representing the payload data on frames that have a payload, or undefined on frames that don't have a payload.

    • get pid(): number | undefined

      A number indicating which layer 3 protocol is in use according to the AX25 spec. Found on information (I) and unnumbered information (UI) frames. Otherwise undefined.

      Valid values are integers 0 to 255 inclusive.

      Returns number | undefined

      a number corresponding to the layer 3 protocol in use. See AX.25 documentation for a key/value table.

      InvalidPidError on frames where this is mutable and an attempt was made to set the number to a non-integer or an integer that is less than 0 or greater than 255.

    • get pollOrFinal(): boolean

      Used in all types of frames. The P/F bit is also used in a command (poll) mode to request an immediate reply to a frame. The reply to this poll is indicated by setting the response (final) bit in the appropriate frame.

      Returns boolean

    • get receivedSequence(): number | undefined

      Exists on information and supervisory frames. Otherwise undefined. Prior to sending an information or supervisory frame, this variable is updated to equal that of the received state variable, thus implicitly acknowledging the proper reception of all frames up to and including receivedSequence - 1.

      Valid values are integers 0 to 7 inclusive when using modulo 8, or integers 0 to 127 inclusive when using modulo 127.

      Returns number | undefined

      RangeError on frames where this is mutable and an attempt was made to set the number to a non-integer, a negative integer, an integer greater than 7 when set to modulo 8, or an integer greater than 127 when set to modulo 128.

    • get repeaters(): Repeater[]

      The repeaters/digipeaters that the frame is addressed to travel through.

      Returns Repeater[]

      an array of Repeater objects

      InvalidCallsignError and/or InvalidSsidError on frames where this is mutable and an attempt was made to set a repeater with an invalid callsign or SSID.

    • get sendSequence(): number | undefined

      Found in the control field of all information frames. Otherwise undefined. It contains the sequence number of the information frame being sent. Just prior to the transmission of the information frame, it is updated to equal the send state variable.

      Valid values are integers 0 to 7 inclusive when using modulo 8, or integers 0 to 127 inclusive when using modulo 127.

      Returns number | undefined

      RangeError on frames where this is mutable and an attempt was made to set the number to a non-integer, a negative integer, an integer greater than 7 when set to modulo 8, or an integer greater than 127 when set to modulo 128.

    • get sourceCallsign(): string

      The sending station's amateur radio callsign. Valid callsigns are 1 to 6 characters (inclusive), all uppercase.

      Returns string

      InvalidCallsignError on frames where this is mutable and an attempt was made to set an invalid callsign.

    • get sourceCommandBit(): boolean

      Determines in conjunction with the destinationCommandBit if the frame is a command, response, or legacy type frame.

      Returns boolean

    • get sourceReservedBitOne(): boolean

      Reserved bit that may be used in an agreed-upon manner in individual networks.

      Returns boolean

    • get sourceReservedBitTwo(): boolean

      Reserved bit that may be used in an agreed-upon manner in individual networks.

      Returns boolean

    • get sourceSsid(): number

      The sending station's SSID. Valid SSIDs are integers 0 to 15 (inclusive).

      Returns number

      InvalidSsidError on frames where this is mutable and an attempt was made to set an invalid SSID.

    • get type(): "information" | "supervisory" | "unnumbered"

      Whether the frame is an unnumbered, supervisory, or information frame.

      Returns "information" | "supervisory" | "unnumbered"

    Methods

    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "RR"
      • receivedSequence: number
      • OptionalpollOrFinal: boolean
      • OptionalcommandOrResponse: "command" | "response"

      Returns RRFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "RNR"
      • receivedSequence: number
      • OptionalpollFinal: boolean
      • OptionalcommandOrResponse: "command" | "response"

      Returns RNRFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "REJ"
      • receivedSequence: number
      • OptionalpollFinal: boolean
      • OptionalcommandOrResponse: "command" | "response"

      Returns REJFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "SREJ"
      • receivedSequence: number
      • pollFinal: boolean
      • OptionalcommandOrResponse: "command" | "response"

      Returns SREJFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "SABME"

      Returns SABMEFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "SABM"

      Returns SABMFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "DISC"

      Returns DISCFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "DM"

      Returns DMFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "UA"

      Returns UAFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "UI"
      • payload: any
      • Optionalpid: number
      • OptionalpollOrFinal: boolean
      • OptionalcommandOrResponse: "command" | "response"

      Returns UIFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "XID"
      • OptionalcommandOrResponse: "command" | "response"
      • OptionalpollOrFinal: boolean

      Returns XIDFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "TEST"
      • Optionalpayload: any
      • OptionalcommandOrResponse: "command" | "response"

      Returns TESTFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Get a pre-addressed OutgoingFrame to reply with. A convenience method that returns a frame type of your choice, with the destination and source information reversed from the source frame.

      Parameters

      • frameSubtype: "I"
      • payload: any
      • receivedSequence: number
      • sendSequence: number
      • OptionalpollOrFinal: boolean
      • Optionalpid: number

      Returns IFrame

      import { createConnection, Socket } from "net";
      import { IncomingFrame, UIFrame } from "jsax25";

      const MY_CALL: string = 'N0CALL'
      const MY_SSID: number = 10

      const kissConnection: Socket = createConnection({
      host: 'localhost',
      port: 8001
      })

      kissConnection.on('data', (chunk) => {
      const incoming = new IncomingFrame(chunk)

      if (incoming.destinationCallsign === MY_CALL && incoming.destinationSsid === MY_SSID) {

      // response's destinationCallsign and destinationSsid are set to incoming's sourceCallsign and sourceSsid
      // response's sourceCallsign and sourceSsid are set to incoming's destinationCallsign and destinationSsid
      const response: UIFrame = incoming.replyWith('UI', `Thank you ${incoming.sourceCallsign}-${incoming.sourceSsid}! I've received your message!`)

      kissConnection.write(new Uint8Array(response.encode()))
      }
      })
    • Parameters

      • receivedSequence: number
      • pollOrFinal: boolean
      • commandOrResponse: "command" | "response"

      Returns SFrameConstructor

    • Returns a JSON representation of the frame.

      Returns {
          commandOrResponse: "command" | "response" | "legacy";
          destinationCallsign: string;
          destinationCommandBit: boolean;
          destinationReservedBitOne: boolean;
          destinationReservedBitTwo: boolean;
          destinationSsid: number;
          isCommand: boolean;
          isLegacy: boolean;
          isResponse: boolean;
          modulo: 8 | 128;
          payload: any;
          pid: number | undefined;
          pollOrFinal: boolean;
          receivedSequence: number | undefined;
          repeaters: Repeater[];
          sendSequence: number | undefined;
          sourceCallsign: string;
          sourceCommandBit: boolean;
          sourceReservedBitOne: boolean;
          sourceReservedBitTwo: boolean;
          sourceSsid: number;
          subtype: FrameSubtype;
          type: "information" | "supervisory" | "unnumbered";
      }

    • Returns a string representation of the frame.

      Returns string