High level Bluetooth Low Energy API and radio abstraction layer

Fork of BLE_API by Bluetooth Low Energy

Committer:
rgrover1
Date:
Fri Jun 19 15:51:59 2015 +0100
Revision:
470:150c2363f776
Parent:
469:c95e603d60dd
Child:
474:2a8a453ecd7e
Synchronized with git rev e8850be6
Author: Rohit Grover
split out DiscoveredService and DiscoveredCharacteristic from ServiceDiscovery.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rgrover1 431:1c8c592430ec 1 /* mbed Microcontroller Library
rgrover1 431:1c8c592430ec 2 * Copyright (c) 2006-2013 ARM Limited
rgrover1 431:1c8c592430ec 3 *
rgrover1 431:1c8c592430ec 4 * Licensed under the Apache License, Version 2.0 (the "License");
rgrover1 431:1c8c592430ec 5 * you may not use this file except in compliance with the License.
rgrover1 431:1c8c592430ec 6 * You may obtain a copy of the License at
rgrover1 431:1c8c592430ec 7 *
rgrover1 431:1c8c592430ec 8 * http://www.apache.org/licenses/LICENSE-2.0
rgrover1 431:1c8c592430ec 9 *
rgrover1 431:1c8c592430ec 10 * Unless required by applicable law or agreed to in writing, software
rgrover1 431:1c8c592430ec 11 * distributed under the License is distributed on an "AS IS" BASIS,
rgrover1 431:1c8c592430ec 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rgrover1 431:1c8c592430ec 13 * See the License for the specific language governing permissions and
rgrover1 431:1c8c592430ec 14 * limitations under the License.
rgrover1 431:1c8c592430ec 15 */
rgrover1 431:1c8c592430ec 16
rgrover1 431:1c8c592430ec 17 #ifndef __SERVICE_DISOVERY_H__
rgrover1 431:1c8c592430ec 18 #define __SERVICE_DISOVERY_H__
rgrover1 431:1c8c592430ec 19
rgrover1 431:1c8c592430ec 20 #include "UUID.h"
rgrover1 431:1c8c592430ec 21 #include "Gap.h"
rgrover1 438:b55ce5f5715d 22 #include "GattAttribute.h"
rgrover1 470:150c2363f776 23 #include "DiscoveredService.h"
rgrover1 470:150c2363f776 24 #include "DiscoveredCharacteristic.h"
rgrover1 431:1c8c592430ec 25
rgrover1 431:1c8c592430ec 26 class ServiceDiscovery {
rgrover1 431:1c8c592430ec 27 public:
rgrover1 431:1c8c592430ec 28 typedef void (*ServiceCallback_t)(const DiscoveredService &);
rgrover1 431:1c8c592430ec 29 typedef void (*CharacteristicCallback_t)(const DiscoveredCharacteristic &);
rgrover1 457:6ebc9bbde90b 30 typedef void (*TerminationCallback_t)(Gap::Handle_t connectionHandle);
rgrover1 431:1c8c592430ec 31
rgrover1 431:1c8c592430ec 32 public:
rgrover1 456:ff4ffb69e19f 33 static ble_error_t launch(Gap::Handle_t connectionHandle,
rgrover1 456:ff4ffb69e19f 34 ServiceCallback_t sc = NULL,
rgrover1 456:ff4ffb69e19f 35 CharacteristicCallback_t cc = NULL,
rgrover1 458:5546ebd25359 36 const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN),
rgrover1 458:5546ebd25359 37 const UUID &matchingCharacteristicUUIDIn = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN));
rgrover1 431:1c8c592430ec 38
rgrover1 431:1c8c592430ec 39 static void terminate(void);
rgrover1 431:1c8c592430ec 40
rgrover1 457:6ebc9bbde90b 41 static bool isActive(void);
rgrover1 457:6ebc9bbde90b 42 static void onTermination(TerminationCallback_t callback);
rgrover1 457:6ebc9bbde90b 43
rgrover1 431:1c8c592430ec 44 protected:
rgrover1 431:1c8c592430ec 45 Gap::Handle_t connHandle; /**< Connection handle as provided by the SoftDevice. */
rgrover1 431:1c8c592430ec 46 UUID matchingServiceUUID;
rgrover1 431:1c8c592430ec 47 ServiceCallback_t serviceCallback;
rgrover1 431:1c8c592430ec 48 UUID matchingCharacteristicUUID;
rgrover1 431:1c8c592430ec 49 CharacteristicCallback_t characteristicCallback;
rgrover1 431:1c8c592430ec 50 };
rgrover1 431:1c8c592430ec 51
rgrover1 431:1c8c592430ec 52 #endif // ifndef __SERVICE_DISOVERY_H__