This commit is contained in:
Wolfgang Hottgenroth 2021-02-08 18:13:30 +01:00
parent 38ae182326
commit 9bd521eb2b

View File

@ -14,7 +14,7 @@ typedef struct {
const t_device devices[] = { const t_device devices[] = {
{ .deviceId = "MainsCnt01", .sharedSecret = "sharedSecretGanzGeheim" }, { .deviceId = "MainsCnt01", .sharedSecret = "sharedSecretGanzGeheim" },
{ .deviceId = NULL, .sharedSecret = NULL } { .deviceId = "", .sharedSecret = "" }
}; };
@ -48,6 +48,10 @@ int main() {
uint8_t i = 0; uint8_t i = 0;
while (1) { while (1) {
if (strlen(devices[i].deviceId) == 0) {
break;
}
if (strncmp(devices[i].deviceId, buf.s.deviceId, sizeof(((t_configBlock*)0)->deviceId)) == 0) { if (strncmp(devices[i].deviceId, buf.s.deviceId, sizeof(((t_configBlock*)0)->deviceId)) == 0) {
printf("Device found: %s\n", devices[i].deviceId); printf("Device found: %s\n", devices[i].deviceId);
@ -68,7 +72,7 @@ int main() {
printf("DeviceId: %s\n", buf.s.deviceId); printf("DeviceId: %s\n", buf.s.deviceId);
printf("Location: %s\n", buf.s.location); printf("Location: %s\n", buf.s.location);
for (uint8_t j = 0; j < SECONDS_PER_MINUTE; j++) { for (uint8_t j = 0; j < SECONDS_PER_MINUTE; j++) {
printf("Time: %llu, Frequency: %lu\n", buf.s.events[j].timestamp, buf.s.events[j].frequency); printf("Time: %lu, Frequency: %u\n", buf.s.events[j].timestamp, buf.s.events[j].frequency);
} }
printf("\n"); printf("\n");
@ -77,6 +81,8 @@ int main() {
} else { } else {
printf("Unknown device\n"); printf("Unknown device\n");
} }
i++;
} }
} }