Minor temporary patch to allow DFU packet callback
Fork of BLE_API by
GattAttribute.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef __GATT_ATTRIBUTE_H__ 00018 #define __GATT_ATTRIBUTE_H__ 00019 00020 class GattAttribute { 00021 public: 00022 typedef uint16_t Handle_t; 00023 00024 public: 00025 /** 00026 * @brief Creates a new GattAttribute using the specified 00027 * UUID, value length, and inital value 00028 * 00029 * @param[in] uuid 00030 * The UUID to use for this attribute 00031 * @param[in] valuePtr 00032 * The memory holding the initial value. 00033 * @param[in] initialLen 00034 * The min length in bytes of this attribute's value 00035 * @param[in] maxLen 00036 * The max length in bytes of this attribute's value 00037 * 00038 * @section EXAMPLE 00039 * 00040 * @code 00041 * 00042 * // UUID = 0x2A19, Min length 2, Max len = 2 00043 * GattAttribute attr = GattAttribute(0x2A19, &someValue, 2, 2); 00044 * 00045 * @endcode 00046 */ 00047 GattAttribute(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t initialLen = 0, uint16_t maxLen = 0) : 00048 _uuid(uuid), _valuePtr(valuePtr), _initialLen(initialLen), _lenMax(maxLen), _len(initialLen), _handle() { 00049 /* empty */ 00050 } 00051 00052 public: 00053 Handle_t getHandle(void) const {return _handle; } 00054 const UUID &getUUID(void) const {return _uuid; } 00055 uint16_t getLength(void) const {return _len; } 00056 uint16_t getInitialLength(void) const {return _initialLen;} 00057 uint16_t getMaxLength(void) const {return _lenMax; } 00058 uint16_t *getLengthPtr(void) {return &_len; } 00059 void setHandle(Handle_t id) {_handle = id; } 00060 uint8_t *getValuePtr(void) {return _valuePtr; } 00061 00062 private: 00063 UUID _uuid; /* Characteristic UUID */ 00064 uint8_t *_valuePtr; 00065 uint16_t _initialLen; /* Initial length of the value */ 00066 uint16_t _lenMax; /* Maximum length of the value */ 00067 uint16_t _len; /* Current length of the value */ 00068 Handle_t _handle; 00069 00070 private: 00071 /* disallow copy and assignment */ 00072 GattAttribute(const GattAttribute &); 00073 GattAttribute& operator=(const GattAttribute &); 00074 }; 00075 00076 #endif // ifndef __GATT_ATTRIBUTE_H__
Generated on Wed Jul 13 2022 06:54:06 by 1.7.2