forked from OpenSmartHub/yamaha-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchainedCommands.js
44 lines (34 loc) · 971 Bytes
/
chainedCommands.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
// var simpleCommands = require('./simpleCommands');
var deferred = require('deferred');
function Yamaha()
{
}
// Navigates and selects the #number of the webradio favorites
Yamaha.prototype.switchToFavoriteNumber = function(favoritelistname, number){
var self = this;
var d = deferred();
self.powerOn().done(function(){
self.setMainInputTo("NET RADIO").done( function(){
self.selectWebRadioListItem(1).done(function(){
self.whenMenuReady("NET_RADIO").done(function(){
self.selectWebRadioListItem(number).done(d.resolve);
});
});
});
});
return d.promise;
};
Yamaha.prototype.switchToWebRadioWithName = function(name){
var self = this;
self.setMainInputTo("NET RADIO").done(function(){
self.getWebRadioList().done(function(result){
console.log(result);
parseString(result, function (err, result) {
console.dir(result);
});
}, function (err) {
console.log("err "+err);
});
});
};
module.exports = Yamaha;