Preliminary main mbed library for nexpaq development

Committer:
nexpaq
Date:
Fri Nov 04 20:27:58 2016 +0000
Revision:
0:6c56fb4bc5f0
Moving to library for sharing updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 0:6c56fb4bc5f0 1 /* mbed Microcontroller Library
nexpaq 0:6c56fb4bc5f0 2 * Copyright (c) 2006-2013 ARM Limited
nexpaq 0:6c56fb4bc5f0 3 *
nexpaq 0:6c56fb4bc5f0 4 * Licensed under the Apache License, Version 2.0 (the "License");
nexpaq 0:6c56fb4bc5f0 5 * you may not use this file except in compliance with the License.
nexpaq 0:6c56fb4bc5f0 6 * You may obtain a copy of the License at
nexpaq 0:6c56fb4bc5f0 7 *
nexpaq 0:6c56fb4bc5f0 8 * http://www.apache.org/licenses/LICENSE-2.0
nexpaq 0:6c56fb4bc5f0 9 *
nexpaq 0:6c56fb4bc5f0 10 * Unless required by applicable law or agreed to in writing, software
nexpaq 0:6c56fb4bc5f0 11 * distributed under the License is distributed on an "AS IS" BASIS,
nexpaq 0:6c56fb4bc5f0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
nexpaq 0:6c56fb4bc5f0 13 * See the License for the specific language governing permissions and
nexpaq 0:6c56fb4bc5f0 14 * limitations under the License.
nexpaq 0:6c56fb4bc5f0 15 */
nexpaq 0:6c56fb4bc5f0 16
nexpaq 0:6c56fb4bc5f0 17 #ifndef __BLE_COMMON_H__
nexpaq 0:6c56fb4bc5f0 18 #define __BLE_COMMON_H__
nexpaq 0:6c56fb4bc5f0 19
nexpaq 0:6c56fb4bc5f0 20 #ifdef __cplusplus
nexpaq 0:6c56fb4bc5f0 21 extern "C" {
nexpaq 0:6c56fb4bc5f0 22 #endif
nexpaq 0:6c56fb4bc5f0 23
nexpaq 0:6c56fb4bc5f0 24
nexpaq 0:6c56fb4bc5f0 25 /*! @brief Assigned values for BLE UUIDs. */
nexpaq 0:6c56fb4bc5f0 26 enum {
nexpaq 0:6c56fb4bc5f0 27 BLE_UUID_UNKNOWN = 0x0000, /**< Reserved UUID. */
nexpaq 0:6c56fb4bc5f0 28 BLE_UUID_SERVICE_PRIMARY = 0x2800, /**< Primary Service. */
nexpaq 0:6c56fb4bc5f0 29 BLE_UUID_SERVICE_SECONDARY = 0x2801, /**< Secondary Service. */
nexpaq 0:6c56fb4bc5f0 30 BLE_UUID_SERVICE_INCLUDE = 0x2802, /**< Include. */
nexpaq 0:6c56fb4bc5f0 31 BLE_UUID_CHARACTERISTIC = 0x2803, /**< Characteristic. */
nexpaq 0:6c56fb4bc5f0 32 BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP = 0x2900, /**< Characteristic Extended Properties Descriptor. */
nexpaq 0:6c56fb4bc5f0 33 BLE_UUID_DESCRIPTOR_CHAR_USER_DESC = 0x2901, /**< Characteristic User Description Descriptor. */
nexpaq 0:6c56fb4bc5f0 34 BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG = 0x2902, /**< Client Characteristic Configuration Descriptor. */
nexpaq 0:6c56fb4bc5f0 35 BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG = 0x2903, /**< Server Characteristic Configuration Descriptor. */
nexpaq 0:6c56fb4bc5f0 36 BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT = 0x2904, /**< Characteristic Presentation Format Descriptor. */
nexpaq 0:6c56fb4bc5f0 37 BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT = 0x2905, /**< Characteristic Aggregate Format Descriptor. */
nexpaq 0:6c56fb4bc5f0 38
nexpaq 0:6c56fb4bc5f0 39 /* GATT specific UUIDs */
nexpaq 0:6c56fb4bc5f0 40 BLE_UUID_GATT = 0x1801, /**< Generic Attribute Profile. */
nexpaq 0:6c56fb4bc5f0 41 BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED = 0x2A05, /**< Service Changed Characteristic. */
nexpaq 0:6c56fb4bc5f0 42
nexpaq 0:6c56fb4bc5f0 43 /* GAP specific UUIDs */
nexpaq 0:6c56fb4bc5f0 44 BLE_UUID_GAP = 0x1800, /**< Generic Access Profile. */
nexpaq 0:6c56fb4bc5f0 45 BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME = 0x2A00, /**< Device Name Characteristic. */
nexpaq 0:6c56fb4bc5f0 46 BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE = 0x2A01, /**< Appearance Characteristic. */
nexpaq 0:6c56fb4bc5f0 47 BLE_UUID_GAP_CHARACTERISTIC_PPF = 0x2A02, /**< Peripheral Privacy Flag Characteristic. */
nexpaq 0:6c56fb4bc5f0 48 BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR = 0x2A03, /**< Reconnection Address Characteristic. */
nexpaq 0:6c56fb4bc5f0 49 BLE_UUID_GAP_CHARACTERISTIC_PPCP = 0x2A04, /**< Peripheral Preferred Connection Parameters Characteristic. */
nexpaq 0:6c56fb4bc5f0 50 };
nexpaq 0:6c56fb4bc5f0 51
nexpaq 0:6c56fb4bc5f0 52 /*! @brief Error codes for the BLE API. */
nexpaq 0:6c56fb4bc5f0 53 enum ble_error_t {
nexpaq 0:6c56fb4bc5f0 54 BLE_ERROR_NONE = 0, /**< No error. */
nexpaq 0:6c56fb4bc5f0 55 BLE_ERROR_BUFFER_OVERFLOW = 1, /**< The requested action would cause a buffer overflow and has been aborted. */
nexpaq 0:6c56fb4bc5f0 56 BLE_ERROR_NOT_IMPLEMENTED = 2, /**< Requested a feature that isn't yet implemented or isn't supported by the target HW. */
nexpaq 0:6c56fb4bc5f0 57 BLE_ERROR_PARAM_OUT_OF_RANGE = 3, /**< One of the supplied parameters is outside the valid range. */
nexpaq 0:6c56fb4bc5f0 58 BLE_ERROR_INVALID_PARAM = 4, /**< One of the supplied parameters is invalid. */
nexpaq 0:6c56fb4bc5f0 59 BLE_STACK_BUSY = 5, /**< The stack is busy. */
nexpaq 0:6c56fb4bc5f0 60 BLE_ERROR_INVALID_STATE = 6, /**< Invalid state. */
nexpaq 0:6c56fb4bc5f0 61 BLE_ERROR_NO_MEM = 7, /**< Out of memory */
nexpaq 0:6c56fb4bc5f0 62 BLE_ERROR_OPERATION_NOT_PERMITTED = 8,
nexpaq 0:6c56fb4bc5f0 63 BLE_ERROR_INITIALIZATION_INCOMPLETE = 9,
nexpaq 0:6c56fb4bc5f0 64 BLE_ERROR_ALREADY_INITIALIZED = 10,
nexpaq 0:6c56fb4bc5f0 65 BLE_ERROR_UNSPECIFIED = 11, /**< Unknown error. */
nexpaq 0:6c56fb4bc5f0 66 BLE_ERROR_INTERNAL_STACK_FAILURE = 12, /**< The platform-specific stack failed */
nexpaq 0:6c56fb4bc5f0 67 };
nexpaq 0:6c56fb4bc5f0 68
nexpaq 0:6c56fb4bc5f0 69 /** @brief Default MTU size. */
nexpaq 0:6c56fb4bc5f0 70 static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23;
nexpaq 0:6c56fb4bc5f0 71
nexpaq 0:6c56fb4bc5f0 72 enum HVXType_t {
nexpaq 0:6c56fb4bc5f0 73 BLE_HVX_NOTIFICATION = 0x01, /**< Handle Value Notification. */
nexpaq 0:6c56fb4bc5f0 74 BLE_HVX_INDICATION = 0x02, /**< Handle Value Indication. */
nexpaq 0:6c56fb4bc5f0 75 };
nexpaq 0:6c56fb4bc5f0 76
nexpaq 0:6c56fb4bc5f0 77 #ifdef __cplusplus
nexpaq 0:6c56fb4bc5f0 78 }
nexpaq 0:6c56fb4bc5f0 79 #endif
nexpaq 0:6c56fb4bc5f0 80
nexpaq 0:6c56fb4bc5f0 81 #endif // ifndef __BLE_COMMON_H__