forked from PSeitz/yamaha-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyamaha.js
30 lines (25 loc) · 914 Bytes
/
yamaha.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
var simpleCommands = require('./simpleCommands');
var chainedCommands = require('./chainedCommands');
/**
* The Yamaha Module Constructor.
* @constructor
* @param {string} ip - The ip of the yamaha receiver.
* @param {number} responseDelay - The delay of the response for put commands, in seconds - defaults to 1. Better than polling...
*
*/
function Yamaha(ip, responseDelay)
{
if (typeof responseDelay == 'string' || responseDelay instanceof String) responseDelay = parseInt(responseDelay);
if (!responseDelay) responseDelay = 1;
this.ip = ip;
this.responseDelay = responseDelay;
this.pollingDelay = 500; // used for menu ready check, webradio e.g.
}
extend(Yamaha.prototype, simpleCommands.prototype);
extend(Yamaha.prototype, chainedCommands.prototype);
function extend(destination , source) {
for (var k in source) {
destination[k] = source[k];
}
}
module.exports = Yamaha;