diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fb8676..9322ba5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,8 @@ name: Push commit to schema registry +permissions: + contents: read + on: push: branches: @@ -11,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Buf - uses: bufbuild/buf-setup-action@v1.18.0 + uses: bufbuild/buf-setup-action@v1.26.1 with: github_token: ${{ github.token }} diff --git a/.github/workflows/create_tag.yml b/.github/workflows/create_tag.yml index 3c49457..482ea79 100644 --- a/.github/workflows/create_tag.yml +++ b/.github/workflows/create_tag.yml @@ -1,5 +1,8 @@ name: Create tag +permissions: + contents: write + on: workflow_dispatch: inputs: @@ -18,7 +21,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - id: version @@ -47,7 +50,7 @@ jobs: echo "NEW_VERSION=v$MAJOR.$MINOR.$PATCH" >> $GITHUB_OUTPUT - name: Create release - uses: ncipollo/release-action@v1.12.0 + uses: ncipollo/release-action@v1.13.0 with: name: Meshtastic Protobufs ${{ steps.version.outputs.NEW_VERSION }} tag: ${{ steps.version.outputs.NEW_VERSION }} @@ -55,7 +58,7 @@ jobs: token: ${{ github.token }} - name: Setup Buf - uses: bufbuild/buf-setup-action@v1 + uses: bufbuild/buf-setup-action@v1.26.1 with: github_token: ${{ github.token }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index d9d52a2..0000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Nightly -on: - schedule: - - cron: 0 8 * * 1-5 - workflow_dispatch: {} - -jobs: - trunk_check: - name: Trunk Check Upload - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Trunk Check - uses: trunk-io/trunk-action@v1 - with: - trunk-token: ${{ secrets.TRUNK_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index da3d251..a54687d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,8 @@ name: Push new version to schema registry +permissions: + contents: read + on: push: tags: @@ -11,10 +14,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Buf - uses: bufbuild/buf-setup-action@v1 + uses: bufbuild/buf-setup-action@v1.26.1 with: github_token: ${{ github.token }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index a7b6e68..598c808 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,4 +1,8 @@ name: pull-request + +permissions: + contents: read + on: pull_request jobs: build: @@ -6,18 +10,18 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Buf - uses: bufbuild/buf-setup-action@v1 + uses: bufbuild/buf-setup-action@v1.26.1 with: github_token: ${{ github.token }} - name: Lint - uses: bufbuild/buf-lint-action@v1 + uses: bufbuild/buf-lint-action@v1.0.3 - name: Push to schema registry - uses: bufbuild/buf-push-action@v1 + uses: bufbuild/buf-push-action@v1.1.1 with: buf_token: ${{ secrets.BUF_TOKEN }} draft: ${{ github.ref_name != 'master'}} diff --git a/.trunk/.gitignore b/.trunk/.gitignore index 8130ba6..1e24652 100644 --- a/.trunk/.gitignore +++ b/.trunk/.gitignore @@ -2,7 +2,7 @@ *logs *actions *notifications +*tools plugins user_trunk.yaml user.yaml -shims diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index b685b59..acdfaad 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,25 +1,28 @@ version: 0.1 cli: - version: 1.10.0 + version: 1.16.2 plugins: sources: - id: trunk - ref: v0.0.17 + ref: v1.2.5 uri: https://github.com/trunk-io/plugins lint: enabled: + - checkov@2.4.9 + - trivy@0.45.1 + - trufflehog@3.57.0 - yamllint@1.32.0 - - buf-lint@1.20.0 - - buf-breaking@1.20.0 - - actionlint@1.6.24 - - markdownlint@0.34.0 - - prettier@2.8.8 - - gitleaks@8.16.3 + - buf-lint@1.26.1 + - buf-breaking@1.26.1 + - actionlint@1.6.26 + - markdownlint@0.37.0 + - prettier@3.0.3 + - gitleaks@8.18.0 - git-diff-check runtimes: enabled: - python@3.10.8 - - go@1.19.5 + - go@1.21.0 - node@18.12.1 actions: disabled: diff --git a/meshtastic/admin.options b/meshtastic/admin.options index 1cd0ab4..1d582e2 100644 --- a/meshtastic/admin.options +++ b/meshtastic/admin.options @@ -2,11 +2,11 @@ *AdminMessage.set_canned_message_module_messages max_size:201 *AdminMessage.get_canned_message_module_messages_response max_size:201 +*AdminMessage.delete_file_request max_size:201 *AdminMessage.set_ringtone_message max_size:231 *AdminMessage.get_ringtone_response max_size:231 - *HamParameters.call_sign max_size:8 *HamParameters.short_name max_size:6 *NodeRemoteHardwarePinsResponse.node_remote_hardware_pins max_count:16 \ No newline at end of file diff --git a/meshtastic/admin.proto b/meshtastic/admin.proto index 191707c..01295f4 100644 --- a/meshtastic/admin.proto +++ b/meshtastic/admin.proto @@ -109,6 +109,26 @@ message AdminMessage { * TODO: REPLACE */ REMOTEHARDWARE_CONFIG = 8; + + /* + * TODO: REPLACE + */ + NEIGHBORINFO_CONFIG = 9; + + /* + * TODO: REPLACE + */ + AMBIENTLIGHTING_CONFIG = 10; + + /* + * TODO: REPLACE + */ + DETECTIONSENSOR_CONFIG = 11; + + /* + * TODO: REPLACE + */ + PAXCOUNTER_CONFIG = 12; } /* @@ -211,6 +231,17 @@ message AdminMessage { */ NodeRemoteHardwarePinsResponse get_node_remote_hardware_pins_response = 20; + /* + * Enter (UF2) DFU mode + * Only implemented on NRF52 currently + */ + bool enter_dfu_mode_request = 21; + + /* + * Delete the file by the specified path from the device + */ + string delete_file_request = 22; + /* * Set the owner for this node */ @@ -245,6 +276,11 @@ message AdminMessage { */ string set_ringtone_message = 37; + /* + * Remove the node by the specified node-num from the NodeDB on the device + */ + uint32 remove_by_nodenum = 38; + /* * Begins an edit transaction for config, module config, owner, and channel settings changes * This will delay the standard *implicit* save to the file system and subsequent reboot behavior until committed (commit_edit_settings) diff --git a/meshtastic/atak.options b/meshtastic/atak.options new file mode 100644 index 0000000..c341400 --- /dev/null +++ b/meshtastic/atak.options @@ -0,0 +1,6 @@ +*Contact.callsign max_size:120 +*Contact.device_callsign max_size:120 +*Status.battery int_size:8 +*PLI.course int_size:16 +*GeoChat.message max_size:200 +*GeoChat.to max_size:120 \ No newline at end of file diff --git a/meshtastic/atak.proto b/meshtastic/atak.proto new file mode 100644 index 0000000..c44479f --- /dev/null +++ b/meshtastic/atak.proto @@ -0,0 +1,251 @@ +syntax = "proto3"; + +package meshtastic; + +option csharp_namespace = "Meshtastic.Protobufs"; +option go_package = "github.com/meshtastic/go/generated"; +option java_outer_classname = "ATAKProtos"; +option java_package = "com.geeksville.mesh"; +option swift_prefix = ""; +/* + * Packets for the official ATAK Plugin + */ +message TAKPacket +{ + /* + * Are the payloads strings compressed for LoRA transport? + */ + bool is_compressed = 1; + /* + * The contact / callsign for ATAK user + */ + Contact contact = 2; + /* + * The group for ATAK user + */ + Group group = 3; + /* + * The status of the ATAK EUD + */ + Status status = 4; + /* + * The payload of the packet + */ + oneof payload_variant { + /* + * TAK position report + */ + PLI pli = 5; + /* + * ATAK GeoChat message + */ + GeoChat chat = 6; + } +} + +/* + * ATAK GeoChat message + */ +message GeoChat { + /* + * The text message + */ + string message = 1; + + /* + * Uid recipient of the message + */ + optional string to = 2; +} + +/* + * ATAK Group + * <__group role='Team Member' name='Cyan'/> + */ +message Group { + /* + * Role of the group member + */ + MemberRole role = 1; + /* + * Team (color) + * Default Cyan + */ + Team team = 2; +} + +enum Team { + /* + * Unspecifed + */ + Unspecifed_Color = 0; + /* + * White + */ + White = 1; + /* + * Yellow + */ + Yellow = 2; + /* + * Orange + */ + Orange = 3; + /* + * Magenta + */ + Magenta = 4; + /* + * Red + */ + Red = 5; + /* + * Maroon + */ + Maroon = 6; + /* + * Purple + */ + Purple = 7; + /* + * Dark Blue + */ + Dark_Blue = 8; + /* + * Blue + */ + Blue = 9; + /* + * Cyan + */ + Cyan = 10; + /* + * Teal + */ + Teal = 11; + /* + * Green + */ + Green = 12; + /* + * Dark Green + */ + Dark_Green = 13; + /* + * Brown + */ + Brown = 14; +} + +/* + * Role of the group member + */ +enum MemberRole { + /* + * Unspecifed + */ + Unspecifed = 0; + /* + * Team Member + */ + TeamMember = 1; + /* + * Team Lead + */ + TeamLead = 2; + /* + * Headquarters + */ + HQ = 3; + /* + * Airsoft enthusiast + */ + Sniper = 4; + /* + * Medic + */ + Medic = 5; + /* + * ForwardObserver + */ + ForwardObserver = 6; + /* + * Radio Telephone Operator + */ + RTO = 7; + /* + * Doggo + */ + K9 = 8; +} + +/* + * ATAK EUD Status + * + */ +message Status { + /* + * Battery level + */ + uint32 battery = 1; +} +/* + * ATAK Contact + * + */ +message Contact { + /* + * Callsign + */ + string callsign = 1; + + /* + * Device callsign + */ + string device_callsign = 2; + /* + * IP address of endpoint in integer form (0.0.0.0 default) + */ + // fixed32 enpoint_address = 3; + /* + * Port of endpoint (4242 default) + */ + // uint32 endpoint_port = 4; + /* + * Phone represented as integer + * Terrible practice, but we really need the wire savings + */ + // uint32 phone = 4; +} + +/* + * Position Location Information from ATAK + */ +message PLI { + /* + * The new preferred location encoding, multiply by 1e-7 to get degrees + * in floating point + */ + sfixed32 latitude_i = 1; + + /* + * The new preferred location encoding, multiply by 1e-7 to get degrees + * in floating point + */ + sfixed32 longitude_i = 2; + + /* + * Altitude (ATAK prefers HAE) + */ + int32 altitude = 3; + + /* + * Speed + */ + uint32 speed = 4; + + /* + * Course in degrees + */ + uint32 course = 5; +} diff --git a/meshtastic/channel.proto b/meshtastic/channel.proto index 6667874..2b10aaf 100644 --- a/meshtastic/channel.proto +++ b/meshtastic/channel.proto @@ -81,6 +81,21 @@ message ChannelSettings { * If true, messages seen on the internet will be forwarded to the local mesh. */ bool downlink_enabled = 6; + + /* + * Per-channel module settings. + */ + ModuleSettings module_settings = 7; +} + +/* + * This message is specifically for modules to store per-channel configuration data. + */ +message ModuleSettings { +/* + * Bits of precision for the location sent in position packets. + */ + uint32 position_precision = 1; } /* diff --git a/meshtastic/config.options b/meshtastic/config.options index 3448af5..4490f08 100644 --- a/meshtastic/config.options +++ b/meshtastic/config.options @@ -1,5 +1,5 @@ *NetworkConfig.wifi_ssid max_size:33 -*NetworkConfig.wifi_psk max_size:64 +*NetworkConfig.wifi_psk max_size:65 *NetworkConfig.ntp_server max_size:33 *NetworkConfig.rsyslog_server max_size:33 @@ -11,4 +11,4 @@ *LoRaConfig.coding_rate int_size:8 *LoRaConfig.channel_num int_size:16 -*PowerConfig.device_battery_ina_address int_size:8 \ No newline at end of file +*PowerConfig.device_battery_ina_address int_size:8 diff --git a/meshtastic/config.proto b/meshtastic/config.proto index 7025a7b..7ebbe45 100644 --- a/meshtastic/config.proto +++ b/meshtastic/config.proto @@ -18,48 +18,83 @@ message Config { */ enum Role { /* - * Client device role + * Description: App connected or stand alone messaging device. + * Technical Details: Default Role */ CLIENT = 0; - /* - * Client Mute device role - * Same as a client except packets will not hop over this node, does not contribute to routing packets for mesh. + * Description: Device that does not forward packets from other devices. */ CLIENT_MUTE = 1; /* - * Router device role. - * Mesh packets will prefer to be routed over this node. This node will not be used by client apps. - * The wifi/ble radios and the oled screen will be put to sleep. + * Description: Infrastructure node for extending network coverage by relaying messages. Visible in Nodes list. + * Technical Details: Mesh packets will prefer to be routed over this node. This node will not be used by client apps. + * The wifi radio and the oled screen will be put to sleep. * This mode may still potentially have higher power usage due to it's preference in message rebroadcasting on the mesh. */ ROUTER = 2; /* - * Router Client device role - * Mesh packets will prefer to be routed over this node. The Router Client can be used as both a Router and an app connected Client. + * Description: Combination of both ROUTER and CLIENT. Not for mobile devices. */ ROUTER_CLIENT = 3; /* - * Repeater device role - * Mesh packets will simply be rebroadcasted over this node. Nodes configured with this role will not originate NodeInfo, Position, Telemetry + * Description: Infrastructure node for extending network coverage by relaying messages with minimal overhead. Not visible in Nodes list. + * Technical Details: Mesh packets will simply be rebroadcasted over this node. Nodes configured with this role will not originate NodeInfo, Position, Telemetry * or any other packet type. They will simply rebroadcast any mesh packets on the same frequency, channel num, spread factor, and coding rate. */ REPEATER = 4; /* - * Tracker device role - * Position Mesh packets will be prioritized higher and sent more frequently by default. + * Description: Broadcasts GPS position packets as priority. + * Technical Details: Position Mesh packets will be prioritized higher and sent more frequently by default. + * When used in conjunction with power.is_power_saving = true, nodes will wake up, + * send position, and then sleep for position.position_broadcast_secs seconds. */ TRACKER = 5; /* - * Sensor device role - * Telemetry Mesh packets will be prioritized higher and sent more frequently by default. + * Description: Broadcasts telemetry packets as priority. + * Technical Details: Telemetry Mesh packets will be prioritized higher and sent more frequently by default. + * When used in conjunction with power.is_power_saving = true, nodes will wake up, + * send environment telemetry, and then sleep for telemetry.environment_update_interval seconds. */ SENSOR = 6; + + /* + * Description: Optimized for ATAK system communication and reduces routine broadcasts. + * Technical Details: Used for nodes dedicated for connection to an ATAK EUD. + * Turns off many of the routine broadcasts to favor CoT packet stream + * from the Meshtastic ATAK plugin -> IMeshService -> Node + */ + TAK = 7; + + /* + * Description: Device that only broadcasts as needed for stealth or power savings. + * Technical Details: Used for nodes that "only speak when spoken to" + * Turns all of the routine broadcasts but allows for ad-hoc communication + * Still rebroadcasts, but with local only rebroadcast mode (known meshes only) + * Can be used for clandestine operation or to dramatically reduce airtime / power consumption + */ + CLIENT_HIDDEN = 8; + + /* + * Description: Broadcasts location as message to default channel regularly for to assist with device recovery. + * Technical Details: Used to automatically send a text message to the mesh + * with the current position of the device on a frequent interval: + * "I'm lost! Position: lat / long" + */ + LOST_AND_FOUND = 9; + + /* + * Description: Enables automatic TAK PLI broadcasts and reduces routine broadcasts. + * Technical Details: Turns off many of the routine broadcasts to favor ATAK CoT packet stream + * and automatic TAK PLI (position location information) broadcasts. + * Uses position module configuration to determine TAK PLI broadcast interval. + */ + TAK_TRACKER = 10; } /* @@ -83,6 +118,12 @@ message Config { * Only rebroadcasts message on the nodes local primary / secondary channels. */ LOCAL_ONLY = 2; + + /* + * Ignores observed messages from foreign meshes like LOCAL_ONLY, + * but takes it step further by also ignoring messages from nodenums not in the node's known list (NodeDB) + */ + KNOWN_ONLY = 3; } /* @@ -134,6 +175,11 @@ message Config { * Clients should then limit available configuration and administrative options inside the user interface */ bool is_managed = 9; + + /* + * Disables the triple-press of user button to enable or disable GPS + */ + bool disable_triple_click = 10; } /* @@ -142,8 +188,9 @@ message Config { message PositionConfig { /* * Bit field of boolean configuration options, indicating which optional - * fields to include when assembling POSITION messages - * Longitude and latitude are always included (also time if GPS-synced) + * fields to include when assembling POSITION messages. + * Longitude, latitude, altitude, speed, heading, and DOP + * are always included (also time if GPS-synced) * NOTE: the more fields are included, the larger the message will be - * leading to longer airtime and a higher risk of packet loss */ @@ -208,6 +255,23 @@ message Config { SPEED = 0x0200; } + enum GpsMode { + /* + * GPS is present but disabled + */ + DISABLED = 0; + + /* + * GPS is present and enabled + */ + ENABLED = 1; + + /* + * GPS is not present on the device + */ + NOT_PRESENT = 2; + } + /* * We should send our position this often (but only if it has changed significantly) * Defaults to 15 minutes @@ -229,7 +293,7 @@ message Config { /* * Is GPS enabled for this node? */ - bool gps_enabled = 4; + bool gps_enabled = 4[deprecated = true]; /* * How often should we try to get GPS position (in seconds) @@ -239,12 +303,9 @@ message Config { uint32 gps_update_interval = 5; /* - * How long should we try to get our position during each gps_update_interval attempt? (in seconds) - * Or if zero, use the default of 30 seconds. - * If we don't get a new gps fix in that time, the gps will be put into sleep until the next gps_update_rate - * window. + * Deprecated in favor of using smart / regular broadcast intervals as implicit attempt time */ - uint32 gps_attempt_time = 6; + uint32 gps_attempt_time = 6 [deprecated = true]; /* * Bit field of boolean configuration options for POSITION messages @@ -268,9 +329,19 @@ message Config { uint32 broadcast_smart_minimum_distance = 10; /* - * The minumum number of seconds (since the last send) before we can send a position to the mesh if position_broadcast_smart_enabled + * The minimum number of seconds (since the last send) before we can send a position to the mesh if position_broadcast_smart_enabled */ uint32 broadcast_smart_minimum_interval_secs = 11; + + /* + * (Re)define PIN_GPS_EN for your board. + */ + uint32 gps_en_gpio = 12; + + /* + * Set where GPS is enabled, disabled, or not present + */ + GpsMode gps_mode = 13; } /* @@ -306,14 +377,6 @@ message Config { */ uint32 wait_bluetooth_secs = 4; - /* - * Mesh Super Deep Sleep Timeout Seconds - * While in Light Sleep if this value is exceeded we will lower into super deep sleep - * for sds_secs (default 1 year) or a button press - * 0 for default of two hours, MAXUINT for disabled - */ - uint32 mesh_sds_timeout_secs = 5; - /* * Super Deep Sleep Seconds * While in Light Sleep if mesh_sds_timeout_secs is exceeded we will lower into super deep sleep @@ -668,6 +731,21 @@ message Config { * Ukraine 868mhz */ UA_868 = 15; + + /* + * Malaysia 433mhz + */ + MY_433 = 16; + + /* + * Malaysia 919mhz + */ + MY_919 = 17; + + /* + * Singapore 923mhz + */ + SG_923 = 18; } /* @@ -765,6 +843,7 @@ message Config { /* * Maximum number of hops. This can't be greater than 7. * Default of 3 + * Attempting to set a value > 7 results in the default */ uint32 hop_limit = 8; @@ -820,6 +899,11 @@ message Config { * in ignore_incoming will have packets they send dropped on receive (by router.cpp) */ repeated uint32 ignore_incoming = 103; + + /* + * If true, the device will not process any packets received via LoRa that passed via MQTT anywhere on the path towards it. + */ + bool ignore_mqtt = 104; } message BluetoothConfig { @@ -868,4 +952,4 @@ message Config { LoRaConfig lora = 6; BluetoothConfig bluetooth = 7; } -} \ No newline at end of file +} diff --git a/meshtastic/deviceonly.options b/meshtastic/deviceonly.options index c164888..d870ace 100644 --- a/meshtastic/deviceonly.options +++ b/meshtastic/deviceonly.options @@ -2,8 +2,7 @@ # https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options # FIXME pick a higher number someday? or do dynamic alloc in nanopb? -*DeviceState.node_db max_count:80 -*DeviceState.node_db_lite max_count:80 +*DeviceState.node_db_lite max_count:100 # FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in RAM *DeviceState.receive_queue max_count:1 @@ -16,4 +15,5 @@ *DeviceState.node_remote_hardware_pins max_count:12 -*NodeInfoLite.channel int_size:8 \ No newline at end of file +*NodeInfoLite.channel int_size:8 +*NodeInfoLite.hops_away int_size:8 \ No newline at end of file diff --git a/meshtastic/deviceonly.proto b/meshtastic/deviceonly.proto index fd2d61f..169df1c 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -32,12 +32,6 @@ message DeviceState { */ User owner = 3; - /* - * Deprecated in 2.1.x - * Old node_db. See NodeInfoLite node_db_lite - */ - repeated NodeInfo node_db = 4 [deprecated = true]; - /* * Received packets saved for delivery to the phone */ @@ -81,7 +75,7 @@ message DeviceState { repeated NodeRemoteHardwarePin node_remote_hardware_pins = 13; /* - * New lite version of NodeDB to decrease + * New lite version of NodeDB to decrease memory footprint */ repeated NodeInfoLite node_db_lite = 14; } @@ -122,6 +116,16 @@ message NodeInfoLite { * local channel index we heard that node on. Only populated if its not the default channel. */ uint32 channel = 7; + + /* + * True if we witnessed the node over MQTT instead of LoRA transport + */ + bool via_mqtt = 8; + + /* + * Number of hops away from us this node is (0 if adjacent) + */ + uint32 hops_away = 9; } /* diff --git a/meshtastic/localonly.proto b/meshtastic/localonly.proto index 4b51795..9297dff 100644 --- a/meshtastic/localonly.proto +++ b/meshtastic/localonly.proto @@ -111,10 +111,25 @@ message LocalModuleConfig { */ ModuleConfig.NeighborInfoConfig neighbor_info = 11; + /* + * The part of the config that is specific to the Ambient Lighting module + */ + ModuleConfig.AmbientLightingConfig ambient_lighting = 12; + + /* + * The part of the config that is specific to the Detection Sensor module + */ + ModuleConfig.DetectionSensorConfig detection_sensor = 13; + + /* + * Paxcounter Config + */ + ModuleConfig.PaxcounterConfig paxcounter = 14; + /* * A version integer used to invalidate old save files when we make * incompatible changes This integer is set at build time and is private to * NodeDB.cpp in the device code. */ uint32 version = 8; -} +} \ No newline at end of file diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 35e4dc6..aedfe99 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -14,6 +14,7 @@ *Data.payload max_size:237 *NodeInfo.channel int_size:8 +*NodeInfo.hops_away int_size:8 # Big enough for 1.2.28.568032c-d *MyNodeInfo.firmware_version max_size:18 @@ -26,6 +27,7 @@ *MeshPacket.encrypted max_size:256 *MeshPacket.payload_variant anonymous_oneof:true *MeshPacket.hop_limit int_size:8 +*MeshPacket.hop_start int_size:8 *MeshPacket.channel int_size:8 *QueueStatus.res int_size:8 @@ -44,7 +46,6 @@ # MyMessage.name max_size:40 # or fixed_length or fixed_count, or max_count - #This value may want to be a few bytes smaller to compensate for the parent fields. *Compressed.data max_size:237 @@ -53,4 +54,8 @@ *NeighborInfo.neighbors max_count:10 -*DeviceMetadata.firmware_version max_size:18 \ No newline at end of file +*DeviceMetadata.firmware_version max_size:18 + +*MqttClientProxyMessage.topic max_size:60 +*MqttClientProxyMessage.data max_size:435 +*MqttClientProxyMessage.text max_size:435 diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index 8c50965..76aa01b 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -37,9 +37,8 @@ message Position { /* * This is usually not sent over the mesh (to save space), but it is sent - * from the phone so that the local device can set its RTC If it is sent over - * the mesh (because there are devices on the mesh without GPS), it will only - * be sent by devices which has a hardware GPS clock. + * from the phone so that the local device can set its time if it is sent over + * the mesh (because there are devices on the mesh without GPS or RTC). * seconds since 1970 */ fixed32 time = 4; @@ -204,6 +203,11 @@ message Position { * detect lost updates if needed */ uint32 seq_number = 22; + + /* + * Indicates the bits of precision set by the sending node + */ + uint32 precision_bits = 23; } /* @@ -305,6 +309,16 @@ enum HardwareModel { */ NANO_G1_EXPLORER = 17; + /* + * B&Q Consulting Nano G2 Ultra: https://wiki.uniteng.com/en/meshtastic/nano-g2-ultra + */ + NANO_G2_ULTRA = 18; + + /* + * LoRAType device: https://loratype.org/ + */ + LORA_TYPE = 19; + /* * B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */ @@ -315,6 +329,31 @@ enum HardwareModel { */ RAK11310 = 26; + /* + * Makerfabs SenseLoRA Receiver (RP2040 + RFM96) + */ + SENSELORA_RP2040 = 27; + + /* + * Makerfabs SenseLoRA Industrial Monitor (ESP32-S3 + RFM96) + */ + SENSELORA_S3 = 28; + + /* + * Canary Radio Company - CanaryOne: https://canaryradio.io/products/canaryone + */ + CANARYONE = 29; + + /* + * Waveshare RP2040 LoRa - https://www.waveshare.com/rp2040-lora.htm + */ + RP2040_LORA = 30; + + /* + * B&Q Consulting Station G2: https://wiki.uniteng.com/en/meshtastic/station-g2 + */ + STATION_G2 = 31; + /* * --------------------------------------------------------------------------- * Less common/prototype boards listed here (needs one more byte over the air) @@ -397,6 +436,69 @@ enum HardwareModel { */ RPI_PICO = 47; + /* + * Heltec Wireless Tracker with ESP32-S3 CPU, built-in GPS, and TFT + * Newer V1.1, version is written on the PCB near the display. + */ + HELTEC_WIRELESS_TRACKER = 48; + + /* + * Heltec Wireless Paper with ESP32-S3 CPU and E-Ink display + */ + HELTEC_WIRELESS_PAPER = 49; + + /* + * LilyGo T-Deck with ESP32-S3 CPU, Keyboard and IPS display + */ + T_DECK = 50; + + /* + * LilyGo T-Watch S3 with ESP32-S3 CPU and IPS display + */ + T_WATCH_S3 = 51; + + /* + * Bobricius Picomputer with ESP32-S3 CPU, Keyboard and IPS display + */ + PICOMPUTER_S3 = 52; + + /* + * Heltec HT-CT62 with ESP32-C3 CPU and SX1262 LoRa + */ + HELTEC_HT62 = 53; + + /* + * EBYTE SPI LoRa module and ESP32-S3 + */ + EBYTE_ESP32_S3 = 54; + + /* + * Waveshare ESP32-S3-PICO with PICO LoRa HAT and 2.9inch e-Ink + */ + ESP32_S3_PICO = 55; + + /* + * CircuitMess Chatter 2 LLCC68 Lora Module and ESP32 Wroom + * Lora module can be swapped out for a Heltec RA-62 which is "almost" pin compatible + * with one cut and one jumper Meshtastic works + */ + CHATTER_2 = 56; + + /* + * Heltec Wireless Paper, With ESP32-S3 CPU and E-Ink display + * Older "V1.0" Variant, has no "version sticker" + * E-Ink model is DEPG0213BNS800 + * Tab on the screen protector is RED + * Flex connector marking is FPC-7528B + */ + HELTEC_WIRELESS_PAPER_V1_0 = 57; + + /* + * Heltec Wireless Tracker with ESP32-S3 CPU, built-in GPS, and TFT + * Older "V1.0" Variant + */ + HELTEC_WIRELESS_TRACKER_V1_0 = 58; + /* * ------------------------------------------------------------------------------------------------------------------------------------------ * Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. @@ -468,6 +570,11 @@ message User { * Also, "long_name" should be their licence number. */ bool is_licensed = 6; + + /* + * Indicates that the user's role in the mesh + */ + Config.DeviceConfig.Role role = 7; } /* @@ -674,6 +781,36 @@ message Waypoint { fixed32 icon = 8; } +/* + * This message will be proxied over the PhoneAPI for the client to deliver to the MQTT server + */ + message MqttClientProxyMessage { + /* + * The MQTT topic this message will be sent /received on + */ + string topic = 1; + + /* + * The actual service envelope payload or text for mqtt pub / sub + */ + oneof payload_variant { + /* + * Bytes + */ + bytes data = 2; + + /* + * Text + */ + string text = 3; + } + + /* + * Whether the message should be retained (or not) + */ + bool retained = 4; +} + /* * A packet envelope sent/received over the mesh * only payload_variant is sent in the payload portion of the LORA packet. @@ -695,9 +832,9 @@ message MeshPacket { * to make sure that critical packets are sent ASAP. * In the case of meshtastic that means we want to send protocol acks as soon as possible * (to prevent unneeded retransmissions), we want routing messages to be sent next, - * then messages marked as reliable and finally ‘background’ packets like periodic position updates. + * then messages marked as reliable and finally 'background' packets like periodic position updates. * So I bit the bullet and implemented a new (internal - not sent over the air) - * field in MeshPacket called ‘priority’. + * field in MeshPacket called 'priority'. * And the transmission queue in the router object is now a priority queue. */ enum Priority { @@ -764,13 +901,11 @@ message MeshPacket { * The sending node number. * Note: Our crypto implementation uses this field as well. * See [crypto](/docs/overview/encryption) for details. - * FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. */ fixed32 from = 1; /* - * The (immediatSee Priority description for more details.y should be fixed32 instead, this encoding only - * hurts the ble link though. + * The (immediate) destination for this packet */ fixed32 to = 2; @@ -815,8 +950,6 @@ message MeshPacket { * any ACK or the completion of a mesh broadcast flood). * Note: Our crypto implementation uses this id as well. * See [crypto](/docs/overview/encryption) for details. - * FIXME - really should be fixed32 instead, this encoding only - * hurts the ble link though. */ fixed32 id = 6; @@ -870,7 +1003,18 @@ message MeshPacket { /* * Describe if this message is delayed */ - Delayed delayed = 13; + Delayed delayed = 13 [deprecated = true]; + + /* + * Describes whether this packet passed via MQTT somewhere along the path it currently took. + */ + bool via_mqtt = 14; + + /* + * Hop limit with which the original packet started. Sent via LoRa using three bits in the unencrypted header. + * When receiving a packet, the difference between hop_start and hop_limit gives how many hops it traveled. + */ + uint32 hop_start = 15; } /* @@ -972,6 +1116,16 @@ message NodeInfo { * local channel index we heard that node on. Only populated if its not the default channel. */ uint32 channel = 7; + + /* + * True if we witnessed the node over MQTT instead of LoRA transport + */ + bool via_mqtt = 8; + + /* + * Number of hops away from us this node is (0 if adjacent) + */ + uint32 hops_away = 9; } /* @@ -1029,7 +1183,7 @@ enum CriticalErrorCode { TRANSMIT_FAILED = 8; /* - * We detected that the main CPU voltage dropped below the minumum acceptable value + * We detected that the main CPU voltage dropped below the minimum acceptable value */ BROWNOUT = 9; @@ -1055,102 +1209,17 @@ message MyNodeInfo { */ uint32 my_node_num = 1; - /* - * Deprecated in 2.1.x (Source from device_metadata) - * Note: This flag merely means we detected a hardware GPS in our node. - * Not the same as UserPreferences.location_sharing - */ - bool has_gps = 2 [deprecated = true]; - - /* - * Deprecated in 2.1.x - * The maximum number of 'software' channels that can be set on this node. - */ - uint32 max_channels = 3 [deprecated = true]; - - /* - * Deprecated in 2.1.x (Source from device_metadata) - * 0.0.5 etc... - */ - string firmware_version = 4 [deprecated = true]; - - /* - * An error message we'd like to report back to the mothership through analytics. - * It indicates a serious bug occurred on the device, the device coped with it, - * but we still want to tell the devs about the bug. - * This field will be cleared after the phone reads MyNodeInfo - * (i.e. it will only be reported once) - * a numeric error code to go with error message, zero means no error - */ - CriticalErrorCode error_code = 5 [deprecated = true]; - - /* - * A numeric error address (nonzero if available) - */ - uint32 error_address = 6 [deprecated = true]; - - /* - * The total number of errors this node has ever encountered - * (well - since the last time we discarded preferences) - */ - uint32 error_count = 7 [deprecated = true]; - /* * The total number of reboots this node has ever encountered * (well - since the last time we discarded preferences) */ uint32 reboot_count = 8; - /* - * Deprecated in 2.1.x - * Calculated bitrate of the current channel (in Bytes Per Second) - */ - float bitrate = 9 [deprecated = true]; - - /* - * Deprecated in 2.1.x - * How long before we consider a message abandoned and we can clear our - * caches of any messages in flight Normally quite large to handle the worst case - * message delivery time, 5 minutes. - * Formerly called FLOOD_EXPIRE_TIME in the device code - */ - uint32 message_timeout_msec = 10 [deprecated = true]; - /* * The minimum app version that can talk to this device. * Phone/PC apps should compare this to their build number and if too low tell the user they must update their app */ uint32 min_app_version = 11; - - /* - * Deprecated in 2.1.x (Only used on device to keep track of utilization) - * 24 time windows of 1hr each with the airtime transmitted out of the device per hour. - */ - repeated uint32 air_period_tx = 12 [deprecated = true]; - - /* - * Deprecated in 2.1.x (Only used on device to keep track of utilization) - * 24 time windows of 1hr each with the airtime of valid packets for your mesh. - */ - repeated uint32 air_period_rx = 13 [deprecated = true]; - - /* - * Deprecated in 2.1.x (Source from DeviceMetadata instead) - * Is the device wifi capable? - */ - bool has_wifi = 14 [deprecated = true]; - - /* - * Deprecated in 2.1.x (Source from DeviceMetrics telemetry payloads) - * Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). - */ - float channel_utilization = 15 [deprecated = true]; - - /* - * Deprecated in 2.1.x (Source from DeviceMetrics telemetry payloads) - * Percent of airtime for transmission used within the last hour. - */ - float air_util_tx = 16 [deprecated = true]; } /* @@ -1320,6 +1389,11 @@ message FromRadio { * Device metadata message */ DeviceMetadata metadata = 13; + + /* + * MQTT Client Proxy Message (device sending to client / phone for publishing to MQTT) + */ + MqttClientProxyMessage mqttClientProxyMessage = 14; } } @@ -1361,6 +1435,11 @@ message ToRadio { */ XModem xmodemPacket = 5; + + /* + * MQTT Client Proxy Message (for client / phone subscribed to MQTT sending to device) + */ + MqttClientProxyMessage mqttClientProxyMessage = 6; } } @@ -1391,10 +1470,15 @@ message NeighborInfo { * Field to pass neighbor info for the next sending cycle */ uint32 last_sent_by_id = 2; + + /* + * Broadcast interval of the represented node (in seconds) + */ + uint32 node_broadcast_interval_secs = 3; /* * The list of out edges from this node */ - repeated Neighbor neighbors = 3; + repeated Neighbor neighbors = 4; } /* @@ -1410,6 +1494,18 @@ message Neighbor { * SNR of last heard message */ float snr = 2; + + /* + * Reception time (in secs since 1970) of last message that was last sent by this ID. + * Note: this is for local storage only and will not be sent out over the mesh. + */ + fixed32 last_rx_time = 3; + + /* + * Broadcast interval of this neighbor (in seconds). + * Note: this is for local storage only and will not be sent out over the mesh. + */ + uint32 node_broadcast_interval_secs = 4; } /* diff --git a/meshtastic/module_config.options b/meshtastic/module_config.options index 32647b3..fdc46d5 100644 --- a/meshtastic/module_config.options +++ b/meshtastic/module_config.options @@ -18,3 +18,11 @@ *RemoteHardwareConfig.available_pins max_count:4 *RemoteHardwarePin.name max_size:15 *RemoteHardwarePin.gpio_pin int_size:8 + +*AmbientLightingConfig.current int_size:8 +*AmbientLightingConfig.red int_size:8 +*AmbientLightingConfig.green int_size:8 +*AmbientLightingConfig.blue int_size:8 + +*DetectionSensorConfig.monitor_pin int_size:8 +*DetectionSensorConfig.name max_size:20 \ No newline at end of file diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index e08fc52..a68a8f5 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -68,6 +68,36 @@ message ModuleConfig { * This is useful if you want to use a single MQTT server for multiple meshtastic networks and separate them via ACLs */ string root = 8; + + /* + * If true, we can use the connected phone / client to proxy messages to MQTT instead of a direct connection + */ + bool proxy_to_client_enabled = 9; + + /* + * If true, we will periodically report unencrypted information about our node to a map via MQTT + */ + bool map_reporting_enabled = 10; + + /* + * Settings for reporting information about our node to a map via MQTT + */ + MapReportSettings map_report_settings = 11; + } + + /* + * Settings for reporting unencrypted information about our node to a map via MQTT + */ + message MapReportSettings { + /* + * How often we should report our info to the map (in seconds) + */ + uint32 publish_interval_secs = 1; + + /* + * Bits of precision for the location sent (default of 32 is full precision). + */ + uint32 position_precision = 2; } /* @@ -106,6 +136,57 @@ message ModuleConfig { uint32 update_interval = 2; } + /* + * Detection Sensor Module Config + */ + message DetectionSensorConfig { + /* + * Whether the Module is enabled + */ + bool enabled = 1; + + /* + * Interval in seconds of how often we can send a message to the mesh when a state change is detected + */ + uint32 minimum_broadcast_secs = 2; + + /* + * Interval in seconds of how often we should send a message to the mesh with the current state regardless of changes + * When set to 0, only state changes will be broadcasted + * Works as a sort of status heartbeat for peace of mind + */ + uint32 state_broadcast_secs = 3; + /* + * Send ASCII bell with alert message + * Useful for triggering ext. notification on bell + */ + bool send_bell = 4; + + /* + * Friendly name used to format message sent to mesh + * Example: A name "Motion" would result in a message "Motion detected" + * Maximum length of 20 characters + */ + string name = 5; + + /* + * GPIO pin to monitor for state changes + */ + uint32 monitor_pin = 6; + + /* + * Whether or not the GPIO pin state detection is triggered on HIGH (1) + * Otherwise LOW (0) + */ + bool detection_triggered_high = 7; + + /* + * Whether or not use INPUT_PULLUP mode for GPIO pin + * Only applicable if the board uses pull-up resistors on the pin + */ + bool use_pullup = 8; + } + /* * Audio Config for codec2 voice */ @@ -161,6 +242,23 @@ message ModuleConfig { uint32 i2s_sck = 7; } + /* + * Config for the Paxcounter Module + */ + message PaxcounterConfig { + /* + * Enable the Paxcounter Module + */ + bool enabled = 1; + + /* + * Interval in seconds of how often we should try to send our + * metrics to the mesh + */ + + uint32 paxcounter_update_interval = 2; + } + /* * Serial Config */ @@ -326,6 +424,12 @@ message ModuleConfig { * and/or beep for 60 seconds */ uint32 nag_timeout = 14; + + /* + * When true, enables devices with native I2S audio output to use the RTTTL over speaker like a buzzer + * T-Watch S3 and T-Deck for example have this capability + */ + bool use_i2s_as_buzzer = 15; } /* @@ -423,6 +527,24 @@ message ModuleConfig { * air quality metrics to the mesh */ uint32 air_quality_interval = 7; + + /* + * Interval in seconds of how often we should try to send our + * air quality metrics to the mesh + */ + bool power_measurement_enabled = 8; + + /* + * Interval in seconds of how often we should try to send our + * air quality metrics to the mesh + */ + uint32 power_update_interval = 9; + + /* + * Interval in seconds of how often we should try to send our + * air quality metrics to the mesh + */ + bool power_screen_enabled = 10; } /* @@ -542,6 +664,38 @@ message ModuleConfig { bool send_bell = 11; } + /* + Ambient Lighting Module - Settings for control of onboard LEDs to allow users to adjust the brightness levels and respective color levels. + Initially created for the RAK14001 RGB LED module. + */ + message AmbientLightingConfig { + + /* + * Sets LED to on or off. + */ + bool led_state = 1; + + /* + * Sets the current for the LED output. Default is 10. + */ + uint32 current = 2; + + /* + * Sets the red LED level. Values are 0-255. + */ + uint32 red = 3; + + /* + * Sets the green LED level. Values are 0-255. + */ + uint32 green = 4; + + /* + * Sets the blue LED level. Values are 0-255. + */ + uint32 blue = 5; + } + /* * TODO: REPLACE */ @@ -595,11 +749,26 @@ message ModuleConfig { * TODO: REPLACE */ NeighborInfoConfig neighbor_info = 10; + + /* + * TODO: REPLACE + */ + AmbientLightingConfig ambient_lighting = 11; /* * TODO: REPLACE */ - TakConfig tak = 11; + DetectionSensorConfig detection_sensor = 12; + + /* + * TODO: REPLACE + */ + PaxcounterConfig paxcounter = 13; + + /* + * TODO: REPLACE + */ + TakConfig tak = 14; } } diff --git a/meshtastic/mqtt.options b/meshtastic/mqtt.options index 261a74b..591e898 100644 --- a/meshtastic/mqtt.options +++ b/meshtastic/mqtt.options @@ -1,3 +1,8 @@ *ServiceEnvelope.packet type:FT_POINTER *ServiceEnvelope.channel_id type:FT_POINTER -*ServiceEnvelope.gateway_id type:FT_POINTER \ No newline at end of file +*ServiceEnvelope.gateway_id type:FT_POINTER + +*MapReport.long_name max_size:40 +*MapReport.short_name max_size:5 +*MapReport.firmware_version max_size:18 +*MapReport.num_online_local_nodes int_size:16 \ No newline at end of file diff --git a/meshtastic/mqtt.proto b/meshtastic/mqtt.proto index 0487f33..17ebf0e 100644 --- a/meshtastic/mqtt.proto +++ b/meshtastic/mqtt.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package meshtastic; import "meshtastic/mesh.proto"; +import "meshtastic/config.proto"; option csharp_namespace = "Meshtastic.Protobufs"; option go_package = "github.com/meshtastic/go/generated"; @@ -31,3 +32,75 @@ message ServiceEnvelope { */ string gateway_id = 3; } + +/* + * Information about a node intended to be reported unencrypted to a map using MQTT. + */ +message MapReport { + /* + * A full name for this user, i.e. "Kevin Hester" + */ + string long_name = 1; + + /* + * A VERY short name, ideally two characters. + * Suitable for a tiny OLED screen + */ + string short_name = 2; + + /* + * Role of the node that applies specific settings for a particular use-case + */ + Config.DeviceConfig.Role role = 3; + + /* + * Hardware model of the node, i.e. T-Beam, Heltec V3, etc... + */ + HardwareModel hw_model = 4; + + /* + * Device firmware version string + */ + string firmware_version = 5; + + /* + * The region code for the radio (US, CN, EU433, etc...) + */ + Config.LoRaConfig.RegionCode region = 6; + + /* + * Modem preset used by the radio (LongFast, MediumSlow, etc...) + */ + Config.LoRaConfig.ModemPreset modem_preset = 7; + + /* + * Whether the node has a channel with default PSK and name (LongFast, MediumSlow, etc...) + * and it uses the default frequency slot given the region and modem preset. + */ + bool has_default_channel = 8; + + /* + * Latitude: multiply by 1e-7 to get degrees in floating point + */ + sfixed32 latitude_i = 9; + + /* + * Longitude: multiply by 1e-7 to get degrees in floating point + */ + sfixed32 longitude_i = 10; + + /* + * Altitude in meters above MSL + */ + int32 altitude = 11; + + /* + * Indicates the bits of precision for latitude and longitude set by the sending node + */ + uint32 position_precision = 12; + + /* + * Number of online nodes (heard in the last 2 hours) this node has in its list that were received locally (not via MQTT) + */ + uint32 num_online_local_nodes = 13; +} \ No newline at end of file diff --git a/meshtastic/paxcount.proto b/meshtastic/paxcount.proto new file mode 100644 index 0000000..47b2639 --- /dev/null +++ b/meshtastic/paxcount.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +package meshtastic; + +option csharp_namespace = "Meshtastic.Protobufs"; +option go_package = "github.com/meshtastic/go/generated"; +option java_outer_classname = "PaxcountProtos"; +option java_package = "com.geeksville.mesh"; +option swift_prefix = ""; + +/* + * TODO: REPLACE + */ +message Paxcount { + /* + * seen Wifi devices + */ + uint32 wifi = 1; + + /* + * Seen BLE devices + */ + uint32 ble = 2; + + /* + * Uptime in seconds + */ + uint32 uptime = 3; +} diff --git a/meshtastic/portnums.proto b/meshtastic/portnums.proto index 0fee327..b02651a 100644 --- a/meshtastic/portnums.proto +++ b/meshtastic/portnums.proto @@ -27,6 +27,7 @@ enum PortNum { * Deprecated: do not use in new code (formerly called OPAQUE) * A message sent from a device outside of the mesh, in a form the mesh does not understand * NOTE: This must be 0, because it is documented in IMeshService.aidl to be so + * ENCODING: binary undefined */ UNKNOWN_APP = 0; @@ -34,89 +35,123 @@ enum PortNum { * A simple UTF-8 text message, which even the little micros in the mesh * can understand and show on their screen eventually in some circumstances * even signal might send messages in this form (see below) + * ENCODING: UTF-8 Plaintext (?) */ TEXT_MESSAGE_APP = 1; /* * Reserved for built-in GPIO/example app. * See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number + * ENCODING: Protobuf */ REMOTE_HARDWARE_APP = 2; /* * The built-in position messaging app. - * Payload is a [Position](/docs/developers/protobufs/api#position) message + * Payload is a Position message. + * ENCODING: Protobuf */ POSITION_APP = 3; /* * The built-in user info app. - * Payload is a [User](/docs/developers/protobufs/api#user) message + * Payload is a User message. + * ENCODING: Protobuf */ NODEINFO_APP = 4; /* * Protocol control packets for mesh protocol use. - * Payload is a [Routing](/docs/developers/protobufs/api#routing) message + * Payload is a Routing message. + * ENCODING: Protobuf */ ROUTING_APP = 5; /* * Admin control packets. - * Payload is a [AdminMessage](/docs/developers/protobufs/api#adminmessage) message + * Payload is a AdminMessage message. + * ENCODING: Protobuf */ ADMIN_APP = 6; /* * Compressed TEXT_MESSAGE payloads. + * ENCODING: UTF-8 Plaintext (?) with Unishox2 Compression + * NOTE: The Device Firmware converts a TEXT_MESSAGE_APP to TEXT_MESSAGE_COMPRESSED_APP if the compressed + * payload is shorter. There's no need for app developers to do this themselves. Also the firmware will decompress + * any incoming TEXT_MESSAGE_COMPRESSED_APP payload and convert to TEXT_MESSAGE_APP. */ TEXT_MESSAGE_COMPRESSED_APP = 7; /* * Waypoint payloads. - * Payload is a [Waypoint](/docs/developers/protobufs/api#waypoint) message + * Payload is a Waypoint message. + * ENCODING: Protobuf */ WAYPOINT_APP = 8; - /* Audio Payloads. + /* + * Audio Payloads. * Encapsulated codec2 packets. On 2.4 GHZ Bandwidths only for now + * ENCODING: codec2 audio frames + * NOTE: audio frames contain a 3 byte header (0xc0 0xde 0xc2) and a one byte marker for the decompressed bitrate. + * This marker comes from the 'moduleConfig.audio.bitrate' enum minus one. */ AUDIO_APP = 9; + /* + * Same as Text Message but originating from Detection Sensor Module. + * NOTE: This portnum traffic is not sent to the public MQTT starting at firmware version 2.2.9 + */ + DETECTION_SENSOR_APP = 10; + /* * Provides a 'ping' service that replies to any packet it receives. * Also serves as a small example module. + * ENCODING: ASCII Plaintext */ REPLY_APP = 32; /* * Used for the python IP tunnel feature + * ENCODING: IP Packet. Handled by the python API, firmware ignores this one and pases on. */ IP_TUNNEL_APP = 33; + /* + * Paxcounter lib included in the firmware + * ENCODING: protobuf + */ + PAXCOUNTER_APP = 34; + /* * Provides a hardware serial interface to send and receive from the Meshtastic network. * Connect to the RX/TX pins of a device with 38400 8N1. Packets received from the Meshtastic * network is forwarded to the RX pin while sending a packet to TX will go out to the Mesh network. * Maximum packet size of 240 bytes. * Module is disabled by default can be turned on by setting SERIAL_MODULE_ENABLED = 1 in SerialPlugh.cpp. + * ENCODING: binary undefined */ SERIAL_APP = 64; /* * STORE_FORWARD_APP (Work in Progress) * Maintained by Jm Casler (MC Hamster) : jm@casler.org + * ENCODING: Protobuf */ STORE_FORWARD_APP = 65; /* * Optional port for messages for the range test module. + * ENCODING: ASCII Plaintext + * NOTE: This portnum traffic is not sent to the public MQTT starting at firmware version 2.2.9 */ RANGE_TEST_APP = 66; /* * Provides a format to send and receive telemetry data from the Meshtastic network. * Maintained by Charles Crossan (crossan007) : crossan007@gmail.com + * ENCODING: Protobuf */ TELEMETRY_APP = 67; @@ -124,6 +159,7 @@ enum PortNum { * Experimental tools for estimating node position without a GPS * Maintained by Github user a-f-G-U-C (a Meshtastic contributor) * Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS + * ENCODING: arrays of int64 fields */ ZPS_APP = 68; @@ -132,19 +168,33 @@ enum PortNum { * as if they did using their LoRa chip. * Maintained by GitHub user GUVWAF. * Project files at https://github.com/GUVWAF/Meshtasticator + * ENCODING: Protobuf (?) */ SIMULATOR_APP = 69; /* * Provides a traceroute functionality to show the route a packet towards * a certain destination would take on the mesh. + * ENCODING: Protobuf */ TRACEROUTE_APP = 70; /* * Aggregates edge info for the network by sending out a list of each node's neighbors + * ENCODING: Protobuf */ NEIGHBORINFO_APP = 71; + + /* + * ATAK Plugin + * Portnum for payloads from the official Meshtastic ATAK plugin + */ + ATAK_PLUGIN = 72; + + /* + * Provides unencrypted information about a node for consumption by a map via MQTT + */ + MAP_REPORT_APP = 73; /* * Private applications should use portnums >= 256. @@ -155,6 +205,7 @@ enum PortNum { /* * ATAK Forwarder Module https://github.com/paulmandal/atak-forwarder + * ENCODING: libcotshrink */ ATAK_FORWARDER = 257; @@ -162,4 +213,4 @@ enum PortNum { * Currently we limit port nums to no higher than this value */ MAX = 511; -} +} \ No newline at end of file diff --git a/meshtastic/storeforward.options b/meshtastic/storeforward.options new file mode 100644 index 0000000..8580aab --- /dev/null +++ b/meshtastic/storeforward.options @@ -0,0 +1 @@ +*StoreAndForward.text max_size:237 \ No newline at end of file diff --git a/meshtastic/storeforward.proto b/meshtastic/storeforward.proto index 425edf9..ef7de2c 100644 --- a/meshtastic/storeforward.proto +++ b/meshtastic/storeforward.proto @@ -58,6 +58,16 @@ message StoreAndForward { */ ROUTER_STATS = 7; + /* + * Router sends a text message from its history that was a direct message. + */ + ROUTER_TEXT_DIRECT = 8; + + /* + * Router sends a text message from its history that was a broadcast. + */ + ROUTER_TEXT_BROADCAST = 9; + /* * Client is an in error state. */ @@ -130,12 +140,12 @@ message StoreAndForward { bool heartbeat = 7; /* - * Is the heartbeat enabled on the server? + * Maximum number of messages the server will return. */ uint32 return_max = 8; /* - * Is the heartbeat enabled on the server? + * Maximum history window in minutes the server will return messages from. */ uint32 return_window = 9; } @@ -155,7 +165,8 @@ message StoreAndForward { uint32 window = 2; /* - * The window of messages that was used to filter the history client requested + * Index in the packet history of the last message sent in a previous request to the server. + * Will be sent to the client before sending the history and can be set in a subsequent request to avoid getting packets the server already sent to the client. */ uint32 last_request = 3; } @@ -165,7 +176,7 @@ message StoreAndForward { */ message Heartbeat { /* - * Number of that will be sent to the client + * Period in seconds that the heartbeat is sent out that will be sent to the client */ uint32 period = 1; @@ -200,8 +211,8 @@ message StoreAndForward { Heartbeat heartbeat = 4; /* - * Empty Payload + * Text from history message. */ - bool empty = 5; + bytes text = 5; } -} +} \ No newline at end of file diff --git a/meshtastic/telemetry.proto b/meshtastic/telemetry.proto index 777653f..282b32c 100644 --- a/meshtastic/telemetry.proto +++ b/meshtastic/telemetry.proto @@ -53,21 +53,56 @@ message EnvironmentMetrics { float barometric_pressure = 3; /* - * Gas resistance in mOhm measured + * Gas resistance in MOhm measured */ float gas_resistance = 4; /* - * Voltage measured + * Voltage measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x) */ float voltage = 5; /* - * Current measured + * Current measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x) */ float current = 6; } +/* + * Power Metrics (voltage / current / etc) + */ +message PowerMetrics { + /* + * Voltage (Ch1) + */ + float ch1_voltage = 1; + + /* + * Current (Ch1) + */ + float ch1_current = 2; + + /* + * Voltage (Ch2) + */ + float ch2_voltage = 3; + + /* + * Current (Ch2) + */ + float ch2_current = 4; + + /* + * Voltage (Ch3) + */ + float ch3_voltage = 5; + + /* + * Current (Ch3) + */ + float ch3_current = 6; +} + /* * Air quality metrics */ @@ -138,11 +173,7 @@ message AirQualityMetrics { */ message Telemetry { /* - * This is usually not sent over the mesh (to save space), but it is sent - * from the phone so that the local device can set its RTC If it is sent over - * the mesh (because there are devices on the mesh without GPS), it will only - * be sent by devices which has a hardware GPS clock (IE Mobile Phone). - * seconds since 1970 + * Seconds since 1970 - or 0 for unknown/unset */ fixed32 time = 1; @@ -161,6 +192,11 @@ message Telemetry { * Air quality metrics */ AirQualityMetrics air_quality_metrics = 4; + + /* + * Power Metrics + */ + PowerMetrics power_metrics = 5; } } @@ -237,4 +273,15 @@ enum TelemetrySensorType { * PM2.5 air quality sensor */ PMSA003I = 13; + + /* + * INA3221 3 Channel Voltage / Current Sensor + */ + INA3221 = 14; + + /* + * BMP085/BMP180 High accuracy temperature and pressure (older Version of BMP280) + */ + BMP085 = 15; + }