![](/media/cache/profiles/416a275fea912be3a578ba281b58bb47.jpg.50x50_q85.jpg)
Button initiated config service
Dependencies: BLE_API_EddystoneConfigService_2 mbed nRF51822
Fork of BLE_EddystoneBeaconConfigService_3 by
Diff: main.cpp
- Revision:
- 14:5a2a104a21a8
- Parent:
- 8:1a21308e5008
- Child:
- 15:af8c24f34a9f
--- 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(); }