43#ifndef __MODULES_INCLUDE_BLUETOOTH_BT_COMMON_H
44#define __MODULES_INCLUDE_BLUETOOTH_BT_COMMON_H
57#define BT_ADV_DATA_MAX_LEN (255)
58#define BT_ADV_DATA_LEN_LEN (1)
59#define BT_ADV_DATA_TYPE_LEN (1)
60#define BT_EIR_LEN (BT_ADV_DATA_MAX_LEN \
61 - BT_ADV_DATA_LEN_LEN \
62 - BT_ADV_DATA_TYPE_LEN)
64#define BLE_IRK_LEN (16)
65#define BLE_CSRK_LEN (16)
66#define BLE_LTK_LEN (16)
67#define BLE_RAND_LEN (8)
73#define BLESTAT_SUCCESS 0x00
77#define BLESTAT_MEMCAP_EXCD 0x07
81#define BLESTAT_CONNECT_TIMEOUT 0x08
85#define BLESTAT_PEER_TERMINATED 0x13
89#define BLESTAT_PEER_TERM_LOWRES 0x14
93#define BLESTAT_PEER_TERM_POFF 0x15
97#define BLESTAT_TERMINATED 0x16
101#define BLESTAT_UNSPEC_ERR 0x1F
105#define BLESTAT_DEVICE_BUSY 0x3A
109#define BLESTAT_PARAM_REJECTED 0x3B
113#define BLESTAT_CONNECT_FAILED 0x3E
181 uint8_t addr[BT_ADDR_LEN];
191 uint8_t irk[BLE_IRK_LEN];
192 uint8_t csrk[BLE_CSRK_LEN];
193 uint8_t ltk[BLE_LTK_LEN];
194 uint8_t rand[BLE_RAND_LEN];
251 void (*scan_result)(
BT_ADDR addr, uint8_t *data, uint8_t len);
255 void (*
mtusize)(uint16_t handle, uint16_t sz);
280 uint8_t data[BT_EIR_LEN];
284#define EXTERN extern "C"
Bluetooth common header for SDK on Spresense.
BT_VISIBILITY
BT visibility ID.
Definition: bluetooth.h:250
BT_PAIR_STATUS
BT pairing result.
Definition: bluetooth.h:210
BT_CMD_STATUS
BT hci command status.
Definition: bluetooth.h:189
BLE_AD_TYPE
BLE data type of advertising data.
Definition: bluetooth.h:326
int bt_get_address(BT_ADDR *addr)
Get Bluetooth module address.
int bt_disable(void)
Bluetooth module disable Bluetooth set power off.
int bt_start_inquiry(void)
Bluetooth inquiry start Start to inquiry for connect peer device.
int bt_get_bond_list(BT_ADDR *addr, int *num)
Bluetooth get bond device list Get bond devices list with BD_ADDR.
int bt_set_visibility(BT_VISIBILITY visibility)
Bluetooth set visible Visible this device from others.
int ble_cancel_advertise(void)
Bluetooth LE cancel advertise Cancel BLE advertise mode.
int bt_finalize(void)
Bluetooth module finalize.
int ble_pairing(uint16_t handle)
Execute pairing.
int ble_start_advertise(void)
Bluetooth LE start advertise Start BLE advertise mode.
int ble_parse_advertising_data(BLE_AD_TYPE target, uint8_t *adv_data, uint8_t adv_len, struct bt_eir_s *eir)
Parse advertise data.
int bt_pairing_enable(void)
Bluetooth pairing enable Entering bluetooth pairing mode.
int ble_get_name(char *name)
Get Bluetooth LE module name.
int ble_get_address(BT_ADDR *addr)
Get Bluetooth LE module address.
int ble_get_negotiated_mtusize(uint16_t handle)
Get negotiated MTU size.
int ble_register_common_cb(struct ble_common_ops_s *ble_common_ops)
Bluetooth LE register common callbacks Register Connect/Advertise/Scan callback.
int ble_disconnect(struct ble_state_s *ble_state)
Bluetooth LE dicsonnect for Central.
int bt_cancel_inquiry(void)
Bluetooth inquiry cancel Cancel to inquiry.
int bt_enable(void)
Bluetooth module enable Bluetooth set power on(and download firmware, etc).
int ble_cancel_scan(void)
Bluetooth LE cancel scan Cancel BLE scan mode.
int ble_disable(void)
Bluetooth LE disable.
int bt_set_address(BT_ADDR *addr)
Set Bluetooth module address This is Spresense side address and should be call before bt_enable.
int ble_start_scan(bool duplicate_filter)
Bluetooth LE start scan Start BLE scan mode.
int bt_register_common_cb(struct bt_common_ops_s *bt_common_ops)
Bluetooth register common callbacks Register Connect/Pairing/Inquiry callback.
int ble_connect(struct ble_state_s *ble_state)
Bluetooth LE connect for Central.
int bt_paring_disable(void)
Bluetooth pairing disable Escaping bluetooth pairing mode.
int bt_init(void)
Bluetooth module initialize For initialize a pin config, NV storage, UART, etc.
int ble_set_address(BT_ADDR *addr)
Set Bluetooth LE module address This is Spresense side address and should be call before bt_enable.
int ble_set_name(char *name)
Set Bluetooth LE module name This name visible for other devices and should be call before bt_enable.
uint16_t ble_set_request_mtusize(uint16_t sz)
Set MTU size that application requests.
int ble_enable(void)
Bluetooth LE enable.
int bt_set_name(char *name)
Set Bluetooth module name This name visible for other devices and should be call before bt_enable.
uint16_t ble_get_request_mtusize(void)
Get MTU size that application requests.
int bt_unbond(BT_ADDR *addr)
Bluetooth unbond by BD_ADDR Unbond device by BD_ADDR.
int bt_get_name(char *name)
Get Bluetooth module name.
BT_CONNECT_STATUS
BT profile connection status.
Definition: bt_common.h:124
@ BT_DISCONNECTING
Definition: bt_common.h:126
@ BT_CONNECTED
Definition: bt_common.h:128
@ BT_CONNECTING
Definition: bt_common.h:127
@ BT_DISCONNECTED
Definition: bt_common.h:125
BT address types.
Definition: bluetooth.h:171
BLE address.
Definition: bt_common.h:179
Bluetooth LE bonding information.
Definition: bt_common.h:210
Definition: bt_common.h:199
Bluetooth LE Common application callbacks.
Definition: bt_common.h:238
void(* save_bondinfo)(int num, struct ble_bondinfo_s *bond)
Definition: bt_common.h:259
void(* connect_status_changed)(struct ble_state_s *ble_state, bool connected, uint8_t status)
Definition: bt_common.h:241
void(* connected_device_name_resp)(const char *name)
Definition: bt_common.h:247
int(* load_bondinfo)(int num, struct ble_bondinfo_s *bond)
Definition: bt_common.h:263
void(* encryption_result)(uint16_t conn_handle, bool result)
Definition: bt_common.h:267
void(* mtusize)(uint16_t handle, uint16_t sz)
Definition: bt_common.h:255
Bluetooth LE common HAL callbacks.
Definition: bt_if.h:139
Definition: bt_common.h:190
Bluetooth LE context.
Definition: bt_common.h:164
struct bt_common_state_s * bt_common_state
Definition: bt_common.h:167
BT_CONNECT_STATUS ble_connection
Definition: bt_common.h:165
uint8_t bt_target_addr_type
Definition: bt_common.h:168
BT_ADDR bt_target_addr
Definition: bt_common.h:169
uint16_t ble_connect_handle
Definition: bt_common.h:166
char bt_target_name[BT_NAME_LEN]
Definition: bt_common.h:170
Bluetooth ACL context.
Definition: bt_common.h:152
struct bt_common_state_s * bt_common_state
Definition: bt_common.h:154
BT_ADDR bt_target_addr
Definition: bt_common.h:155
BT_CONNECT_STATUS bt_acl_connection
Definition: bt_common.h:153
char bt_target_name[BT_NAME_LEN]
Definition: bt_common.h:156
Bluetooth Common application callbacks.
Definition: bt_common.h:223
void(* connected_device_name)(const char *name)
Definition: bt_common.h:229
void(* connect_status_changed)(struct bt_acl_state_s *bt_acl_state, bool connected, int status)
Definition: bt_common.h:228
void(* command_status)(BT_CMD_STATUS status)
Definition: bt_common.h:224
void(* bond_info)(BT_ADDR addr)
Definition: bt_common.h:230
void(* inquiry_complete)(void)
Definition: bt_common.h:227
void(* pairing_complete)(BT_ADDR addr, BT_PAIR_STATUS status)
Definition: bt_common.h:225
void(* inquiry_result)(BT_ADDR addr, char *name)
Definition: bt_common.h:226
Bluetooth base context.
Definition: bt_common.h:136
struct bt_hal_common_ops_s * bt_hal_common_ops
Definition: bt_common.h:137
struct bt_common_ops_s * bt_common_ops
Definition: bt_common.h:139
BT_ADDR bt_addr
Definition: bt_common.h:141
char bt_name[BT_NAME_LEN+1]
Definition: bt_common.h:143
char ble_name[BT_NAME_LEN+1]
Definition: bt_common.h:144
struct ble_common_ops_s * ble_common_ops
Definition: bt_common.h:140
BT_ADDR ble_addr
Definition: bt_common.h:142
struct ble_hal_common_ops_s * ble_hal_common_ops
Definition: bt_common.h:138
The format of one data in advertising data.
Definition: bt_common.h:277
Bluetooth Common HAL callbacks.
Definition: bt_if.h:70