41 #ifndef PJON_ROUTER_TABLE_SIZE
42 #define PJON_ROUTER_TABLE_SIZE 100
45 #include "PJONRouter.h"
51 void add_sender_to_routing_table(
56 uint8_t start_search = 0;
57 uint8_t found_bus = find_bus_with_id(
58 packet_info.tx.bus_id,
63 if(found_bus == PJON_NOT_ASSIGNED) {
64 add(packet_info.tx.bus_id, sender_bus);
68 virtual void dynamic_receiver_function(
75 add_sender_to_routing_table(packet_info, current_bus);
76 PJONSwitch::dynamic_receiver_function(payload, length, packet_info);
85 uint8_t default_gateway = PJON_NOT_ASSIGNED
86 ) :
PJONRouter(bus_count, buses, default_gateway) { };
90 template<
class A,
class B>
101 busA.set_link(&linkA);
102 busB.set_link(&linkB);
105 PJONAny &get_bus(
const uint8_t ix)
107 return ix == 0 ? busA : busB;
112 return linkA.strategy;
116 return linkB.strategy;
121 template<
class A,
class B,
class C>
131 PJON<Any> *buses[3] = { &busA, &busB, &busC };
133 busA.set_link(&linkA);
134 busB.set_link(&linkB);
135 busC.set_link(&linkC);
138 PJONAny &get_bus(
const uint8_t ix)
140 return ix == 0 ? busA : (ix == 1 ? busB : busC);
145 return linkA.strategy;
149 return linkB.strategy;
153 return linkC.strategy;