BLE_API wrapper library for STMicroelectronics' BlueNRG Bluetooth Low Energy expansion board shield
Fork of X_NUCLEO_IDB0XA1 by
x-nucleo-idb0xa1/bluenrg-hci/bluenrg_gatt_server.h@232:f2a7da5d24e1, 2016-06-17 (annotated)
- Committer:
- avilei
- Date:
- Fri Jun 17 16:07:05 2016 +0000
- Revision:
- 232:f2a7da5d24e1
- Parent:
- 132:51056160fa4a
Add firmware update capabilities
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wolfgang Betz |
132:51056160fa4a | 1 | /******************** (C) COPYRIGHT 2012 STMicroelectronics ******************** |
Wolfgang Betz |
132:51056160fa4a | 2 | * File Name : bluenrg_gatt_server.h |
Wolfgang Betz |
132:51056160fa4a | 3 | * Author : AMS - HEA&RF BU |
Wolfgang Betz |
132:51056160fa4a | 4 | * Version : V1.0.0 |
Wolfgang Betz |
132:51056160fa4a | 5 | * Date : 19-July-2012 |
Wolfgang Betz |
132:51056160fa4a | 6 | * Description : Header file for BlueNRG's GATT server layer. |
Wolfgang Betz |
132:51056160fa4a | 7 | ******************************************************************************** |
Wolfgang Betz |
132:51056160fa4a | 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
Wolfgang Betz |
132:51056160fa4a | 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
Wolfgang Betz |
132:51056160fa4a | 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
Wolfgang Betz |
132:51056160fa4a | 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
Wolfgang Betz |
132:51056160fa4a | 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
Wolfgang Betz |
132:51056160fa4a | 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
Wolfgang Betz |
132:51056160fa4a | 14 | *******************************************************************************/ |
Wolfgang Betz |
132:51056160fa4a | 15 | |
Wolfgang Betz |
132:51056160fa4a | 16 | #ifndef __BNRG_GATT_SERVER_H__ |
Wolfgang Betz |
132:51056160fa4a | 17 | #define __BNRG_GATT_SERVER_H__ |
Wolfgang Betz |
132:51056160fa4a | 18 | |
Wolfgang Betz |
132:51056160fa4a | 19 | #include "compiler.h" |
Wolfgang Betz |
132:51056160fa4a | 20 | #include "ble_status.h" |
Wolfgang Betz |
132:51056160fa4a | 21 | |
Wolfgang Betz |
132:51056160fa4a | 22 | /** |
Wolfgang Betz |
132:51056160fa4a | 23 | *@addtogroup GATT GATT |
Wolfgang Betz |
132:51056160fa4a | 24 | *@{ |
Wolfgang Betz |
132:51056160fa4a | 25 | */ |
Wolfgang Betz |
132:51056160fa4a | 26 | |
Wolfgang Betz |
132:51056160fa4a | 27 | /** |
Wolfgang Betz |
132:51056160fa4a | 28 | * @anchor Well-Known_UUIDs |
Wolfgang Betz |
132:51056160fa4a | 29 | * @name Well-Known UUIDs |
Wolfgang Betz |
132:51056160fa4a | 30 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 31 | */ |
Wolfgang Betz |
132:51056160fa4a | 32 | #define PRIMARY_SERVICE_UUID (0x2800) |
Wolfgang Betz |
132:51056160fa4a | 33 | #define SECONDARY_SERVICE_UUID (0x2801) |
Wolfgang Betz |
132:51056160fa4a | 34 | #define INCLUDE_SERVICE_UUID (0x2802) |
Wolfgang Betz |
132:51056160fa4a | 35 | #define CHARACTERISTIC_UUID (0x2803) |
Wolfgang Betz |
132:51056160fa4a | 36 | #define CHAR_EXTENDED_PROP_DESC_UUID (0x2900) |
Wolfgang Betz |
132:51056160fa4a | 37 | #define CHAR_USER_DESC_UUID (0x2901) |
Wolfgang Betz |
132:51056160fa4a | 38 | #define CHAR_CLIENT_CONFIG_DESC_UUID (0x2902) |
Wolfgang Betz |
132:51056160fa4a | 39 | #define CHAR_SERVER_CONFIG_DESC_UUID (0x2903) |
Wolfgang Betz |
132:51056160fa4a | 40 | #define CHAR_FORMAT_DESC_UUID (0x2904) |
Wolfgang Betz |
132:51056160fa4a | 41 | #define CHAR_AGGR_FMT_DESC_UUID (0x2905) |
Wolfgang Betz |
132:51056160fa4a | 42 | #define GATT_SERVICE_UUID (0x1801) |
Wolfgang Betz |
132:51056160fa4a | 43 | #define GAP_SERVICE_UUID (0x1800) |
Wolfgang Betz |
132:51056160fa4a | 44 | #define SERVICE_CHANGED_UUID (0x2A05) |
Wolfgang Betz |
132:51056160fa4a | 45 | /** |
Wolfgang Betz |
132:51056160fa4a | 46 | * @} |
Wolfgang Betz |
132:51056160fa4a | 47 | */ |
Wolfgang Betz |
132:51056160fa4a | 48 | |
Wolfgang Betz |
132:51056160fa4a | 49 | /** |
Wolfgang Betz |
132:51056160fa4a | 50 | * @anchor Access_permissions |
Wolfgang Betz |
132:51056160fa4a | 51 | * @name Access permissions |
Wolfgang Betz |
132:51056160fa4a | 52 | * Access permissions for an attribute |
Wolfgang Betz |
132:51056160fa4a | 53 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 54 | */ |
Wolfgang Betz |
132:51056160fa4a | 55 | #define ATTR_NO_ACCESS (0x00) |
Wolfgang Betz |
132:51056160fa4a | 56 | #define ATTR_ACCESS_READ_ONLY (0x01) |
Wolfgang Betz |
132:51056160fa4a | 57 | #define ATTR_ACCESS_WRITE_REQ_ONLY (0x02) |
Wolfgang Betz |
132:51056160fa4a | 58 | #define ATTR_ACCESS_READ_WRITE (0x03) |
Wolfgang Betz |
132:51056160fa4a | 59 | #define ATTR_ACCESS_WRITE_WITHOUT_RESPONSE (0x04) |
Wolfgang Betz |
132:51056160fa4a | 60 | #define ATTR_ACCESS_SIGNED_WRITE_ALLOWED (0x08) |
Wolfgang Betz |
132:51056160fa4a | 61 | /** |
Wolfgang Betz |
132:51056160fa4a | 62 | * Allows all write procedures |
Wolfgang Betz |
132:51056160fa4a | 63 | */ |
Wolfgang Betz |
132:51056160fa4a | 64 | #define ATTR_ACCESS_WRITE_ANY (0x0E) |
Wolfgang Betz |
132:51056160fa4a | 65 | /** |
Wolfgang Betz |
132:51056160fa4a | 66 | * @} |
Wolfgang Betz |
132:51056160fa4a | 67 | */ |
Wolfgang Betz |
132:51056160fa4a | 68 | |
Wolfgang Betz |
132:51056160fa4a | 69 | /** |
Wolfgang Betz |
132:51056160fa4a | 70 | * @anchor Char_properties |
Wolfgang Betz |
132:51056160fa4a | 71 | * @name Characteristic properties. |
Wolfgang Betz |
132:51056160fa4a | 72 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 73 | */ |
Wolfgang Betz |
132:51056160fa4a | 74 | #define CHAR_PROP_BROADCAST (0x01) |
Wolfgang Betz |
132:51056160fa4a | 75 | #define CHAR_PROP_READ (0x02) |
Wolfgang Betz |
132:51056160fa4a | 76 | #define CHAR_PROP_WRITE_WITHOUT_RESP (0x04) |
Wolfgang Betz |
132:51056160fa4a | 77 | #define CHAR_PROP_WRITE (0x08) |
Wolfgang Betz |
132:51056160fa4a | 78 | #define CHAR_PROP_NOTIFY (0x10) |
Wolfgang Betz |
132:51056160fa4a | 79 | #define CHAR_PROP_INDICATE (0x20) |
Wolfgang Betz |
132:51056160fa4a | 80 | #define CHAR_PROP_SIGNED_WRITE (0x40) |
Wolfgang Betz |
132:51056160fa4a | 81 | #define CHAR_PROP_EXT (0x80) |
Wolfgang Betz |
132:51056160fa4a | 82 | /** |
Wolfgang Betz |
132:51056160fa4a | 83 | * @} |
Wolfgang Betz |
132:51056160fa4a | 84 | */ |
Wolfgang Betz |
132:51056160fa4a | 85 | |
Wolfgang Betz |
132:51056160fa4a | 86 | |
Wolfgang Betz |
132:51056160fa4a | 87 | /** |
Wolfgang Betz |
132:51056160fa4a | 88 | * @anchor Security_permissions |
Wolfgang Betz |
132:51056160fa4a | 89 | * @name Security permissions for an attribute. |
Wolfgang Betz |
132:51056160fa4a | 90 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 91 | */ |
Wolfgang Betz |
132:51056160fa4a | 92 | #define ATTR_PERMISSION_NONE (0x00) /**< No security. */ |
Wolfgang Betz |
132:51056160fa4a | 93 | #define ATTR_PERMISSION_AUTHEN_READ (0x01) /**< Need authentication to read */ |
Wolfgang Betz |
132:51056160fa4a | 94 | #define ATTR_PERMISSION_AUTHOR_READ (0x02) /**< Need authorization to read */ |
Wolfgang Betz |
132:51056160fa4a | 95 | #define ATTR_PERMISSION_ENCRY_READ (0x04) /**< Link must be encrypted to read */ |
Wolfgang Betz |
132:51056160fa4a | 96 | #define ATTR_PERMISSION_AUTHEN_WRITE (0x08) /**< Need authentication to write */ |
Wolfgang Betz |
132:51056160fa4a | 97 | #define ATTR_PERMISSION_AUTHOR_WRITE (0x10) /**< Need authorization to write */ |
Wolfgang Betz |
132:51056160fa4a | 98 | #define ATTR_PERMISSION_ENCRY_WRITE (0x20) /**< Link must be encrypted for write */ |
Wolfgang Betz |
132:51056160fa4a | 99 | /** |
Wolfgang Betz |
132:51056160fa4a | 100 | * @} |
Wolfgang Betz |
132:51056160fa4a | 101 | */ |
Wolfgang Betz |
132:51056160fa4a | 102 | |
Wolfgang Betz |
132:51056160fa4a | 103 | /** |
Wolfgang Betz |
132:51056160fa4a | 104 | * @anchor UUID_Types |
Wolfgang Betz |
132:51056160fa4a | 105 | * @name Type of UUID (16 bit or 128 bit). |
Wolfgang Betz |
132:51056160fa4a | 106 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 107 | */ |
Wolfgang Betz |
132:51056160fa4a | 108 | #define UUID_TYPE_16 (0x01) |
Wolfgang Betz |
132:51056160fa4a | 109 | #define UUID_TYPE_128 (0x02) |
Wolfgang Betz |
132:51056160fa4a | 110 | /** |
Wolfgang Betz |
132:51056160fa4a | 111 | * @} |
Wolfgang Betz |
132:51056160fa4a | 112 | */ |
Wolfgang Betz |
132:51056160fa4a | 113 | |
Wolfgang Betz |
132:51056160fa4a | 114 | /** |
Wolfgang Betz |
132:51056160fa4a | 115 | * @anchor Service_type |
Wolfgang Betz |
132:51056160fa4a | 116 | * @name Type of service (primary or secondary) |
Wolfgang Betz |
132:51056160fa4a | 117 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 118 | */ |
Wolfgang Betz |
132:51056160fa4a | 119 | #define PRIMARY_SERVICE (0x01) |
Wolfgang Betz |
132:51056160fa4a | 120 | #define SECONDARY_SERVICE (0x02) |
Wolfgang Betz |
132:51056160fa4a | 121 | /** |
Wolfgang Betz |
132:51056160fa4a | 122 | * @} |
Wolfgang Betz |
132:51056160fa4a | 123 | */ |
Wolfgang Betz |
132:51056160fa4a | 124 | |
Wolfgang Betz |
132:51056160fa4a | 125 | /** |
Wolfgang Betz |
132:51056160fa4a | 126 | * @anchor Gatt_Event_Mask |
Wolfgang Betz |
132:51056160fa4a | 127 | * @name Gatt Event Mask |
Wolfgang Betz |
132:51056160fa4a | 128 | * Type of event generated by GATT server |
Wolfgang Betz |
132:51056160fa4a | 129 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 130 | */ |
Wolfgang Betz |
132:51056160fa4a | 131 | #define GATT_DONT_NOTIFY_EVENTS (0x00) /**< Do not notify events. */ |
Wolfgang Betz |
132:51056160fa4a | 132 | #define GATT_NOTIFY_ATTRIBUTE_WRITE (0x01) /**< The application will be notified when a client writes to this attribute. |
Wolfgang Betz |
132:51056160fa4a | 133 | An @ref EVT_BLUE_GATT_ATTRIBUTE_MODIFIED will be issued. */ |
Wolfgang Betz |
132:51056160fa4a | 134 | #define GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP (0x02) /**< The application will be notified when a write request, a write cmd |
Wolfgang Betz |
132:51056160fa4a | 135 | or a signed write cmd are received by the server for this attribute. |
Wolfgang Betz |
132:51056160fa4a | 136 | An @ref EVT_BLUE_GATT_WRITE_PERMIT_REQ will be issued. */ |
Wolfgang Betz |
132:51056160fa4a | 137 | #define GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP (0x04) /**< The application will be notified when a read request of any type is |
Wolfgang Betz |
132:51056160fa4a | 138 | received for this attribute. An @ref EVT_BLUE_GATT_READ_PERMIT_REQ will be issued. */ |
Wolfgang Betz |
132:51056160fa4a | 139 | /** |
Wolfgang Betz |
132:51056160fa4a | 140 | * @} |
Wolfgang Betz |
132:51056160fa4a | 141 | */ |
Wolfgang Betz |
132:51056160fa4a | 142 | |
Wolfgang Betz |
132:51056160fa4a | 143 | /** |
Wolfgang Betz |
132:51056160fa4a | 144 | * @name Type of characteristic length |
Wolfgang Betz |
132:51056160fa4a | 145 | * See aci_gatt_add_char() |
Wolfgang Betz |
132:51056160fa4a | 146 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 147 | */ |
Wolfgang Betz |
132:51056160fa4a | 148 | #define CHAR_VALUE_LEN_CONSTANT (0x00) |
Wolfgang Betz |
132:51056160fa4a | 149 | #define CHAR_VALUE_LEN_VARIABLE (0x01) |
Wolfgang Betz |
132:51056160fa4a | 150 | /** |
Wolfgang Betz |
132:51056160fa4a | 151 | * @} |
Wolfgang Betz |
132:51056160fa4a | 152 | */ |
Wolfgang Betz |
132:51056160fa4a | 153 | |
Wolfgang Betz |
132:51056160fa4a | 154 | |
Wolfgang Betz |
132:51056160fa4a | 155 | /** |
Wolfgang Betz |
132:51056160fa4a | 156 | * @name Encryption key size |
Wolfgang Betz |
132:51056160fa4a | 157 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 158 | */ |
Wolfgang Betz |
132:51056160fa4a | 159 | /** |
Wolfgang Betz |
132:51056160fa4a | 160 | * Minimum encryption key size |
Wolfgang Betz |
132:51056160fa4a | 161 | */ |
Wolfgang Betz |
132:51056160fa4a | 162 | #define MIN_ENCRY_KEY_SIZE (7) |
Wolfgang Betz |
132:51056160fa4a | 163 | |
Wolfgang Betz |
132:51056160fa4a | 164 | /** |
Wolfgang Betz |
132:51056160fa4a | 165 | * Maximum encryption key size |
Wolfgang Betz |
132:51056160fa4a | 166 | */ |
Wolfgang Betz |
132:51056160fa4a | 167 | #define MAX_ENCRY_KEY_SIZE (0x10) |
Wolfgang Betz |
132:51056160fa4a | 168 | /** |
Wolfgang Betz |
132:51056160fa4a | 169 | * @} |
Wolfgang Betz |
132:51056160fa4a | 170 | */ |
Wolfgang Betz |
132:51056160fa4a | 171 | |
Wolfgang Betz |
132:51056160fa4a | 172 | /** |
Wolfgang Betz |
132:51056160fa4a | 173 | * @name Characteristic Presentation Format |
Wolfgang Betz |
132:51056160fa4a | 174 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 175 | */ |
Wolfgang Betz |
132:51056160fa4a | 176 | typedef __packed struct _charactFormat { |
Wolfgang Betz |
132:51056160fa4a | 177 | uint8_t format; |
Wolfgang Betz |
132:51056160fa4a | 178 | int8_t exp; |
Wolfgang Betz |
132:51056160fa4a | 179 | uint16_t unit; |
Wolfgang Betz |
132:51056160fa4a | 180 | uint8_t name_space; |
Wolfgang Betz |
132:51056160fa4a | 181 | uint16_t desc; |
Wolfgang Betz |
132:51056160fa4a | 182 | } PACKED charactFormat; |
Wolfgang Betz |
132:51056160fa4a | 183 | |
Wolfgang Betz |
132:51056160fa4a | 184 | /** |
Wolfgang Betz |
132:51056160fa4a | 185 | * @} |
Wolfgang Betz |
132:51056160fa4a | 186 | */ |
Wolfgang Betz |
132:51056160fa4a | 187 | |
Wolfgang Betz |
132:51056160fa4a | 188 | /** |
Wolfgang Betz |
132:51056160fa4a | 189 | * @name Format |
Wolfgang Betz |
132:51056160fa4a | 190 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 191 | */ |
Wolfgang Betz |
132:51056160fa4a | 192 | #define FORMAT_UINT8 0x04 |
Wolfgang Betz |
132:51056160fa4a | 193 | #define FORMAT_UINT16 0x06 |
Wolfgang Betz |
132:51056160fa4a | 194 | #define FORMAT_SINT16 0x0E |
Wolfgang Betz |
132:51056160fa4a | 195 | #define FORMAT_SINT24 0x0F |
Wolfgang Betz |
132:51056160fa4a | 196 | /** |
Wolfgang Betz |
132:51056160fa4a | 197 | * @} |
Wolfgang Betz |
132:51056160fa4a | 198 | */ |
Wolfgang Betz |
132:51056160fa4a | 199 | |
Wolfgang Betz |
132:51056160fa4a | 200 | /** |
Wolfgang Betz |
132:51056160fa4a | 201 | * @name Unit |
Wolfgang Betz |
132:51056160fa4a | 202 | * @{ |
Wolfgang Betz |
132:51056160fa4a | 203 | */ |
Wolfgang Betz |
132:51056160fa4a | 204 | #define UNIT_UNITLESS 0x2700 |
Wolfgang Betz |
132:51056160fa4a | 205 | #define UNIT_TEMP_CELSIUS 0x272F |
Wolfgang Betz |
132:51056160fa4a | 206 | #define UNIT_PRESSURE_BAR 0x2780 |
Wolfgang Betz |
132:51056160fa4a | 207 | /** |
Wolfgang Betz |
132:51056160fa4a | 208 | * @} |
Wolfgang Betz |
132:51056160fa4a | 209 | */ |
Wolfgang Betz |
132:51056160fa4a | 210 | |
Wolfgang Betz |
132:51056160fa4a | 211 | |
Wolfgang Betz |
132:51056160fa4a | 212 | /** |
Wolfgang Betz |
132:51056160fa4a | 213 | * ATT MTU size |
Wolfgang Betz |
132:51056160fa4a | 214 | */ |
Wolfgang Betz |
132:51056160fa4a | 215 | #define ATT_MTU (23) |
Wolfgang Betz |
132:51056160fa4a | 216 | |
Wolfgang Betz |
132:51056160fa4a | 217 | /** |
Wolfgang Betz |
132:51056160fa4a | 218 | * @} |
Wolfgang Betz |
132:51056160fa4a | 219 | */ |
Wolfgang Betz |
132:51056160fa4a | 220 | |
Wolfgang Betz |
132:51056160fa4a | 221 | |
Wolfgang Betz |
132:51056160fa4a | 222 | |
Wolfgang Betz |
132:51056160fa4a | 223 | #endif /* __BNRG_GATT_SERVER_H__ */ |