Переглянути джерело

* repeater login response, FIRMWARE_VER_LEVEL now bumped to 2

Scott Powell 7 місяців тому
батько
коміт
69a71d0e25
2 змінених файлів з 56 додано та 4 видалено
  1. 52 1
      docs/payloads.md
  2. 4 3
      examples/simple_repeater/MyMesh.cpp

+ 52 - 1
docs/payloads.md

@@ -103,7 +103,9 @@ Request type
 | `0x02` | keepalive            | (deprecated) |
 | `0x03` | get telemetry data   | TODO |
 | `0x04` | get min,max,avg data | sensor nodes - get min, max, average for given time span |
-| `0x05` | get access list      | get node's approved access list       |
+| `0x05` | get access list      | get node's approved access list            |
+| `0x06` | get neighbors        | get repeater node's neighbors              |
+| `0x07` | get owner info       | get repeater firmware-ver/name/owner info  |
 
 ### Get stats
 
@@ -132,6 +134,27 @@ Gets information about the node, possibly including the following:
 
 Request data about sensors on the node, including battery level.
 
+### Get Telemetry
+
+TODO
+
+### Get Min/Max/Ave  (Sensor nodes)
+
+TODO
+
+### Get Access List
+
+TODO
+
+### Get Neighors
+
+TODO
+
+### Get Owner Info
+
+TODO
+
+
 ## Response
 
 | Field   | Size (bytes)    | Description |
@@ -179,6 +202,34 @@ txt_type
 | timestamp      | 4               | sender time (unix timestamp)                                                  |
 | password       | rest of message | password for repeater/sensor                                                  |
 
+## Repeater - Regions request
+
+| Field          | Size (bytes)    | Description                                                                   |
+|----------------|-----------------|-------------------------------------------------------------------------------|
+| timestamp      | 4               | sender time (unix timestamp)                                                  |
+| req type       | 1               | 0x01 (request sub type)                                                       |
+| reply path len | 1               | path len for reply                                                       |
+| reply path     | (variable)      | reply path                                                       |
+
+## Repeater - Owner info request
+
+| Field          | Size (bytes)    | Description                                                                   |
+|----------------|-----------------|-------------------------------------------------------------------------------|
+| timestamp      | 4               | sender time (unix timestamp)                                                  |
+| req type       | 1               | 0x02 (request sub type)                                                       |
+| reply path len | 1               | path len for reply                                                       |
+| reply path     | (variable)      | reply path                                                       |
+
+## Repeater - Clock and status request
+
+| Field          | Size (bytes)    | Description                                                                   |
+|----------------|-----------------|-------------------------------------------------------------------------------|
+| timestamp      | 4               | sender time (unix timestamp)                                                  |
+| req type       | 1               | 0x03 (request sub type)                                                       |
+| reply path len | 1               | path len for reply                                                       |
+| reply path     | (variable)      | reply path                                                       |
+
+
 # Group text message / datagram
 
 | Field        | Size (bytes)    | Description                                |

+ 4 - 3
examples/simple_repeater/MyMesh.cpp

@@ -41,14 +41,14 @@
   #define TXT_ACK_DELAY 200
 #endif
 
-#define FIRMWARE_VER_LEVEL       1
+#define FIRMWARE_VER_LEVEL       2
 
 #define REQ_TYPE_GET_STATUS         0x01 // same as _GET_STATS
 #define REQ_TYPE_KEEP_ALIVE         0x02
 #define REQ_TYPE_GET_TELEMETRY_DATA 0x03
 #define REQ_TYPE_GET_ACCESS_LIST    0x05
 #define REQ_TYPE_GET_NEIGHBOURS     0x06
-#define REQ_TYPE_GET_OWNER_INFO     0x07
+#define REQ_TYPE_GET_OWNER_INFO     0x07     // FIRMWARE_VER_LEVEL >= 2
 
 #define RESP_SERVER_LOGIN_OK        0 // response to ANON_REQ
 
@@ -196,6 +196,7 @@ uint8_t MyMesh::handleAnonClockReq(const mesh::Identity& sender, uint32_t sender
     if (_prefs.disable_fwd) {   // is this repeater currently disabled
       reply_data[8] |= 0x80;  // is disabled
     }
+    // TODO:  add some kind of moving-window utilisation metric, so can query 'how busy' is this repeater
     return 9;   // reply length
   }
   return 0;
@@ -359,7 +360,7 @@ int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t
       return reply_offset;
     }
   } else if (payload[0] == REQ_TYPE_GET_OWNER_INFO) {
-    sprintf((char *) &reply_data[4], "%s\n%s", FIRMWARE_VERSION, _prefs.owner_info);
+    sprintf((char *) &reply_data[4], "%s\n%s\n%s", FIRMWARE_VERSION, _prefs.node_name, _prefs.owner_info);
     return 4 + strlen((char *) &reply_data[4]);
   }
   return 0; // unknown command