2013-11-17 00:41:27 +00:00
|
|
|
"use strict"
|
|
|
|
|
2016-04-09 16:08:19 +00:00
|
|
|
function Null(device_id, options) {
|
2013-11-17 00:41:27 +00:00
|
|
|
var self = this
|
2016-04-09 16:08:19 +00:00
|
|
|
options = options || {}
|
2013-11-17 00:41:27 +00:00
|
|
|
this.universe = new Buffer(512)
|
|
|
|
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)
|
2013-11-17 00:41:27 +00:00
|
|
|
}
|
2012-09-02 12:36:08 +00:00
|
|
|
|
2013-11-17 00:41:27 +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
|
|
|
}
|
2013-11-17 00:41:27 +00:00
|
|
|
console.log(this.universe)
|
|
|
|
}
|
2012-09-08 12:43:04 +00:00
|
|
|
|
2014-04-24 17:53:07 +00:00
|
|
|
Null.prototype.updateAll = function(v){
|
2015-05-15 12:34:24 +00:00
|
|
|
for(var i = 0; i < 512; i++) {
|
|
|
|
this.universe[i] = v
|
|
|
|
}
|
2014-04-24 17:53:07 +00:00
|
|
|
}
|
|
|
|
|
2013-11-17 00:41:27 +00:00
|
|
|
Null.prototype.get = function(c) {
|
|
|
|
return this.universe[c]
|
2012-09-02 12:36:08 +00:00
|
|
|
}
|
2013-11-17 00:41:27 +00:00
|
|
|
|
|
|
|
module.exports = Null
|