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
16/**
17 * @addtogroup HdfFingerprintAuth
18 * @{
19 *
20 * @brief Provides APIs for the fingerprint auth driver.
21 *
22 * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver.
23 * After obtaining the fingerprint auth driver proxy, the service can call related APIs to obtain executors.
24 * After obtaining the fingerprint 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 5.0
28 */
29
30/**
31 * @file IAllInOneExecutor.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 5.0
37 */
38
39package ohos.hdi.fingerprint_auth.v2_0;
40
41import ohos.hdi.fingerprint_auth.v2_0.FingerprintAuthTypes;
42import ohos.hdi.fingerprint_auth.v2_0.IExecutorCallback;
43import ohos.hdi.fingerprint_auth.v2_0.ISaCommandCallback;
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 5.0
50 * @version 1.0
51 */
52interface IAllInOneExecutor {
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 Sends parameters to the driver when executor registration is finished.
64     *
65     * @param templateIdList Indicates the templates previously registered to the user auth framework.
66     * @param frameworkPublicKey Indicates the framework public key.
67     * @param extraInfo Indicates the extra information that is sent to the executors.
68     *
69     * @return Returns <b>0</b> if the operation is successful.
70     * @return Returns a non-zero value if the operation fails.
71     */
72    OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo);
73    /**
74     * @brief Cancels the enrollment, authentication, or identification operation.
75     *
76     * @param scheduleId Indicates the schedule ID of the operation to cancel.
77     *
78     * @return Returns <b>0</b> if the operation is successful.
79     * @return Returns a non-zero value if the operation fails.
80     */
81    Cancel([in] unsigned long scheduleId);
82    /**
83     * @brief Send message.
84     *
85     * @param scheduleId Indicates the schedule ID of the message.
86     * @param srcRole is the role of source.
87     * @param msg is the message content.
88     *
89     * @return Returns <b>0</b> if the operation is successful.
90     * @return Returns a non-zero value if the operation fails.
91     */
92    SendMessage([in] unsigned long scheduleId, [in] int srcRole, [in] unsigned char[] msg);
93    /**
94     * @brief Enrolls templates.
95     *
96     * @param scheduleId Indicates the schedule ID of enrollment.
97     * @param extraInfo Indicates the extra information of enrollment.
98     * @param callbackObj Indicates the callback object of enrollment. See {@link IExecutorCallback}.
99     *
100     * @return Returns <b>0</b> if the operation is successful.
101     * @return Returns a non-zero value if the operation fails.
102     */
103    Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
104    /**
105     * @brief Authenticates templates.
106     *
107     * @param scheduleId Indicates the schedule ID of authentication.
108     * @param templateIdList Indicates the templates to authenticate.
109     * @param endAfterFirstFail Indicates end authentication after the first authentication failure.
110     * @param extraInfo Indicates the extra information of authentication.
111     * @param callbackObj Indicates the callback object of authentication. See {@link IExecutorCallback}.
112     *
113     * @return Returns <b>0</b> if the operation is successful.
114     * @return Returns a non-zero value if the operation fails.
115     */
116    Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] boolean endAfterFirstFail,
117        [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
118    /**
119     * @brief Identifies templates.
120     *
121     * @param scheduleId Indicates the schedule ID of identification.
122     * @param extraInfo Indicates the extra information of identification.
123     * @param callbackObj Indicates the callback object of identification. See {@link IExecutorCallback}.
124     *
125     * @return Returns <b>0</b> if the operation is successful.
126     * @return Returns a non-zero value if the operation fails.
127     */
128    Identify([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
129    /**
130     * @brief Deletes templates.
131     *
132     * @param templateIdList Indicates the templates to delete.
133     *
134     * @return Returns <b>0</b> if the operation is successful.
135     * @return Returns a non-zero value if the operation fails.
136     */
137    Delete([in] unsigned long[] templateIdList);
138    /**
139     * @brief Sends a command to the driver.
140     *
141     * @param commandId Indicates the command ID. See {@link DriverCommandId}.
142     * @param extraInfo Indicates the extra information of the command.
143     * @param callbackObj Indicates the callback object of the command. See {@link IExecutorCallback}.
144     *
145     * @return Returns <b>0</b> if the operation is successful.
146     * @return Returns a non-zero value if the operation fails.
147     */
148    SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
149    /**
150     * @brief Get property.
151     *
152     * @param templateIdList Indicates the templates to process.
153     * @param propertyTypes Indicates the property types to get. See {@link GetPropertyType}.
154     * @param property Indicates property. See {@link Property}.
155     *
156     * @return Returns <b>0</b> if the operation is successful.
157     * @return Returns a non-zero value if the operation fails.
158     */
159    GetProperty([in] unsigned long[] templateIdList, [in] int[] propertyTypes, [out] struct Property property);
160    /**
161     * @brief Set cached templates.
162     *
163     * @param templateIdList Indicates the templates to cache.
164     *
165     * @return Returns <b>0</b> if the operation is successful.
166     * @return Returns a non-zero value if the operation fails.
167     */
168    SetCachedTemplates([in] unsigned long[] templateIdList);
169    /**
170     * @brief Register sa command callback.
171     *
172     * @param callbackObj Indicates the sa command callback.
173     *
174     * @return Returns <b>0</b> if the operation is successful.
175     * @return Returns a non-zero value if the operation fails.
176     */
177    RegisterSaCommandCallback([in] ISaCommandCallback callbackObj);
178}
179/** @} */