smart ball test board code

Dependencies:   nrf51-sdk

Fork of nRF51822 by Nordic Semiconductor

Committer:
vcoubard
Date:
Mon Jan 11 10:19:19 2016 +0000
Revision:
568:e1800bd55a9e
Parent:
567:e425ad9e5d6e
Child:
571:f162898cb6c4
Synchronized with git rev 59ced0b4
Author: Vincent Coubard
rename remainingCharacteristic member, now it is named
discoveredCharacteristic. Add doc to the discovery process and the
rationale behind discoveredCharacteristic member.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vcoubard 543:1bf9c597f44f 1 /* mbed Microcontroller Library
vcoubard 543:1bf9c597f44f 2 * Copyright (c) 2006-2013 ARM Limited
vcoubard 543:1bf9c597f44f 3 *
vcoubard 543:1bf9c597f44f 4 * Licensed under the Apache License, Version 2.0 (the "License");
vcoubard 543:1bf9c597f44f 5 * you may not use this file except in compliance with the License.
vcoubard 543:1bf9c597f44f 6 * You may obtain a copy of the License at
vcoubard 543:1bf9c597f44f 7 *
vcoubard 543:1bf9c597f44f 8 * http://www.apache.org/licenses/LICENSE-2.0
vcoubard 543:1bf9c597f44f 9 *
vcoubard 543:1bf9c597f44f 10 * Unless required by applicable law or agreed to in writing, software
vcoubard 543:1bf9c597f44f 11 * distributed under the License is distributed on an "AS IS" BASIS,
vcoubard 543:1bf9c597f44f 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
vcoubard 543:1bf9c597f44f 13 * See the License for the specific language governing permissions and
vcoubard 543:1bf9c597f44f 14 * limitations under the License.
vcoubard 543:1bf9c597f44f 15 */
vcoubard 543:1bf9c597f44f 16
vcoubard 543:1bf9c597f44f 17 #include "nRF5xGattClient.h"
vcoubard 543:1bf9c597f44f 18
vcoubard 567:e425ad9e5d6e 19 nRF5xGattClient &
vcoubard 567:e425ad9e5d6e 20 nRF5xGattClient::getInstance(void) {
vcoubard 567:e425ad9e5d6e 21 static nRF5xGattClient* nRFGattClientSingleton = NULL;
vcoubard 567:e425ad9e5d6e 22 if (nRFGattClientSingleton == NULL) {
vcoubard 567:e425ad9e5d6e 23 nRFGattClientSingleton = new nRF5xGattClient();
vcoubard 567:e425ad9e5d6e 24 }
vcoubard 567:e425ad9e5d6e 25 return *nRFGattClientSingleton;
vcoubard 567:e425ad9e5d6e 26 }
vcoubard 567:e425ad9e5d6e 27
vcoubard 543:1bf9c597f44f 28 #if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110)
vcoubard 543:1bf9c597f44f 29 ble_error_t
vcoubard 543:1bf9c597f44f 30 nRF5xGattClient::launchServiceDiscovery(Gap::Handle_t connectionHandle,
vcoubard 543:1bf9c597f44f 31 ServiceDiscovery::ServiceCallback_t sc,
vcoubard 543:1bf9c597f44f 32 ServiceDiscovery::CharacteristicCallback_t cc,
vcoubard 543:1bf9c597f44f 33 const UUID &matchingServiceUUIDIn,
vcoubard 543:1bf9c597f44f 34 const UUID &matchingCharacteristicUUIDIn)
vcoubard 543:1bf9c597f44f 35 {
vcoubard 568:e1800bd55a9e 36 return _discovery.launch(connectionHandle, sc, cc, matchingServiceUUIDIn, matchingCharacteristicUUIDIn);
vcoubard 543:1bf9c597f44f 37 }
vcoubard 568:e1800bd55a9e 38
vcoubard 568:e1800bd55a9e 39 ble_error_t nRF5xGattClient::discoverCharacteristicDescriptors(
vcoubard 568:e1800bd55a9e 40 const DiscoveredCharacteristic& characteristic,
vcoubard 568:e1800bd55a9e 41 const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback,
vcoubard 568:e1800bd55a9e 42 const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback)
vcoubard 568:e1800bd55a9e 43 {
vcoubard 568:e1800bd55a9e 44 return _characteristicDescriptorDiscoverer.launch(
vcoubard 568:e1800bd55a9e 45 characteristic,
vcoubard 568:e1800bd55a9e 46 discoveryCallback,
vcoubard 568:e1800bd55a9e 47 terminationCallback
vcoubard 568:e1800bd55a9e 48 );
vcoubard 568:e1800bd55a9e 49 }
vcoubard 568:e1800bd55a9e 50
vcoubard 568:e1800bd55a9e 51 bool nRF5xGattClient::isCharacteristicDescriptorsDiscoveryActive(const DiscoveredCharacteristic& characteristic) const {
vcoubard 568:e1800bd55a9e 52 return _characteristicDescriptorDiscoverer.isActive(characteristic);
vcoubard 568:e1800bd55a9e 53 }
vcoubard 568:e1800bd55a9e 54
vcoubard 568:e1800bd55a9e 55 void nRF5xGattClient::terminateCharacteristicDescriptorsDiscovery(const DiscoveredCharacteristic& characteristic) {
vcoubard 568:e1800bd55a9e 56 return _characteristicDescriptorDiscoverer.requestTerminate(characteristic);
vcoubard 568:e1800bd55a9e 57 }
vcoubard 568:e1800bd55a9e 58
rgrover1 431:db7edc9ad0bc 59 #endif