Indoor positioning. Central unit.
Dependencies: aconno_SEGGER_RTT
tasks/tasks.cpp
- Committer:
- dbartolovic
- Date:
- 2018-03-06
- Revision:
- 1:2bdc506d8baa
- Parent:
- 0:07a75b2fae14
- Child:
- 2:1b85a28b1e68
File content as of revision 1:2bdc506d8baa:
/* * * */ #include "tasks.h" #include "aconno_ble.h" #if DEBUG_LED extern DigitalOut advLed; extern DigitalOut scanLed; extern DigitalOut periodicLed; #endif // BLE global data GapAdvertisingData adv_data = GapAdvertisingData(); void periodicCallback(BLE *ble) { while(true) { ble->waitForEvent(); #if DEBUG_LED periodicLed = !periodicLed; #endif wait(PERIODIC_CALLBACK_S); } } void bleStartAdvertising(BLE *ble) { while(true) { adv_data = ble->getAdvertisingData(); adv_data.updateData(adv_data.MANUFACTURER_SPECIFIC_DATA, (uint8_t*)MSD, MSD_SIZE_b); ble->setAdvertisingData(adv_data); ble->gap().startAdvertising(); printf("Advertisement started.\r\n"); #if DEBUG_LED advLed = 0; #endif wait(ADVERTISING_DURATION_S); wait_ms(1000); ble->gap().stopAdvertising(); printf("Advertisement stopped.\r\n"); #if DEBUG_LED advLed = 1; #endif wait(BLE_SLEEP_DURATION_S); wait_ms(1000); } } void bleStartScanning(BLE *ble) { while(true) { ble->gap().setScanParams(1500, 400); ble->gap().startScan(advertisementCallback); Thread::signal_wait(0x00023456); //Thread::signal_clr(ACC_INT_SIG); //bleT.signal_set(DISABLE_BLE_SIG); } }