Scenario 1: Initialization
Description
The initialization API can be called for SDK initialization after a third-party application starts. You only need to call this API once. You must call this API before calling other functional APIs.
Service Process
During SDK initialization, if the Windows 64-bit platform is used, change the name of the HwmSdk.exe file in the HwmSdk folder and call the init synchronization API.
- Change the name of the .exe file (only for the Windows 64-bit platform).
Change the name of the HwmSdk.exe file in the HwmSdk folder to MySdk.exe.
- Call the API.
- Construct the InitInfo data structure.
- Call the Init API to initialize the configuration. The data in the preceding step is used as input parameters.
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
/** * Call the initialization API and start the application. */ async goToInit() { let param = { exePath: "E:\\Hello_World\\debug\\win32\\HwmSdk\\MySdk.exe",// Configure the SDK path only for the Windows 64-bit platform. Assume that the HwmSdk directory is in E:\\Hello_World\\debug\\win32\\ and the .exe file name is MySdk.exe. (The path must be encoded using UTF-8.) logPath: "E:\\Hello_World\\debug\\win32\\MySdk\\log\\",// Specify the log path. (The path must be encoded using UTF-8.) userDataPath: "E:\\Hello_World\\debug\\win32\\MySdk\\UserData\\", // Specify the data path. (The path must be encoded using UTF-8.) appId: getAppId() }; const apiService = new ApiService(); let setResult = await apiService.init(param); if (setResult != 0) { window.electron.ipcRenderer.send("show-error-alert", "init error = " + setResult.ret); } } |
1 2 3 4 5 6 7 8 9 |
/** * Definition of init in ApiService */ init(initInfo) { console.log("init, in param = ", initInfo); let ret = this.uisdkService.init(initInfo); console.log("init, out data = ", ret); return ret; } |
The sample code in the typical scenario and API reference is pseudo code and cannot be directly used.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot