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
GattCharacteristic.cpp@67:0fac4e99f29b, 2014-06-05 (annotated)
- Committer:
- Rohit Grover
- Date:
- Thu Jun 05 08:48:51 2014 +0100
- Revision:
- 67:0fac4e99f29b
- Parent:
- 52:62b9d3b7a689
- Child:
- 82:9853676a88e6
switch to using LongUUID_t and ShortUUID_t
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ktownsend | 27:4a83843f04b0 | 1 | /* mbed Microcontroller Library |
| ktownsend | 27:4a83843f04b0 | 2 | * Copyright (c) 2006-2013 ARM Limited |
| ktownsend | 27:4a83843f04b0 | 3 | * |
| ktownsend | 27:4a83843f04b0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| ktownsend | 27:4a83843f04b0 | 5 | * you may not use this file except in compliance with the License. |
| ktownsend | 27:4a83843f04b0 | 6 | * You may obtain a copy of the License at |
| ktownsend | 27:4a83843f04b0 | 7 | * |
| ktownsend | 27:4a83843f04b0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| ktownsend | 27:4a83843f04b0 | 9 | * |
| ktownsend | 27:4a83843f04b0 | 10 | * Unless required by applicable law or agreed to in writing, software |
| ktownsend | 27:4a83843f04b0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| ktownsend | 27:4a83843f04b0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| ktownsend | 27:4a83843f04b0 | 13 | * See the License for the specific language governing permissions and |
| ktownsend | 27:4a83843f04b0 | 14 | * limitations under the License. |
| ktownsend | 27:4a83843f04b0 | 15 | */ |
| Rohit Grover |
34:da2ea8cd6216 | 16 | |
| ktownsend | 2:ffc5216bd2cc | 17 | #include <stdio.h> |
| ktownsend | 2:ffc5216bd2cc | 18 | #include <string.h> |
| ktownsend | 2:ffc5216bd2cc | 19 | |
| ktownsend | 2:ffc5216bd2cc | 20 | #include "GattCharacteristic.h" |
| ktownsend | 2:ffc5216bd2cc | 21 | |
| ktownsend | 2:ffc5216bd2cc | 22 | /**************************************************************************/ |
| ktownsend | 2:ffc5216bd2cc | 23 | /*! |
| ktownsend | 2:ffc5216bd2cc | 24 | @brief Creates a new GattCharacteristic using the specified 16-bit |
| ktownsend | 2:ffc5216bd2cc | 25 | UUID, value length, and properties |
| Rohit Grover |
34:da2ea8cd6216 | 26 | |
| ktownsend | 2:ffc5216bd2cc | 27 | @note The UUID value must be unique in the service and is normally >1 |
| ktownsend | 2:ffc5216bd2cc | 28 | |
| ktownsend | 2:ffc5216bd2cc | 29 | @param[in] id |
| ktownsend | 2:ffc5216bd2cc | 30 | The 16-bit UUID to use for this characteristic |
| ktownsend | 2:ffc5216bd2cc | 31 | @param[in] minLen |
| ktownsend | 2:ffc5216bd2cc | 32 | The min length in bytes of this characteristic's value |
| ktownsend | 2:ffc5216bd2cc | 33 | @param[in] maxLen |
| ktownsend | 2:ffc5216bd2cc | 34 | The max length in bytes of this characteristic's value |
| ktownsend | 2:ffc5216bd2cc | 35 | @param[in] props |
| ktownsend | 2:ffc5216bd2cc | 36 | The 8-bit bit field containing the characteristic's |
| ktownsend | 2:ffc5216bd2cc | 37 | properties |
| ktownsend | 2:ffc5216bd2cc | 38 | |
| ktownsend | 2:ffc5216bd2cc | 39 | @section EXAMPLE |
| ktownsend | 2:ffc5216bd2cc | 40 | |
| ktownsend | 2:ffc5216bd2cc | 41 | @code |
| ktownsend | 2:ffc5216bd2cc | 42 | |
| ktownsend | 2:ffc5216bd2cc | 43 | // UUID = 0x2A19, Min length 2, Max len = 2, Properties = write |
| ktownsend | 4:50a31ff5f974 | 44 | GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE ); |
| Rohit Grover |
34:da2ea8cd6216 | 45 | |
| ktownsend | 2:ffc5216bd2cc | 46 | @endcode |
| ktownsend | 2:ffc5216bd2cc | 47 | */ |
| ktownsend | 2:ffc5216bd2cc | 48 | /**************************************************************************/ |
| Rohit Grover |
34:da2ea8cd6216 | 49 | GattCharacteristic::GattCharacteristic(uint16_t id, |
| Rohit Grover |
34:da2ea8cd6216 | 50 | uint16_t minLen, |
| Rohit Grover |
34:da2ea8cd6216 | 51 | uint16_t maxLen, |
| Rohit Grover |
51:0329477be5e2 | 52 | uint8_t props) : |
| Rohit Grover |
51:0329477be5e2 | 53 | uuid(id), |
| Rohit Grover |
51:0329477be5e2 | 54 | lenMin(minLen), |
| Rohit Grover |
51:0329477be5e2 | 55 | lenMax(maxLen), |
| Rohit Grover |
51:0329477be5e2 | 56 | handle(), |
| Rohit Grover |
51:0329477be5e2 | 57 | properties(props) |
| ktownsend | 2:ffc5216bd2cc | 58 | { |
| Rohit Grover |
51:0329477be5e2 | 59 | /* empty */ |
| ktownsend | 2:ffc5216bd2cc | 60 | } |
| Rohit Grover |
67:0fac4e99f29b | 61 | |
| Rohit Grover |
67:0fac4e99f29b | 62 | GattCharacteristic::GattCharacteristic(const LongUUID_t longUUID, |
| Rohit Grover |
67:0fac4e99f29b | 63 | uint16_t minLen, |
| Rohit Grover |
67:0fac4e99f29b | 64 | uint16_t maxLen, |
| Rohit Grover |
67:0fac4e99f29b | 65 | uint8_t props) : |
| Rohit Grover |
52:62b9d3b7a689 | 66 | uuid(longUUID), |
| Rohit Grover |
52:62b9d3b7a689 | 67 | lenMin(minLen), |
| Rohit Grover |
52:62b9d3b7a689 | 68 | lenMax(maxLen), |
| Rohit Grover |
52:62b9d3b7a689 | 69 | handle(), |
| Rohit Grover |
52:62b9d3b7a689 | 70 | properties(props) |
| Rohit Grover |
52:62b9d3b7a689 | 71 | { |
| Rohit Grover |
52:62b9d3b7a689 | 72 | /* empty */ |
| Rohit Grover |
52:62b9d3b7a689 | 73 | } |
| ktownsend | 2:ffc5216bd2cc | 74 | |
| ktownsend | 2:ffc5216bd2cc | 75 | /**************************************************************************/ |
| ktownsend | 2:ffc5216bd2cc | 76 | /*! |
| ktownsend | 2:ffc5216bd2cc | 77 | Destructor |
| ktownsend | 2:ffc5216bd2cc | 78 | */ |
| ktownsend | 2:ffc5216bd2cc | 79 | /**************************************************************************/ |
| ktownsend | 2:ffc5216bd2cc | 80 | GattCharacteristic::~GattCharacteristic(void) |
| ktownsend | 2:ffc5216bd2cc | 81 | { |
| ktownsend | 2:ffc5216bd2cc | 82 | } |
