add support for direct paths when sending group data

This commit is contained in:
liamcottle 2026-03-23 21:46:21 +13:00
parent 91aed048e9
commit ed326255d5
3 changed files with 25 additions and 4 deletions

View file

@ -481,7 +481,7 @@ bool BaseChatMesh::sendGroupMessage(uint32_t timestamp, mesh::GroupChannel& chan
return false;
}
bool BaseChatMesh::sendGroupData(mesh::GroupChannel& channel, uint16_t data_type, const uint8_t* data, int data_len) {
bool BaseChatMesh::sendGroupData(mesh::GroupChannel& channel, uint8_t* path, uint8_t path_len, uint16_t data_type, const uint8_t* data, int data_len) {
if (data_len < 0) {
MESH_DEBUG_PRINTLN("sendGroupData: invalid negative data_len=%d", data_len);
return false;
@ -502,7 +502,13 @@ bool BaseChatMesh::sendGroupData(mesh::GroupChannel& channel, uint16_t data_type
MESH_DEBUG_PRINTLN("sendGroupData: unable to create group datagram, data_len=%d", data_len);
return false;
}
sendFloodScoped(channel, pkt);
if (path_len == OUT_PATH_UNKNOWN) {
sendFloodScoped(channel, pkt);
} else {
sendDirect(pkt, path, path_len);
}
return true;
}

View file

@ -150,7 +150,7 @@ public:
int sendMessage(const ContactInfo& recipient, uint32_t timestamp, uint8_t attempt, const char* text, uint32_t& expected_ack, uint32_t& est_timeout);
int sendCommandData(const ContactInfo& recipient, uint32_t timestamp, uint8_t attempt, const char* text, uint32_t& est_timeout);
bool sendGroupMessage(uint32_t timestamp, mesh::GroupChannel& channel, const char* sender_name, const char* text, int text_len);
bool sendGroupData(mesh::GroupChannel& channel, uint16_t data_type, const uint8_t* data, int data_len);
bool sendGroupData(mesh::GroupChannel& channel, uint8_t* path, uint8_t path_len, uint16_t data_type, const uint8_t* data, int data_len);
int sendLogin(const ContactInfo& recipient, const char* password, uint32_t& est_timeout);
int sendAnonReq(const ContactInfo& recipient, const uint8_t* data, uint8_t len, uint32_t& tag, uint32_t& est_timeout);
int sendRequest(const ContactInfo& recipient, uint8_t req_type, uint32_t& tag, uint32_t& est_timeout);