This commit is contained in:
Ben V. Brown 2023-02-05 18:50:55 +11:00
parent 530de36418
commit 92c3f9b107
2 changed files with 29 additions and 27 deletions

View File

@ -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) { void app_voice_assistant_key(APP_KEY_STATUS *status, void *param) {
TRACE(2, "%s event %d", __func__, status->event); TRACE(2, "%s event %d", __func__, status->event);

29
apps/main/rb_codec.cpp Normal file
View File

@ -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