To Be Deploy
Dependencies: BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1
Fork of BLE_EddystoneBeacon_Serviceprod by
Diff: main.cpp
- Revision:
- 14:5a2a104a21a8
- Parent:
- 8:1a21308e5008
- Child:
- 15:af8c24f34a9f
diff -r 91c356fa928e -r 5a2a104a21a8 main.cpp --- a/main.cpp Fri Jul 17 21:45:03 2015 +0000 +++ b/main.cpp Mon Jul 20 04:29:07 2015 +0000 @@ -23,6 +23,7 @@ BLE ble; ZipBeaconConfigService *zipBeaconConfig; +InterruptIn button(p17); /** * URIBeaconConfig service can operate in two modes: a configuration mode which @@ -36,6 +37,13 @@ static const int CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS = 60; // Duration after power-on that config service is available. Ticker configAdvertisementTimeoutTicker; +// +// Have to use this to add a interrupt, because C++ is stupid. +// +void stupidWrapperFn(){ + zipBeaconConfig->pduCountCallback(); + } + /** * Stop advertising the UriBeaconConfig Service after a delay; and switch to normal URIBeacon. */ @@ -89,6 +97,7 @@ ble.gap().startAdvertising(); /* Set the whole thing in motion. After this call a GAP central can scan the zipBeaconConfig * service. This can then be switched to the normal URIBeacon functionality after a timeout. */ + button.rise(&stupidWrapperFn); while (true) { ble.waitForEvent(); }