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 
16 #include "engine_factory.h"
17 #include "enroll_engine.h"
18 #include "wakeup_engine_obj.h"
19 #include "update_engine.h"
20 #include "intell_voice_log.h"
21 #include "intell_voice_generic_factory.h"
22 
23 using namespace OHOS::IntellVoiceUtils;
24 #define LOG_TAG "EngineFactory"
25 
26 namespace OHOS {
27 namespace IntellVoiceEngine {
CreateEngineInst(IntellVoiceEngineType type,const std::string & param)28 sptr<EngineBase> EngineFactory::CreateEngineInst(IntellVoiceEngineType type, const std::string &param)
29 {
30     sptr<EngineBase> engine = nullptr;
31     switch (type) {
32         case INTELL_VOICE_ENROLL:
33             engine = SptrFactory<EngineBase, EnrollEngine>::CreateInstance(param);
34             break;
35         case INTELL_VOICE_WAKEUP:
36             engine = SptrFactory<EngineBase, WakeupEngineObj>::CreateInstance(param);
37             break;
38         case INTELL_VOICE_UPDATE:
39             engine = SptrFactory<EngineBase, UpdateEngine>::CreateInstance(param);
40             break;
41         default:
42             INTELL_VOICE_LOG_INFO("create engine enter, type:%{public}d", type);
43             break;
44     }
45 
46     return engine;
47 }
48 }
49 }
50