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