High level Bluetooth Low Energy API and radio abstraction layer

Dependencies:   nRF51822

Dependents:   LinkNode_LIS3DH

Fork of BLE_API by Bluetooth Low Energy

Committer:
bogdanm
Date:
Tue Apr 01 11:04:56 2014 +0100
Revision:
31:2c94f0501807
Parent:
27:4a83843f04b0
Child:
34:da2ea8cd6216
Synchronized with git revision fdcc1e387426ce216bc17175b73bcd5f4aececff

Who changed what in which revision?

UserRevisionLine numberNew 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 */
ktownsend 27:4a83843f04b0 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
ktownsend 2:ffc5216bd2cc 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 );
ktownsend 2:ffc5216bd2cc 45
ktownsend 2:ffc5216bd2cc 46 @endcode
ktownsend 2:ffc5216bd2cc 47 */
ktownsend 2:ffc5216bd2cc 48 /**************************************************************************/
ktownsend 2:ffc5216bd2cc 49 GattCharacteristic::GattCharacteristic(uint16_t id, uint16_t minLen, uint16_t maxLen, uint8_t props)
ktownsend 2:ffc5216bd2cc 50 {
ktownsend 2:ffc5216bd2cc 51 uuid = id;
ktownsend 2:ffc5216bd2cc 52 memcpy(&properties, &props, 1);
ktownsend 2:ffc5216bd2cc 53 lenMin = minLen;
ktownsend 2:ffc5216bd2cc 54 lenMax = maxLen;
bogdanm 31:2c94f0501807 55 // handle = 0;
ktownsend 2:ffc5216bd2cc 56 }
ktownsend 2:ffc5216bd2cc 57
ktownsend 2:ffc5216bd2cc 58 /**************************************************************************/
ktownsend 2:ffc5216bd2cc 59 /*!
ktownsend 2:ffc5216bd2cc 60 Destructor
ktownsend 2:ffc5216bd2cc 61 */
ktownsend 2:ffc5216bd2cc 62 /**************************************************************************/
ktownsend 2:ffc5216bd2cc 63 GattCharacteristic::~GattCharacteristic(void)
ktownsend 2:ffc5216bd2cc 64 {
ktownsend 2:ffc5216bd2cc 65 }