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