To Be Deploy
Dependencies: BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1
Fork of BLE_EddystoneBeacon_Serviceprod by
Diff: main.cpp
- Revision:
- 23:05e9bb3b13af
- Parent:
- 22:160766614338
- Child:
- 24:8edfe6730cc2
--- a/main.cpp Thu Jul 23 18:00:59 2015 +0000 +++ b/main.cpp Thu Jul 23 20:17:11 2015 +0000 @@ -16,13 +16,13 @@ #include "mbed.h" #include "BLE.h" -#include "ZipBeaconConfigService.h" +#include "EddystoneConfigService.h" #include "DFUService.h" #include "DeviceInformationService.h" #include "ConfigParamsPersistence.h" BLE ble; -ZipBeaconConfigService *zipBeaconConfig; +EddystoneConfigService *zipBeaconConfig; Ticker test; //InterruptIn button(p17); @@ -38,13 +38,6 @@ static const int CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS = 5; // 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->radioNotificationCallback(false); - } - /** * Stop advertising the Config Service after a delay; and switch to a non-connectable advertising mode only beacon. */ @@ -53,7 +46,7 @@ Gap::GapState_t state; state = ble.getGapState(); if (!state.connected) { /* don't switch if we're in a connected state. */ - zipBeaconConfig->setupZipBeaconAdvertisements(); + zipBeaconConfig->setupEddystoneAdvertisements(); ble.gap().startAdvertising(); configAdvertisementTimeoutTicker.detach(); /* disable the callback from the timeout Ticker. */ @@ -84,12 +77,12 @@ * get copied out to persistent storage before switching to normal URIBeacon * operation. */ - ZipBeaconConfigService::Params_t params; + EddystoneConfigService::Params_t params; bool fetchedFromPersistentStorage = loadURIBeaconConfigParams(¶ms); /* Initialize a zipBeaconConfig service providing config params, default URI, and power levels. */ - static ZipBeaconConfigService::PowerLevels_t defaultAdvPowerLevels = {-20, -4, 0, 10}; // Values for ADV packets related to firmware levels - zipBeaconConfig = new ZipBeaconConfigService(ble, params, !fetchedFromPersistentStorage, "http://mbed.org", defaultAdvPowerLevels); + static EddystoneConfigService::PowerLevels_t defaultAdvPowerLevels = {-20, -4, 0, 10}; // Values for ADV packets related to firmware levels + zipBeaconConfig = new EddystoneConfigService(ble, params, !fetchedFromPersistentStorage, "http://mbed.org", defaultAdvPowerLevels); if (!zipBeaconConfig->configuredSuccessfully()) { error("failed to accommodate URI"); } @@ -102,7 +95,6 @@ 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. */ printf("Running...\r\n"); - //button.rise(&stupidWrapperFn); while (true) { ble.waitForEvent(); }