/
device.js
49 lines (39 loc) · 1.38 KB
/
device.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
var Device = function(service, deviceInfo) {
this.service = service;
this.id = deviceInfo.id;
this.name = deviceInfo.name;
this.deviceId = deviceInfo.deviceId;
this.features = deviceInfo.features;
this.model = deviceInfo.model;
this.slideshowFeatures = deviceInfo.slideshowFeatures;
this.supportedContentTypes = deviceInfo.supportedContentTypes;
this.status = null;
};
Device.prototype.getStatus = function(callback) {
// TODO: cache status so a request isn't needed each time
this.service.getDeviceStatus(this.id, callback);
};
Device.prototype.authorize = function(callback) {
this.service.authorize(this.id, callback);
};
Device.prototype.play = function(content, start, callback) {
this.service.play(this.id, content, start, callback);
};
Device.prototype.stop = function(callback) {
this.service.stop(this.id, callback);
};
Device.prototype.scrub = function(position, callback) {
this.service.scrub(this.id, position, callback);
};
Device.prototype.reverse = function(callback) {
this.service.reverse(this.id, callback);
};
Device.prototype.rate = function(value, callback) {
this.service.rate(this.id, value, callback);
};
Device.prototype.volume = function(value, callback) {
this.service.volume(this.id, value, callback);
};
Device.prototype.photo = function(content, transition, callback) {
this.service.photo(this.id, content, transition, callback);
};