BLE temperature profile using digital DS1820 or analog LM35 sensors

Dependencies:   DS1820

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GattCharacteristic.cpp Source File

GattCharacteristic.cpp

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 #include <stdio.h>
00018 #include <string.h>
00019 
00020 #include "GattCharacteristic.h"
00021 
00022 /**************************************************************************/
00023 /*!
00024     @brief  Creates a new GattCharacteristic using the specified 16-bit
00025             UUID, value length, and properties
00026             
00027     @note   The UUID value must be unique in the service and is normally >1
00028 
00029     @param[in]  id
00030                 The 16-bit UUID to use for this characteristic
00031     @param[in]  minLen
00032                 The min length in bytes of this characteristic's value
00033     @param[in]  maxLen
00034                 The max length in bytes of this characteristic's value
00035     @param[in]  props
00036                 The 8-bit bit field containing the characteristic's
00037                 properties
00038 
00039     @section EXAMPLE
00040 
00041     @code
00042 
00043     // UUID = 0x2A19, Min length 2, Max len = 2, Properties = write
00044     GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE );
00045    
00046     @endcode
00047 */
00048 /**************************************************************************/
00049 GattCharacteristic::GattCharacteristic(uint16_t id, uint16_t minLen, uint16_t maxLen, uint8_t props)
00050 {
00051     uuid = id;
00052     memcpy(&properties, &props, 1);
00053     lenMin = minLen;
00054     lenMax = maxLen;
00055 //    handle = 0;
00056 }
00057 
00058 /**************************************************************************/
00059 /*!
00060     Destructor
00061 */
00062 /**************************************************************************/
00063 GattCharacteristic::~GattCharacteristic (void)
00064 {
00065 }