Developer World
Spresense SDK Library v1.4.2-3df2e9d
bluetooth.h File Reference

Bluetooth common header for SDK on Spresense. More...

#include <sdk/config.h>
#include <debug.h>
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct  BT_ADDR
 BT address types. More...
 
struct  BT_UUID
 128-bit UUID types More...
 

Macros

#define BLUETOOTH_DEBUG
 
#define _err(format, ...)   printf(format, ##__VA_ARGS__)
 
#define _info(format, ...)   printf(format, ##__VA_ARGS__)
 
BT success code
#define BT_SUCCESS   0
 
BT fail code
#define BT_FAIL   -127
 
BT Address Length
#define BT_ADDR_LEN   6
 
BT Name Length
#define BT_NAME_LEN   28
 
BT UUID Length
#define BT_UUID128_LEN   16
 

Enumerations

enum  BT_CMD_STATUS {
  BT_COMMAND_STATUS_SUCCESS = 0, BT_COMMAND_STATUS_IN_PROGRESS, BT_COMMAND_STATUS_ALREADY_CONNECTED, BT_COMMAND_STATUS_NOT_CONNECTED,
  BT_COMMAND_STATUS_BAD_HANDLE, BT_COMMAND_STATUS_WRONG_STATE, BT_COMMAND_STATUS_INVALID_ARGS, BT_COMMAND_STATUS_FAILED,
  BT_COMMAND_STATUS_UNKNOWN_GROUP, BT_COMMAND_STATUS_UNKNOWN_COMMAND, BT_COMMAND_STATUS_CLIENT_NOT_REGISTERED, BT_COMMAND_STATUS_OUT_OF_MEMORY,
  BT_COMMAND_STATUS_DISALLOWED
}
 BT hci command status. More...
 
enum  BT_PAIR_STATUS {
  BT_PAIR_SUCCESS, BT_PAIR_PASSKEY_ENTRY_FAILURE, BT_PAIR_OOB_FAILURE, BT_PAIR_PAIRING_AUTHENTICATION_FAILURE,
  BT_PAIR_CONFIRM_VALUE_FAILURE, BT_PAIR_PAIRING_NOT_SUPPORTED, BT_PAIR_ENCRYPTION_KEY_SIZE_FAILURE, BT_PAIR_INVALID_COMMAND,
  BT_PAIR_PAIRING_FAILURE_UNKNOWN, BT_PAIR_REPEATED_ATTEMPTS, BT_PAIR_INTERNAL_PAIRING_ERROR, BT_PAIR_UNKNOWN_IO_CAPABILITIES,
  BT_PAIR_SMP_INITIALIZATION_FAILURE, BT_PAIR_CONFIRMATION_FAILRUE, BT_PAIR_SMP_BUSY, BT_PAIR_ENCRYPTION_FAILURE,
  BT_PAIR_BONDING_STARTED, BT_PAIR_RESPONSE_TIMEOUT, BT_PAIR_GENERIC_FAILURE, BT_PAIR_CONNECTION_TIMEOUT
}
 BT pairing result. More...
 
enum  BT_CONNECT_FAIL_REASON_ID { BT_CONNECT_NO_SERVICE = 0, BT_CONNECT_NO_DEVICE, BT_CONNECT_TIMEOUT, BT_CONNECT_OTHER }
 BT profile connection result. More...
 
enum  BT_VISIBILITY { BT_VIS_NO_DISCOVERY_NO_CONNECTABLE = 0, BT_VIS_DISCOVERY_NO_CONNECTABLE = 1, BT_VIS_NO_DISCOVERY_CONNECTABLE = 2, BT_VIS_DISCOVERY_CONNECTABLE = 3 }
 BT visibility ID. More...
 
enum  BLE_APPEARANCE {
  BLE_APPEARANCE_GENERIC_PHONE = 64, BLE_APPEARANCE_GENERIC_COMPUTER = 128, BLE_APPEARANCE_GENERIC_WATCH = 192, BLE_APPEARANCE_WATCH_SPORTS = 193,
  BLE_APPEARANCE_GENERIC_CLOCK = 256, BLE_APPEARANCE_GENERIC_DISPLAY = 320, BLE_APPEARANCE_GENERIC_REMOTE_CONTROL = 384, BLE_APPEARANCE_GENERIC_EYE_GLASSES = 448,
  BLE_APPEARANCE_GENERIC_TAG = 512, BLE_APPEARANCE_GENERIC_KEYRING = 576, BLE_APPEARANCE_GENERIC_MEDIA_PLAYER = 640, BLE_APPEARANCE_GENERIC_BARCODE_SCANNER = 704,
  BLE_APPEARANCE_GENERIC_THERMOMETER = 768, BLE_APPEARANCE_THERMOMETER_EAR = 769, BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR = 832, BLE_APPEARANCE_HEART_RATE_BELT = 833,
  BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE = 896, BLE_APPEARANCE_BLOOD_PRESSURE_ARM = 897, BLE_APPEARANCE_BLOOD_PRESSURE_WRIST = 898, BLE_APPEARANCE_GENERIC_HID_DEVICE = 960,
  BLE_APPEARANCE_HID_KEYBOARD = 961, BLE_APPEARANCE_HID_MOUSE = 962, BLE_APPEARANCE_HID_JOYSTICK = 963, BLE_APPEARANCE_HID_GAMEPAD = 964,
  BLE_APPEARANCE_HID_DIGITIZER_TABLET = 965, BLE_APPEARANCE_HID_CARD_READER = 966, BLE_APPEARANCE_HID_DIGITAL_PEN = 967, BLE_APPEARANCE_HID_BARCODE_SCANNER = 968,
  BLE_APPEARANCE_GENERIC_GLUCOSE_METER = 1024, BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR = 1088, BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE = 1089, BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE = 1090,
  BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP = 1091, BLE_APPEARANCE_GENERIC_CYCLING = 1152, BLE_APPEARANCE_CYCLING_COMPUTER = 1153, BLE_APPEARANCE_CYCLING_SPEED_SENSOR = 1154,
  BLE_APPEARANCE_CYCLING_CADENCE_SENSOR = 1155, BLE_APPEARANCE_CYCLING_POWER_SENSOR = 1156, BLE_APPEARANCE_CYCLING_SPEED_AND_CADENCE_SENSOR = 1157
}
 BLE appearance ID.
 
enum  BLE_GAP_IO_CAP {
  BLE_GAP_IO_CAP_DISPLAY_ONLY = 0, BLE_GAP_IO_CAP_DISPLAY_YESNO, BLE_GAP_IO_CAP_KEYBOARD_ONLY, BLE_GAP_IO_CAP_NO_INPUT_NO_OUTPUT,
  BLE_GAP_IO_CAP_KEYBOARD_DISPLAY
}
 BLE IO capability. More...
 

Detailed Description

Bluetooth common header for SDK on Spresense.

Author
Sony Semiconductor Solutions Corporation

This header file includes bluetooth common definition between API and HAL I/F.

  • Error code
  • Length of parameter
  • Status

Enumeration Type Documentation

◆ BT_CMD_STATUS

BT hci command status.

Enumerator
BT_COMMAND_STATUS_SUCCESS 

Command success

BT_COMMAND_STATUS_IN_PROGRESS 

Command in progress

BT_COMMAND_STATUS_ALREADY_CONNECTED 

Already connected

BT_COMMAND_STATUS_NOT_CONNECTED 

Not connected

BT_COMMAND_STATUS_BAD_HANDLE 

Bad handle

BT_COMMAND_STATUS_WRONG_STATE 

Wrong state

BT_COMMAND_STATUS_INVALID_ARGS 

Invalid argument

BT_COMMAND_STATUS_FAILED 

Command failed

BT_COMMAND_STATUS_UNKNOWN_GROUP 

Unknown group

BT_COMMAND_STATUS_UNKNOWN_COMMAND 

Unknown command

BT_COMMAND_STATUS_CLIENT_NOT_REGISTERED 

HCI client not registered

BT_COMMAND_STATUS_OUT_OF_MEMORY 

Out of memory

BT_COMMAND_STATUS_DISALLOWED 

Command not allowed

◆ BT_PAIR_STATUS

BT pairing result.

Enumerator
BT_PAIR_SUCCESS 

Pairing success

BT_PAIR_PASSKEY_ENTRY_FAILURE 

Passkey entry failure

BT_PAIR_OOB_FAILURE 

Out of band failure

BT_PAIR_PAIRING_AUTHENTICATION_FAILURE 

Authentication failure

BT_PAIR_CONFIRM_VALUE_FAILURE 

Confirmation value failure

BT_PAIR_PAIRING_NOT_SUPPORTED 

Pairing not supported

BT_PAIR_ENCRYPTION_KEY_SIZE_FAILURE 

Encryption key size failure

BT_PAIR_INVALID_COMMAND 

Invalid pairing command

BT_PAIR_PAIRING_FAILURE_UNKNOWN 

Unknown pairing failure

BT_PAIR_REPEATED_ATTEMPTS 

Repeat attempts

BT_PAIR_INTERNAL_PAIRING_ERROR 

Internal error

BT_PAIR_UNKNOWN_IO_CAPABILITIES 

Unknown I/O capability

BT_PAIR_SMP_INITIALIZATION_FAILURE 

SMP initialization failure

BT_PAIR_CONFIRMATION_FAILRUE 

Confirmation failure

BT_PAIR_SMP_BUSY 

SMP busy

BT_PAIR_ENCRYPTION_FAILURE 

Encryption failure

BT_PAIR_BONDING_STARTED 

Bonding started

BT_PAIR_RESPONSE_TIMEOUT 

Response timeout

BT_PAIR_GENERIC_FAILURE 

Generic failure

BT_PAIR_CONNECTION_TIMEOUT 

Connection timeout

◆ BT_CONNECT_FAIL_REASON_ID

BT profile connection result.

Enumerator
BT_CONNECT_NO_SERVICE 

No service

BT_CONNECT_NO_DEVICE 

No device

BT_CONNECT_TIMEOUT 

Connection timeout

BT_CONNECT_OTHER 

Other reason

◆ BT_VISIBILITY

BT visibility ID.

Enumerator
BT_VIS_NO_DISCOVERY_NO_CONNECTABLE 

No discoverable and no connectable

BT_VIS_DISCOVERY_NO_CONNECTABLE 

Discoverable but no connectable

BT_VIS_NO_DISCOVERY_CONNECTABLE 

No discoverable but connectable

BT_VIS_DISCOVERY_CONNECTABLE 

Discoverable and connectable

◆ BLE_GAP_IO_CAP

BLE IO capability.

Enumerator
BLE_GAP_IO_CAP_DISPLAY_ONLY 

Display Only

BLE_GAP_IO_CAP_DISPLAY_YESNO 

Display and Yes/No entry

BLE_GAP_IO_CAP_KEYBOARD_ONLY 

Keyboard Only

BLE_GAP_IO_CAP_NO_INPUT_NO_OUTPUT 

No Input No Output

BLE_GAP_IO_CAP_KEYBOARD_DISPLAY 

Keyboard and Display