SDK
The function of the SDK header file is implemented by mapping SDK API calls to client API calls.  Table 1  lists the APIs provided by the client.
Table  1  APIs provided by the client
API 
 | 
Description 
 | 
Parameters 
 | 
int AieClientInit(const ConfigInfo &configInfo, ClientInfo &clientInfo, const AlgorithmInfo &algorithmInfo, IServiceDeadCb *cb) 
 | 
Function: Links and initializes the engine service and activates IPC call. 
Return value: Returns 0 if the operation is successful; returns a non-zero value otherwise. 
 | 
configInfo: Indicates engine-related initial configuration data. This parameter must not be null. 
clientInfo: Indicates engine client information. This parameter must not be null. 
algorithmInfo: Indicates information about the called algorithm. This parameter must not be null. 
cb: Indicates the death callback object. This parameter can be null. 
 | 
int AieClientPrepare(const ClientInfo &clientInfo, const AlgorithmInfo &algorithmInfo, const DataInfo &inputInfo, DataInfo &outputInfo, IClientCb *cb) 
 | 
Function: Loads an algorithm plug-in. 
Return value: Returns 0 if the operation is successful; returns a non-zero value otherwise. 
 | 
clientInfo: Indicates engine client information. This parameter must not be null. 
algorithmInfo: Indicates information about the called algorithm. This parameter must not be null. 
inputInfo: Indicates input information specified for algorithm plug-in loading. This parameter can be null. 
outputInfo: Indicates information returned after algorithm plug-in loading, if any. This parameter can be null. 
cb: Indicates the return result of the asynchronous algorithm. This parameter must not be null for the asynchronous algorithm. For the synchronous algorithm, this parameter must be null. 
 | 
int AieClientAsyncProcess(const ClientInfo &clientInfo, const AlgorithmInfo &algorithmInfo, const DataInfo &inputInfo) 
 | 
Function: Executes an asynchronous algorithm. 
Return value: Returns 0 if the operation is successful; returns a non-zero value otherwise. 
 | 
clientInfo: Indicates engine client information. This parameter must not be null. 
algorithmInfo: Indicates information about the called algorithm. This parameter must not be null. 
inputInfo: Indicates input information specified for algorithm operations. This parameter can be null. 
 | 
int AieClientSyncProcess(const ClientInfo &clientInfo, const AlgorithmInfo &algorithmInfo, const DataInfo &inputInfo, DataInfo &outputInfo) 
 | 
Function: Executes a synchronous algorithm. 
Return value: Returns 0 if the operation is successful; returns a non-zero value otherwise. 
 | 
clientInfo: Indicates engine client information. This parameter must not be null. 
algorithmInfo: Indicates information about the called algorithm. This parameter must not be null. 
inputInfo: Indicates input information specified for algorithm operations. This parameter can be null. 
outputInfo: Indicates output information in the return result of the synchronous algorithm. This parameter can be null. 
 | 
int AieClientRelease(const ClientInfo &clientInfo, const AlgorithmInfo &algorithmInfo, const DataInfo &inputInfo) 
 | 
Function: Uninstalls an algorithm plug-in. 
Return value: Returns 0 if the operation is successful; returns a non-zero value otherwise. 
 | 
clientInfo: Indicates engine client information. This parameter must not be null. 
algorithmInfo: Indicates information about the algorithm plug-in to be uninstalled. This parameter must not be null. 
inputInfo: Indicates input information specified for algorithm plug-in uninstallation. This parameter can be null. 
 | 
int AieClientDestroy(ClientInfo &clientInfo) 
 | 
Function: Disconnects from the server and releases the cache. 
Return value: Returns 0 if the operation is successful; returns a non-zero value otherwise. 
 | 
clientInfo: Indicates information about the engine client to be destroyed. This parameter must not be null. 
 | 
int AieClientSetOption(const ClientInfo &clientInfo, int optionType, const DataInfo &inputInfo) 
 | 
Function: Sets configuration items. You can use this API to pass algorithm’s extended information to plug-ins. 
Return value: Returns 0 if the operation is successful; returns a non-zero value otherwise. 
 | 
clientInfo: Indicates engine client information. This parameter must not be null. 
optionType: Indicates the algorithm for obtaining the configuration item information. An algorithm plug-in can use this parameter as needed. This parameter must not be null. 
inputInfo: Indicates algorithm parameter information. An algorithm plug-in can use this parameter as needed. This parameter can be null. 
 | 
int AieClientGetOption(const ClientInfo &clientInfo, int optionType, const DataInfo &inputInfo, DataInfo &outputInfo) 
 | 
Function: Obtains configuration item information based on the specified optionType and inputInfo. 
Return value: Returns 0 if the operation is successful; returns a non-zero value otherwise. 
 | 
clientInfo: Indicates engine client information. This parameter must not be null. 
optionType: Indicates the algorithm for obtaining the configuration item information. This parameter must not be null. 
inputInfo: Indicates input information specified for obtaining configuration item information of the algorithm. This parameter can be null. 
outputInfo: Indicates the configuration item information in the return result. This parameter can be null. 
 | 
Table 2  describes the data structure of  ConfigInfo,  ClientInfo,  AlgorithmInfo, and  DataInfo.
Table  2  Data structure of ConfigInfo, ClientInfo, AlgorithmInfo, and DataInfo
Structure 
 | 
Description 
 | 
Attributes 
 | 
ConfigInfo 
 | 
Algorithm configuration item information 
 | 
const char *description: Indicates the body of configuration item information. 
 | 
ClientInfo 
 | 
Client information 
 | 
long long clientVersion: Indicates client version number. This parameter is not used currently. 
int clientId: Indicates the client ID. 
int sessionId: Indicates the session ID. 
uid_t serverUid: Indicates the UID of the server. 
uid_t clientUid: Indicates the UID of the client. 
int extendLen: Indicates the length of the extended information (extendMsg). 
unsigned char *extendMsg: Indicates the body of the extended information. 
 | 
AlgorithmInfo 
 | 
Algorithm information 
 | 
long long clientVersion: Indicates client version number. This parameter is not used currently. 
bool isAsync: Indicates whether asynchronous execution is used. 
int algorithmType: Indicates the algorithm type ID allocated by the AI engine framework based on the plug-in loading sequence. 
long long algorithmVersion: Indicates the algorithm version number. 
bool isCloud: Indicates whether to migrate data to the cloud. This parameter is not used currently. 
int operateId: Indicates the execution ID. This parameter is not used currently. 
int requestId: Indicates the request ID, which identifies each request and corresponds to the execution result. 
int extendLen: Indicates the length of the extended information (extendMsg). 
unsigned char *extendMsg: Indicates the body of the extended information. 
 | 
DataInfo 
 | 
Algorithm input parameter configuration information (inputInfo) and output parameter configuration information (outputInfo) 
 | 
unsigned char *data: Indicates the data body. 
int length: Indicates the data length. 
 | 
For details about the development process, see the development example for the KWS SDK.
你可能感兴趣的文章
开源鸿蒙 Subsystems
开源鸿蒙 KWS Configuration File
开源鸿蒙 KWS Plug-in
开源鸿蒙 KWS SDK
开源鸿蒙 Development Examples
开源鸿蒙 Configuration File
开源鸿蒙 Plug-in
开源鸿蒙 Development Guidelines
开源鸿蒙 Development Environment
开源鸿蒙 AI Engine Framework