pinebuds/services/app_ai/src/app_ai_manager_api.cpp

116 lines
2.4 KiB
C++
Raw Normal View History

#include "app_ai_manager_api.h"
2022-08-15 04:20:27 -05:00
#include "app_ai_if.h"
#include "app_ai_tws.h"
#include "cmsis_os.h"
#include "hal_trace.h"
2022-08-15 04:20:27 -05:00
#ifdef __AI_VOICE__
#include "ai_manager.h"
#include "ai_thread.h"
#endif
bool app_ai_manager_is_in_multi_ai_mode(void) {
bool ret = false;
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ret = true;
2022-08-15 04:20:27 -05:00
#endif
return ret;
2022-08-15 04:20:27 -05:00
}
bool app_ai_manager_voicekey_is_enable(void) {
bool ret = true;
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ret = ai_voicekey_is_enable();
2022-08-15 04:20:27 -05:00
#endif
return ret;
2022-08-15 04:20:27 -05:00
}
void app_ai_manager_voicekey_save_status(bool state) {
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ai_voicekey_save_status(state);
2022-08-15 04:20:27 -05:00
#endif
}
void app_ai_manager_switch_spec(AI_SPEC_TYPE_E ai_spec) {
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ai_manager_switch_spec(ai_spec);
2022-08-15 04:20:27 -05:00
#endif
}
void app_ai_manager_set_current_spec(AI_SPEC_TYPE_E ai_spec) {
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ai_manager_set_current_spec(ai_spec);
2022-08-15 04:20:27 -05:00
#endif
}
uint8_t app_ai_manager_get_current_spec(void) {
uint8_t ret = -1;
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ret = ai_manager_get_current_spec();
2022-08-15 04:20:27 -05:00
#endif
return ret;
2022-08-15 04:20:27 -05:00
}
bool app_ai_manager_is_need_reboot(void) {
bool ret = false;
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ret = ai_manager_is_need_reboot();
2022-08-15 04:20:27 -05:00
#endif
return ret;
2022-08-15 04:20:27 -05:00
}
void app_ai_manager_enable(bool isEnabled, AI_SPEC_TYPE_E ai_spec) {
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ai_manager_enable(isEnabled, ai_spec);
2022-08-15 04:20:27 -05:00
#endif
}
void app_ai_manager_set_spec_connected_status(AI_SPEC_TYPE_E ai_spec,
uint8_t connected) {
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ai_manager_set_spec_connected_status(ai_spec, connected);
2022-08-15 04:20:27 -05:00
#endif
}
int8_t app_ai_manager_get_spec_connected_status(uint8_t ai_spec) {
uint8_t ret = -1;
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ret = ai_manager_get_spec_connected_status(ai_spec);
2022-08-15 04:20:27 -05:00
#endif
return ret;
2022-08-15 04:20:27 -05:00
}
bool app_ai_manager_spec_get_status_is_in_invalid(void) {
bool ret = true;
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ret = ai_manager_spec_get_status_is_in_invalid();
2022-08-15 04:20:27 -05:00
#endif
return ret;
2022-08-15 04:20:27 -05:00
}
void app_ai_manager_set_spec_update_flag(bool onOff) {
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ai_manager_set_spec_update_flag(onOff);
2022-08-15 04:20:27 -05:00
#endif
}
bool app_ai_manager_get_spec_update_flag(void) {
bool ret = false;
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ret = ai_manager_get_spec_update_flag();
2022-08-15 04:20:27 -05:00
#endif
return ret;
2022-08-15 04:20:27 -05:00
}
void app_ai_manager_spec_update_start_reboot(void) {
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ai_manager_spec_update_start_reboot();
2022-08-15 04:20:27 -05:00
#endif
}
void app_ai_manager_init(void) {
2022-08-15 04:20:27 -05:00
#ifdef IS_MULTI_AI_ENABLED
ai_manager_init();
2022-08-15 04:20:27 -05:00
#endif
}