Includes library modifications to allow access to AIN_4 (AIN_0 / 5)

Committer:
bryantaylor
Date:
Tue Sep 20 21:26:12 2016 +0000
Revision:
0:eafc3fd41f75
hackathon

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bryantaylor 0:eafc3fd41f75 1 /* mbed Microcontroller Library
bryantaylor 0:eafc3fd41f75 2 * Copyright (c) 2006-2013 ARM Limited
bryantaylor 0:eafc3fd41f75 3 *
bryantaylor 0:eafc3fd41f75 4 * Licensed under the Apache License, Version 2.0 (the "License");
bryantaylor 0:eafc3fd41f75 5 * you may not use this file except in compliance with the License.
bryantaylor 0:eafc3fd41f75 6 * You may obtain a copy of the License at
bryantaylor 0:eafc3fd41f75 7 *
bryantaylor 0:eafc3fd41f75 8 * http://www.apache.org/licenses/LICENSE-2.0
bryantaylor 0:eafc3fd41f75 9 *
bryantaylor 0:eafc3fd41f75 10 * Unless required by applicable law or agreed to in writing, software
bryantaylor 0:eafc3fd41f75 11 * distributed under the License is distributed on an "AS IS" BASIS,
bryantaylor 0:eafc3fd41f75 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bryantaylor 0:eafc3fd41f75 13 * See the License for the specific language governing permissions and
bryantaylor 0:eafc3fd41f75 14 * limitations under the License.
bryantaylor 0:eafc3fd41f75 15 */
bryantaylor 0:eafc3fd41f75 16
bryantaylor 0:eafc3fd41f75 17 #ifndef __DISCOVERED_SERVICE_H__
bryantaylor 0:eafc3fd41f75 18 #define __DISCOVERED_SERVICE_H__
bryantaylor 0:eafc3fd41f75 19
bryantaylor 0:eafc3fd41f75 20 #include "UUID.h"
bryantaylor 0:eafc3fd41f75 21 #include "GattAttribute.h"
bryantaylor 0:eafc3fd41f75 22
bryantaylor 0:eafc3fd41f75 23 /**@brief Type for holding information about the service and the characteristics found during
bryantaylor 0:eafc3fd41f75 24 * the discovery process.
bryantaylor 0:eafc3fd41f75 25 */
bryantaylor 0:eafc3fd41f75 26 class DiscoveredService {
bryantaylor 0:eafc3fd41f75 27 public:
bryantaylor 0:eafc3fd41f75 28 /**
bryantaylor 0:eafc3fd41f75 29 * Set information about the discovered service.
bryantaylor 0:eafc3fd41f75 30 *
bryantaylor 0:eafc3fd41f75 31 * @param[in] uuidIn
bryantaylor 0:eafc3fd41f75 32 * The UUID of the discovered service.
bryantaylor 0:eafc3fd41f75 33 * @param[in] startHandleIn
bryantaylor 0:eafc3fd41f75 34 * The start handle of the discovered service in the peer's
bryantaylor 0:eafc3fd41f75 35 * ATT table.
bryantaylor 0:eafc3fd41f75 36 * @param[in] endHandleIn
bryantaylor 0:eafc3fd41f75 37 * The end handle of the discovered service in the peer's
bryantaylor 0:eafc3fd41f75 38 * ATT table.
bryantaylor 0:eafc3fd41f75 39 */
bryantaylor 0:eafc3fd41f75 40 void setup(UUID uuidIn, GattAttribute::Handle_t startHandleIn, GattAttribute::Handle_t endHandleIn) {
bryantaylor 0:eafc3fd41f75 41 uuid = uuidIn;
bryantaylor 0:eafc3fd41f75 42 startHandle = startHandleIn;
bryantaylor 0:eafc3fd41f75 43 endHandle = endHandleIn;
bryantaylor 0:eafc3fd41f75 44 }
bryantaylor 0:eafc3fd41f75 45
bryantaylor 0:eafc3fd41f75 46 /**
bryantaylor 0:eafc3fd41f75 47 * Set the start and end handle of the discovered service.
bryantaylor 0:eafc3fd41f75 48 * @param[in] startHandleIn
bryantaylor 0:eafc3fd41f75 49 * The start handle of the discovered service in the peer's
bryantaylor 0:eafc3fd41f75 50 * ATT table.
bryantaylor 0:eafc3fd41f75 51 * @param[in] endHandleIn
bryantaylor 0:eafc3fd41f75 52 * The end handle of the discovered service in the peer's
bryantaylor 0:eafc3fd41f75 53 * ATT table.
bryantaylor 0:eafc3fd41f75 54 */
bryantaylor 0:eafc3fd41f75 55 void setup(GattAttribute::Handle_t startHandleIn, GattAttribute::Handle_t endHandleIn) {
bryantaylor 0:eafc3fd41f75 56 startHandle = startHandleIn;
bryantaylor 0:eafc3fd41f75 57 endHandle = endHandleIn;
bryantaylor 0:eafc3fd41f75 58 }
bryantaylor 0:eafc3fd41f75 59
bryantaylor 0:eafc3fd41f75 60 /**
bryantaylor 0:eafc3fd41f75 61 * Set the long UUID of the discovered service.
bryantaylor 0:eafc3fd41f75 62 *
bryantaylor 0:eafc3fd41f75 63 * @param[in] longUUID
bryantaylor 0:eafc3fd41f75 64 * The long UUID of the discovered service.
bryantaylor 0:eafc3fd41f75 65 * @param[in] order
bryantaylor 0:eafc3fd41f75 66 * The byte ordering of @p longUUID.
bryantaylor 0:eafc3fd41f75 67 */
bryantaylor 0:eafc3fd41f75 68 void setupLongUUID(UUID::LongUUIDBytes_t longUUID, UUID::ByteOrder_t order = UUID::MSB) {
bryantaylor 0:eafc3fd41f75 69 uuid.setupLong(longUUID, order);
bryantaylor 0:eafc3fd41f75 70 }
bryantaylor 0:eafc3fd41f75 71
bryantaylor 0:eafc3fd41f75 72 public:
bryantaylor 0:eafc3fd41f75 73 /**
bryantaylor 0:eafc3fd41f75 74 * Get the UUID of the discovered service.
bryantaylor 0:eafc3fd41f75 75 *
bryantaylor 0:eafc3fd41f75 76 * @return A reference to the UUID of the discovered service.
bryantaylor 0:eafc3fd41f75 77 */
bryantaylor 0:eafc3fd41f75 78 const UUID &getUUID(void) const {
bryantaylor 0:eafc3fd41f75 79 return uuid;
bryantaylor 0:eafc3fd41f75 80 }
bryantaylor 0:eafc3fd41f75 81
bryantaylor 0:eafc3fd41f75 82 /**
bryantaylor 0:eafc3fd41f75 83 * Get the start handle of the discovered service in the peer's ATT table.
bryantaylor 0:eafc3fd41f75 84 *
bryantaylor 0:eafc3fd41f75 85 * @return A reference to the start handle.
bryantaylor 0:eafc3fd41f75 86 */
bryantaylor 0:eafc3fd41f75 87 const GattAttribute::Handle_t& getStartHandle(void) const {
bryantaylor 0:eafc3fd41f75 88 return startHandle;
bryantaylor 0:eafc3fd41f75 89 }
bryantaylor 0:eafc3fd41f75 90
bryantaylor 0:eafc3fd41f75 91 /**
bryantaylor 0:eafc3fd41f75 92 * Get the end handle of the discovered service in the peer's ATT table.
bryantaylor 0:eafc3fd41f75 93 *
bryantaylor 0:eafc3fd41f75 94 * @return A reference to the end handle.
bryantaylor 0:eafc3fd41f75 95 */
bryantaylor 0:eafc3fd41f75 96 const GattAttribute::Handle_t& getEndHandle(void) const {
bryantaylor 0:eafc3fd41f75 97 return endHandle;
bryantaylor 0:eafc3fd41f75 98 }
bryantaylor 0:eafc3fd41f75 99
bryantaylor 0:eafc3fd41f75 100 public:
bryantaylor 0:eafc3fd41f75 101 /**
bryantaylor 0:eafc3fd41f75 102 * Construct a DiscoveredService instance.
bryantaylor 0:eafc3fd41f75 103 */
bryantaylor 0:eafc3fd41f75 104 DiscoveredService() : uuid(UUID::ShortUUIDBytes_t(0)),
bryantaylor 0:eafc3fd41f75 105 startHandle(GattAttribute::INVALID_HANDLE),
bryantaylor 0:eafc3fd41f75 106 endHandle(GattAttribute::INVALID_HANDLE) {
bryantaylor 0:eafc3fd41f75 107 /* empty */
bryantaylor 0:eafc3fd41f75 108 }
bryantaylor 0:eafc3fd41f75 109
bryantaylor 0:eafc3fd41f75 110 private:
bryantaylor 0:eafc3fd41f75 111 DiscoveredService(const DiscoveredService &);
bryantaylor 0:eafc3fd41f75 112
bryantaylor 0:eafc3fd41f75 113 private:
bryantaylor 0:eafc3fd41f75 114 UUID uuid; /**< UUID of the service. */
bryantaylor 0:eafc3fd41f75 115 GattAttribute::Handle_t startHandle; /**< Service Handle Range. */
bryantaylor 0:eafc3fd41f75 116 GattAttribute::Handle_t endHandle; /**< Service Handle Range. */
bryantaylor 0:eafc3fd41f75 117 };
bryantaylor 0:eafc3fd41f75 118
bryantaylor 0:eafc3fd41f75 119 #endif /*__DISCOVERED_SERVICE_H__*/