• 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_H
17 #define FACE_AUTH_EVENT_H
18 
19 #include <mutex>
20 #include "face_auth_defines.h"
21 #include "face_auth_event_handler.h"
22 
23 namespace OHOS {
24 namespace UserIAM {
25 namespace FaceAuth {
26 class FaceAuthEvent {
27 public:
28     FaceAuthEvent();
29     virtual ~FaceAuthEvent();
30     static std::shared_ptr<FaceAuthEvent> GetInstance();
31     void HandleTask(const AppExecFwk::InnerEvent::Pointer &event);
32     void ProcessAuthenticateTask(const AppExecFwk::InnerEvent::Pointer &event);
33     void ProcessEnrollTask(const AppExecFwk::InnerEvent::Pointer &event);
34     void ProcessRemoveTask(const AppExecFwk::InnerEvent::Pointer &event);
SetEventHandler(const std::shared_ptr<FaceAuthEventHandler> & handler)35     inline void SetEventHandler(const std::shared_ptr<FaceAuthEventHandler> &handler)
36     {
37         eventHandler_ = handler;
38     }
39 private:
40     static std::mutex mutex_;
41     static std::shared_ptr<FaceAuthEvent> instance_;
42     std::shared_ptr<FaceAuthEventHandler> eventHandler_;
43 };
44 } // namespace FaceAuth
45 } // namespace UserIAM
46 } // namespace OHOS
47 #endif // FACE_AUTH_EVENT_H
48