Skip to content

Commit 2715058

Browse files
author
Scott Powell
committed
* misc fixes
1 parent 112b360 commit 2715058

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

examples/simple_sensor/SensorMesh.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ void SensorMesh::applyContactPermissions(const uint8_t* pubkey, uint16_t perms)
327327
memset(c, 0, sizeof(*c));
328328
} else {
329329
c->permissions = perms; // update their permissions
330+
self_id.calcSharedSecret(c->shared_secret, pubkey);
330331
}
331332
dirty_contacts_expiry = futureMillis(LAZY_CONTACTS_WRITE_DELAY); // trigger saveContacts()
332333
}
@@ -464,6 +465,15 @@ void SensorMesh::handleCommand(uint32_t sender_timestamp, char* command, char* r
464465
strcpy(reply, "Err - bad pubkey");
465466
}
466467
}
468+
} else if (sender_timestamp == 0 && strcmp(command, "getperm") == 0) {
469+
Serial.println("Permissions:");
470+
for (int i = 0; i < num_contacts; i++) {
471+
auto c = &contacts[i];
472+
473+
mesh::Utils::printHex(Serial, c->id.pub_key, PUB_KEY_SIZE);
474+
Serial.printf(" %04X\n", c->permissions);
475+
}
476+
reply[0] = 0;
467477
} else {
468478
_cli.handleCommand(sender_timestamp, command, reply); // common CLI commands
469479
}

examples/simple_sensor/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void halt() {
4141
while (1) ;
4242
}
4343

44-
static char command[80];
44+
static char command[120];
4545

4646
void setup() {
4747
Serial.begin(115200);

0 commit comments

Comments
 (0)