diff --git a/404.html b/404.html index 3142b2c4..4f4b0cfb 100644 --- a/404.html +++ b/404.html @@ -349,6 +349,33 @@ +
  • + + + + + + + + MeshCore KISS Modem Protocol + + + + + + + + +
  • + + + + + + + + +
  • @@ -377,14 +404,14 @@
  • - + - Packet Structure + Packet Format @@ -411,7 +438,7 @@ - Meshcore payloads + Payload Format diff --git a/cli_commands/index.html b/cli_commands/index.html index ef798941..ea49599c 100644 --- a/cli_commands/index.html +++ b/cli_commands/index.html @@ -1437,6 +1437,33 @@ +
  • + + + + + + + + MeshCore KISS Modem Protocol + + + + + + + + +
  • + + + + + + + + +
  • @@ -1465,14 +1492,14 @@
  • - + - Packet Structure + Packet Format @@ -1499,7 +1526,7 @@ - Meshcore payloads + Payload Format @@ -3099,7 +3126,7 @@

    Dump all defined regions and flood permissions

    Usage: - region

    -

    Serial Only: Yes

    +

    Serial Only: For firmware older than 1.12.0


    Region Examples

    Example 1: Using F Flag with Named Public Region

    diff --git a/companion_protocol/index.html b/companion_protocol/index.html index 78806632..fd422aec 100644 --- a/companion_protocol/index.html +++ b/companion_protocol/index.html @@ -922,6 +922,33 @@ +
  • + + + + + + + + MeshCore KISS Modem Protocol + + + + + + + + +
  • + + + + + + + + +
  • @@ -950,14 +977,14 @@
  • - + - Packet Structure + Packet Format @@ -984,7 +1011,7 @@ - Meshcore payloads + Payload Format diff --git a/docs/index.html b/docs/index.html index d083d1ac..2c2733f1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -418,6 +418,33 @@ +
  • + + + + + + + + MeshCore KISS Modem Protocol + + + + + + + + +
  • + + + + + + + + +
  • @@ -446,14 +473,14 @@
  • - + - Packet Structure + Packet Format @@ -480,7 +507,7 @@ - Meshcore payloads + Payload Format diff --git a/faq/index.html b/faq/index.html index e260c417..84f3320d 100644 --- a/faq/index.html +++ b/faq/index.html @@ -16,7 +16,7 @@ - + @@ -647,7 +647,7 @@ - 3.7. Q: My repeater maybe suffering from deafness due to high power interference near my mesh's frequency, it is not hearing other in-range MeshCore radios. what can I do? + 3.7. Q: My repeater maybe suffering from deafness due to high power interference near my mesh's frequency, it is not hearing other in-range MeshCore radios. What can I do? @@ -658,7 +658,7 @@ - 3.8 Q: How do I make my repeater an observer on the mesh + 3.8. Q: How do I make my repeater an observer on the mesh? @@ -1380,6 +1380,33 @@ +
  • + + + + + + + + MeshCore KISS Modem Protocol + + + + + + + + +
  • + + + + + + + + +
  • @@ -1408,14 +1435,14 @@
  • - + - Packet Structure + Packet Format @@ -1442,7 +1469,7 @@ - Meshcore payloads + Payload Format @@ -1816,7 +1843,7 @@ - 3.7. Q: My repeater maybe suffering from deafness due to high power interference near my mesh's frequency, it is not hearing other in-range MeshCore radios. what can I do? + 3.7. Q: My repeater maybe suffering from deafness due to high power interference near my mesh's frequency, it is not hearing other in-range MeshCore radios. What can I do? @@ -1827,7 +1854,7 @@ - 3.8 Q: How do I make my repeater an observer on the mesh + 3.8. Q: How do I make my repeater an observer on the mesh? @@ -2586,8 +2613,8 @@
  • 3.4. Q: What is the password to join a room server?
  • 3.5. Q: Can I retrieve a repeater's private key or set a repeater's private key?
  • 3.6. Q: The first byte of my repeater's public key collides with an exisitng repeater on the mesh. How do I get a new private key with a matching public key that has its first byte of my choosing?
  • -
  • 3.7. Q: My repeater maybe suffering from deafness due to high power interference near my mesh's frequency, it is not hearing other in-range MeshCore radios. what can I do?
  • -
  • 3.8 Q: How do I make my repeater an observer on the mesh
  • +
  • 3.7. Q: My repeater maybe suffering from deafness due to high power interference near my mesh's frequency, it is not hearing other in-range MeshCore radios. What can I do?
  • +
  • 3.8. Q: How do I make my repeater an observer on the mesh?
  • 4. T-Deck Related
  • 4.1. Q: Is there a user guide for T-Deck, T-Pager, T-Watch, or T-Display Pro?
  • 4.2. Q: What are the steps to get a T-Deck into DFU (Device Firmware Update) mode?
  • @@ -2777,12 +2804,12 @@ Advert means to advertise yourself on the network. In Reticulum terms it would b

    Reboot the repeater after set prv.key <hex> command for the new private key to take effect.

    3.6. Q: The first byte of my repeater's public key collides with an exisitng repeater on the mesh. How do I get a new private key with a matching public key that has its first byte of my choosing?

    A: You can generate a new private key and specific the first byte of its public key here: https://gessaman.com/mc-keygen/

    -

    3.7. Q: My repeater maybe suffering from deafness due to high power interference near my mesh's frequency, it is not hearing other in-range MeshCore radios. what can I do?

    -

    A: This may be due to the SX1262 radio's auto gain control feature. You can use this command to preiodically reset its AGC.

    +

    3.7. Q: My repeater maybe suffering from deafness due to high power interference near my mesh's frequency, it is not hearing other in-range MeshCore radios. What can I do?

    +

    A: This may be due to the SX1262 radio's auto gain control feature. You can use this command to periodically reset its AGC.

    set agc.reset.interval <number>

    The <number> unit is in seconds and is incremented by 4. set agc.reset.interval 4 works well to cure deafness.

    This is a very low cost operation. AGC reset is done by simply setting state = STATE_IDLE; in function RadioLibWrapper::resetAGC() in RadioLibWrappers.cpp

    -

    3.8 Q: How do I make my repeater an observer on the mesh

    +

    3.8. Q: How do I make my repeater an observer on the mesh?

    A: The observer instruction is available here: https://analyzer.letsmesh.net/observer/onboard


    diff --git a/index.html b/index.html index 2c2690ae..9773e43b 100644 --- a/index.html +++ b/index.html @@ -368,6 +368,33 @@ +
  • + + + + + + + + MeshCore KISS Modem Protocol + + + + + + + + +
  • + + + + + + + + +
  • @@ -396,14 +423,14 @@
  • - + - Packet Structure + Packet Format @@ -430,7 +457,7 @@ - Meshcore payloads + Payload Format @@ -574,7 +601,7 @@
  • Frequently Asked Questions
  • CLI Commands
  • Companion Protocol
  • -
  • Packet Structure
  • +
  • Packet Format
  • QR Codes
  • If you find a mistake in any of our documentation, or find something is missing, please feel free to open a pull request for us to review.

    diff --git a/kiss_modem_protocol/index.html b/kiss_modem_protocol/index.html new file mode 100644 index 00000000..74ea83da --- /dev/null +++ b/kiss_modem_protocol/index.html @@ -0,0 +1,2126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MeshCore KISS Modem Protocol - MeshCore Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + Skip to content + + +
    +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + + + + + +
    + +
    + + + + + + + + + + + + + +

    MeshCore KISS Modem Protocol

    +

    Standard KISS TNC firmware for MeshCore LoRa radios. Compatible with any KISS client (Direwolf, APRSdroid, YAAC, etc.) for sending and receiving raw packets. MeshCore-specific extensions (cryptography, radio configuration, telemetry) are available through the standard SetHardware (0x06) command.

    +

    Serial Configuration

    +

    115200 baud, 8N1, no flow control.

    +

    Frame Format

    +

    Standard KISS framing per the KA9Q/K3MC specification.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ByteNameDescription
    0xC0FENDFrame delimiter
    0xDBFESCEscape character
    0xDCTFENDEscaped FEND (FESC + TFEND = 0xC0)
    0xDDTFESCEscaped FESC (FESC + TFESC = 0xDB)
    +
    ┌──────┬───────────┬──────────────┬──────┐
    +│ FEND │ Type Byte │ Data (escaped)│ FEND │
    +│ 0xC0 │  1 byte   │ 0-510 bytes  │ 0xC0 │
    +└──────┴───────────┴──────────────┴──────┘
    +
    +

    Type Byte

    +

    The type byte is split into two nibbles:

    + + + + + + + + + + + + + + + + + + + + +
    BitsFieldDescription
    7-4PortPort number (0 for single-port TNC)
    3-0CommandCommand number
    +

    Maximum unescaped frame size: 512 bytes.

    +

    Standard KISS Commands

    +

    Host to TNC

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    CommandValueDataDescription
    Data0x00Raw packetQueue packet for transmission
    TXDELAY0x01Delay (1 byte)Transmitter keyup delay in 10ms units (default: 50 = 500ms)
    Persistence0x02P (1 byte)CSMA persistence parameter 0-255 (default: 63)
    SlotTime0x03Interval (1 byte)CSMA slot interval in 10ms units (default: 10 = 100ms)
    TXtail0x04Delay (1 byte)Post-TX hold time in 10ms units (default: 0)
    FullDuplex0x05Mode (1 byte)0 = half duplex, nonzero = full duplex (default: 0)
    SetHardware0x06Sub-command + dataMeshCore extensions (see below)
    Return0xFF-Exit KISS mode (no-op)
    +

    TNC to Host

    + + + + + + + + + + + + + + + + + +
    TypeValueDataDescription
    Data0x00Raw packetReceived packet from radio
    +

    Data frames carry raw packet data only, with no metadata prepended. The Data command payload is limited to 255 bytes to match the MeshCore maximum transmission unit (MAX_TRANS_UNIT); frames larger than 255 bytes are silently dropped. The KISS specification recommends at least 1024 bytes for general-purpose TNCs; this modem is intended for MeshCore packets only, whose protocol MTU is 255 bytes.

    +

    CSMA Behavior

    +

    The TNC implements p-persistent CSMA for half-duplex operation:

    +
      +
    1. When a packet is queued, monitor carrier detect
    2. +
    3. When the channel clears, generate a random value 0-255
    4. +
    5. If the value is less than or equal to P (Persistence), wait TXDELAY then transmit
    6. +
    7. Otherwise, wait SlotTime and repeat from step 1
    8. +
    +

    In full-duplex mode, CSMA is bypassed and packets transmit after TXDELAY.

    +

    SetHardware Extensions (0x06)

    +

    MeshCore-specific functionality uses the standard KISS SetHardware command. The first byte of SetHardware data is a sub-command. Standard KISS clients ignore these frames.

    +

    Frame Format

    +
    ┌──────┬──────┬─────────────┬──────────────┬──────┐
    +│ FEND │ 0x06 │ Sub-command  │ Data (escaped)│ FEND │
    +│ 0xC0 │      │   1 byte    │   variable   │ 0xC0 │
    +└──────┴──────┴─────────────┴──────────────┴──────┘
    +
    +

    Request Sub-commands (Host to TNC)

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Sub-commandValueData
    GetIdentity0x01-
    GetRandom0x02Length (1 byte, 1-64)
    VerifySignature0x03PubKey (32) + Signature (64) + Data
    SignData0x04Data to sign
    EncryptData0x05Key (32) + Plaintext
    DecryptData0x06Key (32) + MAC (2) + Ciphertext
    KeyExchange0x07Remote PubKey (32)
    Hash0x08Data to hash
    SetRadio0x09Freq (4) + BW (4) + SF (1) + CR (1)
    SetTxPower0x0APower dBm (1)
    GetRadio0x0B-
    GetTxPower0x0C-
    GetCurrentRssi0x0D-
    IsChannelBusy0x0E-
    GetAirtime0x0FPacket length (1)
    GetNoiseFloor0x10-
    GetVersion0x11-
    GetStats0x12-
    GetBattery0x13-
    GetMCUTemp0x14-
    GetSensors0x15Permissions (1)
    GetDeviceName0x16-
    Ping0x17-
    Reboot0x18-
    SetSignalReport0x19Enable (1): 0x00=disable, nonzero=enable
    GetSignalReport0x1A-
    +

    Response Sub-commands (TNC to Host)

    +

    Response codes use the high-bit convention: response = command | 0x80. Generic and unsolicited responses use the 0xF0+ range.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Sub-commandValueData
    Identity0x81PubKey (32)
    Random0x82Random bytes (1-64)
    Verify0x83Result (1): 0x00=invalid, 0x01=valid
    Signature0x84Signature (64)
    Encrypted0x85MAC (2) + Ciphertext
    Decrypted0x86Plaintext
    SharedSecret0x87Shared secret (32)
    Hash0x88SHA-256 hash (32)
    Radio0x8BFreq (4) + BW (4) + SF (1) + CR (1)
    TxPower0x8CPower dBm (1)
    CurrentRssi0x8DRSSI dBm (1, signed)
    ChannelBusy0x8EResult (1): 0x00=clear, 0x01=busy
    Airtime0x8FMilliseconds (4)
    NoiseFloor0x90dBm (2, signed)
    Version0x91Version (1) + Reserved (1)
    Stats0x92RX (4) + TX (4) + Errors (4)
    Battery0x93Millivolts (2)
    MCUTemp0x94Temperature (2, signed)
    Sensors0x95CayenneLPP payload
    DeviceName0x96Name (variable, UTF-8)
    Pong0x97-
    SignalReport0x9AStatus (1): 0x00=disabled, 0x01=enabled
    OK0xF0-
    Error0xF1Error code (1)
    TxDone0xF8Result (1): 0x00=failed, 0x01=success
    RxMeta0xF9SNR (1) + RSSI (1)
    +

    Error Codes

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    CodeValueDescription
    InvalidLength0x01Request data too short
    InvalidParam0x02Invalid parameter value
    NoCallback0x03Feature not available
    MacFailed0x04MAC verification failed
    UnknownCmd0x05Unknown sub-command
    EncryptFailed0x06Encryption failed
    +

    Unsolicited Events

    +

    The TNC sends these SetHardware frames without a preceding request:

    +

    TxDone (0xF8): Sent after a packet has been transmitted. Contains a single byte: 0x01 for success, 0x00 for failure.

    +

    RxMeta (0xF9): Sent immediately after each standard data frame (type 0x00) with metadata for the received packet. Contains SNR (1 byte, signed, value x4 for 0.25 dB precision) followed by RSSI (1 byte, signed, dBm). Enabled by default; can be toggled with SetSignalReport. Standard KISS clients ignore this frame.

    +

    Data Formats

    +

    Radio Parameters (SetRadio / Radio response)

    +

    All values little-endian.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FieldSizeDescription
    Frequency4 bytesHz (e.g., 869618000)
    Bandwidth4 bytesHz (e.g., 62500)
    SF1 byteSpreading factor (5-12)
    CR1 byteCoding rate (5-8)
    +

    Version (Version response)

    + + + + + + + + + + + + + + + + + + + + +
    FieldSizeDescription
    Version1 byteFirmware version
    Reserved1 byteAlways 0
    +

    Encrypted (Encrypted response)

    + + + + + + + + + + + + + + + + + + + + +
    FieldSizeDescription
    MAC2 bytesHMAC-SHA256 truncated to 2 bytes
    CiphertextvariableAES-128-CBC encrypted data
    +

    Airtime (Airtime response)

    +

    All values little-endian.

    + + + + + + + + + + + + + + + +
    FieldSizeDescription
    Airtime4 bytesuint32_t, estimated air time in milliseconds
    +

    Noise Floor (NoiseFloor response)

    +

    All values little-endian.

    + + + + + + + + + + + + + + + +
    FieldSizeDescription
    Noise floor2 bytesint16_t, dBm (signed)
    +

    The modem recalibrates the noise floor every 2 seconds with an AGC reset every 30 seconds.

    +

    Stats (Stats response)

    +

    All values little-endian.

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    FieldSizeDescription
    RX4 bytesPackets received
    TX4 bytesPackets transmitted
    Errors4 bytesReceive errors
    +

    Battery (Battery response)

    +

    All values little-endian.

    + + + + + + + + + + + + + + + +
    FieldSizeDescription
    Millivolts2 bytesuint16_t, battery voltage in mV
    +

    MCU Temperature (MCUTemp response)

    +

    All values little-endian.

    + + + + + + + + + + + + + + + +
    FieldSizeDescription
    Temperature2 bytesint16_t, tenths of °C (e.g., 253 = 25.3°C)
    +

    Returns NoCallback error if the board does not support temperature readings.

    +

    Device Name (DeviceName response)

    + + + + + + + + + + + + + + + +
    FieldSizeDescription
    NamevariableUTF-8 string, no null terminator
    +

    Reboot

    +

    Sends an OK response, flushes serial, then reboots the device. The host should expect the connection to drop.

    +

    Sensor Permissions (GetSensors)

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    BitValueDescription
    00x01Base (battery)
    10x02Location (GPS)
    20x04Environment (temp, humidity, pressure)
    +

    Use 0x07 for all permissions.

    +

    Sensor Data (Sensors response)

    +

    Data returned in CayenneLPP format. See CayenneLPP documentation for parsing.

    +

    Cryptographic Algorithms

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    OperationAlgorithm
    Identity / Signing / VerificationEd25519
    Key ExchangeX25519 (ECDH)
    EncryptionAES-128-CBC + HMAC-SHA256 (MAC truncated to 2 bytes)
    HashingSHA-256
    +

    Notes

    +
      +
    • Data payload limit (255 bytes) matches MeshCore MAX_TRANS_UNIT; no change needed for KISS “1024+ recommended” (that applies to general TNCs, not MeshCore)
    • +
    • Modem generates identity on first boot (stored in flash)
    • +
    • All multi-byte values are little-endian unless stated otherwise
    • +
    • SNR values in RxMeta are multiplied by 4 for 0.25 dB precision
    • +
    • TxDone is sent as a SetHardware event after each transmission
    • +
    • Standard KISS clients receive only type 0x00 data frames and can safely ignore all SetHardware (0x06) frames
    • +
    • See packet_structure.md for packet format
    • +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/nrf52_power_management/index.html b/nrf52_power_management/index.html index 5e7f853b..736c9622 100644 --- a/nrf52_power_management/index.html +++ b/nrf52_power_management/index.html @@ -13,10 +13,10 @@ - + - + @@ -358,6 +358,33 @@ + + +
  • + + + + + + + + MeshCore KISS Modem Protocol + + + + + + + + +
  • + + + + + + + @@ -634,14 +661,14 @@
  • - + - Packet Structure + Packet Format @@ -668,7 +695,7 @@ - Meshcore payloads + Payload Format diff --git a/packet_structure/index.html b/packet_format/index.html similarity index 68% rename from packet_structure/index.html rename to packet_format/index.html index 85c4f6be..03f03db8 100644 --- a/packet_structure/index.html +++ b/packet_format/index.html @@ -10,7 +10,7 @@ - + @@ -27,7 +27,7 @@ - Packet Structure - MeshCore Docs + Packet Format - MeshCore Docs @@ -70,7 +70,7 @@
    - + Skip to content @@ -105,7 +105,7 @@
    - Packet Structure + Packet Format
    @@ -360,6 +360,33 @@ +
  • + + + + + + + + MeshCore KISS Modem Protocol + + + + + + + + +
  • + + + + + + + + +
  • @@ -404,7 +431,7 @@ - Packet Structure + Packet Format @@ -422,7 +449,7 @@ - Packet Structure + Packet Format @@ -448,47 +475,75 @@ @@ -513,7 +568,7 @@ - Meshcore payloads + Payload Format @@ -634,47 +689,75 @@ @@ -694,7 +777,7 @@ - + @@ -702,7 +785,77 @@ -

    Packet Structure

    +

    Packet Format

    +

    This document describes the MeshCore packet format.

    + +

    Version 1 Packet Format

    +

    This is the protocol level packet structure used in MeshCore firmware v1.12.0

    +
    [header][transport_codes(optional)][path_length][path][payload]
    +
    + +

    Packet Format

    @@ -715,7 +868,7 @@ - + @@ -723,25 +876,27 @@ - + - + - + - +
    header 1Contains routing type, payload type, and payload version.Contains routing type, payload type, and payload version
    transport_codes2x 16-bit transport codes (if ROUTE_TYPE_TRANSPORT_*)
    path_lenpath_length 1Length of the path field in bytes.Length of the path field in bytes
    path up to 64 (MAX_PATH_SIZE)Stores the routing path if applicable.Stores the routing path if applicable
    payload up to 184 (MAX_PACKET_PAYLOAD)The actual data being transmitted.Data for the provided Payload Type
    -

    Note: see the payloads doc for more information about the content of payload.

    -

    Header Breakdown

    -

    bit 0 means the lowest bit (1s place)

    +
    +

    NOTE: see the Payloads documentation for more information about the content of specific payload types.

    +
    +

    Header Format

    +

    Bit 0 means the lowest bit (1s place)

    @@ -756,23 +911,23 @@ - + - + - +
    0-1 0x03 Route TypeFlood, Direct, Reserved - see below.Flood, Direct, etc
    2-5 0x3C Payload TypeRequest, Response, ACK, etc. - see below.Request, Response, ACK, etc
    6-7 0xC0 Payload VersionVersioning of the payload format - see below.Versioning of the payload format
    -

    Route Type Values

    +

    Route Types

    @@ -785,26 +940,26 @@ - + - + - + - +
    0x00 ROUTE_TYPE_TRANSPORT_FLOODFlood routing mode + transport codesFlood Routing + Transport Codes
    0x01 ROUTE_TYPE_FLOODFlood routing mode (builds up path).Flood Routing
    0x02 ROUTE_TYPE_DIRECTDirect route (path is supplied).Direct Routing
    0x03 ROUTE_TYPE_TRANSPORT_DIRECTdirect route + transport codesDirect Routing + Transport Codes
    -

    Payload Type Values

    +

    Payload Types

    @@ -817,86 +972,86 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
    0x00 PAYLOAD_TYPE_REQRequest (destination/source hashes + MAC).Request (destination/source hashes + MAC)
    0x01 PAYLOAD_TYPE_RESPONSEResponse to REQ or ANON_REQ.Response to REQ or ANON_REQ
    0x02 PAYLOAD_TYPE_TXT_MSGPlain text message.Plain text message
    0x03 PAYLOAD_TYPE_ACKAcknowledgment.Acknowledgment
    0x04 PAYLOAD_TYPE_ADVERTNode advertisement.Node advertisement
    0x05 PAYLOAD_TYPE_GRP_TXTGroup text message (unverified).Group text message (unverified)
    0x06 PAYLOAD_TYPE_GRP_DATAGroup datagram (unverified).Group datagram (unverified)
    0x07 PAYLOAD_TYPE_ANON_REQAnonymous request.Anonymous request
    0x08 PAYLOAD_TYPE_PATHReturned path.Returned path
    0x09 PAYLOAD_TYPE_TRACEtrace a path, collecting SNI for each hop.Trace a path, collecting SNR for each hop
    0x0A PAYLOAD_TYPE_MULTIPARTpacket is part of a sequence of packets.Packet is part of a sequence of packets
    0x0B PAYLOAD_TYPE_CONTROLcontrol packet data (unencrypted)Control packet data (unencrypted)
    0x0C.reserved reserved
    0x0D.reserved reserved
    0x0E.reserved reserved
    0x0F PAYLOAD_TYPE_RAW_CUSTOMCustom packet (raw bytes, custom encryption).Custom packet (raw bytes, custom encryption)
    -

    Payload Version Values

    +

    Payload Versions

    @@ -909,22 +1064,22 @@ - + - + - + - +
    0x00 11-byte src/dest hashes, 2-byte MAC.1-byte src/dest hashes, 2-byte MAC
    0x01 2Future version (e.g., 2-byte hashes, 4-byte MAC).Future version (e.g., 2-byte hashes, 4-byte MAC)
    0x02 3Future version.Future version
    0x03 4Future version.Future version
    diff --git a/payloads/index.html b/payloads/index.html index 0b916401..79924fe7 100644 --- a/payloads/index.html +++ b/payloads/index.html @@ -13,7 +13,7 @@ - + @@ -27,7 +27,7 @@ - Meshcore payloads - MeshCore Docs + Payload Format - MeshCore Docs @@ -70,7 +70,7 @@
    - + Skip to content @@ -105,7 +105,7 @@
    - Meshcore payloads + Payload Format
    @@ -360,6 +360,33 @@ +
  • + + + + + + + + MeshCore KISS Modem Protocol + + + + + + + + +
  • + + + + + + + + +
  • @@ -388,14 +415,14 @@
  • - + - Packet Structure + Packet Format @@ -431,7 +458,7 @@ - Meshcore payloads + Payload Format @@ -449,7 +476,7 @@ - Meshcore payloads + Payload Format @@ -636,8 +663,8 @@ -

    Meshcore payloads

    -

    Inside of each meshcore packet is a payload, identified by the payload type in the packet header. The types of payloads are:

    +

    Payload Format

    +

    Inside each MeshCore Packet is a payload, identified by the payload type in the packet header. The types of payloads are:

    Example Structure (C/C++)

    struct StatsPackets {
    @@ -1332,6 +1368,7 @@
         uint32_t direct_tx;
         uint32_t flood_rx;
         uint32_t direct_rx;
    +    uint32_t recv_errors;    // present when frame size is 30
     } __attribute__((packed));
     

    @@ -1382,11 +1419,12 @@ def parse_stats_radio(frame): } def parse_stats_packets(frame): - """Parse RESP_CODE_STATS + STATS_TYPE_PACKETS frame (26 bytes)""" + """Parse RESP_CODE_STATS + STATS_TYPE_PACKETS frame (26 or 30 bytes)""" + assert len(frame) >= 26, "STATS_TYPE_PACKETS frame too short" response_code, stats_type, recv, sent, flood_tx, direct_tx, flood_rx, direct_rx = \ - struct.unpack('<B B I I I I I I', frame) + struct.unpack('<B B I I I I I I', frame[:26]) assert response_code == 24 and stats_type == 2, "Invalid response type" - return { + result = { 'recv': recv, 'sent': sent, 'flood_tx': flood_tx, @@ -1394,6 +1432,10 @@ def parse_stats_packets(frame): 'flood_rx': flood_rx, 'direct_rx': direct_rx } + if len(frame) >= 30: + (recv_errors,) = struct.unpack('<I', frame[26:30]) + result['recv_errors'] = recv_errors + return result

    Command Usage Example (JavaScript/TypeScript)

    @@ -1442,6 +1484,7 @@ interface StatsPackets { direct_tx: number; flood_rx: number; direct_rx: number; + recv_errors?: number; // present when frame is 30 bytes } function parseStatsCore(buffer: ArrayBuffer): StatsCore { @@ -1477,12 +1520,15 @@ function parseStatsRadio(buffer: ArrayBuffer): StatsRadio { function parseStatsPackets(buffer: ArrayBuffer): StatsPackets { const view = new DataView(buffer); + if (buffer.byteLength < 26) { + throw new Error('STATS_TYPE_PACKETS frame too short'); + } const response_code = view.getUint8(0); const stats_type = view.getUint8(1); if (response_code !== 24 || stats_type !== 2) { throw new Error('Invalid response type'); } - return { + const result: StatsPackets = { recv: view.getUint32(2, true), sent: view.getUint32(6, true), flood_tx: view.getUint32(10, true), @@ -1490,6 +1536,10 @@ function parseStatsPackets(buffer: ArrayBuffer): StatsPackets { flood_rx: view.getUint32(18, true), direct_rx: view.getUint32(22, true) }; + if (buffer.byteLength >= 30) { + result.recv_errors = view.getUint32(26, true); + } + return result; }
    diff --git a/terminal_chat_cli/index.html b/terminal_chat_cli/index.html index aafd5fd4..0844e5f9 100644 --- a/terminal_chat_cli/index.html +++ b/terminal_chat_cli/index.html @@ -358,6 +358,33 @@ +
  • + + + + + + + + MeshCore KISS Modem Protocol + + + + + + + + +
  • + + + + + + + + +
  • @@ -386,14 +413,14 @@
  • - + - Packet Structure + Packet Format @@ -420,7 +447,7 @@ - Meshcore payloads + Payload Format