![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
This is a basic program that provides the necessary BLE service to allow communications with the UPAS
Dependencies: BLE_API mbed nRF51822 CronoDot EEPROM NCP5623BMUTBG ADS1115 BME280 Calibration_one MCP40D17 SDFileSystem LSM303 SI1145 STC3100
Fork of BLE_Button by
Diff: main.cpp
- Revision:
- 6:18d8750f39ee
- Parent:
- 5:43a3ab27f2e4
- Child:
- 8:a7ba7aaba460
diff -r 43a3ab27f2e4 -r 18d8750f39ee main.cpp --- a/main.cpp Sat Jun 20 00:00:32 2015 +0000 +++ b/main.cpp Sat Jun 20 23:52:29 2015 +0000 @@ -18,7 +18,7 @@ #include "BLE.h" #include "ButtonService.h" -BLEDevice ble; +BLE ble; DigitalOut led1(LED1); InterruptIn button(BUTTON1); @@ -39,7 +39,7 @@ void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason) { - ble.startAdvertising(); + ble.gap().startAdvertising(); } void periodicCallback(void) @@ -56,18 +56,18 @@ button.rise(buttonReleasedCallback); ble.init(); - ble.onDisconnection(disconnectionCallback); + ble.gap().onDisconnection(disconnectionCallback); ButtonService buttonService(ble, false /* initial value for button pressed */); buttonServicePtr = &buttonService; /* setup advertising */ - ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); - ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); - ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); - ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); - ble.setAdvertisingInterval(1000); /* 1000ms. */ - ble.startAdvertising(); + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); + ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); + ble.gap().setAdvertisingInterval(1000); /* 1000ms. */ + ble.gap().startAdvertising(); while (true) { ble.waitForEvent();