shunpei kataoka / nRF51822

Fork of nRF51822 by Shuta Nakamae

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Fri Jun 19 15:55:33 2015 +0100
Parent:
335:601d65634447
Child:
337:3d8b3bfe22e1
Commit message:
Synchronized with git rev 3bea28cf
Author: Rohit Grover
cleanup around GattCallbackParamTypes

Changed in this revision

btle/btle_discovery.cpp Show annotated file Show diff for this revision Revisions of this file
nRF51GattServer.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/btle/btle_discovery.cpp	Fri Jun 19 15:55:33 2015 +0100
+++ b/btle/btle_discovery.cpp	Fri Jun 19 15:55:33 2015 +0100
@@ -56,11 +56,11 @@
 
         case BLE_GATTC_EVT_READ_RSP:
             if (DiscoveredCharacteristic::onDataReadCallback != NULL) {
-                GattCharacteristicReadCBParams response = {
-                    .charHandle = p_ble_evt->evt.gattc_evt.params.read_rsp.handle,
-                    .offset     = p_ble_evt->evt.gattc_evt.params.read_rsp.offset,
-                    .len        = p_ble_evt->evt.gattc_evt.params.read_rsp.len,
-                    .data       = p_ble_evt->evt.gattc_evt.params.read_rsp.data,
+                GattReadCallbackParams response = {
+                    .handle = p_ble_evt->evt.gattc_evt.params.read_rsp.handle,
+                    .offset = p_ble_evt->evt.gattc_evt.params.read_rsp.offset,
+                    .len    = p_ble_evt->evt.gattc_evt.params.read_rsp.len,
+                    .data   = p_ble_evt->evt.gattc_evt.params.read_rsp.data,
                 };
                 DiscoveredCharacteristic::onDataReadCallback(&response);
             }
--- a/nRF51GattServer.cpp	Fri Jun 19 15:55:33 2015 +0100
+++ b/nRF51GattServer.cpp	Fri Jun 19 15:55:33 2015 +0100
@@ -336,22 +336,22 @@
         if (nrfCharacteristicHandles[i].value_handle == handle_value) {
             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
+                    GattWriteCallbackParams cbParams = {
+                        .handle  = i,
+                        .writeOp = static_cast<GattWriteCallbackParams::WriteOp_t>(gattsEventP->params.write.op),
+                        .offset  = gattsEventP->params.write.offset,
+                        .len     = gattsEventP->params.write.len,
+                        .data    = gattsEventP->params.write.data
                     };
                     handleDataWrittenEvent(&cbParams);
                     break;
                 }
                 case GattServerEvents::GATT_EVENT_WRITE_AUTHORIZATION_REQ: {
-                    GattCharacteristicWriteAuthCBParams cbParams = {
-                        .charHandle = i,
-                        .offset     = gattsEventP->params.authorize_request.request.write.offset,
-                        .len        = gattsEventP->params.authorize_request.request.write.len,
-                        .data       = gattsEventP->params.authorize_request.request.write.data,
+                    GattWriteAuthCallbackParams cbParams = {
+                        .handle  = i,
+                        .offset  = gattsEventP->params.authorize_request.request.write.offset,
+                        .len     = gattsEventP->params.authorize_request.request.write.len,
+                        .data    = gattsEventP->params.authorize_request.request.write.data,
                     };
                     ble_gatts_rw_authorize_reply_params_t reply = {
                         .type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
@@ -371,23 +371,23 @@
                      * have done if write-authorization had not been enabled.
                      */
                     if (reply.params.write.gatt_status == BLE_GATT_STATUS_SUCCESS) {
-                        GattCharacteristicWriteCBParams cbParams = {
-                            .charHandle = i,
-                            .op         = static_cast<GattCharacteristicWriteCBParams::Type>(gattsEventP->params.authorize_request.request.write.op),
-                            .offset     = gattsEventP->params.authorize_request.request.write.offset,
-                            .len        = gattsEventP->params.authorize_request.request.write.len,
-                            .data       = gattsEventP->params.authorize_request.request.write.data,
+                        GattWriteCallbackParams cbParams = {
+                            .handle  = i,
+                            .writeOp = static_cast<GattWriteCallbackParams::WriteOp_t>(gattsEventP->params.authorize_request.request.write.op),
+                            .offset  = gattsEventP->params.authorize_request.request.write.offset,
+                            .len     = gattsEventP->params.authorize_request.request.write.len,
+                            .data    = gattsEventP->params.authorize_request.request.write.data,
                         };
                         handleDataWrittenEvent(&cbParams);
                     }
                     break;
                 }
                 case GattServerEvents::GATT_EVENT_READ_AUTHORIZATION_REQ: {
-                    GattCharacteristicReadAuthCBParams cbParams = {
-                        .charHandle = i,
-                        .offset     = gattsEventP->params.authorize_request.request.read.offset,
-                        .len        = 0,
-                        .data       = NULL
+                    GattReadAuthCallbackParams cbParams = {
+                        .handle = i,
+                        .offset = gattsEventP->params.authorize_request.request.read.offset,
+                        .len    = 0,
+                        .data   = NULL
                     };
 
                     ble_gatts_rw_authorize_reply_params_t reply = {