Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
public/GattService.h@144:c025c8839682, 2014-11-21 (annotated)
- Committer:
- rgrover1
- Date:
- Fri Nov 21 09:23:24 2014 +0000
- Revision:
- 144:c025c8839682
- Parent:
- 113:7e3fd573d87b
- Child:
- 260:ea7f9f14cc15
Synchronized with git rev 3d8441e2
Author: Rohit Grover
minor cleanup of public API classes.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rohit Grover |
106:a20be740075d | 1 | /* mbed Microcontroller Library |
Rohit Grover |
106:a20be740075d | 2 | * Copyright (c) 2006-2013 ARM Limited |
Rohit Grover |
106:a20be740075d | 3 | * |
Rohit Grover |
106:a20be740075d | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Rohit Grover |
106:a20be740075d | 5 | * you may not use this file except in compliance with the License. |
Rohit Grover |
106:a20be740075d | 6 | * You may obtain a copy of the License at |
Rohit Grover |
106:a20be740075d | 7 | * |
Rohit Grover |
106:a20be740075d | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Rohit Grover |
106:a20be740075d | 9 | * |
Rohit Grover |
106:a20be740075d | 10 | * Unless required by applicable law or agreed to in writing, software |
Rohit Grover |
106:a20be740075d | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Rohit Grover |
106:a20be740075d | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Rohit Grover |
106:a20be740075d | 13 | * See the License for the specific language governing permissions and |
Rohit Grover |
106:a20be740075d | 14 | * limitations under the License. |
Rohit Grover |
106:a20be740075d | 15 | */ |
Rohit Grover |
106:a20be740075d | 16 | |
Rohit Grover |
106:a20be740075d | 17 | #ifndef __GATT_SERVICE_H__ |
Rohit Grover |
106:a20be740075d | 18 | #define __GATT_SERVICE_H__ |
Rohit Grover |
106:a20be740075d | 19 | |
Rohit Grover |
106:a20be740075d | 20 | #include "UUID.h" |
Rohit Grover |
106:a20be740075d | 21 | #include "GattCharacteristic.h" |
Rohit Grover |
106:a20be740075d | 22 | |
rgrover1 | 144:c025c8839682 | 23 | class GattService { |
Rohit Grover |
106:a20be740075d | 24 | public: |
Rohit Grover |
106:a20be740075d | 25 | enum { |
Rohit Grover |
106:a20be740075d | 26 | UUID_ALERT_NOTIFICATION_SERVICE = 0x1811, |
Rohit Grover |
106:a20be740075d | 27 | UUID_BATTERY_SERVICE = 0x180F, |
Rohit Grover |
106:a20be740075d | 28 | UUID_BLOOD_PRESSURE_SERVICE = 0x1810, |
Rohit Grover |
106:a20be740075d | 29 | UUID_CURRENT_TIME_SERVICE = 0x1805, |
Rohit Grover |
106:a20be740075d | 30 | UUID_CYCLING_SPEED_AND_CADENCE = 0x1816, |
Rohit Grover |
106:a20be740075d | 31 | UUID_DEVICE_INFORMATION_SERVICE = 0x180A, |
Rohit Grover |
106:a20be740075d | 32 | UUID_GLUCOSE_SERVICE = 0x1808, |
Rohit Grover |
106:a20be740075d | 33 | UUID_HEALTH_THERMOMETER_SERVICE = 0x1809, |
Rohit Grover |
106:a20be740075d | 34 | UUID_HEART_RATE_SERVICE = 0x180D, |
Rohit Grover |
106:a20be740075d | 35 | UUID_HUMAN_INTERFACE_DEVICE_SERVICE = 0x1812, |
Rohit Grover |
106:a20be740075d | 36 | UUID_IMMEDIATE_ALERT_SERVICE = 0x1802, |
Rohit Grover |
106:a20be740075d | 37 | UUID_LINK_LOSS_SERVICE = 0x1803, |
Rohit Grover |
106:a20be740075d | 38 | UUID_NEXT_DST_CHANGE_SERVICE = 0x1807, |
Rohit Grover |
106:a20be740075d | 39 | UUID_PHONE_ALERT_STATUS_SERVICE = 0x180E, |
Rohit Grover |
106:a20be740075d | 40 | UUID_REFERENCE_TIME_UPDATE_SERVICE = 0x1806, |
Rohit Grover |
106:a20be740075d | 41 | UUID_RUNNING_SPEED_AND_CADENCE = 0x1814, |
Rohit Grover |
106:a20be740075d | 42 | UUID_SCAN_PARAMETERS_SERVICE = 0x1813, |
Rohit Grover |
106:a20be740075d | 43 | UUID_TX_POWER_SERVICE = 0x1804 |
Rohit Grover |
106:a20be740075d | 44 | }; |
Rohit Grover |
106:a20be740075d | 45 | |
rgrover1 | 144:c025c8839682 | 46 | public: |
rgrover1 | 144:c025c8839682 | 47 | /** |
rgrover1 | 144:c025c8839682 | 48 | * @brief Creates a new GattCharacteristic using the specified 16-bit |
rgrover1 | 144:c025c8839682 | 49 | * UUID, value length, and properties |
rgrover1 | 144:c025c8839682 | 50 | * |
rgrover1 | 144:c025c8839682 | 51 | * @note The UUID value must be unique in the service and is normally >1 |
rgrover1 | 144:c025c8839682 | 52 | * |
rgrover1 | 144:c025c8839682 | 53 | * @param[in] uuid |
rgrover1 | 144:c025c8839682 | 54 | * The UUID to use for this characteristic |
rgrover1 | 144:c025c8839682 | 55 | * @param[in] characteristics |
rgrover1 | 144:c025c8839682 | 56 | * A pointer to an array of characteristics to be included within this service |
rgrover1 | 144:c025c8839682 | 57 | * @param[in] numCharacteristics |
rgrover1 | 144:c025c8839682 | 58 | * The number of characteristics |
rgrover1 | 144:c025c8839682 | 59 | */ |
rgrover1 | 144:c025c8839682 | 60 | GattService(const UUID &uuid, GattCharacteristic *characteristics[], unsigned numCharacteristics); |
rgrover1 | 144:c025c8839682 | 61 | |
rgrover1 | 144:c025c8839682 | 62 | const UUID &getUUID(void) const {return _primaryServiceID; } |
rgrover1 | 144:c025c8839682 | 63 | uint16_t getHandle(void) const {return _handle; } |
rgrover1 | 144:c025c8839682 | 64 | uint8_t getCharacteristicCount(void) const {return _characteristicCount;} |
rgrover1 | 144:c025c8839682 | 65 | void setHandle(uint16_t handle) {_handle = handle;} |
rgrover1 | 144:c025c8839682 | 66 | |
Rohit Grover |
106:a20be740075d | 67 | GattCharacteristic *getCharacteristic(uint8_t index) { |
Rohit Grover |
106:a20be740075d | 68 | if (index >= _characteristicCount) { |
Rohit Grover |
106:a20be740075d | 69 | return NULL; |
Rohit Grover |
106:a20be740075d | 70 | } |
Rohit Grover |
106:a20be740075d | 71 | |
Rohit Grover |
106:a20be740075d | 72 | return _characteristics[index]; |
Rohit Grover |
106:a20be740075d | 73 | } |
Rohit Grover |
106:a20be740075d | 74 | |
Rohit Grover |
106:a20be740075d | 75 | private: |
Rohit Grover |
106:a20be740075d | 76 | UUID _primaryServiceID; |
Rohit Grover |
106:a20be740075d | 77 | uint8_t _characteristicCount; |
Rohit Grover |
106:a20be740075d | 78 | GattCharacteristic **_characteristics; |
Rohit Grover |
106:a20be740075d | 79 | uint16_t _handle; |
Rohit Grover |
106:a20be740075d | 80 | }; |
Rohit Grover |
106:a20be740075d | 81 | |
rgrover1 | 144:c025c8839682 | 82 | #endif // ifndef __GATT_SERVICE_H__ |