diff options
Diffstat (limited to 'lock')
| -rw-r--r-- | lock/bend.c | 7 | ||||
| -rw-r--r-- | lock/fend.c | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lock/bend.c b/lock/bend.c index 8436770..b0a0074 100644 --- a/lock/bend.c +++ b/lock/bend.c @@ -134,11 +134,12 @@ int main(void) n = radio_recv(buf, WDLEN); buf[n] = '\0'; rxd = 0; + xor(KEY, buf, msg, WDLEN + 1); uart_write("recv: "); - uart_write(buf); - if (strncmp(buf, LOCK, WDLEN) == 0) + uart_write(msg); + if (strncmp(msg, LOCK, WDLEN) == 0) lock(); - else if (strncmp(buf, UNLOCK, WDLEN) == 0) + else if (strncmp(msg, UNLOCK, WDLEN) == 0) unlock(); } } diff --git a/lock/fend.c b/lock/fend.c index 927c310..e44155b 100644 --- a/lock/fend.c +++ b/lock/fend.c @@ -62,8 +62,9 @@ int main(void) for (;;) { if (islock) { + xor(KEY, LOCK, buf, WDLEN); do { - sync = radio_sendto(txaddr, LOCK, WDLEN); + sync = radio_sendto(txaddr, buf, WDLEN); _delay_ms(50); } while (!sync); sync = 0; @@ -72,8 +73,9 @@ int main(void) } if (isunlock) { + xor(KEY, UNLOCK, buf, WDLEN); do { - sync = radio_sendto(txaddr, UNLOCK, WDLEN); + sync = radio_sendto(txaddr, buf, WDLEN); _delay_ms(50); } while (!sync); sync = 0; |
