Updated on 2024-07-30 GMT+08:00

Initializing the SDK

Function

This API is used to start and initialize the SDK. 1. Before calling this API, modify the name of the HwmSdk.exe file in the HwmSdk folder. 2. Before calling other APIs, you must call this API and wait for the initialization callback result. 3. Each time the initialization API is called, the SDK is restarted and all the previous settings and operations do not exist.

Function Prototype

init(initInfo: InitInfo): SDKERR

Request Parameters

Table 1 Input parameter description
Parameter Mandatory Type Description
initInfo Yes InitInfo Initialization information.
Table 2 InitInfo
Parameter Mandatory Type Description
exePath Yes string SDK startup path, that is, the absolute path of the .exe file in the HwmSdk folder of the SDK package. Before calling this API, change the name of the HwmSdk.exe file in the HwmSdk folder of the SDK package to your desired name. Assume that the path of the HwmSdk folder is D:\MyApp\SDK\HwmSdk\ and the name of the .exe file is MySdk.exe. Then set this parameter to D:\MyApp\SDK\HwmSdk\MySdk.exe. UTF-8 encoding is required. (This parameter is valid only for the Windows 64-bit platform.)
logPath Yes string SDK log path. If this parameter is not set, the default path is used. UTF-8 encoding is required.
userDataPath Yes string SDK user data path. If this parameter is not set, the default path is used. UTF-8 encoding is required. (This parameter is valid only for the Windows platform.)
appId Yes string App ID. For details about how to request an app ID, see section "Introduction to App ID Authentication."
siteType No SiteType Site type. The default value is 0, indicating that Chinese mainland site is used.
logKeepDays No number Log storage duration. Valid value range is 3–30. The default value is 0. 0 indicates that logs are not deleted by day. 1 and 2 will be converted to 3, and values greater than 30 will be converted to 30.
preferredCamera No string Preferred camera list. After this parameter is set, the first available camera is selected based on the sequence in the list when the camera is opened for the first time. This parameter can be left empty. If it is left empty, available cameras are enabled in the default sequence. (This parameter is valid only for the Windows platform.)
appUrl No string Download link on the official website (valid only for the macOS platform).
isSupportMultiAppLogin Yes boolean Whether to support login to multiple applications on the same device.
Table 3 Enumerated values of SiteType
Enumeration Name Enumerated Value Description
HWM_SITE_TYPE_CHINA 0 Chinese mainland.
HWM_SITE_TYPE_AP 1 Asia Pacific.

Return Values

For details about SDKERR, see Error Code Reference.