Add ARM header into source/nRF5xGattClient.h.

Use const references for passing characteristic discovery callbacks
Fix a bug in btle_discovery.cpp, the discovered descriptors were captured
by value instead of reference.
master
Vincent Coubard 2015-11-18 12:45:43 +00:00
parent dc2dfb0a95
commit 8bd7bdfa88
4 changed files with 21 additions and 5 deletions

View File

@ -98,7 +98,7 @@ void bleGattcEventHandler(const ble_evt_t *p_ble_evt)
case BLE_GATTC_EVT_DESC_DISC_RSP: {
uint16_t conn_handle = p_ble_evt->evt.gattc_evt.conn_handle;
uint16_t status = p_ble_evt->evt.gattc_evt.gatt_status;
ble_gattc_evt_desc_disc_rsp_t discovered_descriptors = p_ble_evt->evt.gattc_evt.params.desc_disc_rsp;
const ble_gattc_evt_desc_disc_rsp_t& discovered_descriptors = p_ble_evt->evt.gattc_evt.params.desc_disc_rsp;
switch(status) {
case BLE_GATT_STATUS_SUCCESS:

View File

@ -1,3 +1,19 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2015 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "nRF5xCharacteristicDescriptorDiscoverer.h"
#include "ble_err.h"
#include "mbed-drivers/mbed_error.h"

View File

@ -38,8 +38,8 @@ nRF5xGattClient::launchServiceDiscovery(Gap::Handle_t
ble_error_t nRF5xGattClient::discoverCharacteristicDescriptors(
const DiscoveredCharacteristic& characteristic,
CharacteristicDescriptorDiscovery::DiscoveryCallback_t discoveryCallback,
CharacteristicDescriptorDiscovery::TerminationCallback_t terminationCallback)
const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback,
const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback)
{
return characteristicDescriptorDiscoverer.launch(
characteristic,

View File

@ -112,8 +112,8 @@ public:
*/
virtual ble_error_t discoverCharacteristicDescriptors(
const DiscoveredCharacteristic& characteristic,
CharacteristicDescriptorDiscovery::DiscoveryCallback_t discoveryCallback,
CharacteristicDescriptorDiscovery::TerminationCallback_t terminationCallback
const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback,
const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback
);
/**