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)
71#define BLE_SCAN_PARAM_INTERVAL_MSEC(t) ((t) * 1000 / 625)
72#define BLE_SCAN_PARAM_WINDOW_MSEC(t) ((t) * 1000 / 625)
73#define BLE_SCAN_PARAM_TIMEOUT_MSEC(t) ((t) * 1000 / 10000)
77#define BLE_CONN_PARAM_INTERVAL_MSEC(t) ((t) * 1000 / 1250)
78#define BLE_CONN_PARAM_TIMEOUT_MSEC(t) ((t) * 1000 / 10000)
84#define BLESTAT_SUCCESS 0x00
88#define BLESTAT_MEMCAP_EXCD 0x07
92#define BLESTAT_CONNECT_TIMEOUT 0x08
96#define BLESTAT_PEER_TERMINATED 0x13
100#define BLESTAT_PEER_TERM_LOWRES 0x14
104#define BLESTAT_PEER_TERM_POFF 0x15
108#define BLESTAT_TERMINATED 0x16
112#define BLESTAT_UNSPEC_ERR 0x1F
116#define BLESTAT_DEVICE_BUSY 0x3A
120#define BLESTAT_PARAM_REJECTED 0x3B
124#define BLESTAT_CONNECT_FAILED 0x3E
193 uint8_t addr[BT_ADDR_LEN];
203 uint8_t irk[BLE_IRK_LEN];
204 uint8_t csrk[BLE_CSRK_LEN];
205 uint8_t ltk[BLE_LTK_LEN];
206 uint8_t rand[BLE_RAND_LEN];
279 void (*scan_result)(
BT_ADDR addr, uint8_t *data, uint8_t len);
283 void (*
mtusize)(uint16_t handle, uint16_t sz);
308 uint8_t data[BT_EIR_LEN];
312#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_APPEARANCE
BLE appearance ID.
Definition: bluetooth.h:262
BLE_AD_TYPE
BLE data type of advertising data.
Definition: bluetooth.h:322
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_set_tx_power(int8_t tx_power)
Set Tx power.
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.
uint8_t ble_get_address_type(void)
Get Bluetooth LE module address type.
int ble_get_address(BT_ADDR *addr)
Get Bluetooth LE module address.
int ble_set_scan_param(struct ble_scan_param_s *param)
Set scan parameter.
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_set_conn_param(struct ble_conn_param_s *param)
Set connection parameter.
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 called 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 ble_set_public_address(BT_ADDR *addr)
Set Bluetooth LE module address of the public address type. This is Spresense side address and should...
int bt_paring_disable(void)
Bluetooth pairing disable Escaping bluetooth pairing mode.
int ble_set_appearance(BLE_APPEARANCE appearance)
Set Bluetooth LE module appearance.
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 of the random static address type. This is Spresense side address and...
int ble_set_name(char *name)
Set Bluetooth LE module name This name visible for other devices and should be called before bt_enabl...
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 called 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:135
@ BT_DISCONNECTING
Definition: bt_common.h:137
@ BT_CONNECTED
Definition: bt_common.h:139
@ BT_CONNECTING
Definition: bt_common.h:138
@ BT_DISCONNECTED
Definition: bt_common.h:136
BT address types.
Definition: bluetooth.h:171
BLE address.
Definition: bt_common.h:191
Bluetooth LE bonding information.
Definition: bt_common.h:222
Definition: bt_common.h:211
Bluetooth LE Common application callbacks.
Definition: bt_common.h:266
void(* save_bondinfo)(int num, struct ble_bondinfo_s *bond)
Definition: bt_common.h:287
void(* connect_status_changed)(struct ble_state_s *ble_state, bool connected, uint8_t status)
Definition: bt_common.h:269
void(* connected_device_name_resp)(const char *name)
Definition: bt_common.h:275
int(* load_bondinfo)(int num, struct ble_bondinfo_s *bond)
Definition: bt_common.h:291
void(* encryption_result)(uint16_t conn_handle, bool result)
Definition: bt_common.h:295
void(* mtusize)(uint16_t handle, uint16_t sz)
Definition: bt_common.h:283
Definition: bt_common.h:239
uint16_t slave_latency
Definition: bt_common.h:242
uint16_t max_interval
Definition: bt_common.h:241
uint16_t min_interval
Definition: bt_common.h:240
uint16_t sup_timeout
Definition: bt_common.h:243
Bluetooth LE common HAL callbacks.
Definition: bt_if.h:139
Definition: bt_common.h:202
Definition: bt_common.h:231
uint8_t active
Definition: bt_common.h:232
uint16_t window
Definition: bt_common.h:234
uint16_t interval
Definition: bt_common.h:233
uint16_t timeout
Definition: bt_common.h:235
Bluetooth LE context.
Definition: bt_common.h:176
struct bt_common_state_s * bt_common_state
Definition: bt_common.h:179
BT_CONNECT_STATUS ble_connection
Definition: bt_common.h:177
uint8_t bt_target_addr_type
Definition: bt_common.h:180
BT_ADDR bt_target_addr
Definition: bt_common.h:181
uint16_t ble_connect_handle
Definition: bt_common.h:178
char bt_target_name[BT_NAME_LEN]
Definition: bt_common.h:182
Bluetooth ACL context.
Definition: bt_common.h:164
struct bt_common_state_s * bt_common_state
Definition: bt_common.h:166
BT_ADDR bt_target_addr
Definition: bt_common.h:167
BT_CONNECT_STATUS bt_acl_connection
Definition: bt_common.h:165
char bt_target_name[BT_NAME_LEN]
Definition: bt_common.h:168
Bluetooth Common application callbacks.
Definition: bt_common.h:251
void(* connected_device_name)(const char *name)
Definition: bt_common.h:257
void(* connect_status_changed)(struct bt_acl_state_s *bt_acl_state, bool connected, int status)
Definition: bt_common.h:256
void(* command_status)(BT_CMD_STATUS status)
Definition: bt_common.h:252
void(* bond_info)(BT_ADDR addr)
Definition: bt_common.h:258
void(* inquiry_complete)(void)
Definition: bt_common.h:255
void(* pairing_complete)(BT_ADDR addr, BT_PAIR_STATUS status)
Definition: bt_common.h:253
void(* inquiry_result)(BT_ADDR addr, char *name)
Definition: bt_common.h:254
Bluetooth base context.
Definition: bt_common.h:147
struct bt_hal_common_ops_s * bt_hal_common_ops
Definition: bt_common.h:148
struct bt_common_ops_s * bt_common_ops
Definition: bt_common.h:150
BT_ADDR bt_addr
Definition: bt_common.h:152
char bt_name[BT_NAME_LEN+1]
Definition: bt_common.h:155
char ble_name[BT_NAME_LEN+1]
Definition: bt_common.h:156
struct ble_common_ops_s * ble_common_ops
Definition: bt_common.h:151
uint8_t ble_addr_type
Definition: bt_common.h:154
BT_ADDR ble_addr
Definition: bt_common.h:153
struct ble_hal_common_ops_s * ble_hal_common_ops
Definition: bt_common.h:149
The format of one data in advertising data.
Definition: bt_common.h:305
Bluetooth Common HAL callbacks.
Definition: bt_if.h:70