Skip to content

Commit a5af1b5

Browse files
author
Scott Powell
committed
* companion: disabled processing/sending of keep_alive packets (deprecated)
* FIRMWARE_VER_LEVEL now moved to end of response payloads
1 parent e988531 commit a5af1b5

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

examples/companion_radio/MyMesh.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,8 +1690,8 @@ void MyMesh::checkSerialInterface() {
16901690
_serial->writeFrame(out_frame, 5);
16911691
_iter_started = false;
16921692
}
1693-
} else if (!_serial->isWriteBusy()) {
1694-
checkConnections();
1693+
//} else if (!_serial->isWriteBusy()) {
1694+
// checkConnections(); // TODO - deprecate the 'Connections' stuff
16951695
}
16961696
}
16971697

examples/simple_repeater/MyMesh.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,13 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
123123
uint32_t now = getRTCClock()->getCurrentTimeUnique();
124124
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
125125
reply_data[4] = RESP_SERVER_LOGIN_OK;
126-
reply_data[5] = FIRMWARE_VER_LEVEL; // Legacy: was recommended keep-alive interval (secs / 16)
126+
reply_data[5] = 0; // Legacy: was recommended keep-alive interval (secs / 16)
127127
reply_data[6] = client->isAdmin() ? 1 : 0;
128128
reply_data[7] = client->permissions;
129129
getRNG()->random(&reply_data[8], 4); // random blob to help packet-hash uniqueness
130+
reply_data[12] = FIRMWARE_VER_LEVEL; // New field
130131

131-
return 12; // reply length
132+
return 13; // reply length
132133
}
133134

134135
int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t *payload, size_t payload_len) {

examples/simple_room_server/MyMesh.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,22 +336,22 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
336336
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
337337
// TODO: maybe reply with count of messages waiting to be synced for THIS client?
338338
reply_data[4] = RESP_SERVER_LOGIN_OK;
339-
reply_data[5] = FIRMWARE_VER_LEVEL; // Legacy: was recommended keep-alive interval (secs / 16)
339+
reply_data[5] = 0; // Legacy: was recommended keep-alive interval (secs / 16)
340340
reply_data[6] = (client->isAdmin() ? 1 : (client->permissions == 0 ? 2 : 0));
341341
// LEGACY: reply_data[7] = getUnsyncedCount(client);
342342
reply_data[7] = client->permissions; // NEW
343343
getRNG()->random(&reply_data[8], 4); // random blob to help packet-hash uniqueness
344-
// LEGACY: memcpy(&reply_data[8], "OK", 2);
344+
reply_data[12] = FIRMWARE_VER_LEVEL; // New field
345345

346346
next_push = futureMillis(PUSH_NOTIFY_DELAY_MILLIS); // delay next push, give RESPONSE packet time to arrive first
347347

348348
if (packet->isRouteFlood()) {
349349
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
350350
mesh::Packet *path = createPathReturn(sender, client->shared_secret, packet->path, packet->path_len,
351-
PAYLOAD_TYPE_RESPONSE, reply_data, 12);
351+
PAYLOAD_TYPE_RESPONSE, reply_data, 13);
352352
if (path) sendFlood(path, SERVER_RESPONSE_DELAY);
353353
} else {
354-
mesh::Packet *reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, client->shared_secret, reply_data, 12);
354+
mesh::Packet *reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, client->shared_secret, reply_data, 13);
355355
if (reply) {
356356
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
357357
sendDirect(reply, client->out_path, client->out_path_len, SERVER_RESPONSE_DELAY);

examples/simple_sensor/SensorMesh.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,13 @@ uint8_t SensorMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t*
366366
uint32_t now = getRTCClock()->getCurrentTimeUnique();
367367
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
368368
reply_data[4] = RESP_SERVER_LOGIN_OK;
369-
reply_data[5] = FIRMWARE_VER_LEVEL;
369+
reply_data[5] = 0;
370370
reply_data[6] = client->isAdmin() ? 1 : 0;
371371
reply_data[7] = client->permissions;
372372
getRNG()->random(&reply_data[8], 4); // random blob to help packet-hash uniqueness
373+
reply_data[12] = FIRMWARE_VER_LEVEL;
373374

374-
return 12; // reply length
375+
return 13; // reply length
375376
}
376377

377378
void SensorMesh::handleCommand(uint32_t sender_timestamp, char* command, char* reply) {

0 commit comments

Comments
 (0)