• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 FACE_AUTH_EVENT_HANDLER_H
17 #define FACE_AUTH_EVENT_HANDLER_H
18 
19 #include "event_handler.h"
20 #include "face_auth_defines.h"
21 
22 namespace OHOS {
23 namespace UserIAM {
24 namespace FaceAuth {
25 class FaceAuthEventHandler : public AppExecFwk::EventHandler {
26 public:
27     FaceAuthEventHandler(const std::shared_ptr<AppExecFwk::EventRunner> &runner);
28     virtual ~FaceAuthEventHandler();
29     void RemoveEvent(const uint64_t reqId);
30     template <typename T>
SendEvent(int32_t innerEventId,std::unique_ptr<T> && object,Priority priority)31     inline bool SendEvent(int32_t innerEventId, std::unique_ptr<T> &&object, Priority priority)
32     {
33         return AppExecFwk::EventHandler::SendEvent(AppExecFwk::InnerEvent::Get((uint32_t) innerEventId, object), 0,
34             priority);
35     }
SendEvent(int32_t innerEventId,Priority priority)36     inline bool SendEvent(int32_t innerEventId, Priority priority)
37     {
38         auto info = std::make_unique<int>(0);
39         return AppExecFwk::EventHandler::SendEvent(AppExecFwk::InnerEvent::Get((uint32_t) innerEventId,
40             std::move(info)), 0, priority);
41     }
42     void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event);
43 };
44 }  // namespace FaceAuth
45 }  // namespace UserIAM
46 }  // namespace OHOS
47 #endif // FACE_AUTH_EVENT_HANDLER_H
48