Updated on 2023-03-23 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 Y InitInfo Initialization information.
Table 2 InitInfo
Parameter Mandatory Type Description
exePath Y 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 Y string SDK log path. If this parameter is not set, the default path is used. UTF-8 encoding is required.
userDataPath Y 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 Y string App ID. For details about how to request an app ID, see section "Introduction to App ID Authentication."
siteType N SiteType Site type. The default value is 0, indicating that Chinese mainland site is used.
logKeepDays N 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 N 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 N string Download link on the official website (valid only for the macOS platform).
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.