Developer World
Spresense SDK Library v3.3.0-375c679
bt_if.h
Go to the documentation of this file.
1/****************************************************************************
2 * modules/include/bluetooth/hal/bt_if.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
45#ifndef __MODULES_INCLUDE_BLUETOOTH_HAL_BT_IF_H
46#define __MODULES_INCLUDE_BLUETOOTH_HAL_BT_IF_H
47
48/****************************************************************************
49 * Included Files
50 ****************************************************************************/
51
52#include <stdint.h>
53#include <bluetooth/bluetooth.h>
57#include <bluetooth/ble_gatt.h>
60
61/****************************************************************************
62 * Public Types
63 ****************************************************************************/
64
70{
71 int (*init)(void);
72 int (*finalize)(void);
73 int (*enable)(bool enable);
74 int (*setDevAddr)(BT_ADDR *addr);
75 int (*getDevAddr)(BT_ADDR *addr);
76 int (*setDevName)(char *name);
77 int (*getDevName)(char *name);
78 int (*paringEnable)(bool enable);
79 int (*getBondList)(BT_ADDR *addrs, int *num);
80 int (*unBond)(BT_ADDR *addr);
81 int (*setVisibility)(BT_VISIBILITY visibility);
82 int (*inquiryStart)(void);
83 int (*inquiryCancel)(void);
84};
85
91{
92 int (*connect)(BT_ADDR *addr, uint16_t handle, bool connect);
93 int (*aacEnable)(bool enable);
94 int (*vendorCodecEnable)(bool enable);
95 int (*set_codec)(BT_AUDIO_CODEC_INFO *codec_info);
96};
97
103{
104 int (*avrcc_connect)(BT_ADDR *addr, uint16_t handle, bool connect);
105 int (*avrct_connect)(BT_ADDR *addr, uint16_t handle, bool connect);
106 int (*send_avrcp_command)(BT_ADDR *addr, BT_AVRCP_CMD_ID cmd_id, bool press, uint16_t handle);
108};
109
115{
116 int (*connect)(BT_ADDR *addr, uint16_t handle, bool connect);
117 int (*audio_connect)(BT_ADDR *addr, uint16_t handle, bool connect);
119 int (*send_at_command)(BT_ADDR *addr, char *at_str, uint16_t handle);
120 int (*press_button)(BT_ADDR *addr, uint16_t handle);
121};
122
128{
129 int (*connect)(BT_ADDR *addr, uint16_t handle, bool connect);
130 int (*setUuid)(BT_UUID *uuid);
131 int (*sendTxData)(BT_ADDR *addr, uint8_t *data, int len, uint16_t handle);
132};
133
139{
140 int (*setDevAddr)(BT_ADDR *addr, uint8_t type);
141 int (*setDevName)(char *name);
142 int (*setAppearance)(BLE_APPEARANCE appearance);
144 int (*advertise)(bool enable);
145 int (*startScan)(bool duplicate_filter);
146 int (*stopScan)(void);
147 int (*connect)(uint8_t addr_type, const BT_ADDR *addr);
148 int (*disconnect)(const uint16_t conn_handle);
149 int (*pairing)(uint16_t conn_handle);
150 uint16_t (*setMtuSize)(uint16_t sz);
151 uint16_t (*getMtuSize)(void);
152 int (*getNegotiatedMtuSize)(uint16_t handle);
153 int (*setTxPower)(int8_t tx_power);
154 int (*setScanParam)(struct ble_scan_param_s *param);
155 int (*setConnParam)(struct ble_conn_param_s *param);
156};
157
163{
164 int (*addService)(struct ble_gatt_service_s *ble_gatt_service);
165 int (*addChar)(uint16_t serv_handle, struct ble_gatt_char_s *ble_gatt_char);
166 int (*write)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle);
167 int (*read)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle);
168 int (*notify)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle);
169};
170
176{
179 int (*startDbDiscovery)(uint16_t conn_handle);
180
183 int (*continueDbDiscovery)(uint16_t start_handle, uint16_t conn_handle);
184
187 int (*discoverUuid)(uint16_t conn_handle,
188 BLE_UUID *srv_uuid,
189 BLE_UUID *char_uuid);
190
193 int (*send_confirm)(uint16_t conn_handle, uint16_t char_handle);
194
197 int (*write)(uint16_t conn_handle,
198 uint16_t char_handle,
199 uint8_t *data,
200 int len,
201 bool rsp);
202
205 int (*read)(uint16_t conn_handle, uint16_t char_handle);
206
209 int (*descriptor_write)(uint16_t conn_handle,
210 uint16_t handle,
211 uint8_t *data,
212 uint16_t len);
213
216 int (*descriptor_read)(uint16_t conn_handle,
217 uint16_t handle);
218
222};
223
229{
232};
233
234#ifdef __cplusplus
235#define EXTERN extern "C"
236extern "C"
237{
238#else
239#define EXTERN extern
240#endif
241
242/****************************************************************************
243 * Public Function Prototypes
244 ****************************************************************************/
245
254int bt_common_register_hal(struct bt_hal_common_ops_s *bt_hal_common_ops);
255
266
275int bt_a2dp_register_hal(struct bt_hal_a2dp_ops_s *bt_hal_a2dp_ops);
276
286int bt_a2dp_event_handler(struct bt_event_t *bt_event);
287
296int bt_avrcp_register_hal(struct bt_hal_avrcp_ops_s *bt_hal_avrcp_ops);
297
307int bt_avrcp_event_handler(struct bt_event_t *bt_event);
308
317int bt_hfp_register_hal(struct bt_hal_hfp_ops_s *bt_hal_hfp_ops);
318
328int bt_hfp_event_handler(struct bt_event_t *bt_event);
329
338int bt_spp_register_hal(struct bt_hal_spp_ops_s *bt_hal_spp_ops);
339
349int bt_spp_event_handler(struct bt_event_t *bt_event);
350
359int ble_common_register_hal(struct ble_hal_common_ops_s *ble_hal_common_ops);
360
371
380int ble_gatt_register_hal(struct ble_hal_gatt_ops_s *ble_hal_gatt_ops);
381
391int ble_gatt_event_handler(struct bt_event_t *bt_event);
392
403
404#undef EXTERN
405#ifdef __cplusplus
406}
407#endif
408
409#endif /* __MODULES_INCLUDE_BLUETOOTH_HAL_BT_IF_H */
Bluetooth Low Energy GATT Server/Client API.
Bluetooth LE header for SDK on Spresense.
Bluetooth common header for SDK on Spresense.
BT_VISIBILITY
BT visibility ID.
Definition: bluetooth.h:250
BLE_APPEARANCE
BLE appearance ID.
Definition: bluetooth.h:262
Bluetooth A2DP common header for SDK on Spresense.
AVRCP command I/F.
BT_AVRCP_CMD_ID
AVRCP command list.
Definition: bt_avrcp_cmds.h:64
Bluetooth HAL I/F for event handler.
Bluetooth HFP common header for SDK on Spresense.
BT_HFP_HF_FEATURE_FLAG
HFP HF device supported feature flags.
Definition: bt_hfp_features.h:75
int ble_gatt_register_hal(struct ble_hal_gatt_ops_s *ble_hal_gatt_ops)
Bluetooth LE GATT function HAL register.
int ble_common_register_hal(struct ble_hal_common_ops_s *ble_hal_common_ops)
Bluetooth LE common function HAL register.
int bt_a2dp_event_handler(struct bt_event_t *bt_event)
A2DP event handler HAL should call this function if receive A2DP event(BT_A2DP_EVENT_ID).
int bt_common_event_handler(struct bt_event_t *bt_event)
Common event handler HAL should call this function if receive common event(BT_COMMON_EVENT_ID).
int ble_common_event_handler(struct bt_event_t *bt_event)
BLE common event handler HAL should call this function if receive BLE common event(BLE_COMMON_EVENT_I...
int bt_a2dp_register_hal(struct bt_hal_a2dp_ops_s *bt_hal_a2dp_ops)
Bluetooth A2DP function HAL register.
int bt_spp_register_hal(struct bt_hal_spp_ops_s *bt_hal_spp_ops)
Bluetooth SPP function HAL register.
int bt_hfp_event_handler(struct bt_event_t *bt_event)
HFP event handler HAL should call this function if receive HFP event(BT_HFP_EVENT_ID).
int bt_spp_event_handler(struct bt_event_t *bt_event)
SPP event handler HAL should call this function if receive SPP event(BT_SPP_EVENT_ID).
int bt_hfp_register_hal(struct bt_hal_hfp_ops_s *bt_hal_hfp_ops)
Bluetooth HFP function HAL register.
int bt_avrcp_event_handler(struct bt_event_t *bt_event)
AVRCP event handler HAL should call this function if receive AVRCP event(BT_AVRCP_EVENT_ID).
int bt_common_register_hal(struct bt_hal_common_ops_s *bt_hal_common_ops)
Bluetooth common function HAL register.
int ble_gatt_event_handler(struct bt_event_t *bt_event)
BLE GATT event handler HAL should call this function if receive BLE GATT event(BLE_GATT_EVENT_ID).
int ble_register_gatt_central_cb(struct ble_gatt_central_ops_s *central_ops)
Temporary I/F helps app hook central callbacks to framework stored state Should be removed after cons...
int bt_avrcp_register_hal(struct bt_hal_avrcp_ops_s *bt_hal_avrcp_ops)
Bluetooth AVRCP function HAL register.
Connection parameters for PPCP.
Definition: ble_params.h:62
BLE UUID structure.
Definition: ble_gatt.h:177
BT address types.
Definition: bluetooth.h:171
Codec information element structure, used to provide info of a single type of codec.
Definition: bt_a2dp_codecs.h:195
BT avrc supported notify event.
Definition: bt_event.h:582
128-bit UUID types
Definition: bluetooth.h:180
Definition: bt_common.h:239
Bluetooth LE characteristic callbacks(for Central)
Definition: ble_gatt.h:397
Bluetooth LE GATT characteristic context.
Definition: ble_gatt.h:242
uint16_t handle
Definition: ble_gatt.h:243
Bluetooth LE GATT service context.
Definition: ble_gatt.h:260
Bluetooth LE common HAL callbacks.
Definition: bt_if.h:139
int(* advertise)(bool enable)
Definition: bt_if.h:144
int(* stopScan)(void)
Definition: bt_if.h:146
int(* setDevName)(char *name)
Definition: bt_if.h:141
int(* getNegotiatedMtuSize)(uint16_t handle)
Definition: bt_if.h:152
int(* setTxPower)(int8_t tx_power)
Definition: bt_if.h:153
int(* setScanParam)(struct ble_scan_param_s *param)
Definition: bt_if.h:154
int(* setDevAddr)(BT_ADDR *addr, uint8_t type)
Definition: bt_if.h:140
int(* connect)(uint8_t addr_type, const BT_ADDR *addr)
Definition: bt_if.h:147
int(* disconnect)(const uint16_t conn_handle)
Definition: bt_if.h:148
int(* pairing)(uint16_t conn_handle)
Definition: bt_if.h:149
uint16_t(* setMtuSize)(uint16_t sz)
Definition: bt_if.h:150
int(* startScan)(bool duplicate_filter)
Definition: bt_if.h:145
int(* setAppearance)(BLE_APPEARANCE appearance)
Definition: bt_if.h:142
uint16_t(* getMtuSize)(void)
Definition: bt_if.h:151
int(* setConnParam)(struct ble_conn_param_s *param)
Definition: bt_if.h:155
int(* setPPCP)(BLE_CONN_PARAMS ppcp)
Definition: bt_if.h:143
Bluetooth LE GATT HAL.
Definition: bt_if.h:229
struct ble_hal_gatts_ops_s gatts
Definition: bt_if.h:230
struct ble_hal_gattc_ops_s gattc
Definition: bt_if.h:231
Bluetooth LE GATTC HAL callbacks.
Definition: bt_if.h:176
int(* send_confirm)(uint16_t conn_handle, uint16_t char_handle)
Definition: bt_if.h:193
int(* descriptor_read)(uint16_t conn_handle, uint16_t handle)
Definition: bt_if.h:216
int(* descriptor_write)(uint16_t conn_handle, uint16_t handle, uint8_t *data, uint16_t len)
Definition: bt_if.h:209
int(* write)(uint16_t conn_handle, uint16_t char_handle, uint8_t *data, int len, bool rsp)
Definition: bt_if.h:197
int(* set_vendor_uuid)(BLE_UUID *uuid)
Definition: bt_if.h:221
int(* discoverUuid)(uint16_t conn_handle, BLE_UUID *srv_uuid, BLE_UUID *char_uuid)
Definition: bt_if.h:187
int(* startDbDiscovery)(uint16_t conn_handle)
Definition: bt_if.h:179
int(* read)(uint16_t conn_handle, uint16_t char_handle)
Definition: bt_if.h:205
int(* continueDbDiscovery)(uint16_t start_handle, uint16_t conn_handle)
Definition: bt_if.h:183
Bluetooth LE GATTS HAL callbacks.
Definition: bt_if.h:163
int(* notify)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle)
Definition: bt_if.h:168
int(* addService)(struct ble_gatt_service_s *ble_gatt_service)
Definition: bt_if.h:164
int(* write)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle)
Definition: bt_if.h:166
int(* addChar)(uint16_t serv_handle, struct ble_gatt_char_s *ble_gatt_char)
Definition: bt_if.h:165
int(* read)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle)
Definition: bt_if.h:167
Definition: bt_common.h:231
Bluetooth parent event data type.
Definition: bt_event.h:233
Bluetooth A2DP HAL callbacks.
Definition: bt_if.h:91
int(* vendorCodecEnable)(bool enable)
Definition: bt_if.h:94
int(* connect)(BT_ADDR *addr, uint16_t handle, bool connect)
Definition: bt_if.h:92
int(* set_codec)(BT_AUDIO_CODEC_INFO *codec_info)
Definition: bt_if.h:95
int(* aacEnable)(bool enable)
Definition: bt_if.h:93
Bluetooth AVRCP HAL callbacks.
Definition: bt_if.h:103
int(* avrcc_connect)(BT_ADDR *addr, uint16_t handle, bool connect)
Definition: bt_if.h:104
int(* send_avrcp_command)(BT_ADDR *addr, BT_AVRCP_CMD_ID cmd_id, bool press, uint16_t handle)
Definition: bt_if.h:106
int(* configure_notification)(BT_AVRC_SUPPORT_NOTIFY_EVENT *notification_list)
Definition: bt_if.h:107
int(* avrct_connect)(BT_ADDR *addr, uint16_t handle, bool connect)
Definition: bt_if.h:105
Bluetooth Common HAL callbacks.
Definition: bt_if.h:70
int(* setVisibility)(BT_VISIBILITY visibility)
Definition: bt_if.h:81
int(* paringEnable)(bool enable)
Definition: bt_if.h:78
int(* setDevName)(char *name)
Definition: bt_if.h:76
int(* inquiryCancel)(void)
Definition: bt_if.h:83
int(* init)(void)
Definition: bt_if.h:71
int(* getDevName)(char *name)
Definition: bt_if.h:77
int(* getBondList)(BT_ADDR *addrs, int *num)
Definition: bt_if.h:79
int(* setDevAddr)(BT_ADDR *addr)
Definition: bt_if.h:74
int(* finalize)(void)
Definition: bt_if.h:72
int(* inquiryStart)(void)
Definition: bt_if.h:82
int(* unBond)(BT_ADDR *addr)
Definition: bt_if.h:80
int(* getDevAddr)(BT_ADDR *addr)
Definition: bt_if.h:75
int(* enable)(bool enable)
Definition: bt_if.h:73
Bluetooth HFP HAL callbacks.
Definition: bt_if.h:115
int(* connect)(BT_ADDR *addr, uint16_t handle, bool connect)
Definition: bt_if.h:116
int(* set_hf_feature)(BT_HFP_HF_FEATURE_FLAG hf_heature)
Definition: bt_if.h:118
int(* press_button)(BT_ADDR *addr, uint16_t handle)
Definition: bt_if.h:120
int(* send_at_command)(BT_ADDR *addr, char *at_str, uint16_t handle)
Definition: bt_if.h:119
int(* audio_connect)(BT_ADDR *addr, uint16_t handle, bool connect)
Definition: bt_if.h:117
Bluetooth SPP HAL callbacks.
Definition: bt_if.h:128
int(* connect)(BT_ADDR *addr, uint16_t handle, bool connect)
Definition: bt_if.h:129
int(* setUuid)(BT_UUID *uuid)
Definition: bt_if.h:130
int(* sendTxData)(BT_ADDR *addr, uint8_t *data, int len, uint16_t handle)
Definition: bt_if.h:131