mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 01:52:48 +00:00
Router
This commit is contained in:
parent
e01e830c0e
commit
654d38ed3f
@ -192,12 +192,6 @@ void printBytes(const char *label, const uint8_t *p, size_t numbytes)
|
||||
*/
|
||||
ErrorCode Router::send(meshtastic_MeshPacket *p)
|
||||
{
|
||||
// Skip the normal ceremony for repeaters
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||
assert(iface);
|
||||
return iface->send(p);
|
||||
}
|
||||
|
||||
if (p->to == nodeDB.getNodeNum()) {
|
||||
LOG_ERROR("BUG! send() called with packet destined for local node!\n");
|
||||
packetPool.release(p);
|
||||
|
@ -9,10 +9,17 @@ RepeaterModule *repeaterModule;
|
||||
|
||||
bool RepeaterModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Routing *r)
|
||||
{
|
||||
printPacket("Repeater rebroadcasting message", &mp);
|
||||
meshtastic_MeshPacket *p = const_cast<meshtastic_MeshPacket *>(&mp);
|
||||
router->send(p);
|
||||
return true;
|
||||
printPacket("Repeater observed message", &mp);
|
||||
router->sniffReceived(&mp, r);
|
||||
|
||||
// FIXME - move this to a non promsicious PhoneAPI module?
|
||||
// Note: we are careful not to send back packets that started with the phone back to the phone
|
||||
if ((mp.to == NODENUM_BROADCAST || mp.to == nodeDB.getNodeNum()) && (mp.from != 0)) {
|
||||
printPacket("Delivering rx packet", &mp);
|
||||
service.handleFromRadio(&mp);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
meshtastic_MeshPacket *RepeaterModule::allocReply()
|
||||
|
Loading…
Reference in New Issue
Block a user