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#ifndef I_AIE_CLIENT_INL 17#define I_AIE_CLIENT_INL 18 19#include <vector> 20 21#include "client_factory.h" 22#include "i_client_cb.h" 23#include "protocol/retcode_inner/aie_retcode_inner.h" 24#include "protocol/struct_definition/aie_info_define.h" 25#include "utils/aie_macros.h" 26#include "utils/log/aie_log.h" 27 28namespace OHOS { 29namespace AI { 30inline int AieClientInit(const ConfigInfo &configInfo, ClientInfo &clientInfo, 31 const AlgorithmInfo &algorithmInfo, IServiceDeadCb *cb) 32{ 33 HILOGI("[IAieClient]AieClientInit"); 34 ClientFactory *client = GetClient(); 35 CHK_RET(client == nullptr, RETCODE_NULL_PARAM); 36 return client->ClientInit(configInfo, clientInfo, algorithmInfo, cb); 37} 38 39inline int AieClientPrepare(const ClientInfo &clientInfo, const AlgorithmInfo &algorithmInfo, 40 const DataInfo &inputInfo, DataInfo &outputInfo, IClientCb *cb) 41{ 42 HILOGI("[IAieClient]AieClientPrepare"); 43 ClientFactory *client = GetClient(); 44 CHK_RET(client == nullptr, RETCODE_NULL_PARAM); 45 return client->ClientPrepare(clientInfo, algorithmInfo, inputInfo, outputInfo, cb); 46} 47 48inline int AieClientAsyncProcess(const ClientInfo &clientInfo, const AlgorithmInfo &algorithmInfo, 49 const DataInfo &inputInfo) 50{ 51 HILOGI("[IAieClient]AieClientAsyncProcess"); 52 ClientFactory *client = GetClient(); 53 CHK_RET(client == nullptr, RETCODE_NULL_PARAM); 54 return client->ClientAsyncProcess(clientInfo, algorithmInfo, inputInfo); 55} 56 57inline int AieClientDestroy(ClientInfo &clientInfo) 58{ 59 HILOGI("[IAieClient]AieClientDestroy"); 60 ClientFactory *client = GetClient(); 61 CHK_RET(client == nullptr, RETCODE_NULL_PARAM); 62 return client->ClientDestroy(clientInfo); 63} 64 65inline int AieClientSetOption(const ClientInfo &clientInfo, int optionType, const DataInfo &inputInfo) 66{ 67 HILOGI("[IAieClient]AieClientSetOption"); 68 ClientFactory *client = GetClient(); 69 CHK_RET(client == nullptr, RETCODE_NULL_PARAM); 70 return client->ClientSetOption(clientInfo, optionType, inputInfo); 71} 72 73inline int AieClientGetOption(const ClientInfo &clientInfo, int optionType, const DataInfo &inputInfo, 74 DataInfo &outputInfo) 75{ 76 HILOGI("[IAieClient]AieClientGetOption"); 77 ClientFactory *client = GetClient(); 78 CHK_RET(client == nullptr, RETCODE_NULL_PARAM); 79 return client->ClientGetOption(clientInfo, optionType, inputInfo, outputInfo); 80} 81 82inline int AieClientRelease(const ClientInfo &clientInfo, const AlgorithmInfo &algorithmInfo, 83 const DataInfo &inputInfo) 84{ 85 HILOGI("[IAieClient]AieClientRelease"); 86 ClientFactory *client = GetClient(); 87 CHK_RET(client == nullptr, RETCODE_NULL_PARAM); 88 return client->ClientRelease(clientInfo, algorithmInfo, inputInfo); 89} 90 91inline int AieClientSyncProcess(const ClientInfo &clientInfo, const AlgorithmInfo &algorithmInfo, 92 const DataInfo &inputInfo, DataInfo &outputInfo) 93{ 94 HILOGI("[IAieClient]AieClientSyncProcess."); 95 ClientFactory *client = GetClient(); 96 CHK_RET(client == nullptr, RETCODE_NULL_PARAM); 97 return client->ClientSyncProcess(clientInfo, algorithmInfo, inputInfo, outputInfo); 98} 99} // namespace AI 100} // namespace OHOS 101 102#endif // I_AIE_CLIENT_INL