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