OSDN Git Service

am 36762636: (-s ours) am 41a842af: am 2e3d006b: GKI cleanup - Eliminate usage of...
[android-x86/system-bt.git] / bta / hl / bta_hl_ci.c
1 /******************************************************************************
2  *
3  *  Copyright (C) 2009-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18
19 /******************************************************************************
20  *
21  *  This is the implementation file for the HeaLth device profile (HL)
22  *  subsystem call-in functions.
23  *
24  ******************************************************************************/
25
26 #include <stddef.h>
27 #include "bta_api.h"
28 #include "btm_api.h"
29 #include "bta_sys.h"
30 #include "bta_hl_api.h"
31 #include "bta_hl_co.h"
32 #include "bta_hl_int.h"
33
34 /*******************************************************************************
35 **
36 ** Function         bta_hl_ci_get_tx_data
37 **
38 ** Description      This function is called in response to the
39 **                  bta_hl_co_get_tx_data call-out function.
40 **
41 ** Parameters       mdl_handle -MDL handle
42 **                  status - BTA_MA_STATUS_OK if operation is successful
43 **                           BTA_MA_STATUS_FAIL if any errors have occurred.
44 **                  evt    - evt from the call-out function
45 **
46 ** Returns          void
47 **
48 *******************************************************************************/
49 extern void bta_hl_ci_get_tx_data(  tBTA_HL_MDL_HANDLE mdl_handle,
50                                     tBTA_HL_STATUS status,
51                                     UINT16 evt )
52 {
53     tBTA_HL_CI_GET_PUT_DATA  *p_evt;
54
55 #if  (BTA_HL_DEBUG == TRUE)
56     APPL_TRACE_DEBUG("bta_hl_ci_get_tx_data mdl_handle=%d status=%d evt=%d\n",
57                       mdl_handle, status, evt);
58 #endif
59
60     if ((p_evt = (tBTA_HL_CI_GET_PUT_DATA *)osi_getbuf(sizeof(tBTA_HL_CI_GET_PUT_DATA))) != NULL)
61     {
62         p_evt->hdr.event = evt;
63         p_evt->mdl_handle =  mdl_handle;
64         p_evt->status = status;
65         bta_sys_sendmsg(p_evt);
66     }
67 }
68
69 /*******************************************************************************
70 **
71 ** Function         bta_hl_ci_put_rx_data
72 **
73 ** Description      This function is called in response to the
74 **                  bta_hl_co_put_rx_data call-out function.
75 **
76 ** Parameters       mdl_handle -MDL handle
77 **                  status - BTA_MA_STATUS_OK if operation is successful
78 **                           BTA_MA_STATUS_FAIL if any errors have occurred.
79 **                  evt    - evt from the call-out function
80 **
81 ** Returns          void
82 **
83 *******************************************************************************/
84 extern void bta_hl_ci_put_rx_data(  tBTA_HL_MDL_HANDLE mdl_handle,
85                                     tBTA_HL_STATUS status,
86                                     UINT16 evt )
87 {
88     tBTA_HL_CI_GET_PUT_DATA  *p_evt;
89 #if  (BTA_HL_DEBUG == TRUE)
90     APPL_TRACE_DEBUG("bta_hl_ci_put_rx_data mdl_handle=%d status=%d evt=%d\n",
91                       mdl_handle, status, evt);
92 #endif
93
94     if ((p_evt = (tBTA_HL_CI_GET_PUT_DATA *)osi_getbuf(sizeof(tBTA_HL_CI_GET_PUT_DATA))) != NULL)
95     {
96         p_evt->hdr.event = evt;
97         p_evt->mdl_handle =  mdl_handle;
98         p_evt->status = status;
99         bta_sys_sendmsg(p_evt);
100     }
101 }
102
103
104 /*******************************************************************************
105 **
106 ** Function         bta_hl_ci_get_echo_data
107 **
108 ** Description      This function is called in response to the
109 **                  bta_hl_co_get_echo_data call-out function.
110 **
111 ** Parameters       mcl_handle -MCL handle
112 **                  status - BTA_MA_STATUS_OK if operation is successful
113 **                           BTA_MA_STATUS_FAIL if any errors have occurred.
114 **                  evt    - evt from the call-out function
115 **
116 ** Returns          void
117 **
118 *******************************************************************************/
119 extern void bta_hl_ci_get_echo_data(  tBTA_HL_MCL_HANDLE mcl_handle,
120                                       tBTA_HL_STATUS status,
121                                       UINT16 evt )
122 {
123     tBTA_HL_CI_ECHO_DATA  *p_evt;
124
125 #if  (BTA_HL_DEBUG == TRUE)
126     APPL_TRACE_DEBUG("bta_hl_ci_get_echo_data mcl_handle=%d status=%d evt=%d\n",
127                       mcl_handle, status, evt);
128 #endif
129
130     if ((p_evt = (tBTA_HL_CI_ECHO_DATA *)osi_getbuf(sizeof(tBTA_HL_CI_ECHO_DATA))) != NULL)
131     {
132         p_evt->hdr.event = evt;
133         p_evt->mcl_handle =  mcl_handle;
134         p_evt->status = status;
135         bta_sys_sendmsg(p_evt);
136     }
137 }
138
139 /*******************************************************************************
140 **
141 ** Function         bta_hl_ci_put_echo_data
142 **
143 ** Description      This function is called in response to the
144 **                  bta_hl_co_put_echo_data call-out function.
145 **
146 ** Parameters       mcl_handle -MCL handle
147 **                  status - BTA_MA_STATUS_OK if operation is successful
148 **                           BTA_MA_STATUS_FAIL if any errors have occurred.
149 **                  evt    - evt from the call-out function
150 **
151 ** Returns          void
152 **
153 *******************************************************************************/
154 extern void bta_hl_ci_put_echo_data(  tBTA_HL_MCL_HANDLE mcl_handle,
155                                       tBTA_HL_STATUS status,
156                                       UINT16 evt )
157 {
158     tBTA_HL_CI_ECHO_DATA  *p_evt;
159
160 #if  (BTA_HL_DEBUG == TRUE)
161     APPL_TRACE_DEBUG("bta_hl_ci_put_echo_data mcl_handle=%d status=%d evt=%d\n",
162                       mcl_handle, status, evt);
163 #endif
164
165     if ((p_evt = (tBTA_HL_CI_ECHO_DATA *)osi_getbuf(sizeof(tBTA_HL_CI_ECHO_DATA))) != NULL)
166     {
167         p_evt->hdr.event = evt;
168         p_evt->mcl_handle =  mcl_handle;
169         p_evt->status = status;
170         bta_sys_sendmsg(p_evt);
171     }
172 }