47#ifndef __MODULES_INCLUDE_BLUETOOTH_BLUETOOTH_H
48#define __MODULES_INCLUDE_BLUETOOTH_BLUETOOTH_H
50#define BLUETOOTH_DEBUG
56#include <sdk/config.h>
72#define _err(format, ...) printf(format, ##__VA_ARGS__)
74#define _info(format, ...) printf(format, ##__VA_ARGS__)
102#define BT_NAME_LEN 28
109#define BT_UUID128_LEN 16
119#define BLE_ADV_FLAGS_LIMITED_DISC_MODE (0x01)
123#define BLE_ADV_FLAGS_GENERAL_DISC_MODE (0x02)
127#define BLE_ADV_FLAGS_BR_EDR_NOT_SUPPORTED (0x04)
131#define BLE_ADV_FLAGS_LE_BR_EDR_CONTROLLER (0x08)
135#define BLE_ADV_FLAGS_LE_BR_EDR_HOST (0x10)
146#define BLE_UUID_128BIT_STRING_LENGTH (36)
150#define BLE_UUID_16BIT_STRING_LENGTH (4)
154#define BLE_UUID_128BIT_STRING_BUFSIZE (BLE_UUID_128BIT_STRING_LENGTH + 1)
158#define BLE_UUID_16BIT_STRING_BUFSIZE (BLE_UUID_16BIT_STRING_LENGTH + 1)
172 uint8_t address[BT_ADDR_LEN];
181 uint8_t uuid128[BT_UUID128_LEN];
257#ifdef EXTERNALS_NRF52
258#include "ble_types.h"
267 BLE_APPEARANCE_GENERIC_PHONE = 64,
268 BLE_APPEARANCE_GENERIC_COMPUTER = 128,
269 BLE_APPEARANCE_GENERIC_WATCH = 192,
270 BLE_APPEARANCE_WATCH_SPORTS = 193,
271 BLE_APPEARANCE_GENERIC_CLOCK = 256,
272 BLE_APPEARANCE_GENERIC_DISPLAY = 320,
273 BLE_APPEARANCE_GENERIC_REMOTE_CONTROL = 384,
274 BLE_APPEARANCE_GENERIC_EYE_GLASSES = 448,
275 BLE_APPEARANCE_GENERIC_TAG = 512,
276 BLE_APPEARANCE_GENERIC_KEYRING = 576,
277 BLE_APPEARANCE_GENERIC_MEDIA_PLAYER = 640,
278 BLE_APPEARANCE_GENERIC_BARCODE_SCANNER = 704,
279 BLE_APPEARANCE_GENERIC_THERMOMETER = 768,
280 BLE_APPEARANCE_THERMOMETER_EAR = 769,
281 BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR = 832,
282 BLE_APPEARANCE_HEART_RATE_BELT = 833,
283 BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE = 896,
284 BLE_APPEARANCE_BLOOD_PRESSURE_ARM = 897,
285 BLE_APPEARANCE_BLOOD_PRESSURE_WRIST = 898,
286 BLE_APPEARANCE_GENERIC_HID_DEVICE = 960,
287 BLE_APPEARANCE_HID_KEYBOARD = 961,
288 BLE_APPEARANCE_HID_MOUSE = 962,
289 BLE_APPEARANCE_HID_JOYSTICK = 963,
290 BLE_APPEARANCE_HID_GAMEPAD = 964,
291 BLE_APPEARANCE_HID_DIGITIZER_TABLET = 965,
292 BLE_APPEARANCE_HID_CARD_READER = 966,
293 BLE_APPEARANCE_HID_DIGITAL_PEN = 967,
294 BLE_APPEARANCE_HID_BARCODE_SCANNER = 968,
295 BLE_APPEARANCE_GENERIC_GLUCOSE_METER = 1024,
296 BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR = 1088,
297 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE = 1089,
298 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE = 1090,
299 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP = 1091,
300 BLE_APPEARANCE_GENERIC_CYCLING = 1152,
301 BLE_APPEARANCE_CYCLING_COMPUTER = 1153,
302 BLE_APPEARANCE_CYCLING_SPEED_SENSOR = 1154,
303 BLE_APPEARANCE_CYCLING_CADENCE_SENSOR = 1155,
304 BLE_APPEARANCE_CYCLING_POWER_SENSOR = 1156,
305 BLE_APPEARANCE_CYCLING_SPEED_AND_CADENCE_SENSOR = 1157,
BLE_ADDRESS_TYPE
BLE address type.
Definition: bluetooth.h:474
@ BLE_ADDRTYPE_RAND_PRIV_RESOLVABLE
Definition: bluetooth.h:485
@ BLE_ADDRTYPE_RAND_STATIC
Definition: bluetooth.h:481
@ BLE_ADDRTYPE_PUBLIC
Definition: bluetooth.h:477
@ BLE_ADDRTYPE_RAND_PRIV_NONRESOLVABLE
Definition: bluetooth.h:489
BT_VISIBILITY
BT visibility ID.
Definition: bluetooth.h:250
@ BT_VIS_DISCOVERY_CONNECTABLE
Definition: bluetooth.h:254
@ BT_VIS_DISCOVERY_NO_CONNECTABLE
Definition: bluetooth.h:252
@ BT_VIS_NO_DISCOVERY_NO_CONNECTABLE
Definition: bluetooth.h:251
@ BT_VIS_NO_DISCOVERY_CONNECTABLE
Definition: bluetooth.h:253
BT_CONNECT_FAIL_REASON_ID
BT profile connection result.
Definition: bluetooth.h:238
@ BT_CONNECT_TIMEOUT
Definition: bluetooth.h:241
@ BT_CONNECT_NO_DEVICE
Definition: bluetooth.h:240
@ BT_CONNECT_NO_SERVICE
Definition: bluetooth.h:239
@ BT_CONNECT_OTHER
Definition: bluetooth.h:242
BT_PAIR_STATUS
BT pairing result.
Definition: bluetooth.h:210
@ BT_PAIR_PAIRING_AUTHENTICATION_FAILURE
Definition: bluetooth.h:214
@ BT_PAIR_RESPONSE_TIMEOUT
Definition: bluetooth.h:228
@ BT_PAIR_CONFIRM_VALUE_FAILURE
Definition: bluetooth.h:215
@ BT_PAIR_PASSKEY_ENTRY_FAILURE
Definition: bluetooth.h:212
@ BT_PAIR_SMP_BUSY
Definition: bluetooth.h:225
@ BT_PAIR_OOB_FAILURE
Definition: bluetooth.h:213
@ BT_PAIR_ENCRYPTION_KEY_SIZE_FAILURE
Definition: bluetooth.h:217
@ BT_PAIR_INTERNAL_PAIRING_ERROR
Definition: bluetooth.h:221
@ BT_PAIR_PAIRING_FAILURE_UNKNOWN
Definition: bluetooth.h:219
@ BT_PAIR_REPEATED_ATTEMPTS
Definition: bluetooth.h:220
@ BT_PAIR_CONNECTION_TIMEOUT
Definition: bluetooth.h:230
@ BT_PAIR_INVALID_COMMAND
Definition: bluetooth.h:218
@ BT_PAIR_GENERIC_FAILURE
Definition: bluetooth.h:229
@ BT_PAIR_SMP_INITIALIZATION_FAILURE
Definition: bluetooth.h:223
@ BT_PAIR_ENCRYPTION_FAILURE
Definition: bluetooth.h:226
@ BT_PAIR_SUCCESS
Definition: bluetooth.h:211
@ BT_PAIR_CONFIRMATION_FAILRUE
Definition: bluetooth.h:224
@ BT_PAIR_UNKNOWN_IO_CAPABILITIES
Definition: bluetooth.h:222
@ BT_PAIR_PAIRING_NOT_SUPPORTED
Definition: bluetooth.h:216
@ BT_PAIR_BONDING_STARTED
Definition: bluetooth.h:227
BT_CMD_STATUS
BT hci command status.
Definition: bluetooth.h:189
@ BT_COMMAND_STATUS_ALREADY_CONNECTED
Definition: bluetooth.h:192
@ BT_COMMAND_STATUS_FAILED
Definition: bluetooth.h:197
@ BT_COMMAND_STATUS_WRONG_STATE
Definition: bluetooth.h:195
@ BT_COMMAND_STATUS_OUT_OF_MEMORY
Definition: bluetooth.h:201
@ BT_COMMAND_STATUS_CLIENT_NOT_REGISTERED
Definition: bluetooth.h:200
@ BT_COMMAND_STATUS_SUCCESS
Definition: bluetooth.h:190
@ BT_COMMAND_STATUS_INVALID_ARGS
Definition: bluetooth.h:196
@ BT_COMMAND_STATUS_NOT_CONNECTED
Definition: bluetooth.h:193
@ BT_COMMAND_STATUS_IN_PROGRESS
Definition: bluetooth.h:191
@ BT_COMMAND_STATUS_DISALLOWED
Definition: bluetooth.h:202
@ BT_COMMAND_STATUS_UNKNOWN_GROUP
Definition: bluetooth.h:198
@ BT_COMMAND_STATUS_UNKNOWN_COMMAND
Definition: bluetooth.h:199
@ BT_COMMAND_STATUS_BAD_HANDLE
Definition: bluetooth.h:194
BLE_GAP_IO_CAP
BLE IO capability.
Definition: bluetooth.h:313
@ BLE_GAP_IO_CAP_NO_INPUT_NO_OUTPUT
Definition: bluetooth.h:317
@ BLE_GAP_IO_CAP_DISPLAY_YESNO
Definition: bluetooth.h:315
@ BLE_GAP_IO_CAP_KEYBOARD_ONLY
Definition: bluetooth.h:316
@ BLE_GAP_IO_CAP_DISPLAY_ONLY
Definition: bluetooth.h:314
@ BLE_GAP_IO_CAP_KEYBOARD_DISPLAY
Definition: bluetooth.h:318
BLE_APPEARANCE
BLE appearance ID.
Definition: bluetooth.h:266
BLE_AD_TYPE
BLE data type of advertising data.
Definition: bluetooth.h:326
@ BLE_AD_TYPE_32BIT_SERVICE_UUID_COMPLETE
Definition: bluetooth.h:349
@ BLE_AD_TYPE_16BIT_SERVICE_UUID_INCOMPLETE
Definition: bluetooth.h:337
@ BLE_AD_TYPE_ADVERTISING_INTERVAL
Definition: bluetooth.h:421
@ BLE_AD_TYPE_RANDOM_TARGET_ADDRESS
Definition: bluetooth.h:413
@ BLE_AD_TYPE_PUBLIC_TARGET_ADDRESS
Definition: bluetooth.h:409
@ BLE_AD_TYPE_128BIT_SERVICE_UUID_INCOMPLETE
Definition: bluetooth.h:353
@ BLE_AD_TYPE_SERVICE_DATA_128BIT_UUID
Definition: bluetooth.h:445
@ BLE_AD_TYPE_FLAGS
Definition: bluetooth.h:333
@ BLE_AD_TYPE_SERVICE_DATA_32BIT_UUID
Definition: bluetooth.h:441
@ BLE_AD_TYPE_TX_POWER_LEVEL
Definition: bluetooth.h:369
@ BLE_AD_TYPE_COMPLETE_LOCAL_NAME
Definition: bluetooth.h:365
@ BLE_AD_TYPE_MANUFACTURER_SPECIFIC_DATA
Definition: bluetooth.h:465
@ BLE_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE
Definition: bluetooth.h:341
@ BLE_AD_TYPE_SECURITY_MANAGER_OOB_FLAGS
Definition: bluetooth.h:389
@ BLE_AD_TYPE_SOLICITED_SERVICE_UUIDS_16BIT
Definition: bluetooth.h:397
@ BLE_AD_TYPE_CLASS_OF_DEVICE
Definition: bluetooth.h:373
@ BLE_AD_TYPE_LESC_CONFIRMATION_VALUE
Definition: bluetooth.h:449
@ BLE_AD_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS
Definition: bluetooth.h:425
@ BLE_AD_TYPE_CONNECTION_INTERVAL_RANGE
Definition: bluetooth.h:393
@ BLE_AD_TYPE_URI
Definition: bluetooth.h:457
@ BLE_AD_TYPE_ADDRESS_TYPE
Definition: bluetooth.h:329
@ BLE_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R256
Definition: bluetooth.h:437
@ BLE_AD_TYPE_SERVICE_DATA
Definition: bluetooth.h:405
@ BLE_AD_TYPE_SIMPLE_PAIRING_HASH_C256
Definition: bluetooth.h:433
@ BLE_AD_TYPE_SECURITY_MANAGER_TK_VALUE
Definition: bluetooth.h:385
@ BLE_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R
Definition: bluetooth.h:381
@ BLE_AD_TYPE_LE_ROLE
Definition: bluetooth.h:429
@ BLE_AD_TYPE_3D_INFORMATION_DATA
Definition: bluetooth.h:461
@ BLE_AD_TYPE_SHORT_LOCAL_NAME
Definition: bluetooth.h:361
@ BLE_AD_TYPE_APPEARANCE
Definition: bluetooth.h:417
@ BLE_AD_TYPE_SOLICITED_SERVICE_UUIDS_128BIT
Definition: bluetooth.h:401
@ BLE_AD_TYPE_LESC_RANDOM_VALUE
Definition: bluetooth.h:453
@ BLE_AD_TYPE_SIMPLE_PAIRING_HASH_C
Definition: bluetooth.h:377
@ BLE_AD_TYPE_32BIT_SERVICE_UUID_INCOMPLETE
Definition: bluetooth.h:345
@ BLE_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE
Definition: bluetooth.h:357
BT address types.
Definition: bluetooth.h:171
128-bit UUID types
Definition: bluetooth.h:180