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 /*chipsea_ohos proguard begin*/ 16 #include "cs_proguard.h" 17 /*chipsea_ohos proguard end*/ 18 #include "cs_target_config.h" 19 #if APP_SUPPORT_HSP == 1 20 #include "cs_adp_api.h" 21 #include "al_rtos.h" 22 #include "app_bt.h" 23 app_hsp_key_handle(uint32_t key)24BOOL app_hsp_key_handle(uint32_t key) 25 { 26 BOOL ret = FALSE; 27 APP_DEVLIST * hfp_devinfo = NULL; 28 29 hfp_devinfo = cs_adp_get_hsp_current_devinfo(); 30 if(hfp_devinfo == NULL){ 31 return ret; 32 } 33 34 switch(key){ 35 case APP_KEY_PLAY|APP_KEY_PRESS: 36 37 break; 38 case APP_KEY_VOLADD|APP_KEY_PRESS: 39 case APP_KEY_VOLADD|APP_KEY_HOLD: 40 case APP_KEY_VOLSUB|APP_KEY_PRESS: 41 case APP_KEY_VOLSUB|APP_KEY_HOLD: 42 43 break; 44 case APP_KEY_PLAY|APP_KEY_DOUBLE_CLICK: 45 break; 46 case APP_KEY_PLAY|APP_KEY_HOLD: 47 break; 48 default: 49 break; 50 } 51 return ret; 52 } 53 54 app_hsp_msg_handle(CS_EVENT * event)55void app_hsp_msg_handle(CS_EVENT *event) 56 { 57 CS_ADP_HFP_EVENT *cs_hfp_msg = (CS_ADP_HFP_EVENT *)event->Param; 58 59 TRACE("APP:app_hsp_msg_handle event = %d",event->EventId); 60 61 switch(event->EventId) 62 { 63 case CS_ADP_HSP_CONNECTED: 64 if(cs_hfp_msg->hfpparam == 0){ 65 66 } 67 break; 68 case CS_ADP_HSP_DISCONNECTED: 69 if(cs_hfp_msg->hfpparam == 0){ 70 71 }else{ 72 73 } 74 break; 75 case CS_ADP_HSP_AUDIO_CONNECTED: 76 if(cs_hfp_msg->hfpparam == 0){ 77 78 }else{ 79 80 } 81 break; 82 case CS_ADP_HSP_AUDIO_DISCONNECTED: 83 if(cs_hfp_msg->hfpparam == 0){ 84 85 }else{ 86 87 } 88 break; 89 case CS_ADP_HSP_AUDIO_DATA_SENT: 90 91 break; 92 case CS_ADP_HSP_AUDIO_DATA_IND: 93 { 94 CS_ADP_HFP_AUDIO_DATA *audiodata = (CS_ADP_HFP_AUDIO_DATA *)cs_hfp_msg->hfpparam; 95 //cs_adp_hfp_send_sco_data(Chan, &hf_sendbuff_ctrl.mempool[idx].packet); 96 } 97 break; 98 case CS_ADP_HSP_RING_IND: 99 100 break; 101 case CS_ADP_HSP_SPEAKER_VOLUME: 102 { 103 U8 volume = (uint8_t)cs_hfp_msg->hfpparam; 104 105 } 106 break; 107 108 } 109 } 110 111 #endif 112