• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
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 #include "engine_factory.h"
16 #include "intell_voice_log.h"
17 #include "enroll_engine.h"
18 #include "wakeup_engine.h"
19 
20 #undef HDF_LOG_TAG
21 #define HDF_LOG_TAG "IntellVoiceEngineFactory"
22 
23 using namespace OHOS::HDI::IntelligentVoice::Engine::V1_0;
24 
25 namespace OHOS {
26 namespace IntelligentVoice {
27 namespace Engine {
CreateEngine(IntellVoiceEngineAdapterType type)28 std::unique_ptr<EngineBase> EngineFactory::CreateEngine(IntellVoiceEngineAdapterType type)
29 {
30     std::unique_ptr<EngineBase> engine = nullptr;
31 
32     switch (type) {
33         case ENROLL_ADAPTER_TYPE:
34             engine = std::make_unique<EnrollEngine>();
35             break;
36         case WAKEUP_ADAPTER_TYPE:
37             engine = std::make_unique<WakeupEngine>();
38             break;
39         default:
40             INTELLIGENT_VOICE_LOGE("type: %{public}d is invalid", type);
41             break;
42     }
43 
44     return engine;
45 }
46 }
47 }
48 }