feat: Add support for PAYLOAD_TYPE_GRP_DATA#1928
feat: Add support for PAYLOAD_TYPE_GRP_DATA#1928dz0ny wants to merge 10 commits intomeshcore-dev:devfrom
Conversation
dz0ny
commented
Mar 5, 2026
- Docs changes are to reflect how it is currently in fw
- This adds ability to send datagram data to everyone in channel
There was a problem hiding this comment.
Pull request overview
Adds channel-wide binary datagram support by introducing PAYLOAD_TYPE_GRP_DATA handling and exposing it through the companion radio example + protocol docs, enabling non-text payloads to be broadcast to all members of a group channel.
Changes:
- Add a new
onChannelDataRecv()hook andsendGroupData()API to the chat mesh helper layer. - Handle inbound
PAYLOAD_TYPE_GRP_DATApackets and forward them to the new callback. - Update the companion radio example and companion protocol docs to support/send/parse channel payloads beyond plain UTF-8 text.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/helpers/BaseChatMesh.h | Adds onChannelDataRecv() virtual + sendGroupData() API. |
| src/helpers/BaseChatMesh.cpp | Routes PAYLOAD_TYPE_GRP_DATA to the new callback; implements sendGroupData(). |
| examples/companion_radio/MyMesh.h | Declares override for onChannelDataRecv(). |
| examples/companion_radio/MyMesh.cpp | Implements channel data receive framing + sends non-plain channel payloads via sendGroupData(). |
| docs/companion_protocol.md | Updates protocol docs to describe channel payload semantics and OK/error responses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a54a351 to
965c40c
Compare
|
Howdy, thanks for the PR! We have a previously opened PR for similar functionality here #1530. We left some review comments on it, but it was never followed up so didn't get merged. I noticed in this PR you have merged both group text and group data into the single
We also need to have a distinct payload type at the start of the raw group data as well, so we can reserve certain types for specific tasks. I have some more info about this in the previous PR comments. |
|
Ah, the SOS, reaction thing yep. Pushed changes, so one can specify type and then binary 0xff is for custom apps. |
965c40c to
d448c1e
Compare
|
@liamcottle Should users be allowed to send packets on idx=0 (the public channel)? I think maybe not the 0xff type, but the others should be allowed. What do you think? I know users want SOS, REACTION types, so those should be allowed. Just custom protocols probably not. |
liamcottle
left a comment
There was a problem hiding this comment.
Looking good, thanks for your changes so far. Please see some extra comments.
I'll discuss this one with Scott. |
|
We should probably go with |
Docs changes are to reflect how it is currently in fw This adds ability to send datagram data to everyone in channel
cd7557d to
f25d7a8
Compare
|
Addressed the current review items in 2fe3c36 |
Sounds a bit premature optimization. App author can wire their own type in paylaod and this would be the only such type while the protocol uses uint8_t. |
| uint8_t txt_type = data[4]; | ||
| if (type == PAYLOAD_TYPE_GRP_TXT && len > 5 && (txt_type >> 2) == 0) { // 0 = plain text msg | ||
| if (type == PAYLOAD_TYPE_GRP_TXT) { | ||
| if (len < 5) { |
There was a problem hiding this comment.
old check was if len > 5 (disallowing exactly 5) and new logic is len < 5, which means exactly 5 is now allowed? Will this be problematic?
Looking good! Thank you for the updates :) |
After discussions with Scott, I think we should go with Meshtastic does similar with their portnums, which goes up to 500+ IDs. Ideally, in your MeshCore SAR app, the MeshCore project would allocate you a "unique ID" from the It was noted that if everyone is using I also think it would be beneficial to provide a larger pool of development/prototype ids, such as I would suggest to go with the larger pool from day one. I'd expect we would eat up ~256 unique application/type ids pretty quickly at the rate we are seeing networks grow, and new custom applications come about. One could argue that we could just use a custom channel key to segregate applications, such as "#meshcore-sar", but I can see usefulness in being able to send "well known" payload types to any channel. For example, we could have a new "share contact" payload, and allow that to be sent to any channel. |
|
Could you please change the base branch to 'dev'? |
|
Looks good, but I'd rather drop the enforced 'timestamp' field in all the methods (and the new companion protocol parts), and just have a data byte array (with explicit data_len). If various data_types need a timestamp they can just include one. |
|
@ripplebiz changed to dev, you can merge now. |