feat(mqtt): peer-namespaced talker topics
External (peer-side) talker events move from flat talker/<tg>/start with is_trunk=true to peer/<peer_id>/talker/<tg>/start. Local-only talker/<tg>/start retains today's behavior. To carry peer_id through the signal path: add peer_id as a 4th argument to TGHandler::trunkTalkerUpdated; reorder clearTrunkTalkerForTG / clearTrunkTalkersForPeer / clearAllTrunkTalkers so the signal fires before m_trunk_talker_peer_ids is erased; pre-populate m_trunk_talker_peer_ids in setTrunkTalkerForTGViaPeer before calling the inner setter; switch TrunkLink::handleMsgPeerTalkerStart from setTrunkTalkerForTG to setTrunkTalkerForTGViaPeer. Reasons: dashboards subscribing across the mesh can now use peer/+/talker/+/start to enumerate peer talkers without parsing the is_trunk payload flag, and the namespacing aligns with the new peer/<peer_id>/client/<call>/* topics added in Tasks 5-6.
This commit is contained in:
1 parent
81672bae23
commit
af746d7534
8 files changed
+105
-34
No files matched your search
@@ -262,6 +262,34 @@ void MqttPublisher::onTalkerStop(uint32_t tg, const std::string& callsign,
|
||||
}
|
||||
|
||||
|
||||
void MqttPublisher::onPeerTalkerStart(const std::string& peer_id,
|
||||
uint32_t tg,
|
||||
const std::string& callsign)
|
||||
{
|
||||
Json::Value payload;
|
||||
payload["callsign"] = callsign;
|
||||
payload["tg"] = static_cast<Json::UInt>(tg);
|
||||
Json::StreamWriterBuilder wb;
|
||||
wb["indentation"] = "";
|
||||
string topic = "peer/" + peer_id + "/talker/" + to_string(tg) + "/start";
|
||||
publish(topic, Json::writeString(wb, payload));
|
||||
}
|
||||
|
||||
|
||||
void MqttPublisher::onPeerTalkerStop(const std::string& peer_id,
|
||||
uint32_t tg,
|
||||
const std::string& callsign)
|
||||
{
|
||||
Json::Value payload;
|
||||
payload["callsign"] = callsign;
|
||||
payload["tg"] = static_cast<Json::UInt>(tg);
|
||||
Json::StreamWriterBuilder wb;
|
||||
wb["indentation"] = "";
|
||||
string topic = "peer/" + peer_id + "/talker/" + to_string(tg) + "/stop";
|
||||
publish(topic, Json::writeString(wb, payload));
|
||||
}
|
||||
|
||||
|
||||
void MqttPublisher::onClientConnected(const std::string& callsign,
|
||||
uint32_t tg, const std::string& ip)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user