dmx-flok/drivers/null.js

43 lines
744 B
JavaScript
Raw Normal View History

function Null(deviceId, options) {
const self = this;
options = options || {};
this.universe = Buffer.alloc(513, 0);
self.start();
2015-05-15 12:34:24 +00:00
}
Null.prototype.start = function () {
const self = this;
2015-05-15 12:34:24 +00:00
self.timeout = setInterval(() => {
console.log(self.universe);
}, 1000);
};
2015-05-15 12:34:24 +00:00
Null.prototype.stop = function () {
clearInterval(this.timeout);
};
2012-09-02 12:36:08 +00:00
Null.prototype.close = cb => {
cb(null);
};
2012-09-08 12:43:04 +00:00
Null.prototype.update = function (u) {
for (const c in u) {
this.universe[c] = u[c];
}
console.log(this.universe.slice(1));
};
Null.prototype.updateAll = function (v) {
for (let i = 1; i <= 512; i++) {
this.universe[i] = v;
}
};
Null.prototype.get = function (c) {
return this.universe[c];
};
module.exports = Null;