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