1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifdef __INTERCONNECTION__
5 #ifndef __APP_INTERCONNECTION_SPP_H__
6 #define __APP_INTERCONNECTION_SPP_H__
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include "bluetooth.h"
13 
14 #define SPP_RECV_BUFFER_SIZE                        3072
15 
16 uint8_t* app_interconnection_ea_parse_data(uint8_t* sourceDataPtr, uint32_t* eaDataPtr);
17 
18 uint16_t app_interconnection_spp_data_calculate_crc16(uint8_t *buf, uint32_t len);
19 
20 struct spp_device *app_interconnection_get_spp_client();
21 
22 struct spp_device *app_interconnection_get_spp_server();
23 
24 typedef void(*app_spp_tx_done_t)(void);
25 
26 void red_spp_register_tx_done(app_spp_tx_done_t callback);
27 
28 void app_spp_client_open(uint8_t* pServiceSearchRequest, uint8_t serviceSearchRequestLen);
29 
30 void app_spp_client_close(void);
31 
32 void app_spp_client_close(void);
33 
34 void app_spp_client_init_variable(void);
35 
36 bt_status_t app_interconnection_spp_client_read_data(char * buffer, uint16_t* ptrLen);
37 
38 bt_status_t app_interconnection_spp_server_read_data(char * buffer, uint16_t* ptrLen);
39 
40 void app_interconnection_send_data_via_spp(uint8_t* ptrData, uint16_t length, uint8_t port);
41 
42 void app_interconnection_spp_client_disconnected_callback(void);
43 
44 void app_interconnection_spp_server_disconnected_callback(void);
45 
46 void app_spp_client_init_variable(void);
47 
48 void app_spp_server_init(void);
49 
50 void app_spp_server_close(void);
51 
52 void app_spp_server_init_variable(void);
53 
54 void app_ibrt_spp_client_open();
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif // #ifndef __APP_INTERCONNECTION_SPP_H__
61 #endif // #ifdef __INTERCONNECTION__