1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 5 #ifndef __CONMGR_API_H_ 6 #define __CONMGR_API_H_ 7 8 #include "me_api.h" 9 10 typedef void btif_cmgr_handler_t; 11 12 #ifndef BTIF_CMGR_DEFAULT_SNIFF_EXIT_POLICY 13 #define BTIF_CMGR_DEFAULT_SNIFF_EXIT_POLICY CMGR_SNIFF_EXIT_ON_AUDIO 14 #endif /* */ 15 16 #ifndef BTIF_CMGR_DEFAULT_SNIFF_TIMER 17 #define BTIF_CMGR_DEFAULT_SNIFF_TIMER CMGR_SNIFF_DONT_CARE 18 #endif /* */ 19 20 #ifndef BTIF_CMGR_AUDIO_DEFAULT_PARMS 21 //#define CMGR_AUDIO_DEFAULT_PARMS CMGR_AUDIO_PARMS_S3 22 #define BTIF_CMGR_AUDIO_DEFAULT_PARMS CMGR_AUDIO_PARMS_S4 23 #endif /* */ 24 25 #ifndef BTIF_CMGR_SNIFF_MIN_INTERVAL 26 #ifdef BISTO_ENABLED 27 #define BTIF_CMGR_SNIFF_MIN_INTERVAL 160 28 #else 29 #define BTIF_CMGR_SNIFF_MIN_INTERVAL 800 30 #endif 31 #endif /* */ 32 33 #ifndef BTIF_CMGR_SNIFF_MAX_INTERVAL 34 #ifdef BISTO_ENABLED 35 #define BTIF_CMGR_SNIFF_MAX_INTERVAL 160 36 #else 37 #define BTIF_CMGR_SNIFF_MAX_INTERVAL 800 38 #endif 39 #endif /* */ 40 41 #ifndef BTIF_CMGR_SNIFF_ATTEMPT 42 #define BTIF_CMGR_SNIFF_ATTEMPT 3 43 #endif /* */ 44 45 #ifndef BTIF_CMGR_SNIFF_TIMEOUT 46 #define BTIF_CMGR_SNIFF_TIMEOUT 1 47 #endif /* */ 48 49 #define BTIF_CMGR_SNIFF_DISABLED (0xFF) 50 #define BTIF_CMGR_SNIFF_DONT_CARE (0) 51 #define BTIF_CMGR_SNIFF_TIMER (10000) 52 #define BTIF_CMGR_TWS_SNIFF_TIMER (10000) 53 #define BTIF_CMGR_MOBILE_SNIFF_TIMER (20000) 54 55 typedef U8 btif_cmgr_sniff_exit_policy_t; 56 57 #define BTIF_CMGR_SNIFF_EXIT_ON_SEND 0x01 58 59 #define BTIF_CMGR_SNIFF_EXIT_ON_AUDIO 0x02 60 61 /* End of CmgrSniffExitPolicy */ 62 63 /*--------------------------------------------------------------------------- 64 * cmgr_event_t type 65 * 66 * All indications and confirmations are sent through a callback function. 67 * The profile registers with the Connection Manager at initialization. Calls 68 * are made to request ACL and SCO resources. The Connection Manager calls 69 * the profile's callback function to indicate the results of those requests. 70 */ 71 typedef uint8_t cmgr_event_t; 72 73 #define BTIF_CMEVENT_DATA_LINK_CON_CNF 1 74 75 #define BTIF_CMEVENT_DATA_LINK_CON_IND 2 76 77 #define BTIF_CMEVENT_DATA_LINK_DIS 3 78 79 #define BTIF_CMEVENT_AUDIO_LINK_REQ 4 80 81 #define BTIF_CMEVENT_AUDIO_LINK_CON 5 82 83 #define BTIF_CMEVENT_AUDIO_LINK_DIS 6 84 85 #define BTIF_CMEVENT_AUDIO_DATA 7 86 87 #define BTIF_CMEVENT_AUDIO_DATA_SENT 8 88 89 #define BTIF_CMEVENT_ENTER_SNIFF_MODE 9 90 91 #define BTIF_CMEVENT_EXIT_SNIFF_PARK_MODE 10 92 93 /* End of cmgr_event_t */ 94 95 #ifdef __cplusplus 96 extern "C" { 97 #endif /* */ 98 99 btif_cmgr_handler_t *btif_cmgr_get_first_handler(btif_remote_device_t * remDev); 100 101 bt_status_t btif_cmgr_set_sniff_exit_policy(btif_cmgr_handler_t * cmgr_handler, 102 btif_cmgr_sniff_exit_policy_t Policy); 103 104 bt_status_t btif_cmgr_set_sniff_timer(btif_cmgr_handler_t * cmgr_handler, 105 btif_sniff_info_t * SniffInfo, TimeT Time); 106 107 uint32_t btif_cmgr_get_cmgrhandler_sniff_timeout(btif_cmgr_handler_t * cmgr_handler); 108 109 uint16_t btif_cmgr_get_cmgrhandler_sniff_Interval(btif_cmgr_handler_t * cmgr_handler); 110 111 btif_sniff_info_t*btif_cmgr_get_cmgrhandler_sniff_info(btif_cmgr_handler_t *cmgr_handler); 112 113 btif_remote_device_t *btif_cmgr_get_cmgrhandler_remdev(btif_cmgr_handler_t *cmgr_handler); 114 115 uint16_t btif_cmgr_get_cmgrhandler_remdev_hci_handle(btif_cmgr_handler_t * cmgr_handler); 116 117 btif_handler *btif_cmgr_get_cmgrhandler_remdev_bthandle(btif_cmgr_handler_t *cmgr_handler); 118 119 bt_status_t btif_cmgr_set_sniff_info_to_all_handler_by_remdev(btif_sniff_info_t * SniffInfo, 120 btif_remote_device_t * remDev); 121 122 bt_status_t btif_cmgr_set_sniff_timeout_handler_ext(void (*ext_fn)(evm_timer_t * timer, 123 BOOL * skipInternalHandler)); 124 125 bt_status_t btif_cmgr_init_sniff_timer(btif_remote_device_t *remDev); 126 127 bt_status_t btif_cmgr_deinit_sniff_timer(btif_remote_device_t *remDev); 128 129 bt_status_t btif_cmgr_clear_sniff_timer(btif_cmgr_handler_t * Handler); 130 131 bt_status_t btif_cmgr_disable_sniff_timer(btif_cmgr_handler_t * Handler); 132 133 btif_link_type_t btif_cmgr_get_sco_connect_sco_link_type(btif_cmgr_handler_t * cmgr_handler); 134 135 uint16_t btif_cmgr_get_sco_connect_sco_Hcihandler(btif_cmgr_handler_t * cmgr_handler); 136 137 uint8_t btif_cmgr_get_sco_connect_sco_rx_parms_sco_transmission_interval(btif_cmgr_handler_t * 138 cmgr_handler); 139 140 uint8_t btif_cmgr_get_sco_connect_sco_rx_parms_sco_retransmission_window(btif_cmgr_handler_t * 141 cmgr_handler); 142 143 uint8_t btif_cmgr_set_sco_connect_sco_rx_parms_sco_transmission_interval( 144 btif_cmgr_handler_t * cmgr_handler, 145 uint8_t interval); 146 147 uint8_t btif_cmgr_set_sco_connect_sco_rx_parms_sco_retransmission_window( 148 btif_cmgr_handler_t *cmgr_handler, 149 uint8_t window); 150 151 bt_status_t btif_cmgr_remove_audio_link(btif_cmgr_handler_t * cmgr_handler); 152 153 bool btif_cmgr_is_audio_up(btif_cmgr_handler_t *Handler); 154 155 bt_status_t btif_cmgr_set_master_role(btif_cmgr_handler_t *cmgr_handler, BOOL flag); 156 157 void btif_evm_start_timer(evm_timer_t *timer, TimeT ms); 158 159 void *btif_cmgr_get_default_conn_handler(void); 160 161 void *btif_cmgr_handler_create(void); 162 163 void btif_cmgr_handler_init(void); 164 165 bt_status_t btif_cmgr_register_handler(btif_cmgr_handler_t *cmgr_handler, 166 btif_cmgr_callback callback); 167 168 bt_status_t btif_cmgr_create_data_link(btif_cmgr_handler_t *cmgr_handler, 169 bt_bdaddr_t *bd_addr); 170 171 bt_status_t btif_cmgr_remove_data_link(btif_cmgr_handler_t *cmgr_handler); 172 173 btif_cmgr_handler_t *btif_cmgr_get_acl_handler(btif_remote_device_t *remDev); 174 175 btif_cmgr_handler_t * btif_cmgr_get_conn_ind_handler(btif_remote_device_t *remDev); 176 177 bool btif_cmgr_is_link_up(btif_cmgr_handler_t *cmgr_handler); 178 btif_remote_device_t *btif_cmgr_pts_get_remDev(btif_cmgr_handler_t *cmgr_handler); 179 180 #if defined(IBRT) 181 uint32_t btif_save_cmgr_cxt(uint8_t * ctx_buffer); 182 uint32_t btif_set_cmgr_cxt(uint8_t * ctx_buffer, uint8_t bt_devices_idx,uint8_t rm_devtbl_idx); 183 uint32_t btif_save_avrcp_ctx(uint8_t * ctx_buffer); 184 uint32_t btif_set_avrcp_ctx(uint8_t * ctx_buffer, uint8_t bt_devices_idx,uint8_t rm_devtbl_idx, uint8_t avd_ctx_device_idx); 185 #endif 186 187 #ifdef __cplusplus 188 } 189 #endif /* */ 190 #endif /* */ 191 192