Originally from Donal's blog article. http://mbed.org/users/donalm/code/BLE_Health_Thermometer_Blog/ Changed low freq. clock source from XTAL to IRC.
Dependents: BLE_Health_Thermometer_IRC BLE_RCBController_micono_test BLE_konashi_PIO_test BLE_ADT7410_TMP102_Sample ... more
Fork of BLE_API_Native_blog by
GattCharacteristic.cpp@0:4c3097c65247, 2014-02-06 (annotated)
- Committer:
- ktownsend
- Date:
- Thu Feb 06 11:51:06 2014 +0000
- Revision:
- 0:4c3097c65247
Native mode drivers
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ktownsend | 0:4c3097c65247 | 1 | /* mbed Microcontroller Library |
ktownsend | 0:4c3097c65247 | 2 | * Copyright (c) 2006-2013 ARM Limited |
ktownsend | 0:4c3097c65247 | 3 | * |
ktownsend | 0:4c3097c65247 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ktownsend | 0:4c3097c65247 | 5 | * you may not use this file except in compliance with the License. |
ktownsend | 0:4c3097c65247 | 6 | * You may obtain a copy of the License at |
ktownsend | 0:4c3097c65247 | 7 | * |
ktownsend | 0:4c3097c65247 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ktownsend | 0:4c3097c65247 | 9 | * |
ktownsend | 0:4c3097c65247 | 10 | * Unless required by applicable law or agreed to in writing, software |
ktownsend | 0:4c3097c65247 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
ktownsend | 0:4c3097c65247 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ktownsend | 0:4c3097c65247 | 13 | * See the License for the specific language governing permissions and |
ktownsend | 0:4c3097c65247 | 14 | * limitations under the License. |
ktownsend | 0:4c3097c65247 | 15 | */ |
ktownsend | 0:4c3097c65247 | 16 | |
ktownsend | 0:4c3097c65247 | 17 | #include <stdio.h> |
ktownsend | 0:4c3097c65247 | 18 | #include <string.h> |
ktownsend | 0:4c3097c65247 | 19 | |
ktownsend | 0:4c3097c65247 | 20 | #include "GattCharacteristic.h" |
ktownsend | 0:4c3097c65247 | 21 | |
ktownsend | 0:4c3097c65247 | 22 | /**************************************************************************/ |
ktownsend | 0:4c3097c65247 | 23 | /*! |
ktownsend | 0:4c3097c65247 | 24 | @brief Creates a new GattCharacteristic using the specified 16-bit |
ktownsend | 0:4c3097c65247 | 25 | UUID, value length, and properties |
ktownsend | 0:4c3097c65247 | 26 | |
ktownsend | 0:4c3097c65247 | 27 | @note The UUID value must be unique in the service and is normally >1 |
ktownsend | 0:4c3097c65247 | 28 | |
ktownsend | 0:4c3097c65247 | 29 | @param[in] id |
ktownsend | 0:4c3097c65247 | 30 | The 16-bit UUID to use for this characteristic |
ktownsend | 0:4c3097c65247 | 31 | @param[in] minLen |
ktownsend | 0:4c3097c65247 | 32 | The min length in bytes of this characteristic's value |
ktownsend | 0:4c3097c65247 | 33 | @param[in] maxLen |
ktownsend | 0:4c3097c65247 | 34 | The max length in bytes of this characteristic's value |
ktownsend | 0:4c3097c65247 | 35 | @param[in] props |
ktownsend | 0:4c3097c65247 | 36 | The 8-bit bit field containing the characteristic's |
ktownsend | 0:4c3097c65247 | 37 | properties |
ktownsend | 0:4c3097c65247 | 38 | |
ktownsend | 0:4c3097c65247 | 39 | @section EXAMPLE |
ktownsend | 0:4c3097c65247 | 40 | |
ktownsend | 0:4c3097c65247 | 41 | @code |
ktownsend | 0:4c3097c65247 | 42 | |
ktownsend | 0:4c3097c65247 | 43 | // UUID = 0x2A19, Min length 2, Max len = 2, Properties = write |
ktownsend | 0:4c3097c65247 | 44 | GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE ); |
ktownsend | 0:4c3097c65247 | 45 | |
ktownsend | 0:4c3097c65247 | 46 | @endcode |
ktownsend | 0:4c3097c65247 | 47 | */ |
ktownsend | 0:4c3097c65247 | 48 | /**************************************************************************/ |
ktownsend | 0:4c3097c65247 | 49 | GattCharacteristic::GattCharacteristic(uint16_t id, uint16_t minLen, uint16_t maxLen, uint8_t props) |
ktownsend | 0:4c3097c65247 | 50 | { |
ktownsend | 0:4c3097c65247 | 51 | uuid = id; |
ktownsend | 0:4c3097c65247 | 52 | memcpy(&properties, &props, 1); |
ktownsend | 0:4c3097c65247 | 53 | lenMin = minLen; |
ktownsend | 0:4c3097c65247 | 54 | lenMax = maxLen; |
ktownsend | 0:4c3097c65247 | 55 | // handle = 0; |
ktownsend | 0:4c3097c65247 | 56 | } |
ktownsend | 0:4c3097c65247 | 57 | |
ktownsend | 0:4c3097c65247 | 58 | /**************************************************************************/ |
ktownsend | 0:4c3097c65247 | 59 | /*! |
ktownsend | 0:4c3097c65247 | 60 | Destructor |
ktownsend | 0:4c3097c65247 | 61 | */ |
ktownsend | 0:4c3097c65247 | 62 | /**************************************************************************/ |
ktownsend | 0:4c3097c65247 | 63 | GattCharacteristic::~GattCharacteristic(void) |
ktownsend | 0:4c3097c65247 | 64 | { |
ktownsend | 0:4c3097c65247 | 65 | } |