テスト用

Fork of nRF51822 by Nordic Semiconductor

Revision:
66:b3680699d9a4
Parent:
57:2aa01a5008ac
--- a/nRF51GattServer.cpp	Mon Sep 08 17:21:46 2014 +0100
+++ b/nRF51GattServer.cpp	Mon Sep 22 11:19:51 2014 +0100
@@ -60,6 +60,13 @@
     for (uint8_t i = 0; i < service.getCharacteristicCount(); i++) {
         GattCharacteristic *p_char = service.getCharacteristic(i);
 
+        /* Skip any incompletely defined, read-only characteristics. */
+        if ((p_char->getValueAttribute().getValuePtr() == NULL) &&
+            (p_char->getValueAttribute().getInitialLength() == 0) &&
+            (p_char->getProperties() == GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ)) {
+            continue;
+        }
+
         nordicUUID = custom_convert_to_nordic_uuid(p_char->getValueAttribute().getUUID());
 
         ASSERT ( ERROR_NONE ==
@@ -277,12 +284,13 @@
             switch (eventType) {
                 case GattServerEvents::GATT_EVENT_DATA_WRITTEN: {
                     GattCharacteristicWriteCBParams cbParams = {
+                        .charHandle = i,
                         .op     = static_cast<GattCharacteristicWriteCBParams::Type>(gattsEventP->params.write.op),
                         .offset = gattsEventP->params.write.offset,
                         .len    = gattsEventP->params.write.len,
                         .data   = gattsEventP->params.write.data
                     };
-                    handleDataWrittenEvent(i, &cbParams);
+                    handleDataWrittenEvent(&cbParams);
                     break;
                 }
                 default: