Developer World
Spresense SDK Library v3.2.0-ebc0364
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);
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};
154
160{
161 int (*addService)(struct ble_gatt_service_s *ble_gatt_service);
162 int (*addChar)(uint16_t serv_handle, struct ble_gatt_char_s *ble_gatt_char);
163 int (*write)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle);
164 int (*read)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle);
165 int (*notify)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle);
166};
167
173{
176 int (*startDbDiscovery)(uint16_t conn_handle);
177
180 int (*continueDbDiscovery)(uint16_t start_handle, uint16_t conn_handle);
181
184 int (*discoverUuid)(uint16_t conn_handle,
185 BLE_UUID *srv_uuid,
186 BLE_UUID *char_uuid);
187
190 int (*send_confirm)(uint16_t conn_handle, uint16_t char_handle);
191
194 int (*write)(uint16_t conn_handle,
195 uint16_t char_handle,
196 uint8_t *data,
197 int len,
198 bool rsp);
199
202 int (*read)(uint16_t conn_handle, uint16_t char_handle);
203
206 int (*descriptor_write)(uint16_t conn_handle,
207 uint16_t handle,
208 uint8_t *data,
209 uint16_t len);
210
213 int (*descriptor_read)(uint16_t conn_handle,
214 uint16_t handle);
215};
216
222{
225};
226
227#ifdef __cplusplus
228#define EXTERN extern "C"
229extern "C"
230{
231#else
232#define EXTERN extern
233#endif
234
235/****************************************************************************
236 * Public Function Prototypes
237 ****************************************************************************/
238
247int bt_common_register_hal(struct bt_hal_common_ops_s *bt_hal_common_ops);
248
259
268int bt_a2dp_register_hal(struct bt_hal_a2dp_ops_s *bt_hal_a2dp_ops);
269
279int bt_a2dp_event_handler(struct bt_event_t *bt_event);
280
289int bt_avrcp_register_hal(struct bt_hal_avrcp_ops_s *bt_hal_avrcp_ops);
290
300int bt_avrcp_event_handler(struct bt_event_t *bt_event);
301
310int bt_hfp_register_hal(struct bt_hal_hfp_ops_s *bt_hal_hfp_ops);
311
321int bt_hfp_event_handler(struct bt_event_t *bt_event);
322
331int bt_spp_register_hal(struct bt_hal_spp_ops_s *bt_hal_spp_ops);
332
342int bt_spp_event_handler(struct bt_event_t *bt_event);
343
352int ble_common_register_hal(struct ble_hal_common_ops_s *ble_hal_common_ops);
353
364
373int ble_gatt_register_hal(struct ble_hal_gatt_ops_s *ble_hal_gatt_ops);
374
384int ble_gatt_event_handler(struct bt_event_t *bt_event);
385
396
397#undef EXTERN
398#ifdef __cplusplus
399}
400#endif
401
402#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:266
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:573
128-bit UUID types
Definition: bluetooth.h:180
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(* setDevAddr)(BT_ADDR *addr)
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(* setPPCP)(BLE_CONN_PARAMS ppcp)
Definition: bt_if.h:143
Bluetooth LE GATT HAL.
Definition: bt_if.h:222
struct ble_hal_gatts_ops_s gatts
Definition: bt_if.h:223
struct ble_hal_gattc_ops_s gattc
Definition: bt_if.h:224
Bluetooth LE GATTC HAL callbacks.
Definition: bt_if.h:173
int(* send_confirm)(uint16_t conn_handle, uint16_t char_handle)
Definition: bt_if.h:190
int(* descriptor_read)(uint16_t conn_handle, uint16_t handle)
Definition: bt_if.h:213
int(* descriptor_write)(uint16_t conn_handle, uint16_t handle, uint8_t *data, uint16_t len)
Definition: bt_if.h:206
int(* write)(uint16_t conn_handle, uint16_t char_handle, uint8_t *data, int len, bool rsp)
Definition: bt_if.h:194
int(* discoverUuid)(uint16_t conn_handle, BLE_UUID *srv_uuid, BLE_UUID *char_uuid)
Definition: bt_if.h:184
int(* startDbDiscovery)(uint16_t conn_handle)
Definition: bt_if.h:176
int(* read)(uint16_t conn_handle, uint16_t char_handle)
Definition: bt_if.h:202
int(* continueDbDiscovery)(uint16_t start_handle, uint16_t conn_handle)
Definition: bt_if.h:180
Bluetooth LE GATTS HAL callbacks.
Definition: bt_if.h:160
int(* notify)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle)
Definition: bt_if.h:165
int(* addService)(struct ble_gatt_service_s *ble_gatt_service)
Definition: bt_if.h:161
int(* write)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle)
Definition: bt_if.h:163
int(* addChar)(uint16_t serv_handle, struct ble_gatt_char_s *ble_gatt_char)
Definition: bt_if.h:162
int(* read)(struct ble_gatt_char_s *ble_gatt_char, uint16_t handle)
Definition: bt_if.h:164
Bluetooth parent event data type.
Definition: bt_event.h:224
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