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/**
17 * @addtogroup HdfFaceAuth
18 * @{
19 *
20 * @brief Provides APIs for the face auth driver.
21 *
22 * The face auth driver provides a unified interface for the face auth service to access the face auth driver.
23 * After obtaining the face auth driver proxy, the service can call related APIs to obtain executors.
24 * After obtaining the face auth executors, the service can call related APIs to get executor information, get
25 * template information, and enroll, authenticate, and delete templates, etc.
26 *
27 * @since 3.2
28 */
29
30/**
31 * @file IExecutor.idl
32 *
33 * @brief Defines the APIs of the executors. These APIs can be used to get executor information, get
34 * template information, and enroll, authenticate, and delete templates, etc.
35 *
36 * @since 3.2
37 */
38
39package ohos.hdi.face_auth.v1_0;
40
41import ohos.hdi.face_auth.v1_0.FaceAuthTypes;
42import ohos.hdi.face_auth.v1_0.IExecutorCallback;
43sequenceable ohos.hdi.camera.v1_0.BufferProducerSequenceable;
44
45/**
46 * @brief Defines the APIs of the executors. These APIs can be used to get executor information, get
47 * template information, and enroll, authenticate, and delete templates, etc.
48 *
49 * @since 3.2
50 * @version 1.0
51 */
52interface IExecutor {
53    /**
54     * @brief Gets executor information.
55     *
56     * @param executorInfo Indicates executor information. See {@link ExecutorInfo}.
57     *
58     * @return Returns <b>0</b> if the operation is successful.
59     * @return Returns a non-zero value if the operation fails.
60     */
61    GetExecutorInfo([out] struct ExecutorInfo executorInfo);
62    /**
63     * @brief Gets template information.
64     *
65     * @param templateId Indicates the template ID.
66     * @param templateInfo Indicates template information. See {@link TemplateInfo}.
67     *
68     * @return Returns <b>0</b> if the operation is successful.
69     * @return Returns a non-zero value if the operation fails.
70     *
71     * @deprecated
72     */
73    GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo);
74    /**
75     * @brief Sends parameters to the driver when executor registration is finished.
76     *
77     * @param templateIdList Indicates the templates previously registered to the user auth framework.
78     * @param frameworkPublicKey Indicates the framework public key.
79     * @param extraInfo Indicates the extra information that is sent to the executors.
80     *
81     * @return Returns <b>0</b> if the operation is successful.
82     * @return Returns a non-zero value if the operation fails.
83     */
84    OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo);
85    /**
86     * @brief Enrolls templates.
87     *
88     * @param scheduleId Indicates the schedule ID of enrollment.
89     * @param extraInfo Indicates the extra information of enrollment.
90     * @param callbackObj Indicates the callback object of enrollment. See {@link IExecutorCallback}.
91     *
92     * @return Returns <b>0</b> if the operation is successful.
93     * @return Returns a non-zero value if the operation fails.
94     */
95    Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
96    /**
97     * @brief Authenticates templates.
98     *
99     * @param scheduleId Indicates the schedule ID of authentication.
100     * @param templateIdList Indicates the templates to authenticate.
101     * @param extraInfo Indicates the extra information of authentication.
102     * @param callbackObj Indicates the callback object of authentication. See {@link IExecutorCallback}.
103     *
104     * @return Returns <b>0</b> if the operation is successful.
105     * @return Returns a non-zero value if the operation fails.
106     */
107    Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
108    /**
109     * @brief Identifies templates.
110     *
111     * @param scheduleId Indicates the schedule ID of identification.
112     * @param extraInfo Indicates the extra information of identification.
113     * @param callbackObj Indicates the callback object of identification. See {@link IExecutorCallback}.
114     *
115     * @return Returns <b>0</b> if the operation is successful.
116     * @return Returns a non-zero value if the operation fails.
117     */
118    Identify([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
119    /**
120     * @brief Deletes templates.
121     *
122     * @param templateIdList Indicates the templates to delete.
123     *
124     * @return Returns <b>0</b> if the operation is successful.
125     * @return Returns a non-zero value if the operation fails.
126     */
127    Delete([in] unsigned long[] templateIdList);
128    /**
129     * @brief Cancels the enrollment, authentication, or identification operation.
130     *
131     * @param scheduleId Indicates the schedule ID of the operation to cancel.
132     *
133     * @return Returns <b>0</b> if the operation is successful.
134     * @return Returns a non-zero value if the operation fails.
135     */
136    Cancel([in] unsigned long scheduleId);
137    /**
138     * @brief Sends a command to the driver.
139     *
140     * @param commandId Indicates the command ID. See {@link CommandId}.
141     * @param extraInfo Indicates the extra information of the command.
142     * @param callbackObj Indicates the callback object of the command. See {@link IExecutorCallback}.
143     *
144     * @return Returns <b>0</b> if the operation is successful.
145     * @return Returns a non-zero value if the operation fails.
146     */
147    SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
148    /**
149     * @brief Set buffer producer.
150     *
151     * @param bufferProducer Indicates bufferProducer set to executor.
152     *
153     * @return Returns <b>0</b> if the operation is successful.
154     * @return Returns a non-zero value if the operation fails.
155     */
156    SetBufferProducer([in] BufferProducerSequenceable bufferProducer);
157}
158/** @} */