1 /* 2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef CSADPMGR 16 #define CSADPMGR 17 /*chipsea_ohos proguard begin*/ 18 #include "cs_proguard.h" 19 /*chipsea_ohos proguard end*/ 20 21 #include "bt_types_def.h" 22 #include "cs_adp_type.h" 23 #include "cs_adp_dev.h" 24 #include "cs_adp_a2dp.h" 25 #include "cs_adp_avrcp.h" 26 #include "cs_adp_hfp.h" 27 #include "cs_adp_hsp.h" 28 #include "cs_adp_spp.h" 29 #include "cs_adp_hid.h" 30 31 #define APP_BT_ROLE_SWITCH_LIMIT 2 32 33 34 typedef struct _APP_DEVLIST{ 35 BT_ADDR bdaddr; 36 U8 acl_mode; 37 U8 role; 38 bt_mgr_adp_state adp_state; 39 bt_a2dp_adp_state a2dp_state; 40 bt_avrcp_adp_state avrcp_state; 41 bt_hid_adp_state hid_state; 42 bt_hfp_adp_state hfp_state; 43 bt_hfp_adp_call_status hfp_call_status; 44 bt_hfp_adp_callhold_status hfp_call_hold; 45 bt_hfp_adp_siri_status hfp_siri_status; 46 BT_A2DP_ROLE a2dp_role; 47 A2DP_AUDIO_CAP a2dp_audio_cap; 48 U16 sco_handle; 49 U16 negotiated_codec; 50 S8 peer_volume_hfp; 51 S8 peer_volume_a2dp; 52 bt_class_of_device cod; 53 }APP_DEVLIST; 54 55 typedef struct _APP_BT_MGR{ 56 APP_DEVLIST device_list[LINK_MAX]; 57 BT_ADDR local_addr; 58 BT_ADDR le_addr; 59 U8 max_device_num; 60 U8 connect_index; 61 bt_class_of_device local_cod; 62 }APP_BT_MGR; 63 64 typedef struct _CS_EVENT_{ 65 U32 EventId; 66 U32 Param; 67 }CS_EVENT; 68 69 typedef void (*app_msg_handle_cb)(CS_EVENT *event); 70 71 typedef struct _APP_ADP_MSG_HANDLE{ 72 cs_bt_msg_module module; 73 app_msg_handle_cb callback; 74 }app_adp_msg_handle; 75 76 typedef struct { 77 bt_class_of_device cod; 78 }Mgr_InquiryResult_t; 79 80 typedef struct _CS_ADP_MGR_EVENT_{ 81 BT_ADDR bdaddr; 82 union { 83 bt_err_type reason; 84 Mgr_InquiryResult_t inqResultP; 85 }p; 86 }CS_ADP_MGR_EVENT; 87 88 APP_DEVLIST *app_bt_get_mgr_devinfo(BT_ADDR bdaddr); 89 extern void cs_adp_dispatch_msg(CS_EVENT *event); 90 91 92 #endif 93