From b6d0b7a5dd06d3e141e089697ddb44dd154dcc15 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Mon, 27 Apr 2026 10:22:17 -0700 Subject: [PATCH] Refine data type definitions and update registration process in documentation --- docs/companion_protocol.md | 20 +++++++++----------- docs/number_allocations.md | 1 + src/helpers/TxtDataHelpers.h | 3 --- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/docs/companion_protocol.md b/docs/companion_protocol.md index fc2ad32d..8129bc90 100644 --- a/docs/companion_protocol.md +++ b/docs/companion_protocol.md @@ -318,19 +318,17 @@ Remaining bytes: Binary payload (variable length) #### Registered `data_type` values -Declared in `src/helpers/TxtDataHelpers.h`. These values have agreed-upon payload schemas so different client apps on the same channel can interoperate. +`data_type` is an **application identifier**, not a payload-format identifier. Each registered value identifies an application that owns its own internal payload schemas. The firmware does not inspect payload contents — `data_type` is transported opaquely. -| Value | Constant | Purpose | Payload schema | -|--------|----------------------|---------------------------------------------|--------------------------------------------------------------------------------------------------------| -| 0x0000 | `DATA_TYPE_RESERVED` | Reserved; invalid on send | — | -| 0x0001 | `DATA_TYPE_SMAZ_TEXT`| Raw SMAZ-compressed UTF-8 text | `[sender_name_len: u8][sender_name: UTF-8 × sender_name_len][smaz_bytes: remaining]` | -| 0x0002 | `DATA_TYPE_GIPHY_GIF`| Giphy GIF id (avoids base64 tax) | `[sender_name_len: u8][sender_name: UTF-8 × sender_name_len][giphy_id: ASCII, remaining]` | -| 0x0003 | `DATA_TYPE_REACTION` | Emoji reaction targeting a prior message | `[target_hash: 2 bytes LE][emoji_index: u8][sender_name_len: u8][sender_name: UTF-8 × sender_name_len]` | -| 0xFFFF | `DATA_TYPE_DEV` | Developer/experimental namespace | Application-defined | +| Value | Constant | Purpose | +|-----------------|----------------------|--------------------------------------------------------------------------| +| 0x0000 | `DATA_TYPE_RESERVED` | Reserved; invalid on send | +| 0x0001 – 0x00FF | — | Reserved for internal use | +| 0x0100 – 0xFEFF | — | Registered application namespaces (see [number_allocations.md](number_allocations.md)) | +| 0xFF00 – 0xFFFE | — | Testing/development; no registration required | +| 0xFFFF | `DATA_TYPE_DEV` | Developer/experimental namespace | -The firmware does not inspect the payload contents — `data_type` is transported opaquely, and the schemas above are a client-side contract between cooperating apps. - -To request a new registered value, submit a PR adding a `#define` to `TxtDataHelpers.h` and a row to this table. +To register a new application, submit a PR adding a row to the table in [docs/number_allocations.md](number_allocations.md). Internal sub-formats within an allocated application ID are owned by that application and are not tracked in MeshCore firmware or this document. --- diff --git a/docs/number_allocations.md b/docs/number_allocations.md index 94ad1efd..c4715c5e 100644 --- a/docs/number_allocations.md +++ b/docs/number_allocations.md @@ -15,6 +15,7 @@ Once you have a working app/project, you need to be able to demonstrate it exist | Data-Type range | App name | Contact | |-----------------|-----------------------------|------------------------------------------------------| | 0000 - 00FF | -reserved for internal use- | | +| 0100 | MeshCore Open | zsylvester@monitormx.com — https://github.com/zjs81/meshcore-open | | FF00 - FFFF | -reserved for testing/dev- | | (add rows, inside the range 0100 - FEFF for custom apps) diff --git a/src/helpers/TxtDataHelpers.h b/src/helpers/TxtDataHelpers.h index 432c0f12..ece494f2 100644 --- a/src/helpers/TxtDataHelpers.h +++ b/src/helpers/TxtDataHelpers.h @@ -7,9 +7,6 @@ #define TXT_TYPE_CLI_DATA 1 // a CLI command #define TXT_TYPE_SIGNED_PLAIN 2 // plain text, signed by sender #define DATA_TYPE_RESERVED 0x0000 // reserved for future use -#define DATA_TYPE_SMAZ_TEXT 0x0001 // raw SMAZ-compressed UTF-8 text meshcore-open Flutter client. -#define DATA_TYPE_GIPHY_GIF 0x0002 // ASCII Giphy GIF id meshcore-open Flutter client. -#define DATA_TYPE_REACTION 0x0003 // 2-byte target message hash + 1-byte emoji index meshcore-open Flutter client. #define DATA_TYPE_DEV 0xFFFF // developer namespace for experimenting with group/channel datagrams and building apps class StrHelper {