Developer World
Spresense SDK Library v1.4.2-3df2e9d
bt_hfp.h
Go to the documentation of this file.
1 /****************************************************************************
2  * modules/include/bluetooth/bt_hfp.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 
43 #ifndef __MODULES_INCLUDE_BLUETOOTH_BT_HFP_H
44 #define __MODULES_INCLUDE_BLUETOOTH_BT_HFP_H
45 
46 /****************************************************************************
47  * Included Files
48  ****************************************************************************/
49 
50 #include <stdint.h>
51 #include <bluetooth/bluetooth.h>
53 #include <bluetooth/bt_common.h>
54 
55 /****************************************************************************
56  * Public Types
57  ****************************************************************************/
58 
64 {
65  void (*command_status)(BT_CMD_STATUS status);
66  void (*connect)(struct bt_acl_state_s *bt_acl_state, BT_PROFILE_TYPE btProfileType);
67  void (*disconnect)(struct bt_acl_state_s *bt_acl_state);
68  void (*audio_connect)(struct bt_acl_state_s *bt_acl_state);
69  void (*audio_disconnect)(struct bt_acl_state_s *bt_acl_state);
70  void (*ag_feature)(struct bt_acl_state_s *bt_acl_state, BT_HFP_AG_FEATURE_FLAG feature);
71  void (*hf_at_response)(struct bt_acl_state_s *bt_acl_state, char *at_resp);
72 };
73 
79 {
82  uint16_t bt_hfp_handle;
88 };
89 
90 /****************************************************************************
91  * Public Function Prototypes
92  ****************************************************************************/
93 
100 bool bt_hfp_is_supported(void);
101 
111 int bt_hfp_connect(struct bt_acl_state_s *bt_acl_state);
112 
122 int bt_hfp_disconnect(struct bt_acl_state_s *bt_acl_state);
123 
133 int bt_hfp_audio_connect(struct bt_acl_state_s *bt_acl_state);
134 
144 int bt_hfp_audio_disconnect(struct bt_acl_state_s *bt_acl_state);
145 
156 int bt_hfp_send_at_command(struct bt_acl_state_s *bt_acl_state, char *at_cmd_str);
157 
166 int bt_hfp_press_button(struct bt_acl_state_s *bt_acl_state);
167 
177 
187 int bt_hfp_register_cb(struct bt_hfp_ops_s *bt_hfp_ops);
188 
189 #endif /* __MODULES_INCLUDE_BLUETOOTH_BT_HFP_H */
void(* audio_disconnect)(struct bt_acl_state_s *bt_acl_state)
Definition: bt_hfp.h:69
Bluetooth HFP HAL callbacks.
Definition: bt_if.h:114
BT_PROFILE_TYPE
BT HFP profile type.
Definition: bt_hfp_features.h:65
int bt_hfp_connect(struct bt_acl_state_s *bt_acl_state)
Bluetooth HFP connect Connect to peer device with HFP.
int bt_hfp_press_button(struct bt_acl_state_s *bt_acl_state)
Bluetooth press button Press button.
void(* connect)(struct bt_acl_state_s *bt_acl_state, BT_PROFILE_TYPE btProfileType)
Definition: bt_hfp.h:66
BT_HFP_HF_FEATURE_FLAG bt_hfp_supported_feature
Definition: bt_hfp.h:87
BT_CONNECT_STATUS bt_hfp_connection
Definition: bt_hfp.h:80
int bt_hfp_send_at_command(struct bt_acl_state_s *bt_acl_state, char *at_cmd_str)
Bluetooth send HFP command Send HFP command.
Bluetooth generic API.
int bt_hfp_register_cb(struct bt_hfp_ops_s *bt_hfp_ops)
Bluetooth HFP Register callbacks Set callback about HFP.
void(* audio_connect)(struct bt_acl_state_s *bt_acl_state)
Definition: bt_hfp.h:68
int bt_hfp_set_feature(BT_HFP_HF_FEATURE_FLAG flag)
Bluetooth set feature Set feature.
bool bt_hfp_is_supported(void)
Get HFP support or not support.
uint16_t bt_hfp_audio_handle
Definition: bt_hfp.h:83
int bt_hfp_audio_connect(struct bt_acl_state_s *bt_acl_state)
Bluetooth HFP Audio connect Connect to peer device with HFP Audio.
Bluetooth HFP common header for SDK on Spresense.
BT_HFP_HF_FEATURE_FLAG
HFP HF device supported feature flags.
Definition: bt_hfp_features.h:74
void(* hf_at_response)(struct bt_acl_state_s *bt_acl_state, char *at_resp)
Definition: bt_hfp.h:71
BT_CONNECT_STATUS
BT profile connection status.
Definition: bt_common.h:61
struct bt_acl_state_s * bt_acl_state
Definition: bt_hfp.h:84
int bt_hfp_audio_disconnect(struct bt_acl_state_s *bt_acl_state)
Bluetooth HFP Audio disconnect Disconnect to peer device with HFP Audio.
BT_HFP_AG_FEATURE_FLAG
HFP AG device supported feature flags.
Definition: bt_hfp_features.h:93
Bluetooth HFP application callbacks.
Definition: bt_hfp.h:63
Bluetooth ACL context.
Definition: bt_common.h:89
BT_CONNECT_STATUS bt_hfp_audio_connection
Definition: bt_hfp.h:81
void(* ag_feature)(struct bt_acl_state_s *bt_acl_state, BT_HFP_AG_FEATURE_FLAG feature)
Definition: bt_hfp.h:70
uint16_t bt_hfp_handle
Definition: bt_hfp.h:82
Bluetooth HFP context.
Definition: bt_hfp.h:78
int bt_hfp_disconnect(struct bt_acl_state_s *bt_acl_state)
Bluetooth HFP disconnect Disconnect to peer device with HFP.
struct bt_hfp_ops_s * bt_hfp_ops
Definition: bt_hfp.h:86
BT_CMD_STATUS
BT hci command status.
Definition: bluetooth.h:138
struct bt_hal_hfp_ops_s * bt_hal_hfp_ops
Definition: bt_hfp.h:85
Bluetooth common header for SDK on Spresense.
void(* command_status)(BT_CMD_STATUS status)
Definition: bt_hfp.h:65
void(* disconnect)(struct bt_acl_state_s *bt_acl_state)
Definition: bt_hfp.h:67