• 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 
16 #ifndef ENROLL_INTELL_VOICE_ENGINE_H
17 #define ENROLL_INTELL_VOICE_ENGINE_H
18 
19 #include "i_intell_voice_engine.h"
20 #include "engine_callback_inner.h"
21 #include "intell_voice_info.h"
22 
23 namespace OHOS {
24 namespace IntellVoice {
25 using OHOS::IntellVoiceEngine::IIntellVoiceEngineEventCallback;
26 using OHOS::IntellVoiceEngine::IIntellVoiceEngine;
27 using OHOS::IntellVoiceEngine::EngineCallbackInner;
28 
29 struct EnrollIntelligentVoiceEngineDescriptor {
30     std::string wakeupPhrase;
31 };
32 
33 struct EngineConfig {
34     std::string language;
35     std::string region;
36 };
37 
38 class EnrollIntellVoiceEngine {
39 public:
40     EnrollIntellVoiceEngine(const EnrollIntelligentVoiceEngineDescriptor &descriptor);
41     ~EnrollIntellVoiceEngine();
42 
43     int32_t Init(const EngineConfig &config);
44     int32_t Start(const bool &isLast);
45     int32_t Stop();
46     int32_t Commit();
47     int32_t SetSensibility(const int32_t &sensibility);
48     int32_t SetWakeupHapInfo(const WakeupHapInfo &info);
49     int32_t SetParameter(const std::string &key, const std::string &value);
50     int32_t GetParameter(const std::string &key);
51     int32_t Release();
52     int32_t SetCallback(std::shared_ptr<IIntellVoiceEngineEventCallback> callback);
53 
54 private:
55     sptr<IIntellVoiceEngine> engine_ = nullptr;
56     std::unique_ptr<EnrollIntelligentVoiceEngineDescriptor> descriptor_ = nullptr;
57     sptr<EngineCallbackInner> callback_ = nullptr;
58 };
59 }  // namespace IntellVoice
60 }  // namespace OHOS
61 
62 #endif
63