• 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 <cerrno>
16 #include "hdf_base.h"
17 #include "i_trigger.h"
18 #include "intell_voice_log.h"
19 
20 #undef HDF_LOG_TAG
21 #define HDF_LOG_TAG "IntellVoiceTriggerMgr"
22 
23 using namespace OHOS::HDI::IntelligentVoice::Trigger::V1_0;
24 
25 namespace OHOS {
26 namespace IntelligentVoice {
27 namespace Trigger {
28 class IntellVoiceTriggerManager final : public ITriggerManager {
29 public:
LoadAdapter(const IntellVoiceTriggerAdapterDsecriptor & descriptor,std::unique_ptr<ITrigger> & adapter)30     int32_t LoadAdapter(const IntellVoiceTriggerAdapterDsecriptor &descriptor,
31         std::unique_ptr<ITrigger> &adapter) override
32     {
33         INTELLIGENT_VOICE_LOGD("load adapter stub");
34         return HDF_SUCCESS;
35     }
36 
UnloadAdapter(const IntellVoiceTriggerAdapterDsecriptor & descriptor)37     int32_t UnloadAdapter(const IntellVoiceTriggerAdapterDsecriptor &descriptor) override
38     {
39         INTELLIGENT_VOICE_LOGD("unload adapter stub");
40         return HDF_SUCCESS;
41     }
42 
GetInstance()43     static IntellVoiceTriggerManager *GetInstance()
44     {
45         static IntellVoiceTriggerManager trigger;
46         return &trigger;
47     }
48 private:
IntellVoiceTriggerManager()49     IntellVoiceTriggerManager() {};
~IntellVoiceTriggerManager()50     ~IntellVoiceTriggerManager() {};
51 };
52 }
53 }
54 }
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
GetIntellVoiceTriggerHalInst(void)59 __attribute__ ((visibility ("default"))) OHOS::IntelligentVoice::Trigger::ITriggerManager *GetIntellVoiceTriggerHalInst(void)
60 {
61     INTELLIGENT_VOICE_LOGD("enter to intell voice trigger stub");
62     return OHOS::IntelligentVoice::Trigger::IntellVoiceTriggerManager::GetInstance();
63 }
64 #ifdef __cplusplus
65 }
66 #endif
67