dmx-flok/drivers/null.js

43 lines
731 B
JavaScript
Raw Normal View History

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