Developer World
Spresense SDK Library v1.4.2-3df2e9d
bluetooth.h
Go to the documentation of this file.
1 /****************************************************************************
2  * modules/include/bluetooth/bluetooth.h
3  *
4  * Copyright 2018 Sony Semiconductor Solutions Corporation
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  * 3. Neither the name of Sony Semiconductor Solutions Corporation nor
17  * the names of its contributors may be used to endorse or promote
18  * products derived from this software without specific prior written
19  * permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  ****************************************************************************/
35 
47 #ifndef __MODULES_INCLUDE_BLUETOOTH_BLUETOOTH_H
48 #define __MODULES_INCLUDE_BLUETOOTH_BLUETOOTH_H
49 
50 #define BLUETOOTH_DEBUG
51 
52 /****************************************************************************
53  * Included Files
54  ****************************************************************************/
55 
56 #include <sdk/config.h>
57 
58 #include <debug.h>
59 #include <errno.h>
60 #include <stdbool.h>
61 #include <stdint.h>
62 #ifdef BLUETOOTH_DEBUG
63 #include <stdio.h>
64 #endif
65 
66 /****************************************************************************
67  * Pre-processor Definitions
68  ****************************************************************************/
69 
70 #ifdef BLUETOOTH_DEBUG
71 #undef _err
72 #define _err(format, ...) printf(format, ##__VA_ARGS__)
73 #undef _info
74 #define _info(format, ...) printf(format, ##__VA_ARGS__)
75 #endif
76 
81 #define BT_SUCCESS 0
82 
88 #define BT_FAIL -127
89 
95 #define BT_ADDR_LEN 6
96 
102 #define BT_NAME_LEN 28
103 
109 #define BT_UUID128_LEN 16
110 
112 /****************************************************************************
113  * Public Types
114  ****************************************************************************/
115 
120 typedef struct
121 {
122  uint8_t address[BT_ADDR_LEN];
123 } BT_ADDR;
124 
129 typedef struct
130 {
131  uint8_t uuid128[BT_UUID128_LEN];
132 } BT_UUID;
133 
138 typedef enum
139 {
153 } BT_CMD_STATUS;
154 
159 typedef enum
160 {
182 
187 typedef enum
188 {
194 
199 typedef enum
200 {
205 } BT_VISIBILITY;
206 
211 typedef enum
212 {
213  BLE_APPEARANCE_GENERIC_PHONE = 64,
214  BLE_APPEARANCE_GENERIC_COMPUTER = 128,
215  BLE_APPEARANCE_GENERIC_WATCH = 192,
216  BLE_APPEARANCE_WATCH_SPORTS = 193,
217  BLE_APPEARANCE_GENERIC_CLOCK = 256,
218  BLE_APPEARANCE_GENERIC_DISPLAY = 320,
219  BLE_APPEARANCE_GENERIC_REMOTE_CONTROL = 384,
220  BLE_APPEARANCE_GENERIC_EYE_GLASSES = 448,
221  BLE_APPEARANCE_GENERIC_TAG = 512,
222  BLE_APPEARANCE_GENERIC_KEYRING = 576,
223  BLE_APPEARANCE_GENERIC_MEDIA_PLAYER = 640,
224  BLE_APPEARANCE_GENERIC_BARCODE_SCANNER = 704,
225  BLE_APPEARANCE_GENERIC_THERMOMETER = 768,
226  BLE_APPEARANCE_THERMOMETER_EAR = 769,
227  BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR = 832,
228  BLE_APPEARANCE_HEART_RATE_BELT = 833,
229  BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE = 896,
230  BLE_APPEARANCE_BLOOD_PRESSURE_ARM = 897,
231  BLE_APPEARANCE_BLOOD_PRESSURE_WRIST = 898,
232  BLE_APPEARANCE_GENERIC_HID_DEVICE = 960,
233  BLE_APPEARANCE_HID_KEYBOARD = 961,
234  BLE_APPEARANCE_HID_MOUSE = 962,
235  BLE_APPEARANCE_HID_JOYSTICK = 963,
236  BLE_APPEARANCE_HID_GAMEPAD = 964,
237  BLE_APPEARANCE_HID_DIGITIZER_TABLET = 965,
238  BLE_APPEARANCE_HID_CARD_READER = 966,
239  BLE_APPEARANCE_HID_DIGITAL_PEN = 967,
240  BLE_APPEARANCE_HID_BARCODE_SCANNER = 968,
241  BLE_APPEARANCE_GENERIC_GLUCOSE_METER = 1024,
242  BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR = 1088,
243  BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE = 1089,
244  BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE = 1090,
245  BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP = 1091,
246  BLE_APPEARANCE_GENERIC_CYCLING = 1152,
247  BLE_APPEARANCE_CYCLING_COMPUTER = 1153,
248  BLE_APPEARANCE_CYCLING_SPEED_SENSOR = 1154,
249  BLE_APPEARANCE_CYCLING_CADENCE_SENSOR = 1155,
250  BLE_APPEARANCE_CYCLING_POWER_SENSOR = 1156,
251  BLE_APPEARANCE_CYCLING_SPEED_AND_CADENCE_SENSOR = 1157,
253 
258 typedef enum {
265 
266 /****************************************************************************
267  * Private Data
268  ****************************************************************************/
269 
270 /****************************************************************************
271  * Public Function Prototypes
272  ****************************************************************************/
273 
274 #endif /* __MODULES_INCLUDE_BLUETOOTH_BLUETOOTH_H */
Definition: bluetooth.h:145
Definition: bluetooth.h:150
Definition: bluetooth.h:176
Definition: bluetooth.h:168
Definition: bluetooth.h:175
Definition: bluetooth.h:166
Definition: bluetooth.h:179
Definition: bluetooth.h:191
Definition: bluetooth.h:261
Definition: bluetooth.h:142
Definition: bluetooth.h:165
BT_PAIR_STATUS
BT pairing result.
Definition: bluetooth.h:159
Definition: bluetooth.h:180
BT address types.
Definition: bluetooth.h:120
Definition: bluetooth.h:174
Definition: bluetooth.h:167
BLE_GAP_IO_CAP
BLE IO capability.
Definition: bluetooth.h:258
Definition: bluetooth.h:190
Definition: bluetooth.h:169
Definition: bluetooth.h:144
Definition: bluetooth.h:170
Definition: bluetooth.h:189
Definition: bluetooth.h:260
Definition: bluetooth.h:161
Definition: bluetooth.h:177
Definition: bluetooth.h:147
BT_VISIBILITY
BT visibility ID.
Definition: bluetooth.h:199
Definition: bluetooth.h:140
Definition: bluetooth.h:162
Definition: bluetooth.h:173
Definition: bluetooth.h:152
Definition: bluetooth.h:172
Definition: bluetooth.h:149
BLE_APPEARANCE
BLE appearance ID.
Definition: bluetooth.h:211
Definition: bluetooth.h:148
Definition: bluetooth.h:171
Definition: bluetooth.h:202
BT_CONNECT_FAIL_REASON_ID
BT profile connection result.
Definition: bluetooth.h:187
Definition: bluetooth.h:178
Definition: bluetooth.h:151
Definition: bluetooth.h:163
Definition: bluetooth.h:143
Definition: bluetooth.h:201
Definition: bluetooth.h:192
Definition: bluetooth.h:146
BT_CMD_STATUS
BT hci command status.
Definition: bluetooth.h:138
Definition: bluetooth.h:263
Definition: bluetooth.h:262
Definition: bluetooth.h:141
Definition: bluetooth.h:204
128-bit UUID types
Definition: bluetooth.h:129
Definition: bluetooth.h:259
Definition: bluetooth.h:164
Definition: bluetooth.h:203