1 /*
2 * Copyright (c) 2021 GOODIX.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 /*
17 * INCLUDE FILES
18 *****************************************************************************************
19 */
20 #include "gr55xx_sys.h"
21
22 /*
23 * LOCAL FUNCTION DECLARATION
24 *****************************************************************************************
25 */
26 static void app_l2cap_lecb_conn_req_cb(uint8_t conn_idx, lecb_conn_req_ind_t *p_conn_req);
27 static void app_l2cap_lecb_conn_cb(uint8_t conn_idx, uint8_t status, lecb_conn_ind_t *p_conn_ind);
28 static void app_l2cap_lecb_add_credits_ind_cb(uint8_t conn_idx, lecb_add_credits_ind_t *p_add_credits_ind);
29 static void app_l2cap_lecb_disconn_cb(uint8_t conn_idx, uint8_t status, lecb_disconn_ind_t *p_disconn_ind);
30 static void app_l2cap_lecb_sdu_recv_cb(uint8_t conn_idx, lecb_sdu_t *p_sdu);
31 static void app_l2cap_lecb_sdu_send_cb(uint8_t conn_idx, uint8_t status, lecb_sdu_send_evt_t *p_sdu_send_evt);
32 static void app_l2cap_lecb_credit_add_cmp_cb(uint8_t conn_idx, uint8_t status, uint16_t local_cid);
33
34 /*
35 * GLOBAL VARIABLE DEFINITIONS
36 *****************************************************************************************
37 */
38 const l2cap_lecb_cb_fun_t app_l2cap_callback = {
39 .app_l2cap_lecb_conn_req_cb = app_l2cap_lecb_conn_req_cb,
40 .app_l2cap_lecb_conn_cb = app_l2cap_lecb_conn_cb,
41 .app_l2cap_lecb_add_credits_ind_cb = app_l2cap_lecb_add_credits_ind_cb,
42 .app_l2cap_lecb_disconn_cb = app_l2cap_lecb_disconn_cb,
43 .app_l2cap_lecb_sdu_recv_cb = app_l2cap_lecb_sdu_recv_cb,
44 .app_l2cap_lecb_sdu_send_cb = app_l2cap_lecb_sdu_send_cb,
45 .app_l2cap_lecb_credit_add_cmp_cb = app_l2cap_lecb_credit_add_cmp_cb,
46 };
47
48 /*
49 * LOCAL FUNCTION DEFINITIONS
50 *****************************************************************************************
51 */
52 /**
53 *****************************************************************************************
54 * @brief This callback function will be called when receiving lecb connection request.
55 *
56 * @param[in] conn_idx: The connection index.
57 * @param[in] p_conn_req: The information of LE credit based connection request. See @ref lecb_conn_req_ind_t.
58 *****************************************************************************************
59 */
app_l2cap_lecb_conn_req_cb(uint8_t conn_idx,lecb_conn_req_ind_t * p_conn_req)60 static void app_l2cap_lecb_conn_req_cb(uint8_t conn_idx, lecb_conn_req_ind_t *p_conn_req)
61 {
62 }
63
64 /**
65 *****************************************************************************************
66 * @brief This callback function will be called when receiving lecb created indication.
67 *
68 * @param[in] conn_idx: The connection index.
69 * @param[in] status: The status of L2cap operation.
70 * @param[in] p_conn_ind: The information LE credit based connection created indication. See @ref lecb_conn_ind_t.
71 *****************************************************************************************
72 */
app_l2cap_lecb_conn_cb(uint8_t conn_idx,uint8_t status,lecb_conn_ind_t * p_conn_ind)73 static void app_l2cap_lecb_conn_cb(uint8_t conn_idx, uint8_t status, lecb_conn_ind_t *p_conn_ind)
74 {
75 }
76
77 /**
78 *****************************************************************************************
79 * @brief This callback function will be called when receiving lecb connection addition indication.
80 *
81 * @param[in] conn_idx: The connection index.
82 * @param[in] p_add_credits_ind: The information of LE credit based connection addition indication.
83 * See @ref lecb_add_credits_ind_t.
84 *****************************************************************************************
85 */
app_l2cap_lecb_add_credits_ind_cb(uint8_t conn_idx,lecb_add_credits_ind_t * p_add_credits_ind)86 static void app_l2cap_lecb_add_credits_ind_cb(uint8_t conn_idx, lecb_add_credits_ind_t *p_add_credits_ind)
87 {
88 }
89
90 /**
91 *****************************************************************************************
92 * @brief This callback function will be called when receiving LE Credit Based disconnection indication.
93 *
94 * @param[in] conn_idx: The connection index.
95 * @param[in] status: The status of L2cap operation.
96 * @param[in] p_disconn_ind: The information of LE credit based disconnect indication. See @ref lecb_disconn_ind_t.
97 *****************************************************************************************
98 */
app_l2cap_lecb_disconn_cb(uint8_t conn_idx,uint8_t status,lecb_disconn_ind_t * p_disconn_ind)99 static void app_l2cap_lecb_disconn_cb(uint8_t conn_idx, uint8_t status, lecb_disconn_ind_t *p_disconn_ind)
100 {
101 }
102
103 /**
104 *****************************************************************************************
105 * @brief This callback function will be called when receiving SDU packet.
106 *
107 * @param[in] conn_idx: The connection index.
108 * @param[in] p_sdu: SDU packet parameter. See @ref lecb_sdu_t.
109 *****************************************************************************************
110 */
app_l2cap_lecb_sdu_recv_cb(uint8_t conn_idx,lecb_sdu_t * p_sdu)111 static void app_l2cap_lecb_sdu_recv_cb(uint8_t conn_idx, lecb_sdu_t *p_sdu)
112 {
113 }
114
115 /**
116 *****************************************************************************************
117 * @brief This callback function will be called when sending SDU packet.
118 *
119 * @param[in] conn_idx: The connection index.
120 * @param[in] status: The status of L2cap operation.
121 * @param[in] p_sdu_send_evt: SDU packet parameter. @see lecb_sdu_send_evt_t.
122 *****************************************************************************************
123 */
app_l2cap_lecb_sdu_send_cb(uint8_t conn_idx,uint8_t status,lecb_sdu_send_evt_t * p_sdu_send_evt)124 static void app_l2cap_lecb_sdu_send_cb(uint8_t conn_idx, uint8_t status, lecb_sdu_send_evt_t *p_sdu_send_evt)
125 {
126 }
127
128 /**
129 *****************************************************************************************
130 * @brief This callback function will be called when adding lecb credit.
131 *
132 * @param[in] conn_idx: The connection index.
133 * @param[in] status: The status of L2cap operation.
134 *****************************************************************************************
135 */
app_l2cap_lecb_credit_add_cmp_cb(uint8_t conn_idx,uint8_t status,uint16_t local_cid)136 static void app_l2cap_lecb_credit_add_cmp_cb(uint8_t conn_idx, uint8_t status, uint16_t local_cid)
137 {
138 }
139
140