dragoon  4383
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ble_types.h
1 /*
2  * Copyright (c) 2012 - 2017, Nordic Semiconductor ASA
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice, this
9  * list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form, except as embedded into a Nordic
12  * Semiconductor ASA integrated circuit in a product or a software update for
13  * such product, must reproduce the above copyright notice, this list of
14  * conditions and the following disclaimer in the documentation and/or other
15  * materials provided with the distribution.
16  *
17  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * 4. This software, with or without modification, must only be used with a
22  * Nordic Semiconductor ASA integrated circuit.
23  *
24  * 5. Any software provided in binary form under this license must not be reverse
25  * engineered, decompiled, modified and/or disassembled.
26  *
27  * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
28  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29  * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
30  * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
31  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
38 
48 #ifndef BLE_TYPES_H__
49 #define BLE_TYPES_H__
50 
51 #include <stdint.h>
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
62 #define BLE_CONN_HANDLE_INVALID 0xFFFF
63 #define BLE_CONN_HANDLE_ALL 0xFFFE
69 /* Generic UUIDs, applicable to all services */
70 #define BLE_UUID_UNKNOWN 0x0000
71 #define BLE_UUID_SERVICE_PRIMARY 0x2800
72 #define BLE_UUID_SERVICE_SECONDARY 0x2801
73 #define BLE_UUID_SERVICE_INCLUDE 0x2802
74 #define BLE_UUID_CHARACTERISTIC 0x2803
75 #define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP 0x2900
76 #define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC 0x2901
77 #define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG 0x2902
78 #define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG 0x2903
79 #define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT 0x2904
80 #define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT 0x2905
81 /* GATT specific UUIDs */
82 #define BLE_UUID_GATT 0x1801
83 #define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED 0x2A05
84 /* GAP specific UUIDs */
85 #define BLE_UUID_GAP 0x1800
86 #define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00
87 #define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01
88 #define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03
89 #define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04
90 #define BLE_UUID_GAP_CHARACTERISTIC_CAR 0x2AA6
91 #define BLE_UUID_GAP_CHARACTERISTIC_RPA_ONLY 0x2AC9
97 #define BLE_UUID_TYPE_UNKNOWN 0x00
98 #define BLE_UUID_TYPE_BLE 0x01
99 #define BLE_UUID_TYPE_VENDOR_BEGIN 0x02
106 #define BLE_APPEARANCE_UNKNOWN 0
107 #define BLE_APPEARANCE_GENERIC_PHONE 64
108 #define BLE_APPEARANCE_GENERIC_COMPUTER 128
109 #define BLE_APPEARANCE_GENERIC_WATCH 192
110 #define BLE_APPEARANCE_WATCH_SPORTS_WATCH 193
111 #define BLE_APPEARANCE_GENERIC_CLOCK 256
112 #define BLE_APPEARANCE_GENERIC_DISPLAY 320
113 #define BLE_APPEARANCE_GENERIC_REMOTE_CONTROL 384
114 #define BLE_APPEARANCE_GENERIC_EYE_GLASSES 448
115 #define BLE_APPEARANCE_GENERIC_TAG 512
116 #define BLE_APPEARANCE_GENERIC_KEYRING 576
117 #define BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 640
118 #define BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 704
119 #define BLE_APPEARANCE_GENERIC_THERMOMETER 768
120 #define BLE_APPEARANCE_THERMOMETER_EAR 769
121 #define BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR 832
122 #define BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 833
123 #define BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 896
124 #define BLE_APPEARANCE_BLOOD_PRESSURE_ARM 897
125 #define BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 898
126 #define BLE_APPEARANCE_GENERIC_HID 960
127 #define BLE_APPEARANCE_HID_KEYBOARD 961
128 #define BLE_APPEARANCE_HID_MOUSE 962
129 #define BLE_APPEARANCE_HID_JOYSTICK 963
130 #define BLE_APPEARANCE_HID_GAMEPAD 964
131 #define BLE_APPEARANCE_HID_DIGITIZERSUBTYPE 965
132 #define BLE_APPEARANCE_HID_CARD_READER 966
133 #define BLE_APPEARANCE_HID_DIGITAL_PEN 967
134 #define BLE_APPEARANCE_HID_BARCODE 968
135 #define BLE_APPEARANCE_GENERIC_GLUCOSE_METER 1024
136 #define BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 1088
137 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE 1089
138 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE 1090
139 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP 1091
140 #define BLE_APPEARANCE_GENERIC_CYCLING 1152
141 #define BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER 1153
142 #define BLE_APPEARANCE_CYCLING_SPEED_SENSOR 1154
143 #define BLE_APPEARANCE_CYCLING_CADENCE_SENSOR 1155
144 #define BLE_APPEARANCE_CYCLING_POWER_SENSOR 1156
145 #define BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR 1157
146 #define BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 3136
147 #define BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 3137
148 #define BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN 3138
149 #define BLE_APPEARANCE_GENERIC_WEIGHT_SCALE 3200
150 #define BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT 5184
151 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP 5185
152 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP 5186
153 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD 5187
154 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD 5188
158 #define BLE_UUID_BLE_ASSIGN(instance, value) do {\
159  instance.type = BLE_UUID_TYPE_BLE; \
160  instance.uuid = value;} while(0)
161 
163 #define BLE_UUID_COPY_PTR(dst, src) do {\
164  (dst)->type = (src)->type; \
165  (dst)->uuid = (src)->uuid;} while(0)
166 
168 #define BLE_UUID_COPY_INST(dst, src) do {\
169  (dst).type = (src).type; \
170  (dst).uuid = (src).uuid;} while(0)
171 
173 #define BLE_UUID_EQ(p_uuid1, p_uuid2) \
174  (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid))
175 
177 #define BLE_UUID_NEQ(p_uuid1, p_uuid2) \
178  (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid))
179 
186 typedef struct
187 {
188  uint8_t uuid128[16];
189 } ble_uuid128_t;
190 
192 typedef struct
193 {
194  uint16_t uuid;
195  uint8_t type;
196 } ble_uuid_t;
197 
199 typedef struct
200 {
201  uint8_t *p_data;
202  uint16_t len;
203 } ble_data_t;
204 
206 #ifdef __cplusplus
207 }
208 #endif
209 
210 #endif /* BLE_TYPES_H__ */
211