![](/media/cache/profiles/b5c4ec91390a6fbccf8d918d443563ed.jpg.50x50_q85.jpg)
Indoor positioning. Peripheral unit.
Dependencies: aconno_SEGGER_RTT
aconno_ble/aconno_ble.cpp@0:ad937152493a, 2018-03-06 (annotated)
- Committer:
- jurica238814
- Date:
- Tue Mar 06 09:53:36 2018 +0000
- Revision:
- 0:ad937152493a
Publish commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jurica238814 | 0:ad937152493a | 1 | /* |
jurica238814 | 0:ad937152493a | 2 | * Made by Jurica Resetar @ aconno |
jurica238814 | 0:ad937152493a | 3 | * More info @ aconno.de |
jurica238814 | 0:ad937152493a | 4 | * |
jurica238814 | 0:ad937152493a | 5 | */ |
jurica238814 | 0:ad937152493a | 6 | |
jurica238814 | 0:ad937152493a | 7 | #include "aconno_ble.h" |
jurica238814 | 0:ad937152493a | 8 | |
jurica238814 | 0:ad937152493a | 9 | /** |
jurica238814 | 0:ad937152493a | 10 | * Callback triggered when the ble initialization process has finished |
jurica238814 | 0:ad937152493a | 11 | */ |
jurica238814 | 0:ad937152493a | 12 | void bleInitComplete(BLE::InitializationCompleteCallbackContext *params){ |
jurica238814 | 0:ad937152493a | 13 | BLE& ble = params->ble; |
jurica238814 | 0:ad937152493a | 14 | ble_error_t error = params->error; |
jurica238814 | 0:ad937152493a | 15 | |
jurica238814 | 0:ad937152493a | 16 | if (error != BLE_ERROR_NONE) { |
jurica238814 | 0:ad937152493a | 17 | return; |
jurica238814 | 0:ad937152493a | 18 | } |
jurica238814 | 0:ad937152493a | 19 | |
jurica238814 | 0:ad937152493a | 20 | /* Ensure that it is the default instance of BLE */ |
jurica238814 | 0:ad937152493a | 21 | if(ble.getInstanceID() != BLE::DEFAULT_INSTANCE) { |
jurica238814 | 0:ad937152493a | 22 | return; |
jurica238814 | 0:ad937152493a | 23 | } |
jurica238814 | 0:ad937152493a | 24 | |
jurica238814 | 0:ad937152493a | 25 | /* setup advertising */ |
jurica238814 | 0:ad937152493a | 26 | ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); |
jurica238814 | 0:ad937152493a | 27 | ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, (uint8_t *)MSD, MSD_SIZE_b); |
jurica238814 | 0:ad937152493a | 28 | ble.gap().setAdvertisingInterval(ADV_INTERVAL_MS); |
jurica238814 | 0:ad937152493a | 29 | } |