mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon Apr 07 18:28:36 2014 +0100
Revision:
82:6473597d706e
Release 82 of the mbed library

Main changes:

- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 82:6473597d706e 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
bogdanm 82:6473597d706e 2 *
bogdanm 82:6473597d706e 3 * The information contained herein is confidential property of Nordic Semiconductor. The use,
bogdanm 82:6473597d706e 4 * copying, transfer or disclosure of such information is prohibited except by express written
bogdanm 82:6473597d706e 5 * agreement with Nordic Semiconductor.
bogdanm 82:6473597d706e 6 *
bogdanm 82:6473597d706e 7 */
bogdanm 82:6473597d706e 8 /**
bogdanm 82:6473597d706e 9 @addtogroup BLE_GATT Generic Attribute Profile (GATT) Common
bogdanm 82:6473597d706e 10 @{
bogdanm 82:6473597d706e 11 @brief Common definitions and prototypes for the GATT interfaces.
bogdanm 82:6473597d706e 12 */
bogdanm 82:6473597d706e 13
bogdanm 82:6473597d706e 14 #ifndef BLE_GATT_H__
bogdanm 82:6473597d706e 15 #define BLE_GATT_H__
bogdanm 82:6473597d706e 16
bogdanm 82:6473597d706e 17 #include "ble_types.h"
bogdanm 82:6473597d706e 18 #include "ble_ranges.h"
bogdanm 82:6473597d706e 19
bogdanm 82:6473597d706e 20
bogdanm 82:6473597d706e 21 /** @addtogroup BLE_GATT_DEFINES Defines
bogdanm 82:6473597d706e 22 * @{ */
bogdanm 82:6473597d706e 23
bogdanm 82:6473597d706e 24 /** @brief Default MTU size. */
bogdanm 82:6473597d706e 25 #define GATT_MTU_SIZE_DEFAULT 23
bogdanm 82:6473597d706e 26
bogdanm 82:6473597d706e 27 /** @brief Only the default MTU size of 23 is currently supported. */
bogdanm 82:6473597d706e 28 #define GATT_RX_MTU 23
bogdanm 82:6473597d706e 29
bogdanm 82:6473597d706e 30
bogdanm 82:6473597d706e 31 /**@brief Invalid Attribute Handle. */
bogdanm 82:6473597d706e 32 #define BLE_GATT_HANDLE_INVALID 0x0000
bogdanm 82:6473597d706e 33
bogdanm 82:6473597d706e 34 /** @defgroup BLE_GATT_TIMEOUT_SOURCES GATT Timeout sources
bogdanm 82:6473597d706e 35 * @{ */
bogdanm 82:6473597d706e 36 #define BLE_GATT_TIMEOUT_SRC_PROTOCOL 0x00 /**< ATT Protocol timeout. */
bogdanm 82:6473597d706e 37 /** @} */
bogdanm 82:6473597d706e 38
bogdanm 82:6473597d706e 39 /** @defgroup BLE_GATT_WRITE_OPS GATT Write operations
bogdanm 82:6473597d706e 40 * @{ */
bogdanm 82:6473597d706e 41 #define BLE_GATT_OP_INVALID 0x00 /**< Invalid Operation. */
bogdanm 82:6473597d706e 42 #define BLE_GATT_OP_WRITE_REQ 0x01 /**< Write Request. */
bogdanm 82:6473597d706e 43 #define BLE_GATT_OP_WRITE_CMD 0x02 /**< Write Command. */
bogdanm 82:6473597d706e 44 #define BLE_GATT_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */
bogdanm 82:6473597d706e 45 #define BLE_GATT_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */
bogdanm 82:6473597d706e 46 #define BLE_GATT_OP_EXEC_WRITE_REQ 0x05 /**< Execute Write Request. */
bogdanm 82:6473597d706e 47 /** @} */
bogdanm 82:6473597d706e 48
bogdanm 82:6473597d706e 49 /** @defgroup BLE_GATT_EXEC_WRITE_FLAGS GATT Execute Write flags
bogdanm 82:6473597d706e 50 * @{ */
bogdanm 82:6473597d706e 51 #define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL 0x00
bogdanm 82:6473597d706e 52 #define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE 0x01
bogdanm 82:6473597d706e 53 /** @} */
bogdanm 82:6473597d706e 54
bogdanm 82:6473597d706e 55 /** @defgroup BLE_GATT_HVX_TYPES GATT Handle Value operations
bogdanm 82:6473597d706e 56 * @{ */
bogdanm 82:6473597d706e 57 #define BLE_GATT_HVX_INVALID 0x00 /**< Invalid Operation. */
bogdanm 82:6473597d706e 58 #define BLE_GATT_HVX_NOTIFICATION 0x01 /**< Handle Value Notification. */
bogdanm 82:6473597d706e 59 #define BLE_GATT_HVX_INDICATION 0x02 /**< Handle Value Indication. */
bogdanm 82:6473597d706e 60 /** @} */
bogdanm 82:6473597d706e 61
bogdanm 82:6473597d706e 62 /** @defgroup BLE_GATT_STATUS_CODES GATT Status Codes
bogdanm 82:6473597d706e 63 * @{ */
bogdanm 82:6473597d706e 64 #define BLE_GATT_STATUS_SUCCESS 0x0000 /**< Success. */
bogdanm 82:6473597d706e 65 #define BLE_GATT_STATUS_UNKNOWN 0x0001 /**< Unknown or not applicable status. */
bogdanm 82:6473597d706e 66 #define BLE_GATT_STATUS_ATTERR_INVALID 0x0100 /**< ATT Error: Invalid Error Code. */
bogdanm 82:6473597d706e 67 #define BLE_GATT_STATUS_ATTERR_INVALID_HANDLE 0x0101 /**< ATT Error: Invalid Attribute Handle. */
bogdanm 82:6473597d706e 68 #define BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED 0x0102 /**< ATT Error: Read not permitted. */
bogdanm 82:6473597d706e 69 #define BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED 0x0103 /**< ATT Error: Write not permitted. */
bogdanm 82:6473597d706e 70 #define BLE_GATT_STATUS_ATTERR_INVALID_PDU 0x0104 /**< ATT Error: Used in ATT as Invalid PDU. */
bogdanm 82:6473597d706e 71 #define BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION 0x0105 /**< ATT Error: Authenticated link required. */
bogdanm 82:6473597d706e 72 #define BLE_GATT_STATUS_ATTERR_REQUEST_NOT_SUPPORTED 0x0106 /**< ATT Error: Used in ATT as Request Not Supported. */
bogdanm 82:6473597d706e 73 #define BLE_GATT_STATUS_ATTERR_INVALID_OFFSET 0x0107 /**< ATT Error: Offset specified was past the end of the attribute. */
bogdanm 82:6473597d706e 74 #define BLE_GATT_STATUS_ATTERR_INSUF_AUTHORIZATION 0x0108 /**< ATT Error: Used in ATT as Insufficient Authorisation. */
bogdanm 82:6473597d706e 75 #define BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL 0x0109 /**< ATT Error: Used in ATT as Prepare Queue Full. */
bogdanm 82:6473597d706e 76 #define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND 0x010A /**< ATT Error: Used in ATT as Attribute not found. */
bogdanm 82:6473597d706e 77 #define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_LONG 0x010B /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */
bogdanm 82:6473597d706e 78 #define BLE_GATT_STATUS_ATTERR_INSUF_ENC_KEY_SIZE 0x010C /**< ATT Error: Encryption key size used is insufficient. */
bogdanm 82:6473597d706e 79 #define BLE_GATT_STATUS_ATTERR_INVALID_ATT_VAL_LENGTH 0x010D /**< ATT Error: Invalid value size. */
bogdanm 82:6473597d706e 80 #define BLE_GATT_STATUS_ATTERR_UNLIKELY_ERROR 0x010E /**< ATT Error: Very unlikely error. */
bogdanm 82:6473597d706e 81 #define BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION 0x010F /**< ATT Error: Encrypted link required. */
bogdanm 82:6473597d706e 82 #define BLE_GATT_STATUS_ATTERR_UNSUPPORTED_GROUP_TYPE 0x0110 /**< ATT Error: Attribute type is not a supported grouping attribute. */
bogdanm 82:6473597d706e 83 #define BLE_GATT_STATUS_ATTERR_INSUF_RESOURCES 0x0111 /**< ATT Error: Encrypted link required. */
bogdanm 82:6473597d706e 84 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_BEGIN 0x0112 /**< ATT Error: Reserved for Future Use range #1 begin. */
bogdanm 82:6473597d706e 85 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_END 0x017F /**< ATT Error: Reserved for Future Use range #1 end. */
bogdanm 82:6473597d706e 86 #define BLE_GATT_STATUS_ATTERR_APP_BEGIN 0x0180 /**< ATT Error: Application range begin. */
bogdanm 82:6473597d706e 87 #define BLE_GATT_STATUS_ATTERR_APP_END 0x019F /**< ATT Error: Application range end. */
bogdanm 82:6473597d706e 88 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_BEGIN 0x01A0 /**< ATT Error: Reserved for Future Use range #2 begin. */
bogdanm 82:6473597d706e 89 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_END 0x01DF /**< ATT Error: Reserved for Future Use range #2 end. */
bogdanm 82:6473597d706e 90 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_BEGIN 0x01E0 /**< ATT Error: Reserved for Future Use range #3 begin. */
bogdanm 82:6473597d706e 91 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_END 0x01FC /**< ATT Error: Reserved for Future Use range #3 end. */
bogdanm 82:6473597d706e 92 #define BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR 0x01FD /**< ATT Common Profile and Service Error: Client Characteristic Configuration Descriptor improperly configured. */
bogdanm 82:6473597d706e 93 #define BLE_GATT_STATUS_ATTERR_CPS_PROC_ALR_IN_PROG 0x01FE /**< ATT Common Profile and Service Error: Procedure Already in Progress. */
bogdanm 82:6473597d706e 94 #define BLE_GATT_STATUS_ATTERR_CPS_OUT_OF_RANGE 0x01FF /**< ATT Common Profile and Service Error: Out Of Range. */
bogdanm 82:6473597d706e 95 /** @} */
bogdanm 82:6473597d706e 96
bogdanm 82:6473597d706e 97
bogdanm 82:6473597d706e 98 /** @defgroup BLE_GATT_CPF_FORMATS Characteristic Presentation Formats
bogdanm 82:6473597d706e 99 * @note Found at http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml
bogdanm 82:6473597d706e 100 * @{ */
bogdanm 82:6473597d706e 101 #define BLE_GATT_CPF_FORMAT_RFU 0x00 /**< Reserved For Future Use. */
bogdanm 82:6473597d706e 102 #define BLE_GATT_CPF_FORMAT_BOOLEAN 0x01 /**< Boolean. */
bogdanm 82:6473597d706e 103 #define BLE_GATT_CPF_FORMAT_2BIT 0x02 /**< Unsigned 2-bit integer. */
bogdanm 82:6473597d706e 104 #define BLE_GATT_CPF_FORMAT_NIBBLE 0x03 /**< Unsigned 4-bit integer. */
bogdanm 82:6473597d706e 105 #define BLE_GATT_CPF_FORMAT_UINT8 0x04 /**< Unsigned 8-bit integer. */
bogdanm 82:6473597d706e 106 #define BLE_GATT_CPF_FORMAT_UINT12 0x05 /**< Unsigned 12-bit integer. */
bogdanm 82:6473597d706e 107 #define BLE_GATT_CPF_FORMAT_UINT16 0x06 /**< Unsigned 16-bit integer. */
bogdanm 82:6473597d706e 108 #define BLE_GATT_CPF_FORMAT_UINT24 0x07 /**< Unsigned 24-bit integer. */
bogdanm 82:6473597d706e 109 #define BLE_GATT_CPF_FORMAT_UINT32 0x08 /**< Unsigned 32-bit integer. */
bogdanm 82:6473597d706e 110 #define BLE_GATT_CPF_FORMAT_UINT48 0x09 /**< Unsigned 48-bit integer. */
bogdanm 82:6473597d706e 111 #define BLE_GATT_CPF_FORMAT_UINT64 0x0A /**< Unsigned 64-bit integer. */
bogdanm 82:6473597d706e 112 #define BLE_GATT_CPF_FORMAT_UINT128 0x0B /**< Unsigned 128-bit integer. */
bogdanm 82:6473597d706e 113 #define BLE_GATT_CPF_FORMAT_SINT8 0x0C /**< Signed 2-bit integer. */
bogdanm 82:6473597d706e 114 #define BLE_GATT_CPF_FORMAT_SINT12 0x0D /**< Signed 12-bit integer. */
bogdanm 82:6473597d706e 115 #define BLE_GATT_CPF_FORMAT_SINT16 0x0E /**< Signed 16-bit integer. */
bogdanm 82:6473597d706e 116 #define BLE_GATT_CPF_FORMAT_SINT24 0x0F /**< Signed 24-bit integer. */
bogdanm 82:6473597d706e 117 #define BLE_GATT_CPF_FORMAT_SINT32 0x10 /**< Signed 32-bit integer. */
bogdanm 82:6473597d706e 118 #define BLE_GATT_CPF_FORMAT_SINT48 0x11 /**< Signed 48-bit integer. */
bogdanm 82:6473597d706e 119 #define BLE_GATT_CPF_FORMAT_SINT64 0x12 /**< Signed 64-bit integer. */
bogdanm 82:6473597d706e 120 #define BLE_GATT_CPF_FORMAT_SINT128 0x13 /**< Signed 128-bit integer. */
bogdanm 82:6473597d706e 121 #define BLE_GATT_CPF_FORMAT_FLOAT32 0x14 /**< IEEE-754 32-bit floating point. */
bogdanm 82:6473597d706e 122 #define BLE_GATT_CPF_FORMAT_FLOAT64 0x15 /**< IEEE-754 64-bit floating point. */
bogdanm 82:6473597d706e 123 #define BLE_GATT_CPF_FORMAT_SFLOAT 0x16 /**< IEEE-11073 16-bit SFLOAT. */
bogdanm 82:6473597d706e 124 #define BLE_GATT_CPF_FORMAT_FLOAT 0x17 /**< IEEE-11073 32-bit FLOAT. */
bogdanm 82:6473597d706e 125 #define BLE_GATT_CPF_FORMAT_DUINT16 0x18 /**< IEEE-20601 format. */
bogdanm 82:6473597d706e 126 #define BLE_GATT_CPF_FORMAT_UTF8S 0x19 /**< UTF-8 string. */
bogdanm 82:6473597d706e 127 #define BLE_GATT_CPF_FORMAT_UTF16S 0x1A /**< UTF-16 string. */
bogdanm 82:6473597d706e 128 #define BLE_GATT_CPF_FORMAT_STRUCT 0x1B /**< Opaque Structure. */
bogdanm 82:6473597d706e 129 /** @} */
bogdanm 82:6473597d706e 130
bogdanm 82:6473597d706e 131 /** @defgroup BLE_GATT_CPF_NAMESPACES GATT Bluetooth Namespaces
bogdanm 82:6473597d706e 132 * @{
bogdanm 82:6473597d706e 133 */
bogdanm 82:6473597d706e 134 #define BLE_GATT_CPF_NAMESPACE_BTSIG 0x01
bogdanm 82:6473597d706e 135 #define BLE_GATT_CPF_NAMESPACE_DESCRIPTION_UNKNOWN 0x0000
bogdanm 82:6473597d706e 136 /** @} */
bogdanm 82:6473597d706e 137
bogdanm 82:6473597d706e 138 /** @} */
bogdanm 82:6473597d706e 139
bogdanm 82:6473597d706e 140 /**@brief GATT Characteristic Properties. */
bogdanm 82:6473597d706e 141 typedef struct
bogdanm 82:6473597d706e 142 {
bogdanm 82:6473597d706e 143 /* Standard properties */
bogdanm 82:6473597d706e 144 uint8_t broadcast :1; /**< Broadcasting of value permitted. */
bogdanm 82:6473597d706e 145 uint8_t read :1; /**< Reading value permitted. */
bogdanm 82:6473597d706e 146 uint8_t write_wo_resp :1; /**< Writing value with Write Command permitted. */
bogdanm 82:6473597d706e 147 uint8_t write :1; /**< Writing value with Write Request permitted. */
bogdanm 82:6473597d706e 148 uint8_t notify :1; /**< Notications of value permitted. */
bogdanm 82:6473597d706e 149 uint8_t indicate :1; /**< Indications of value permitted. */
bogdanm 82:6473597d706e 150 uint8_t auth_signed_wr :1; /**< Writing value with Signed Write Command permitted. */
bogdanm 82:6473597d706e 151 } ble_gatt_char_props_t;
bogdanm 82:6473597d706e 152
bogdanm 82:6473597d706e 153 /**@brief GATT Characteristic Extended Properties. */
bogdanm 82:6473597d706e 154 typedef struct
bogdanm 82:6473597d706e 155 {
bogdanm 82:6473597d706e 156 /* Extended properties */
bogdanm 82:6473597d706e 157 uint8_t reliable_wr :1; /**< Writing value with Queued Write Request permitted. */
bogdanm 82:6473597d706e 158 uint8_t wr_aux :1; /**< Writing the Characteristic User Description permitted. */
bogdanm 82:6473597d706e 159 } ble_gatt_char_ext_props_t;
bogdanm 82:6473597d706e 160
bogdanm 82:6473597d706e 161 #endif // BLE_GATT_H__
bogdanm 82:6473597d706e 162
bogdanm 82:6473597d706e 163 /**
bogdanm 82:6473597d706e 164 @}
bogdanm 82:6473597d706e 165 @}
bogdanm 82:6473597d706e 166 */