Skip to content

Commit d265cf0

Browse files
committed
Add surveillanceStation.camera.getSnapshot API
1 parent 056a883 commit d265cf0

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

lib/surveillance-station.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,44 @@
1+
'use strict';
2+
3+
var util = require('util');
4+
5+
6+
function Camera(syno) {
7+
this.syno = syno;
8+
return this;
9+
}
10+
11+
Camera.prototype.getSnapshot = function() {
12+
/*jshint validthis:true */
13+
var
14+
userParams =
15+
typeof arguments[0] === 'object' ? arguments[0] :
16+
{},
17+
callback =
18+
typeof arguments[1] === 'function' ? arguments[1] :
19+
typeof arguments[0] === 'function' ? arguments[0] :
20+
null
21+
;
22+
var params = {
23+
api : 'SYNO.SurveillanceStation.Camera',
24+
version: 9,
25+
method : 'GetSnapshot'
26+
};
27+
util._extend(params, userParams);
28+
29+
var query = this.syno.query({
30+
path: '/webapi/entry.cgi',
31+
params: params,
32+
headers: {
33+
'Accept': 'image/jpeg',
34+
}
35+
}, callback || null);
36+
37+
return query;
38+
}
39+
140
module.exports = function(syno) {
241
return {
42+
camera: new Camera(syno),
343
};
444
};

0 commit comments

Comments
 (0)