Minor temporary patch to allow DFU packet callback

Fork of BLE_API by Bluetooth Low Energy

Committer:
rgrover1
Date:
Fri Nov 21 09:23:24 2014 +0000
Revision:
144:c025c8839682
Parent:
140:407d134c179d
Child:
260:ea7f9f14cc15
Synchronized with git rev 3d8441e2
Author: Rohit Grover
minor cleanup of public API classes.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
carlescufi 112:64c88ad45610 1 /* mbed Microcontroller Library
carlescufi 112:64c88ad45610 2 * Copyright (c) 2006-2013 ARM Limited
carlescufi 112:64c88ad45610 3 *
carlescufi 112:64c88ad45610 4 * Licensed under the Apache License, Version 2.0 (the "License");
carlescufi 112:64c88ad45610 5 * you may not use this file except in compliance with the License.
carlescufi 112:64c88ad45610 6 * You may obtain a copy of the License at
carlescufi 112:64c88ad45610 7 *
carlescufi 112:64c88ad45610 8 * http://www.apache.org/licenses/LICENSE-2.0
carlescufi 112:64c88ad45610 9 *
carlescufi 112:64c88ad45610 10 * Unless required by applicable law or agreed to in writing, software
carlescufi 112:64c88ad45610 11 * distributed under the License is distributed on an "AS IS" BASIS,
carlescufi 112:64c88ad45610 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
carlescufi 112:64c88ad45610 13 * See the License for the specific language governing permissions and
carlescufi 112:64c88ad45610 14 * limitations under the License.
carlescufi 112:64c88ad45610 15 */
carlescufi 112:64c88ad45610 16
carlescufi 112:64c88ad45610 17 #ifndef __GATT_ATTRIBUTE_H__
carlescufi 112:64c88ad45610 18 #define __GATT_ATTRIBUTE_H__
carlescufi 112:64c88ad45610 19
rgrover1 144:c025c8839682 20 class GattAttribute {
carlescufi 112:64c88ad45610 21 public:
Rohit Grover 118:620d28e7a1ba 22 typedef uint16_t Handle_t;
carlescufi 112:64c88ad45610 23
Rohit Grover 118:620d28e7a1ba 24 public:
carlescufi 112:64c88ad45610 25 /**
carlescufi 112:64c88ad45610 26 * @brief Creates a new GattAttribute using the specified
carlescufi 112:64c88ad45610 27 * UUID, value length, and inital value
carlescufi 112:64c88ad45610 28 *
carlescufi 112:64c88ad45610 29 * @param[in] uuid
carlescufi 112:64c88ad45610 30 * The UUID to use for this attribute
carlescufi 112:64c88ad45610 31 * @param[in] valuePtr
carlescufi 112:64c88ad45610 32 * The memory holding the initial value.
carlescufi 112:64c88ad45610 33 * @param[in] initialLen
carlescufi 112:64c88ad45610 34 * The min length in bytes of this characteristic's value
carlescufi 112:64c88ad45610 35 * @param[in] maxLen
carlescufi 112:64c88ad45610 36 * The max length in bytes of this characteristic's value
carlescufi 112:64c88ad45610 37 *
carlescufi 112:64c88ad45610 38 * @section EXAMPLE
carlescufi 112:64c88ad45610 39 *
carlescufi 112:64c88ad45610 40 * @code
carlescufi 112:64c88ad45610 41 *
carlescufi 112:64c88ad45610 42 * // UUID = 0x2A19, Min length 2, Max len = 2, Properties = write
carlescufi 112:64c88ad45610 43 * GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE );
carlescufi 112:64c88ad45610 44 *
carlescufi 112:64c88ad45610 45 * @endcode
carlescufi 112:64c88ad45610 46 */
carlescufi 112:64c88ad45610 47 /**************************************************************************/
carlescufi 112:64c88ad45610 48 GattAttribute(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t initialLen = 0, uint16_t maxLen = 0) :
rgrover1 144:c025c8839682 49 _uuid(uuid), _valuePtr(valuePtr), _initialLen(initialLen), _lenMax(maxLen), _handle() {
carlescufi 112:64c88ad45610 50 /* empty */
carlescufi 112:64c88ad45610 51 }
carlescufi 112:64c88ad45610 52
carlescufi 112:64c88ad45610 53 public:
rgrover1 144:c025c8839682 54 Handle_t getHandle(void) const {return _handle; }
rgrover1 144:c025c8839682 55 const UUID &getUUID(void) const {return _uuid; }
rgrover1 144:c025c8839682 56 uint16_t getInitialLength(void) const {return _initialLen;}
rgrover1 144:c025c8839682 57 uint16_t getMaxLength(void) const {return _lenMax; }
rgrover1 144:c025c8839682 58 void setHandle(Handle_t id) {_handle = id; }
rgrover1 144:c025c8839682 59 uint8_t *getValuePtr(void) {return _valuePtr; }
Rohit Grover 118:620d28e7a1ba 60
rgrover1 144:c025c8839682 61 private:
carlescufi 112:64c88ad45610 62 UUID _uuid; /* Characteristic UUID */
carlescufi 112:64c88ad45610 63 uint8_t *_valuePtr;
carlescufi 112:64c88ad45610 64 uint16_t _initialLen; /* Initial length of the value */
carlescufi 112:64c88ad45610 65 uint16_t _lenMax; /* Maximum length of the value */
Rohit Grover 118:620d28e7a1ba 66 Handle_t _handle;
rgrover1 144:c025c8839682 67
rgrover1 144:c025c8839682 68 private:
rgrover1 144:c025c8839682 69 /* disallow copy and assignment */
rgrover1 144:c025c8839682 70 GattAttribute(const GattAttribute &);
rgrover1 144:c025c8839682 71 GattAttribute& operator=(const GattAttribute &);
carlescufi 112:64c88ad45610 72 };
carlescufi 112:64c88ad45610 73
rgrover1 137:4b648181ea6b 74 #endif // ifndef __GATT_ATTRIBUTE_H__