Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API LIS3DH mbed nRF51822 BMC050 nRF51_LowPwr nRF51_Vdd
Fork of BLE_EddystoneBeacon_Service by
Revision 24:8edfe6730cc2, committed 2015-07-23
- Comitter:
- mbedAustin
- Date:
- Thu Jul 23 20:38:20 2015 +0000
- Parent:
- 23:05e9bb3b13af
- Child:
- 25:e20bed9e466f
- Commit message:
- Renamed ZipBeacon ->EddystoneBeacon
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jul 23 20:17:11 2015 +0000
+++ b/main.cpp Thu Jul 23 20:38:20 2015 +0000
@@ -22,7 +22,7 @@
#include "ConfigParamsPersistence.h"
BLE ble;
-EddystoneConfigService *zipBeaconConfig;
+EddystoneConfigService *EddystoneBeaconConfig;
Ticker test;
//InterruptIn button(p17);
@@ -36,7 +36,7 @@
* The following help with this switch.
*/
static const int CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS = 5; // Duration after power-on that config service is available.
-Ticker configAdvertisementTimeoutTicker;
+Ticker configAdvertisementTimeout;
/**
* Stop advertising the Config Service after a delay; and switch to a non-connectable advertising mode only beacon.
@@ -46,12 +46,9 @@
Gap::GapState_t state;
state = ble.getGapState();
if (!state.connected) { /* don't switch if we're in a connected state. */
- zipBeaconConfig->setupEddystoneAdvertisements();
- ble.gap().startAdvertising();
-
- configAdvertisementTimeoutTicker.detach(); /* disable the callback from the timeout Ticker. */
+ EddystoneBeaconConfig->setupEddystoneAdvertisements();
+ configAdvertisementTimeout.detach(); /* disable the callback from the timeout Ticker. */
printf("removing config service\r\n");
- //test.attach(stupidWrapperFn,1);
}
}
@@ -80,19 +77,19 @@
EddystoneConfigService::Params_t params;
bool fetchedFromPersistentStorage = loadURIBeaconConfigParams(¶ms);
- /* Initialize a zipBeaconConfig service providing config params, default URI, and power levels. */
+ /* Initialize a EddystoneBeaconConfig service providing config params, default URI, and power levels. */
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()) {
+ EddystoneBeaconConfig = new EddystoneConfigService(ble, params, !fetchedFromPersistentStorage, "http://mbed.org", defaultAdvPowerLevels);
+ if (!EddystoneBeaconConfig->configuredSuccessfully()) {
error("failed to accommodate URI");
}
- configAdvertisementTimeoutTicker.attach(timeout, CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS);
+ configAdvertisementTimeout.attach(timeout, CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS);
// Setup auxiliary services to allow over-the-air firmware updates, etc
DFUService dfu(ble);
DeviceInformationService deviceInfo(ble, "ARM", "UriBeacon", "SN1", "hw-rev1", "fw-rev1", "soft-rev1");
- ble.gap().startAdvertising(); /* Set the whole thing in motion. After this call a GAP central can scan the zipBeaconConfig
+ ble.gap().startAdvertising(); /* Set the whole thing in motion. After this call a GAP central can scan the EddystoneBeaconConfig
* service. This can then be switched to the normal URIBeacon functionality after a timeout. */
printf("Running...\r\n");
while (true) {
