BLE_API

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers blecommon.h Source File

blecommon.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 __BLE_COMMON_H__
00018 #define __BLE_COMMON_H__
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 
00025 /*! @brief Assigned values for BLE UUIDs. */
00026 enum {
00027     BLE_UUID_UNKNOWN                             = 0x0000, /**< Reserved UUID. */
00028     BLE_UUID_SERVICE_PRIMARY                     = 0x2800, /**< Primary Service. */
00029     BLE_UUID_SERVICE_SECONDARY                   = 0x2801, /**< Secondary Service. */
00030     BLE_UUID_SERVICE_INCLUDE                     = 0x2802, /**< Include. */
00031     BLE_UUID_CHARACTERISTIC                      = 0x2803, /**< Characteristic. */
00032     BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP            = 0x2900, /**< Characteristic Extended Properties Descriptor. */
00033     BLE_UUID_DESCRIPTOR_CHAR_USER_DESC           = 0x2901, /**< Characteristic User Description Descriptor. */
00034     BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG       = 0x2902, /**< Client Characteristic Configuration Descriptor. */
00035     BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG       = 0x2903, /**< Server Characteristic Configuration Descriptor. */
00036     BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT = 0x2904, /**< Characteristic Presentation Format Descriptor. */
00037     BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT    = 0x2905, /**< Characteristic Aggregate Format Descriptor. */
00038 
00039 /* GATT specific UUIDs */
00040     BLE_UUID_GATT                                = 0x1801, /**< Generic Attribute Profile. */
00041     BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED = 0x2A05, /**< Service Changed Characteristic. */
00042 
00043 /* GAP specific UUIDs */
00044     BLE_UUID_GAP                                 = 0x1800, /**< Generic Access Profile. */
00045     BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME      = 0x2A00, /**< Device Name Characteristic. */
00046     BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE       = 0x2A01, /**< Appearance Characteristic. */
00047     BLE_UUID_GAP_CHARACTERISTIC_PPF              = 0x2A02, /**< Peripheral Privacy Flag Characteristic. */
00048     BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR      = 0x2A03, /**< Reconnection Address Characteristic. */
00049     BLE_UUID_GAP_CHARACTERISTIC_PPCP             = 0x2A04, /**< Peripheral Preferred Connection Parameters Characteristic. */
00050 };
00051 
00052 /*! @brief Error codes for the BLE API. */
00053 enum ble_error_t {
00054     BLE_ERROR_NONE                      = 0, /**< No error. */
00055     BLE_ERROR_BUFFER_OVERFLOW           = 1, /**< The requested action would cause a buffer overflow and has been aborted. */
00056     BLE_ERROR_NOT_IMPLEMENTED           = 2, /**< Requested a feature that isn't yet implemented or isn't supported by the target HW. */
00057     BLE_ERROR_PARAM_OUT_OF_RANGE        = 3, /**< One of the supplied parameters is outside the valid range. */
00058     BLE_ERROR_INVALID_PARAM             = 4, /**< One of the supplied parameters is invalid. */
00059     BLE_STACK_BUSY                      = 5, /**< The stack is busy. */
00060     BLE_ERROR_INVALID_STATE             = 6, /**< Invalid state. */
00061     BLE_ERROR_NO_MEM                    = 7, /**< Out of memory */
00062     BLE_ERROR_OPERATION_NOT_PERMITTED   = 8,
00063     BLE_ERROR_INITIALIZATION_INCOMPLETE = 9,
00064     BLE_ERROR_ALREADY_INITIALIZED       = 10,
00065     BLE_ERROR_UNSPECIFIED               = 11, /**< Unknown error. */
00066     BLE_ERROR_INTERNAL_STACK_FAILURE    = 12, /**< The platform-specific stack failed */
00067 };
00068 
00069 /** @brief Default MTU size. */
00070 static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23;
00071 
00072 enum HVXType_t {
00073     BLE_HVX_NOTIFICATION = 0x01,  /**< Handle Value Notification. */
00074     BLE_HVX_INDICATION   = 0x02,  /**< Handle Value Indication. */
00075 };
00076 
00077 #ifdef __cplusplus
00078 }
00079 #endif
00080 
00081 #endif // ifndef __BLE_COMMON_H__