Test for export ti uv2/emblocks
Dependencies: BLE_API mbed-src nRF51822
Fork of BLE_HTM_by_InTempSensr by
Diff: main.cpp
- Revision:
- 2:97bfd761b6c3
- Parent:
- 0:1865c1b765f4
--- a/main.cpp Fri Jan 30 07:54:51 2015 +0000 +++ b/main.cpp Wed Oct 07 19:45:13 2015 +0000 @@ -15,14 +15,14 @@ */ #include "mbed.h" -#include "BLEDevice.h" -#include "ble_hrs.h" -#include "ble_hts.h" +#include "BLE.h" +#include "HeartRateService.h" //ble_hrs.h +#include "HealthThermometerService.h" //ble_hts.h #include "nrf_soc.h" // for internal Thermo sensoer // nRF51822n nrf; /* BLE radio driver */ -BLEDevice ble; +BLE ble; DigitalOut led1(LED1); DigitalOut led2(LED2); uint8_t cnt; @@ -70,24 +70,24 @@ void Update_Values(); -void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason) // Mod +void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params) // Mod { - DEBUG("Disconnected handle %u!\n\r", handle); + //DEBUG("Disconnected handle %u!\n\r", handle); DEBUG("Restarting the advertising process\n\r"); led2 = 0; ble.startAdvertising(); } -void onConnectionCallback(Gap::Handle_t handle,Gap::addr_type_t peerAddrType, const Gap::address_t peerAddr, const Gap::ConnectionParams_t *params) //Mod +void onConnectionCallback(const Gap::ConnectionCallbackParams_t *params) //Mod { - DEBUG("connected. Got handle %u\r\n", handle); + //DEBUG("connected. Got handle %u\r\n", handle); connectionParams.slaveLatency = 1; led2 = 1; - if (ble.updateConnectionParams(handle, &connectionParams) != BLE_ERROR_NONE) { - DEBUG("failed to update connection paramter\r\n"); - } + //if (ble.updateConnectionParams(const Gap::ConnectionCallbackParams_t *params) { + // DEBUG("failed to update connection paramter\r\n"); + //} } @@ -118,8 +118,8 @@ ticker.attach(periodicCallback, 1.0 ); DEBUG("Initialising the nRF51822\n\r"); ble.init(); - ble.onDisconnection(disconnectionCallback); - ble.onConnection(onConnectionCallback); + ble.gap().onDisconnection(disconnectionCallback); + ble.gap().onConnection(onConnectionCallback); ble.getPreferredConnectionParams(&connectionParams);