サイコン用プログラム BLE通信送信確認

Dependencies:   mbed BLE_API nRF51822

Revision:
21:600cf473d9e7
Parent:
20:9ff36d021c34
Child:
22:500a89982568
--- a/main.cpp	Sun May 31 13:11:11 2015 +0000
+++ b/main.cpp	Sat Jun 27 13:26:34 2015 +0000
@@ -1,5 +1,5 @@
 #include "mbed.h"
-#include "BLEDevice.h"
+#include "BLE.h"
 #include "MPU6050.h"
 
 /*
@@ -22,7 +22,7 @@
 #define SLAVE_LATENCY     0
 #define TICKER_INTERVAL   2.0f
 
-BLEDevice   ble;
+BLE   ble;
 
 MPU6050 mpu(I2C_SDA0, I2C_SCL0);
 
@@ -137,9 +137,7 @@
     ble.startAdvertising();
 }
 
-void connectionCallback(Gap::Handle_t handle, Gap::addr_type_t peerAddrType,
-                        const Gap::Address_t peerAddr, Gap::addr_type_t ownAddrType,
-                        const Gap::Address_t ownAddr, const Gap::ConnectionParams_t *params)
+void connectionCallback(const Gap::ConnectionCallbackParams_t *params)
 {
 
     //DEBUG("connected. Got handle %u\r\n", handle);
@@ -156,18 +154,18 @@
         gap_conn_params.maxConnectionInterval        = Gap::MSEC_TO_GAP_DURATION_UNITS(CONN_INTERVAL);
         gap_conn_params.connectionSupervisionTimeout = Gap::MSEC_TO_GAP_DURATION_UNITS(CONN_SUP_TIMEOUT);
         gap_conn_params.slaveLatency                 = SLAVE_LATENCY;
-        //ble.updateConnectionParams(handle, &gap_conn_params);
         
-    if (ble.updateConnectionParams(handle, &gap_conn_params) != BLE_ERROR_NONE) {
+    if (ble.updateConnectionParams(params->handle, &gap_conn_params) != BLE_ERROR_NONE) {
         //DEBUG("failed to update connection paramter\r\n");
     }
 }
 
-void writtenCallback(const GattCharacteristicWriteCBParams *params){
+//void writtenCallback(const GattCharacteristicWriteCBParams *params){
+void writtenCallback(const GattWriteCallbackParams *params){
     char acceleroRange = 0xFF;
     char gyroRange = 0xFF;
     
-    if (params->charHandle == writeChar.getValueAttribute().getHandle()) {
+    if (params->handle == writeChar.getValueAttribute().getHandle()) {
         uint16_t len = params->len;
         
         if (len == 2) {
@@ -219,7 +217,7 @@
     }
 }
 
-void timeoutCallback(void)
+void timeoutCallback(const Gap::TimeoutSource_t source)
 {
     //DEBUG("TimeOut\n\r");
     //DEBUG("Restarting the advertising process\n\r");