BLE_BlueNRG for Nucleo board
Dependents: Nucleo_BLE_HeartRate Nucleo_BLE_UART Nucleo_BLE_UART
Warning: Deprecated!
Supported drivers and applications can be found at this link.
hci/inc/gatt_service.h@0:a948f5f3904c, 2014-12-19 (annotated)
- Committer:
- sjallouli
- Date:
- Fri Dec 19 18:56:07 2014 +0000
- Revision:
- 0:a948f5f3904c
BLE_BlueNRG for Nucleo board
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sjallouli | 0:a948f5f3904c | 1 | /******************** (C) COPYRIGHT 2012 STMicroelectronics ******************** |
sjallouli | 0:a948f5f3904c | 2 | * File Name : gatt_server.h |
sjallouli | 0:a948f5f3904c | 3 | * Author : AMS - HEA&RF BU |
sjallouli | 0:a948f5f3904c | 4 | * Version : V1.0.0 |
sjallouli | 0:a948f5f3904c | 5 | * Date : 19-July-2012 |
sjallouli | 0:a948f5f3904c | 6 | * Description : Header file for BlueNRG's GATT server layer. |
sjallouli | 0:a948f5f3904c | 7 | ******************************************************************************** |
sjallouli | 0:a948f5f3904c | 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
sjallouli | 0:a948f5f3904c | 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
sjallouli | 0:a948f5f3904c | 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
sjallouli | 0:a948f5f3904c | 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
sjallouli | 0:a948f5f3904c | 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
sjallouli | 0:a948f5f3904c | 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
sjallouli | 0:a948f5f3904c | 14 | *******************************************************************************/ |
sjallouli | 0:a948f5f3904c | 15 | |
sjallouli | 0:a948f5f3904c | 16 | #ifndef __GATT_SERV_H__ |
sjallouli | 0:a948f5f3904c | 17 | #define __GATT_SERV_H__ |
sjallouli | 0:a948f5f3904c | 18 | |
sjallouli | 0:a948f5f3904c | 19 | #include "compiler.h" |
sjallouli | 0:a948f5f3904c | 20 | #include "ble_status.h" |
sjallouli | 0:a948f5f3904c | 21 | |
sjallouli | 0:a948f5f3904c | 22 | /** |
sjallouli | 0:a948f5f3904c | 23 | * UUID table |
sjallouli | 0:a948f5f3904c | 24 | */ |
sjallouli | 0:a948f5f3904c | 25 | #define PRIMARY_SERVICE_UUID (0x2800) |
sjallouli | 0:a948f5f3904c | 26 | #define SECONDARY_SERVICE_UUID (0x2801) |
sjallouli | 0:a948f5f3904c | 27 | #define INCLUDE_SERVICE_UUID (0x2802) |
sjallouli | 0:a948f5f3904c | 28 | #define CHARACTERISTIC_UUID (0x2803) |
sjallouli | 0:a948f5f3904c | 29 | #define CHAR_EXTENDED_PROP_DESC_UUID (0x2900) |
sjallouli | 0:a948f5f3904c | 30 | #define CHAR_USER_DESC_UUID (0x2901) |
sjallouli | 0:a948f5f3904c | 31 | #define CHAR_CLIENT_CONFIG_DESC_UUID (0x2902) |
sjallouli | 0:a948f5f3904c | 32 | #define CHAR_SERVER_CONFIG_DESC_UUID (0x2903) |
sjallouli | 0:a948f5f3904c | 33 | #define CHAR_FORMAT_DESC_UUID (0x2904) |
sjallouli | 0:a948f5f3904c | 34 | #define CHAR_AGGR_FMT_DESC_UUID (0x2905) |
sjallouli | 0:a948f5f3904c | 35 | #define GATT_SERVICE_UUID (0x1801) |
sjallouli | 0:a948f5f3904c | 36 | #define GAP_SERVICE_UUID (0x1800) |
sjallouli | 0:a948f5f3904c | 37 | #define SERVICE_CHANGED_UUID (0x2A05) |
sjallouli | 0:a948f5f3904c | 38 | |
sjallouli | 0:a948f5f3904c | 39 | /****************************************************************************** |
sjallouli | 0:a948f5f3904c | 40 | * Types |
sjallouli | 0:a948f5f3904c | 41 | *****************************************************************************/ |
sjallouli | 0:a948f5f3904c | 42 | |
sjallouli | 0:a948f5f3904c | 43 | /** |
sjallouli | 0:a948f5f3904c | 44 | * Access permissions |
sjallouli | 0:a948f5f3904c | 45 | * for an attribute |
sjallouli | 0:a948f5f3904c | 46 | */ |
sjallouli | 0:a948f5f3904c | 47 | typedef tHalUint8 tAttrAccessFlags; |
sjallouli | 0:a948f5f3904c | 48 | #define ATTR_NO_ACCESS (0x00) |
sjallouli | 0:a948f5f3904c | 49 | #define ATTR_ACCESS_READ_ONLY (0x01) |
sjallouli | 0:a948f5f3904c | 50 | #define ATTR_ACCESS_WRITE_REQ_ONLY (0x02) |
sjallouli | 0:a948f5f3904c | 51 | #define ATTR_ACCESS_READ_WRITE (0x03) |
sjallouli | 0:a948f5f3904c | 52 | #define ATTR_ACCESS_WRITE_WITHOUT_RESPONSE (0x04) |
sjallouli | 0:a948f5f3904c | 53 | #define ATTR_ACCESS_SIGNED_WRITE_ALLOWED (0x08) |
sjallouli | 0:a948f5f3904c | 54 | |
sjallouli | 0:a948f5f3904c | 55 | /** |
sjallouli | 0:a948f5f3904c | 56 | * Allows all write procedures |
sjallouli | 0:a948f5f3904c | 57 | */ |
sjallouli | 0:a948f5f3904c | 58 | #define ATTR_ACCESS_WRITE_ANY (0x0E) |
sjallouli | 0:a948f5f3904c | 59 | |
sjallouli | 0:a948f5f3904c | 60 | /** |
sjallouli | 0:a948f5f3904c | 61 | * Characteristic properties. |
sjallouli | 0:a948f5f3904c | 62 | */ |
sjallouli | 0:a948f5f3904c | 63 | #define CHAR_PROP_BROADCAST (0x01) |
sjallouli | 0:a948f5f3904c | 64 | #define CHAR_PROP_READ (0x02) |
sjallouli | 0:a948f5f3904c | 65 | #define CHAR_PROP_WRITE_WITHOUT_RESP (0x04) |
sjallouli | 0:a948f5f3904c | 66 | #define CHAR_PROP_WRITE (0x08) |
sjallouli | 0:a948f5f3904c | 67 | #define CHAR_PROP_NOTIFY (0x10) |
sjallouli | 0:a948f5f3904c | 68 | #define CHAR_PROP_INDICATE (0x20) |
sjallouli | 0:a948f5f3904c | 69 | #define CHAR_PROP_SIGNED_WRITE (0x40) |
sjallouli | 0:a948f5f3904c | 70 | #define CHAR_PROP_EXT (0x80) |
sjallouli | 0:a948f5f3904c | 71 | |
sjallouli | 0:a948f5f3904c | 72 | /** |
sjallouli | 0:a948f5f3904c | 73 | * Security permissions |
sjallouli | 0:a948f5f3904c | 74 | * for an attribute |
sjallouli | 0:a948f5f3904c | 75 | */ |
sjallouli | 0:a948f5f3904c | 76 | typedef tHalUint8 tAttrSecurityFlags; |
sjallouli | 0:a948f5f3904c | 77 | #define ATTR_PERMISSION_NONE (0x00) |
sjallouli | 0:a948f5f3904c | 78 | #define ATTR_PERMISSION_AUTHEN_READ (0x01) |
sjallouli | 0:a948f5f3904c | 79 | #define ATTR_PERMISSION_AUTHOR_READ (0x02) |
sjallouli | 0:a948f5f3904c | 80 | #define ATTR_PERMISSION_ENCRY_READ (0x04) |
sjallouli | 0:a948f5f3904c | 81 | #define ATTR_PERMISSION_AUTHEN_WRITE (0x08) |
sjallouli | 0:a948f5f3904c | 82 | #define ATTR_PERMISSION_AUTHOR_WRITE (0x10) |
sjallouli | 0:a948f5f3904c | 83 | #define ATTR_PERMISSION_ENCRY_WRITE (0x20) |
sjallouli | 0:a948f5f3904c | 84 | |
sjallouli | 0:a948f5f3904c | 85 | /** |
sjallouli | 0:a948f5f3904c | 86 | * Type of UUID |
sjallouli | 0:a948f5f3904c | 87 | * (16 bit or 128 bit) |
sjallouli | 0:a948f5f3904c | 88 | */ |
sjallouli | 0:a948f5f3904c | 89 | typedef tHalUint8 tUuidType; |
sjallouli | 0:a948f5f3904c | 90 | #define UUID_TYPE_16 (0x01) |
sjallouli | 0:a948f5f3904c | 91 | #define UUID_TYPE_128 (0x02) |
sjallouli | 0:a948f5f3904c | 92 | |
sjallouli | 0:a948f5f3904c | 93 | /** |
sjallouli | 0:a948f5f3904c | 94 | * Type of service |
sjallouli | 0:a948f5f3904c | 95 | * (primary or secondary) |
sjallouli | 0:a948f5f3904c | 96 | */ |
sjallouli | 0:a948f5f3904c | 97 | typedef tHalUint8 tServiceType; |
sjallouli | 0:a948f5f3904c | 98 | #define PRIMARY_SERVICE (0x01) |
sjallouli | 0:a948f5f3904c | 99 | #define SECONDARY_SERVICE (0x02) |
sjallouli | 0:a948f5f3904c | 100 | |
sjallouli | 0:a948f5f3904c | 101 | /** |
sjallouli | 0:a948f5f3904c | 102 | * Type of event generated by |
sjallouli | 0:a948f5f3904c | 103 | * Gatt server |
sjallouli | 0:a948f5f3904c | 104 | */ |
sjallouli | 0:a948f5f3904c | 105 | typedef tHalUint8 tGattServerEvent; |
sjallouli | 0:a948f5f3904c | 106 | #define GATT_SERVER_ATTR_WRITE (0x01) |
sjallouli | 0:a948f5f3904c | 107 | #define GATT_INTIMATE_AND_WAIT_FOR_APPL_AUTH (0x02) |
sjallouli | 0:a948f5f3904c | 108 | #define GATT_INTIMATE_APPL_WHEN_READ_N_WAIT (0x04) |
sjallouli | 0:a948f5f3904c | 109 | #define GATT_SERVER_ATTR_READ_WRITE GATT_SERVER_ATTR_WRITE|GATT_INTIMATE_APPL_WHEN_READ_N_WAIT |
sjallouli | 0:a948f5f3904c | 110 | |
sjallouli | 0:a948f5f3904c | 111 | |
sjallouli | 0:a948f5f3904c | 112 | /** |
sjallouli | 0:a948f5f3904c | 113 | * Min encryption key size |
sjallouli | 0:a948f5f3904c | 114 | */ |
sjallouli | 0:a948f5f3904c | 115 | #define MIN_ENCRY_KEY_SIZE (7) |
sjallouli | 0:a948f5f3904c | 116 | |
sjallouli | 0:a948f5f3904c | 117 | /** |
sjallouli | 0:a948f5f3904c | 118 | * Max encryption key size |
sjallouli | 0:a948f5f3904c | 119 | */ |
sjallouli | 0:a948f5f3904c | 120 | #define MAX_ENCRY_KEY_SIZE (0x10) |
sjallouli | 0:a948f5f3904c | 121 | |
sjallouli | 0:a948f5f3904c | 122 | typedef struct __packed _charactFormat { |
sjallouli | 0:a948f5f3904c | 123 | tHalUint8 format; |
sjallouli | 0:a948f5f3904c | 124 | tHalInt8 exp; |
sjallouli | 0:a948f5f3904c | 125 | tHalUint16 unit; |
sjallouli | 0:a948f5f3904c | 126 | tHalUint8 name_space; |
sjallouli | 0:a948f5f3904c | 127 | tHalUint16 desc; |
sjallouli | 0:a948f5f3904c | 128 | } PACKED charactFormat; |
sjallouli | 0:a948f5f3904c | 129 | |
sjallouli | 0:a948f5f3904c | 130 | #define FORMAT_UINT8 0x04 |
sjallouli | 0:a948f5f3904c | 131 | #define FORMAT_UINT16 0x06 |
sjallouli | 0:a948f5f3904c | 132 | #define FORMAT_SINT16 0x0E |
sjallouli | 0:a948f5f3904c | 133 | #define FORMAT_SINT24 0x0F |
sjallouli | 0:a948f5f3904c | 134 | |
sjallouli | 0:a948f5f3904c | 135 | |
sjallouli | 0:a948f5f3904c | 136 | #define UNIT_UNITLESS 0x2700 |
sjallouli | 0:a948f5f3904c | 137 | #define UNIT_TEMP_CELSIUS 0x272F |
sjallouli | 0:a948f5f3904c | 138 | #define UNIT_PRESSURE_BAR 0x2780 |
sjallouli | 0:a948f5f3904c | 139 | |
sjallouli | 0:a948f5f3904c | 140 | |
sjallouli | 0:a948f5f3904c | 141 | /* |
sjallouli | 0:a948f5f3904c | 142 | * Default MTU size |
sjallouli | 0:a948f5f3904c | 143 | */ |
sjallouli | 0:a948f5f3904c | 144 | #define ATT_DEFAULT_MTU (23) |
sjallouli | 0:a948f5f3904c | 145 | |
sjallouli | 0:a948f5f3904c | 146 | |
sjallouli | 0:a948f5f3904c | 147 | #endif /* __GATT_SERVER_H__ */ |