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