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