Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API nRF51822
Fork of Puck by
Diff: Puck.h
- Revision:
- 25:831f72375d05
- Parent:
- 23:21b5ecbc84ea
diff -r cd6703df9501 -r 831f72375d05 Puck.h
--- a/Puck.h Mon Mar 09 13:38:22 2015 +0000
+++ b/Puck.h Mon Jun 29 18:59:40 2015 +0000
@@ -18,7 +18,7 @@
#ifndef __PUCK_HPP__
#define __PUCK_HPP__
-#include "BLEDevice.h"
+#include "BLE.h"
#include "mbed.h"
#include "Log.h"
#include <vector>
@@ -49,7 +49,7 @@
Puck(const Puck&);
Puck& operator=(const Puck&);
- BLEDevice ble;
+ BLE ble;
uint8_t beaconPayload[25];
PuckState state;
std::vector<GattService*> services;
@@ -64,7 +64,7 @@
public:
static Puck &getPuck();
- BLEDevice &getBle() { return ble; }
+ BLE &getBle() { return ble; }
PuckState getState() { return state; }
void setState(PuckState state);
void init(uint16_t minor);
@@ -97,16 +97,13 @@
Puck::getPuck().setState(DISCONNECTED);
}
-void onConnection(Gap::Handle_t handle,
- Gap::addr_type_t peerAddrType,
- const Gap::address_t peerAddr,
- const Gap::ConnectionParams_t * connectionParams) {
+void onConnection(const Gap::ConnectionCallbackParams_t*) {
LOG_INFO("Connected.\n");
Puck::getPuck().setState(CONNECTED);
}
-void onDataWrittenCallback(const GattCharacteristicWriteCBParams *context) {
- Puck::getPuck().onDataWritten(context->charHandle, context->data, context->len);
+void onDataWrittenCallback(const GattWriteCallbackParams *context) {
+ Puck::getPuck().onDataWritten(context->handle, context->data, context->len);
}
bool isEqualUUID(const UUID* uuidA, const UUID uuidB) {
@@ -203,7 +200,7 @@
}
ble.init();
- LOG_DEBUG("Inited BLEDevice.\n");
+ LOG_DEBUG("Inited BLE.\n");
setState(DISCONNECTED);
char deviceName[10];
@@ -231,7 +228,7 @@
for(int i = 0; i < services.size(); i++) {
ble.addService(*services[i]);
- LOG_DEBUG("Added service %x to BLEDevice\n", services[i]);
+ LOG_DEBUG("Added service %x to BLE\n", services[i]);
}
LOG_INFO("Inited puck as 0x%X.\n", minor);
