• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #ifndef ONLY_FIRST_ENGINE_MANAGER_H
16 #define ONLY_FIRST_ENGINE_MANAGER_H
17 
18 #include <mutex>
19 #include "engine_base.h"
20 #include "i_intell_voice_engine.h"
21 #include "i_intell_voice_service.h"
22 #include "intell_voice_definitions.h"
23 #include "intell_voice_death_recipient.h"
24 
25 namespace OHOS {
26 namespace IntellVoiceEngine {
27 class OnlyFirstEngineManager {
28 public:
29     OnlyFirstEngineManager();
30     ~OnlyFirstEngineManager();
SetScreenOff(bool value)31     void SetScreenOff(bool value) {};
GetEnrollResult(IntellVoiceEngineType type)32     static bool GetEnrollResult(IntellVoiceEngineType type) { return false; };
GetWakeupSourceFilesList(std::vector<std::string> & cloneFiles)33     int32_t GetWakeupSourceFilesList(std::vector<std::string> &cloneFiles) { return 0; };
GetWakeupSourceFile(const std::string & filePath,std::vector<uint8_t> & buffer)34     int32_t GetWakeupSourceFile(const std::string &filePath, std::vector<uint8_t> &buffer) { return 0; };
SendWakeupFile(const std::string & filePath,const std::vector<uint8_t> & buffer)35     int32_t SendWakeupFile(const std::string &filePath, const std::vector<uint8_t> &buffer) { return 0; };
GetUploadFiles(int numMax,std::vector<UploadFilesFromHdi> & files)36     int32_t GetUploadFiles(int numMax, std::vector<UploadFilesFromHdi> &files) { return 0; };
ClearUserDataInner()37     void ClearUserDataInner() {};
HeadsetHostDie()38     void HeadsetHostDie() {};
IsNeedUpdateComplete(int32_t result,const std::string & param)39     bool IsNeedUpdateComplete(int32_t result, const std::string &param) { return false; };
IsNeedUpdateRetry()40     bool IsNeedUpdateRetry() { return false; };
SilenceUpdate()41     int32_t SilenceUpdate() { return 0; };
42     int32_t WhisperVprUpdate(bool reEnroll = false) { return 0; };
CloneUpdate(const std::string & wakeupInfo,const sptr<IRemoteObject> & object)43     int32_t CloneUpdate(const std::string &wakeupInfo, const sptr<IRemoteObject> &object) { return 0; };
SetDspSensibility(const std::string & sensibility)44     void SetDspSensibility(const std::string &sensibility) {};
OnServiceStart()45     void OnServiceStart() {};
OnServiceStop()46     void OnServiceStop() {};
ClearWakeupEngineCb()47     void ClearWakeupEngineCb() {};
48 
49     bool IsEngineExist(IntellVoiceEngineType type);
50     bool AnyEngineExist(const std::vector<IntellVoiceEngineType>& types);
51     bool RegisterProxyDeathRecipient(IntellVoiceEngineType type, const sptr<IRemoteObject> &object);
52     bool DeregisterProxyDeathRecipient(IntellVoiceEngineType type);
53 
54     int32_t SetParameter(const std::string &keyValueList);
55     std::string GetParameter(const std::string &key);
56     void EngineOnDetected(int32_t uuid);
57     sptr<IIntellVoiceEngine> CreateEngine(IntellVoiceEngineType type, const std::string &param = "");
58     int32_t ReleaseEngineInner(IntellVoiceEngineType type);
59     bool CreateOrResetWakeupEngine();
60     int32_t ServiceStopProc();
61 
62 private:
63     sptr<IIntellVoiceEngine> CreateEngineInner(IntellVoiceEngineType type);
64 
65 private:
66     std::mutex deathMutex_;
67     sptr<EngineBase> wakeupEngine_ = nullptr;
68     sptr<IntellVoiceUtils::IntellVoiceDeathRecipient> proxyDeathRecipient_ = nullptr;
69     sptr<IRemoteObject> deathRecipientObj_ = nullptr;
70 };
71 }  // namespace IntellVoiceEngine
72 }  // namespace OHOS
73 #endif
74