1 /*
2  * Copyright (c) 2021 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 ic_sdk
18  * @{
19  *
20  * @brief Defines the development tool functions, constants, and error codes for image classification (IC).
21  *
22  * @since 2.2
23  * @version 1.0
24  */
25 
26 /**
27  * @file ic_sdk.h
28  *
29  * @brief Defines the development tool functions for image classification.
30  *
31  * @since 2.2
32  * @version 1.0
33  */
34 
35 #ifndef IC_SDK_H
36 #define IC_SDK_H
37 
38 #include <memory>
39 
40 #include "ic_callback.h"
41 
42 namespace OHOS {
43 namespace AI {
44 class IcSdk {
45 public:
46     /**
47      * @brief Defines the constructor for the development tool.
48      *
49      * @since 2.2
50      * @version 1.0
51      */
52     IcSdk() = default;
53 
54     /**
55      * @brief Defines the destructor for the development tool, release model, and related variables.
56      *
57      * @since 2.2
58      * @version 1.0
59      */
60     ~IcSdk();
61 
62     /**
63      * @brief Establishes a connection from the development tool to the AI server.
64      *
65      * @return Returns {@link IC_RETCODE_SUCCESS} if the operation is successful;
66      * returns a non-zero error code defined by {@link IcRetCode} otherwise.
67      *
68      * @since 2.2
69      * @version 1.0
70      */
71     int32_t Create();
72 
73     /**
74      * @brief Imports images from the development tool to the image classification model for prediction.
75      *
76      * @param picInput Indicates the input BGR image.
77      * @return Returns {@link IC_RETCODE_SUCCESS} if the operation is successful;
78      * returns a non-zero error code defined by {@link IcRetCode} otherwise.
79      *
80      * @since 2.2
81      * @version 1.0
82      */
83     int32_t SyncExecute(const IcInput &picInput);
84 
85     /**
86      * @brief Defines the callback function.
87      *
88      * @param callback Indicates the specified callback.
89      * @return Returns {@link IC_RETCODE_SUCCESS} if the operation is successful;
90      * returns a non-zero error code defined by {@link IcRetCode} otherwise.
91      *
92      * @since 2.2
93      * @version 1.0
94      */
95     int32_t SetCallback(std::shared_ptr<IcCallback> callback);
96 
97     /**
98      * @brief Destroys the loaded model and related resources.
99      *
100      * @return Returns {@link IC_RETCODE_SUCCESS} if the operation is successful;
101      * returns a non-zero error code defined by {@link IcRetCode} otherwise.
102      *
103      * @since 2.2
104      * @version 1.0
105      */
106     int32_t Destroy();
107 };
108 } // namespace AI
109 } // namespace OHOS
110 
111 #endif // IC_SDK_H
112 /** @} */