Updated

Fork of BLE_API by Bluetooth Low Energy

Committer:
rgrover1
Date:
Fri Jun 19 15:52:06 2015 +0100
Revision:
524:6e97ab392e2a
Child:
525:c80c57d748f8
Synchronized with git rev 43177a02
Author: Rohit Grover
remove un-necessary comments in GattClient.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rgrover1 524:6e97ab392e2a 1 /* mbed Microcontroller Library
rgrover1 524:6e97ab392e2a 2 * Copyright (c) 2006-2013 ARM Limited
rgrover1 524:6e97ab392e2a 3 *
rgrover1 524:6e97ab392e2a 4 * Licensed under the Apache License, Version 2.0 (the "License");
rgrover1 524:6e97ab392e2a 5 * you may not use this file except in compliance with the License.
rgrover1 524:6e97ab392e2a 6 * You may obtain a copy of the License at
rgrover1 524:6e97ab392e2a 7 *
rgrover1 524:6e97ab392e2a 8 * http://www.apache.org/licenses/LICENSE-2.0
rgrover1 524:6e97ab392e2a 9 *
rgrover1 524:6e97ab392e2a 10 * Unless required by applicable law or agreed to in writing, software
rgrover1 524:6e97ab392e2a 11 * distributed under the License is distributed on an "AS IS" BASIS,
rgrover1 524:6e97ab392e2a 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rgrover1 524:6e97ab392e2a 13 * See the License for the specific language governing permissions and
rgrover1 524:6e97ab392e2a 14 * limitations under the License.
rgrover1 524:6e97ab392e2a 15 */
rgrover1 524:6e97ab392e2a 16
rgrover1 524:6e97ab392e2a 17 #ifndef __GATT_CLIENT_H__
rgrover1 524:6e97ab392e2a 18 #define __GATT_CLIENT_H__
rgrover1 524:6e97ab392e2a 19
rgrover1 524:6e97ab392e2a 20 #include "Gap.h"
rgrover1 524:6e97ab392e2a 21 #include "GattAttribute.h"
rgrover1 524:6e97ab392e2a 22 #include "ServiceDiscovery.h"
rgrover1 524:6e97ab392e2a 23
rgrover1 524:6e97ab392e2a 24 #include "GattCallbackParamTypes.h"
rgrover1 524:6e97ab392e2a 25
rgrover1 524:6e97ab392e2a 26 class GattClient {
rgrover1 524:6e97ab392e2a 27 public:
rgrover1 524:6e97ab392e2a 28 typedef void (*ReadCallback_t)(const GattReadCallbackParams *params);
rgrover1 524:6e97ab392e2a 29
rgrover1 524:6e97ab392e2a 30 enum WriteOp_t {
rgrover1 524:6e97ab392e2a 31 GATT_OP_WRITE_REQ = 0x01, /**< Write Request. */
rgrover1 524:6e97ab392e2a 32 GATT_OP_WRITE_CMD = 0x02, /**< Write Command. */
rgrover1 524:6e97ab392e2a 33 };
rgrover1 524:6e97ab392e2a 34
rgrover1 524:6e97ab392e2a 35 typedef void (*WriteCallback_t)(const GattWriteCallbackParams *params);
rgrover1 524:6e97ab392e2a 36
rgrover1 524:6e97ab392e2a 37 public:
rgrover1 524:6e97ab392e2a 38 /**
rgrover1 524:6e97ab392e2a 39 * Launch service discovery. Once launched, service discovery will remain
rgrover1 524:6e97ab392e2a 40 * active with callbacks being issued back into the application for matching
rgrover1 524:6e97ab392e2a 41 * services/characteristics. isActive() can be used to determine status; and
rgrover1 524:6e97ab392e2a 42 * a termination callback (if setup) will be invoked at the end. Service
rgrover1 524:6e97ab392e2a 43 * discovery can be terminated prematurely if needed using terminate().
rgrover1 524:6e97ab392e2a 44 *
rgrover1 524:6e97ab392e2a 45 * @param connectionHandle
rgrover1 524:6e97ab392e2a 46 * Handle for the connection with the peer.
rgrover1 524:6e97ab392e2a 47 * @param sc
rgrover1 524:6e97ab392e2a 48 * This is the application callback for matching service.
rgrover1 524:6e97ab392e2a 49 * @param cc
rgrover1 524:6e97ab392e2a 50 * This is the application callback for matching characteristic.
rgrover1 524:6e97ab392e2a 51 * @param matchingServiceUUID
rgrover1 524:6e97ab392e2a 52 * UUID based filter for specifying a service in which the application is
rgrover1 524:6e97ab392e2a 53 * interested.
rgrover1 524:6e97ab392e2a 54 * @param matchingCharacteristicUUIDIn
rgrover1 524:6e97ab392e2a 55 * UUID based filter for specifying characteristic in which the application
rgrover1 524:6e97ab392e2a 56 * is interested.
rgrover1 524:6e97ab392e2a 57 *
rgrover1 524:6e97ab392e2a 58 * @Note Using wildcard values for both service-UUID and characteristic-
rgrover1 524:6e97ab392e2a 59 * UUID will result in complete service discovery--callbacks being
rgrover1 524:6e97ab392e2a 60 * called for every service and characteristic.
rgrover1 524:6e97ab392e2a 61 *
rgrover1 524:6e97ab392e2a 62 * @return
rgrover1 524:6e97ab392e2a 63 * BLE_ERROR_NONE if service discovery is launched successfully; else an appropriate error.
rgrover1 524:6e97ab392e2a 64 */
rgrover1 524:6e97ab392e2a 65 virtual ble_error_t launchServiceDiscovery(Gap::Handle_t connectionHandle,
rgrover1 524:6e97ab392e2a 66 ServiceDiscovery::ServiceCallback_t sc = NULL,
rgrover1 524:6e97ab392e2a 67 ServiceDiscovery::CharacteristicCallback_t cc = NULL,
rgrover1 524:6e97ab392e2a 68 const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN),
rgrover1 524:6e97ab392e2a 69 const UUID &matchingCharacteristicUUIDIn = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) = 0;
rgrover1 524:6e97ab392e2a 70
rgrover1 524:6e97ab392e2a 71 virtual void onServiceDiscoveryTermination(ServiceDiscovery::TerminationCallback_t callback) = 0;
rgrover1 524:6e97ab392e2a 72
rgrover1 524:6e97ab392e2a 73 /**
rgrover1 524:6e97ab392e2a 74 * Is service-discovery currently active?
rgrover1 524:6e97ab392e2a 75 */
rgrover1 524:6e97ab392e2a 76 virtual bool isServiceDiscoveryActive(void) const = 0;
rgrover1 524:6e97ab392e2a 77
rgrover1 524:6e97ab392e2a 78 /**
rgrover1 524:6e97ab392e2a 79 * Terminate an ongoing service-discovery. This should result in an
rgrover1 524:6e97ab392e2a 80 * invocation of the TerminationCallback if service-discovery is active.
rgrover1 524:6e97ab392e2a 81 */
rgrover1 524:6e97ab392e2a 82 virtual void terminateServiceDiscovery(void) = 0;
rgrover1 524:6e97ab392e2a 83
rgrover1 524:6e97ab392e2a 84 /* Initiate a Gatt Client read procedure by attribute-handle.*/
rgrover1 524:6e97ab392e2a 85 virtual ble_error_t read(Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset) const = 0;
rgrover1 524:6e97ab392e2a 86
rgrover1 524:6e97ab392e2a 87 virtual ble_error_t write(GattClient::WriteOp_t cmd, Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, size_t length, const uint8_t *value) const = 0;
rgrover1 524:6e97ab392e2a 88
rgrover1 524:6e97ab392e2a 89 protected:
rgrover1 524:6e97ab392e2a 90 GattClient() {
rgrover1 524:6e97ab392e2a 91 /* empty */
rgrover1 524:6e97ab392e2a 92 }
rgrover1 524:6e97ab392e2a 93
rgrover1 524:6e97ab392e2a 94 private:
rgrover1 524:6e97ab392e2a 95 /* disallow copy and assignment */
rgrover1 524:6e97ab392e2a 96 GattClient(const GattClient &);
rgrover1 524:6e97ab392e2a 97 GattClient& operator=(const GattClient &);
rgrover1 524:6e97ab392e2a 98 };
rgrover1 524:6e97ab392e2a 99
rgrover1 524:6e97ab392e2a 100 #endif // ifndef __GATT_CLIENT_H__