High level Bluetooth Low Energy API and radio abstraction layer
Fork of BLE_API by
ble/DiscoveredService.h@710:b2e1a2660ec2, 2015-06-19 (annotated)
- Committer:
- rgrover1
- Date:
- Fri Jun 19 15:53:28 2015 +0100
- Revision:
- 710:b2e1a2660ec2
- Parent:
- public/DiscoveredService.h@470:150c2363f776
Synchronized with git rev 7e8977d8
Author: Rohit Grover
Release 0.3.8
=============
This is a minor set of enhancements before we yotta-ize BLE_API.
Enhancements
~~~~~~~~~~~~
* Minor rework for class UUID; added a default and copy constructor; and a != operator.
* Added copy constructor and accessors for GapAdvertisingParams.
* GapScanningParams:: remove unnecessary checks for SCAN_TIMEOUT_MAX.
* Add a comment header block to explain why BLEDevice::init() may not be safe
to call from global static context.
* Introduce GattAttribute::INVALID_HANDLE.
* Replace some deprecated uses of Gap::address_t with Gap::Address_t.
Bugfixes
~~~~~~~~
* None.
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__*/ |