Developer World
Spresense SDK Library v1.4.2-3df2e9d
bt_spp.h
Go to the documentation of this file.
1 /****************************************************************************
2  * modules/include/bluetooth/bt_spp.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_SPP_H
44 #define __MODULES_INCLUDE_BLUETOOTH_BT_SPP_H
45 
46 /****************************************************************************
47  * Included Files
48  ****************************************************************************/
49 
50 #include <stdint.h>
51 #include <bluetooth/bluetooth.h>
52 #include <bluetooth/bt_common.h>
53 
54 /****************************************************************************
55  * Public Types
56  ****************************************************************************/
57 
63 {
64  void (*connect)(struct bt_acl_state_s *bt_acl_state);
65  void (*disconnect)(struct bt_acl_state_s *bt_acl_state);
66  void (*connection_fail)(struct bt_acl_state_s *bt_acl_state, BT_CONNECT_FAIL_REASON_ID fail_id);
67  void (*receive_data)(struct bt_acl_state_s *bt_acl_state, uint8_t *data, int len);
68 };
69 
75 {
77  uint16_t bt_spp_handle;
82 };
83 
84 /****************************************************************************
85  * Private Data
86  ****************************************************************************/
87 
88 /****************************************************************************
89  * Public Function Prototypes
90  ****************************************************************************/
91 
98 bool bt_spp_is_supported(void);
99 
109 int bt_spp_connect(struct bt_acl_state_s *bt_acl_state);
110 
120 int bt_spp_disconnect(struct bt_acl_state_s *bt_acl_state);
121 
130 int bt_spp_set_uuid(BT_UUID *uuid);
131 
142 int bt_spp_send_tx_data(struct bt_acl_state_s *bt_acl_state, uint8_t *data, int len);
143 
153 int bt_spp_register_cb(struct bt_spp_ops_s *bt_spp_ops);
154 
155 #endif /* __MODULES_INCLUDE_BLUETOOTH_BT_SPP_H */
struct bt_spp_ops_s * bt_spp_ops
Definition: bt_spp.h:80
BT_CONNECT_STATUS bt_spp_connection
Definition: bt_spp.h:76
uint16_t bt_spp_handle
Definition: bt_spp.h:77
Bluetooth generic API.
Bluetooth SPP HAL callbacks.
Definition: bt_if.h:127
BT_UUID spp_uuid
Definition: bt_spp.h:81
int bt_spp_set_uuid(BT_UUID *uuid)
Bluetooth SPP set UUID.
void(* disconnect)(struct bt_acl_state_s *bt_acl_state)
Definition: bt_spp.h:65
int bt_spp_connect(struct bt_acl_state_s *bt_acl_state)
Bluetooth SPP connect Connect to peer device with SPP.
bool bt_spp_is_supported(void)
Get SPP support or not support.
struct bt_acl_state_s * bt_acl_state
Definition: bt_spp.h:78
void(* receive_data)(struct bt_acl_state_s *bt_acl_state, uint8_t *data, int len)
Definition: bt_spp.h:67
void(* connection_fail)(struct bt_acl_state_s *bt_acl_state, BT_CONNECT_FAIL_REASON_ID fail_id)
Definition: bt_spp.h:66
BT_CONNECT_STATUS
BT profile connection status.
Definition: bt_common.h:61
int bt_spp_disconnect(struct bt_acl_state_s *bt_acl_state)
Bluetooth SPP disconnect Disconnect to peer device with SPP.
void(* connect)(struct bt_acl_state_s *bt_acl_state)
Definition: bt_spp.h:64
Bluetooth ACL context.
Definition: bt_common.h:89
BT_CONNECT_FAIL_REASON_ID
BT profile connection result.
Definition: bluetooth.h:187
Bluetooth SPP application callbacks.
Definition: bt_spp.h:62
Bluetooth SPP context.
Definition: bt_spp.h:74
int bt_spp_register_cb(struct bt_spp_ops_s *bt_spp_ops)
Bluetooth SPP Register notification Set callback about SPP callbacks.
Bluetooth common header for SDK on Spresense.
struct bt_hal_spp_ops_s * bt_hal_spp_ops
Definition: bt_spp.h:79
int bt_spp_send_tx_data(struct bt_acl_state_s *bt_acl_state, uint8_t *data, int len)
Bluetooth SPP send Tx data.
128-bit UUID types
Definition: bluetooth.h:129