-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathHikVisionWebPlugin.razor.js
More file actions
36 lines (30 loc) · 1.2 KB
/
HikVisionWebPlugin.razor.js
File metadata and controls
36 lines (30 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { init as initVision, login as loginVision, logout, startRealPlay, stopRealPlay, openSound, closeSound, setVolume, capturePicture, capturePictureAndDownload, dispose as disposeVision } from '../hikvision.js';
import Data from '../../BootstrapBlazor/modules/data.js';
export async function init(id, invoke) {
const el = document.getElementById(id);
if (el === null) {
return;
}
Data.set(id, {
invoke
});
const inited = await initVision(id);
await invoke.invokeMethodAsync('TriggerInited', inited);
}
export async function login(id, ip, port, userName, password, loginType) {
const vision = Data.get(id);
await loginVision(id, ip, port, userName, password, loginType);
const { logined, invoke } = vision;
if (logined) {
await invoke.invokeMethodAsync('TriggerGetChannelList', {
analogChannels: vision.analogChannels,
digitalChannels: vision.digitalChannels,
zeroChannels: vision.zeroChannels
});
}
return logined;
}
export { logout, startRealPlay, stopRealPlay, openSound, closeSound, setVolume, capturePicture, capturePictureAndDownload }
export function dispose(id) {
disposeVision(id);
}