* repeater: onAnonDataRecv(), future code check bug fix (offset 4)
* sensor: onAnonDataRecv(), future request code provision
This commit is contained in:
@@ -434,9 +434,9 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
|
|||||||
|
|
||||||
data[len] = 0; // ensure null terminator
|
data[len] = 0; // ensure null terminator
|
||||||
uint8_t reply_len;
|
uint8_t reply_len;
|
||||||
if (data[0] == 0 || data[0] >= ' ') { // is password, ie. a login request
|
if (data[4] == 0 || data[4] >= ' ') { // is password, ie. a login request
|
||||||
reply_len = handleLoginReq(sender, secret, timestamp, &data[4]);
|
reply_len = handleLoginReq(sender, secret, timestamp, &data[4]);
|
||||||
//} else if (data[0] == ANON_REQ_TYPE_*) { // future type codes
|
//} else if (data[4] == ANON_REQ_TYPE_*) { // future type codes
|
||||||
// TODO
|
// TODO
|
||||||
} else {
|
} else {
|
||||||
reply_len = 0; // unknown request type
|
reply_len = 0; // unknown request type
|
||||||
|
|||||||
@@ -449,7 +449,14 @@ void SensorMesh::onAnonDataRecv(mesh::Packet* packet, const uint8_t* secret, con
|
|||||||
memcpy(×tamp, data, 4);
|
memcpy(×tamp, data, 4);
|
||||||
|
|
||||||
data[len] = 0; // ensure null terminator
|
data[len] = 0; // ensure null terminator
|
||||||
uint8_t reply_len = handleLoginReq(sender, secret, timestamp, &data[4]);
|
uint8_t reply_len;
|
||||||
|
if (data[4] == 0 || data[4] >= ' ') { // is password, ie. a login request
|
||||||
|
reply_len = handleLoginReq(sender, secret, timestamp, &data[4]);
|
||||||
|
//} else if (data[4] == ANON_REQ_TYPE_*) { // future type codes
|
||||||
|
// TODO
|
||||||
|
} else {
|
||||||
|
reply_len = 0; // unknown request type
|
||||||
|
}
|
||||||
|
|
||||||
if (reply_len == 0) return; // invalid request
|
if (reply_len == 0) return; // invalid request
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user