• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 TRIGGER_CALLBACK_MESSAGE_H
16 #define TRIGGER_CALLBACK_MESSAGE_H
17 
18 #include <functional>
19 #include <map>
20 #include <string>
21 #include "nocopyable.h"
22 
23 namespace OHOS {
24 namespace IntellVoiceTrigger {
25 enum TriggerCbMessageId {
26     TRIGGER_CONNECT_SERVICE_START = 0,
27 };
28 
29 class TriggerCallbackMessage {
30 public:
31     TriggerCallbackMessage() = default;
32     ~TriggerCallbackMessage() = default;
33 
34     using Func = std::function<void()>;
35     static void RegisterFunc(TriggerCbMessageId id, Func func);
36     static void CallFunc(TriggerCbMessageId id);
37 
38 private:
39     static std::map<TriggerCbMessageId, Func> g_triggerFuncMap;
40     DISALLOW_COPY_AND_MOVE(TriggerCallbackMessage);
41 };
42 }  // namespace IntellVoiceTrigger
43 }  // namespace OHOS
44 #endif
45