diff --git a/apps/main/apps.cpp b/apps/main/apps.cpp index 18d291b..69196e5 100644 --- a/apps/main/apps.cpp +++ b/apps/main/apps.cpp @@ -821,33 +821,6 @@ extern "C" void app_bt_key(APP_KEY_STATUS *status, void *param) { } } -#ifdef RB_CODEC -extern bool app_rbcodec_check_hfp_active(void); -void app_switch_player_key(APP_KEY_STATUS *status, void *param) { - TRACE(3, "%s %d,%d", __func__, status->code, status->event); - - if (!rb_ctl_is_init_done()) { - TRACE(0, "rb ctl not init done"); - return; - } - - if (app_rbcodec_check_hfp_active()) { - app_bt_key(status, param); - return; - } - - app_rbplay_audio_reset_pause_status(); - - if (app_rbplay_mode_switch()) { - app_voice_report(APP_STATUS_INDICATION_POWERON, 0); - app_rbcodec_ctr_play_onoff(true); - } else { - app_rbcodec_ctr_play_onoff(false); - app_voice_report(APP_STATUS_INDICATION_POWEROFF, 0); - } - return; -} -#endif void app_voice_assistant_key(APP_KEY_STATUS *status, void *param) { TRACE(2, "%s event %d", __func__, status->event); diff --git a/apps/main/rb_codec.cpp b/apps/main/rb_codec.cpp new file mode 100644 index 0000000..6a5daca --- /dev/null +++ b/apps/main/rb_codec.cpp @@ -0,0 +1,29 @@ + + +#ifdef RB_CODEC +extern bool app_rbcodec_check_hfp_active(void); +void app_switch_player_key(APP_KEY_STATUS *status, void *param) { + TRACE(3, "%s %d,%d", __func__, status->code, status->event); + + if (!rb_ctl_is_init_done()) { + TRACE(0, "rb ctl not init done"); + return; + } + + if (app_rbcodec_check_hfp_active()) { + app_bt_key(status, param); + return; + } + + app_rbplay_audio_reset_pause_status(); + + if (app_rbplay_mode_switch()) { + app_voice_report(APP_STATUS_INDICATION_POWERON, 0); + app_rbcodec_ctr_play_onoff(true); + } else { + app_rbcodec_ctr_play_onoff(false); + app_voice_report(APP_STATUS_INDICATION_POWEROFF, 0); + } + return; +} +#endif