2018-12-19 19:24:06 +00:00
|
|
|
function Null(deviceId, options) {
|
|
|
|
const self = this;
|
2013-11-17 00:41:27 +00:00
|
|
|
|
2018-12-19 19:24:06 +00:00
|
|
|
options = options || {};
|
|
|
|
this.universe = Buffer.alloc(513, 0);
|
|
|
|
self.start();
|
2015-05-15 12:34:24 +00:00
|
|
|
}
|
|
|
|
|
2018-12-19 19:24:06 +00:00
|
|
|
Null.prototype.start = function () {
|
|
|
|
const self = this;
|
2015-05-15 12:34:24 +00:00
|
|
|
|
2018-12-19 19:24:06 +00:00
|
|
|
self.timeout = setInterval(() => {
|
|
|
|
console.log(self.universe);
|
|
|
|
}, 1000);
|
|
|
|
};
|
2015-05-15 12:34:24 +00:00
|
|
|
|
2018-12-19 19:24:06 +00:00
|
|
|
Null.prototype.stop = function () {
|
|
|
|
clearInterval(this.timeout);
|
|
|
|
};
|
2012-09-02 12:36:08 +00:00
|
|
|
|
2018-12-19 19:24:06 +00:00
|
|
|
Null.prototype.close = cb => {
|
|
|
|
cb(null);
|
|
|
|
};
|
2012-09-08 12:43:04 +00:00
|
|
|
|
2018-12-19 19:24:06 +00:00
|
|
|
Null.prototype.update = function (u) {
|
|
|
|
for (const c in u) {
|
|
|
|
this.universe[c] = u[c];
|
|
|
|
}
|
|
|
|
console.log(this.universe.slice(1));
|
|
|
|
};
|
2014-04-24 17:53:07 +00:00
|
|
|
|
2018-12-19 19:24:06 +00:00
|
|
|
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];
|
|
|
|
};
|
2013-11-17 00:41:27 +00:00
|
|
|
|
2018-12-19 19:24:06 +00:00
|
|
|
module.exports = Null;
|