BLE Application to open a Garage door
Dependencies: BLE_API Crypto RNG mbed nRF51822
Fork of BLE_LED by
Revision 15:88ea59cb2b9e, committed 2017-05-01
- Comitter:
- duststorm
- Date:
- Mon May 01 00:33:07 2017 +0000
- Parent:
- 14:1c187c90992c
- Commit message:
- force address for Nano to F2:9B:4B:03:02:01 to match the prefix expected by the app
Changed in this revision
GaragemService.h | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1c187c90992c -r 88ea59cb2b9e GaragemService.h --- a/GaragemService.h Sun Aug 30 01:10:16 2015 +0000 +++ b/GaragemService.h Mon May 01 00:33:07 2017 +0000 @@ -49,10 +49,10 @@ DBG("TS=%lu\tID=%c%c%c%c\tSYSKEY=%s\r\n", *((uint32_t *) msg), msg[4], msg[5], msg[6], msg[7], &msg[8]); - //check we are not a victim of a repetion attack + //check we are not a victim of a repetition attack DBG("%lu\t>=\t%lu\r\n", history.last_ts(), *((uint32_t*) &msg[0])); if(history.last_ts() >= *((uint32_t *) &msg[0])) { - DBG("HA HA repetion here...\r\n"); + DBG("HA HA repetition here...\r\n"); return GARAGEM_ERROR_REPETITION_ATTACK; }
diff -r 1c187c90992c -r 88ea59cb2b9e main.cpp --- a/main.cpp Sun Aug 30 01:10:16 2015 +0000 +++ b/main.cpp Mon May 01 00:33:07 2017 +0000 @@ -14,7 +14,6 @@ #include "ble/services/iBeacon.h" #include "DeviceInformationService.h" - // HOW-TO TEST: //create a string to write to the characteristic 2000:2001 //openssl enc -aes-128-cbc -K 9734062BA852A049CF5D40593B769014 -iv A2685636521871D02306E2EB8F7027B3 -out /dev/stdout -in inputfile @@ -96,6 +95,11 @@ #endif ble.init(); + + // Note that the Garagem app that is in the Google Play store has the prefix for the BLE Nano hardcoded as F2:9B:4B, but newer Nanos do not have this prefix + // The following line changes the address on your Nano to ensure it will work with the app as is. + const uint8_t address1[] = {0x01,0x02,0x03,0x4B,0x9B,0xF2}; ble.setAddress(Gap::ADDR_TYPE_PUBLIC, address1); + ble.onDisconnection(disconnectionCallback); ble.gattServer().onDataWritten(onDataWrittenCallback);