4848#define REQ_TYPE_GET_TELEMETRY_DATA 0x03
4949#define REQ_TYPE_GET_ACCESS_LIST 0x05
5050#define REQ_TYPE_GET_NEIGHBOURS 0x06
51+ #define REQ_TYPE_GET_OWNER_INFO 0x07
5152
5253#define RESP_SERVER_LOGIN_OK 0 // response to ANON_REQ
5354
5455#define ANON_REQ_TYPE_REGIONS 0x01
55- #define ANON_REQ_TYPE_VER_OWNER 0x02
56- #define ANON_REQ_TYPE_VER 0x03
56+ #define ANON_REQ_TYPE_OWNER 0x02
57+ #define ANON_REQ_TYPE_BASIC 0x03 // just remote clock
5758
5859#define CLI_REPLY_DELAY_MILLIS 600
5960
@@ -159,7 +160,7 @@ uint8_t MyMesh::handleAnonRegionsReq(const mesh::Identity& sender, uint32_t send
159160 return 0 ;
160161}
161162
162- uint8_t MyMesh::handleAnonVerOwnerReq (const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t * data) {
163+ uint8_t MyMesh::handleAnonOwnerReq (const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t * data) {
163164 if (anon_limiter.allow (rtc_clock.getCurrentTime ())) {
164165 // request data has: {reply-path-len}{reply-path}
165166 reply_path_len = *data++ & 0x3F ;
@@ -169,14 +170,14 @@ uint8_t MyMesh::handleAnonVerOwnerReq(const mesh::Identity& sender, uint32_t sen
169170 memcpy (reply_data, &sender_timestamp, 4 ); // prefix with sender_timestamp, like a tag
170171 uint32_t now = getRTCClock ()->getCurrentTime ();
171172 memcpy (&reply_data[4 ], &now, 4 ); // include our clock (for easy clock sync, and packet hash uniqueness)
172- sprintf ((char *) &reply_data[8 ], " %s\n %s\n %s " , FIRMWARE_VERSION , _prefs.node_name , _prefs.owner_info );
173+ sprintf ((char *) &reply_data[8 ], " %s\n %s" , _prefs.node_name , _prefs.owner_info );
173174
174175 return 8 + strlen ((char *) &reply_data[8 ]); // reply length
175176 }
176177 return 0 ;
177178}
178179
179- uint8_t MyMesh::handleAnonVerReq (const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t * data) {
180+ uint8_t MyMesh::handleAnonClockReq (const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t * data) {
180181 if (anon_limiter.allow (rtc_clock.getCurrentTime ())) {
181182 // request data has: {reply-path-len}{reply-path}
182183 reply_path_len = *data++ & 0x3F ;
@@ -186,9 +187,16 @@ uint8_t MyMesh::handleAnonVerReq(const mesh::Identity& sender, uint32_t sender_t
186187 memcpy (reply_data, &sender_timestamp, 4 ); // prefix with sender_timestamp, like a tag
187188 uint32_t now = getRTCClock ()->getCurrentTime ();
188189 memcpy (&reply_data[4 ], &now, 4 ); // include our clock (for easy clock sync, and packet hash uniqueness)
189- strcpy ((char *) &reply_data[8 ], FIRMWARE_VERSION);
190-
191- return 8 + strlen ((char *) &reply_data[8 ]); // reply length
190+ reply_data[8 ] = 0 ; // features
191+ #ifdef WITH_RS232_BRIDGE
192+ reply_data[8 ] |= 0x01 ; // is bridge, type UART
193+ #elif WITH_ESPNOW_BRIDGE
194+ reply_data[8 ] |= 0x03 ; // is bridge, type ESP-NOW
195+ #endif
196+ if (_prefs.disable_fwd ) { // is this repeater currently disabled
197+ reply_data[8 ] |= 0x80 ; // is disabled
198+ }
199+ return 9 ; // reply length
192200 }
193201 return 0 ;
194202}
@@ -350,6 +358,9 @@ int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t
350358
351359 return reply_offset;
352360 }
361+ } else if (payload[0 ] == REQ_TYPE_GET_OWNER_INFO) {
362+ sprintf ((char *) &reply_data[4 ], " %s\n %s" , FIRMWARE_VERSION, _prefs.owner_info );
363+ return 4 + strlen ((char *) &reply_data[4 ]);
353364 }
354365 return 0 ; // unknown command
355366}
@@ -508,10 +519,10 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
508519 reply_len = handleLoginReq (sender, secret, timestamp, &data[4 ], packet->isRouteFlood ());
509520 } else if (data[4 ] == ANON_REQ_TYPE_REGIONS && packet->isRouteDirect ()) {
510521 reply_len = handleAnonRegionsReq (sender, timestamp, &data[5 ]);
511- } else if (data[4 ] == ANON_REQ_TYPE_VER_OWNER && packet->isRouteDirect ()) {
512- reply_len = handleAnonVerOwnerReq (sender, timestamp, &data[5 ]);
513- } else if (data[4 ] == ANON_REQ_TYPE_VER && packet->isRouteDirect ()) {
514- reply_len = handleAnonVerReq (sender, timestamp, &data[5 ]);
522+ } else if (data[4 ] == ANON_REQ_TYPE_OWNER && packet->isRouteDirect ()) {
523+ reply_len = handleAnonOwnerReq (sender, timestamp, &data[5 ]);
524+ } else if (data[4 ] == ANON_REQ_TYPE_BASIC && packet->isRouteDirect ()) {
525+ reply_len = handleAnonClockReq (sender, timestamp, &data[5 ]);
515526 } else {
516527 reply_len = 0 ; // unknown/invalid request type
517528 }
@@ -700,7 +711,9 @@ bool MyMesh::onPeerPathRecv(mesh::Packet *packet, int sender_idx, const uint8_t
700711
701712void MyMesh::onControlDataRecv (mesh::Packet* packet) {
702713 uint8_t type = packet->payload [0 ] & 0xF0 ; // just test upper 4 bits
703- if (type == CTL_TYPE_NODE_DISCOVER_REQ && packet->payload_len >= 6 && discover_limiter.allow (rtc_clock.getCurrentTime ())) {
714+ if (type == CTL_TYPE_NODE_DISCOVER_REQ && packet->payload_len >= 6
715+ && !_prefs.disable_fwd && discover_limiter.allow (rtc_clock.getCurrentTime ())
716+ ) {
704717 int i = 1 ;
705718 uint8_t filter = packet->payload [i++];
706719 uint32_t tag;
0 commit comments