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