Indoor positioning. Peripheral unit.
Dependencies: aconno_SEGGER_RTT
Diff: aconno_ble/aconno_ble.cpp
- Revision:
- 0:ad937152493a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/aconno_ble/aconno_ble.cpp Tue Mar 06 09:53:36 2018 +0000 @@ -0,0 +1,29 @@ +/* + * Made by Jurica Resetar @ aconno + * More info @ aconno.de + * + */ + +#include "aconno_ble.h" + +/** +* Callback triggered when the ble initialization process has finished +*/ +void bleInitComplete(BLE::InitializationCompleteCallbackContext *params){ + BLE& ble = params->ble; + ble_error_t error = params->error; + + if (error != BLE_ERROR_NONE) { + return; + } + + /* Ensure that it is the default instance of BLE */ + if(ble.getInstanceID() != BLE::DEFAULT_INSTANCE) { + return; + } + + /* setup advertising */ + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t *)MSD, MSD_SIZE_b); + ble.gap().setAdvertisingInterval(ADV_INTERVAL_MS); +}