Bike service
Fork of BLE_API by
ble/DiscoveredService.h@1132:692ddf04fc42, 2016-04-06 (annotated)
- Committer:
- vcoubard
- Date:
- Wed Apr 06 19:13:46 2016 +0100
- Revision:
- 1132:692ddf04fc42
- Parent:
- 1056:ce2fb3d09929
- Child:
- 1135:d540a48f650d
Synchronized with git rev 13bf70b6
Author: Rohit Grover
Release 2.1.5
=============
A minor release to separate the concept of minlen and len in
GattCharacteristic. Also contains some improvements to documentation.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vcoubard | 1132:692ddf04fc42 | 1 | /* mbed Microcontroller Library |
vcoubard | 1132:692ddf04fc42 | 2 | * Copyright (c) 2006-2013 ARM Limited |
vcoubard | 1132:692ddf04fc42 | 3 | * |
vcoubard | 1132:692ddf04fc42 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
vcoubard | 1132:692ddf04fc42 | 5 | * you may not use this file except in compliance with the License. |
vcoubard | 1132:692ddf04fc42 | 6 | * You may obtain a copy of the License at |
vcoubard | 1132:692ddf04fc42 | 7 | * |
vcoubard | 1132:692ddf04fc42 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
vcoubard | 1132:692ddf04fc42 | 9 | * |
vcoubard | 1132:692ddf04fc42 | 10 | * Unless required by applicable law or agreed to in writing, software |
vcoubard | 1132:692ddf04fc42 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
vcoubard | 1132:692ddf04fc42 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
vcoubard | 1132:692ddf04fc42 | 13 | * See the License for the specific language governing permissions and |
vcoubard | 1132:692ddf04fc42 | 14 | * limitations under the License. |
vcoubard | 1132:692ddf04fc42 | 15 | */ |
vcoubard | 1132:692ddf04fc42 | 16 | |
vcoubard | 1132:692ddf04fc42 | 17 | #ifndef __DISCOVERED_SERVICE_H__ |
vcoubard | 1132:692ddf04fc42 | 18 | #define __DISCOVERED_SERVICE_H__ |
vcoubard | 1132:692ddf04fc42 | 19 | |
vcoubard | 1132:692ddf04fc42 | 20 | #include "UUID.h" |
vcoubard | 1132:692ddf04fc42 | 21 | #include "GattAttribute.h" |
vcoubard | 1132:692ddf04fc42 | 22 | |
vcoubard | 1132:692ddf04fc42 | 23 | /**@brief Type for holding information about the service and the characteristics found during |
vcoubard | 1132:692ddf04fc42 | 24 | * the discovery process. |
vcoubard | 1132:692ddf04fc42 | 25 | */ |
vcoubard | 1132:692ddf04fc42 | 26 | class DiscoveredService { |
vcoubard | 1132:692ddf04fc42 | 27 | public: |
vcoubard | 1132:692ddf04fc42 | 28 | void setup(UUID uuidIn, GattAttribute::Handle_t startHandleIn, GattAttribute::Handle_t endHandleIn) { |
vcoubard | 1132:692ddf04fc42 | 29 | uuid = uuidIn; |
vcoubard | 1132:692ddf04fc42 | 30 | startHandle = startHandleIn; |
vcoubard | 1132:692ddf04fc42 | 31 | endHandle = endHandleIn; |
vcoubard | 1132:692ddf04fc42 | 32 | } |
vcoubard | 1132:692ddf04fc42 | 33 | |
vcoubard | 1132:692ddf04fc42 | 34 | void setup(GattAttribute::Handle_t startHandleIn, GattAttribute::Handle_t endHandleIn) { |
vcoubard | 1132:692ddf04fc42 | 35 | startHandle = startHandleIn; |
vcoubard | 1132:692ddf04fc42 | 36 | endHandle = endHandleIn; |
vcoubard | 1132:692ddf04fc42 | 37 | } |
vcoubard | 1132:692ddf04fc42 | 38 | |
vcoubard | 1132:692ddf04fc42 | 39 | void setupLongUUID(UUID::LongUUIDBytes_t longUUID) { |
vcoubard | 1132:692ddf04fc42 | 40 | uuid.setupLong(longUUID); |
vcoubard | 1132:692ddf04fc42 | 41 | } |
vcoubard | 1132:692ddf04fc42 | 42 | |
vcoubard | 1132:692ddf04fc42 | 43 | public: |
vcoubard | 1132:692ddf04fc42 | 44 | const UUID &getUUID(void) const { |
vcoubard | 1132:692ddf04fc42 | 45 | return uuid; |
vcoubard | 1132:692ddf04fc42 | 46 | } |
vcoubard | 1132:692ddf04fc42 | 47 | |
vcoubard | 1132:692ddf04fc42 | 48 | const GattAttribute::Handle_t& getStartHandle(void) const { |
vcoubard | 1132:692ddf04fc42 | 49 | return startHandle; |
vcoubard | 1132:692ddf04fc42 | 50 | } |
vcoubard | 1132:692ddf04fc42 | 51 | const GattAttribute::Handle_t& getEndHandle(void) const { |
vcoubard | 1132:692ddf04fc42 | 52 | return endHandle; |
vcoubard | 1132:692ddf04fc42 | 53 | } |
vcoubard | 1132:692ddf04fc42 | 54 | |
vcoubard | 1132:692ddf04fc42 | 55 | public: |
vcoubard | 1132:692ddf04fc42 | 56 | DiscoveredService() : uuid(UUID::ShortUUIDBytes_t(0)), |
vcoubard | 1132:692ddf04fc42 | 57 | startHandle(GattAttribute::INVALID_HANDLE), |
vcoubard | 1132:692ddf04fc42 | 58 | endHandle(GattAttribute::INVALID_HANDLE) { |
vcoubard | 1132:692ddf04fc42 | 59 | /* empty */ |
vcoubard | 1132:692ddf04fc42 | 60 | } |
vcoubard | 1132:692ddf04fc42 | 61 | |
vcoubard | 1132:692ddf04fc42 | 62 | private: |
vcoubard | 1132:692ddf04fc42 | 63 | DiscoveredService(const DiscoveredService &); |
vcoubard | 1132:692ddf04fc42 | 64 | |
vcoubard | 1132:692ddf04fc42 | 65 | private: |
vcoubard | 1132:692ddf04fc42 | 66 | UUID uuid; /**< UUID of the service. */ |
vcoubard | 1132:692ddf04fc42 | 67 | GattAttribute::Handle_t startHandle; /**< Service Handle Range. */ |
vcoubard | 1132:692ddf04fc42 | 68 | GattAttribute::Handle_t endHandle; /**< Service Handle Range. */ |
vcoubard | 1132:692ddf04fc42 | 69 | }; |
vcoubard | 1132:692ddf04fc42 | 70 | |
rgrover1 | 716:11b41f651697 | 71 | #endif /*__DISCOVERED_SERVICE_H__*/ |