1 /******************************************************************************
2  *
3  *  Copyright 2005-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 interface file for hid host call-out functions.
22  *
23  ******************************************************************************/
24 #ifndef BTA_HH_CO_H
25 #define BTA_HH_CO_H
26 
27 #include "bta_hh_api.h"
28 
29 typedef struct {
30   uint16_t rpt_uuid;
31   uint8_t rpt_id;
32   tBTA_HH_RPT_TYPE rpt_type;
33   uint8_t srvc_inst_id;
34   uint16_t char_inst_id;
35 } tBTA_HH_RPT_CACHE_ENTRY;
36 
37 /*******************************************************************************
38  *
39  * Function         bta_hh_co_data
40  *
41  * Description      This callout function is executed by HH when data is
42  *                  received
43  *                  in interupt channel.
44  *
45  *
46  * Returns          void.
47  *
48  ******************************************************************************/
49 extern void bta_hh_co_data(uint8_t dev_handle, uint8_t* p_rpt, uint16_t len,
50                            tBTA_HH_PROTO_MODE mode, uint8_t sub_class,
51                            uint8_t ctry_code, const RawAddress& peer_addr,
52                            uint8_t app_id);
53 
54 /*******************************************************************************
55  *
56  * Function         bta_hh_co_open
57  *
58  * Description      This callout function is executed by HH when connection is
59  *                  opened, and application may do some device specific
60  *                  initialization.
61  *
62  * Returns          void.
63  *
64  ******************************************************************************/
65 extern void bta_hh_co_open(uint8_t dev_handle, uint8_t sub_class,
66                            uint16_t attr_mask, uint8_t app_id);
67 
68 /*******************************************************************************
69  *
70  * Function         bta_hh_co_close
71  *
72  * Description      This callout function is executed by HH when connection is
73  *                  closed, and device specific finalizatio nmay be needed.
74  *
75  * Returns          void.
76  *
77  ******************************************************************************/
78 extern void bta_hh_co_close(uint8_t dev_handle, uint8_t app_id);
79 
80 /*******************************************************************************
81  *
82  * Function         bta_hh_co_set_rpt_rsp
83  *
84  * Description      This callout function is executed by HH when Set Report
85  *                  Response is received on Control Channel.
86  *
87  * Returns          void.
88  *
89  ******************************************************************************/
90 extern void bta_hh_co_set_rpt_rsp(uint8_t dev_handle, uint8_t status);
91 
92 /*******************************************************************************
93  *
94  * Function         bta_hh_co_get_rpt_rsp
95  *
96  * Description      This callout function is executed by HH when Get Report
97  *                  Response is received on Control Channel.
98  *
99  * Returns          void.
100  *
101  ******************************************************************************/
102 extern void bta_hh_co_get_rpt_rsp(uint8_t dev_handle, uint8_t status,
103                                   uint8_t* p_rpt, uint16_t len);
104 
105 #if (BTA_HH_LE_INCLUDED == TRUE)
106 /*******************************************************************************
107  *
108  * Function         bta_hh_le_co_rpt_info
109  *
110  * Description      This callout function is to convey the report information on
111  *                  a HOGP device to the application. Application can save this
112  *                  information in NV if device is bonded and load it back when
113  *                  stack reboot.
114  *
115  * Parameters       remote_bda  - remote device address
116  *                  p_entry     - report entry pointer
117  *                  app_id      - application id
118  *
119  * Returns          void.
120  *
121  ******************************************************************************/
122 extern void bta_hh_le_co_rpt_info(const RawAddress& remote_bda,
123                                   tBTA_HH_RPT_CACHE_ENTRY* p_entry,
124                                   uint8_t app_id);
125 
126 /*******************************************************************************
127  *
128  * Function         bta_hh_le_co_cache_load
129  *
130  * Description      This callout function is to request the application to load
131  *                  the cached HOGP report if there is any. When cache reading
132  *                  is completed, bta_hh_le_ci_cache_load() is called by the
133  *                  application.
134  *
135  * Parameters       remote_bda  - remote device address
136  *                  p_num_rpt: number of cached report
137  *                  app_id      - application id
138  *
139  * Returns          the acched report array
140  *
141  ******************************************************************************/
142 extern tBTA_HH_RPT_CACHE_ENTRY* bta_hh_le_co_cache_load(
143     const RawAddress& remote_bda, uint8_t* p_num_rpt, uint8_t app_id);
144 
145 /*******************************************************************************
146  *
147  * Function         bta_hh_le_co_reset_rpt_cache
148  *
149  * Description      This callout function is to reset the HOGP device cache.
150  *
151  * Parameters       remote_bda  - remote device address
152  *
153  * Returns          none
154  *
155  ******************************************************************************/
156 extern void bta_hh_le_co_reset_rpt_cache(const RawAddress& remote_bda,
157                                          uint8_t app_id);
158 
159 #endif /* #if (BTA_HH_LE_INCLUDED == TRUE) */
160 
161 #endif /* BTA_HH_CO_H */
162