-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
57 lines (41 loc) · 1.17 KB
/
example.js
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* Created by sguilly on 16/07/2015.
*/
var Cam = require('./lib/onvif').Cam;
Cam.LoadWsdl(function () {
var cam = new Cam({
hostname: '192.168.0.31',
username: 'admin',
password: 'pbjsteam'
});
var cam1 = new Cam({
hostname: '192.168.0.19',
username: 'admin',
password: 'pbjsteam'
});
var cam2 = new Cam({
hostname: '192.168.0.33',
username: 'admin',
password: 'pbjsteam'
});
cam.exec('device','GetDeviceInformation').then(function (values) {
console.log(values);
}).catch(function (error) {
// Handle any error from all above steps
console.log(error);
});
cam.exec('media','GetProfiles').then(function (values) {
//console.log(JSON.stringify(values,null,3));
console.log(values.Profiles[0].attributes.token);
cam.exec('media','GetSnapshotUri',{ProfileToken: values.Profiles[0].attributes.token}).then(function (values) {
console.log(values);
})
.catch(function (error) {
// Handle any error from all above steps
console.log(error);
});
}).catch(function (error) {
// Handle any error from all above steps
console.log(error);
});
});