Error code overview: IPConnection.ERROR_ALREADY_CONNECTED = 11 IPConnection.ERROR_NOT_CONNECTED = 12 IPConnection.ERROR_CONNECT_FAILED = 13 IPConnection.ERROR_INVALID_FUNCTION_ID = 21 IPConnection.ERROR_TIMEOUT = 31 IPConnection.ERROR_INVALID_PARAMETER = 41 IPConnection.ERROR_FUNCTION_NOT_SUPPORTED = 42 IPConnection.ERROR_UNKNOWN_ERROR = 43 http://www.tinkerforge.com/de/doc/Software/Bricklets/MotionDetector_Bricklet_JavaScript.html https://www.npmjs.com/package/nodejs-websocket https://devcenter.heroku.com/articles/node-websockets
44 lines
796 B
JavaScript
44 lines
796 B
JavaScript
/**
|
|
* @file Simple wrapper for stream.Readable, used for receiving binary data
|
|
*/
|
|
'use strict'
|
|
|
|
var util = require('util'),
|
|
stream = require('stream')
|
|
|
|
/**
|
|
* Represents the readable stream for binary frames
|
|
* @class
|
|
* @event readable
|
|
* @event end
|
|
*/
|
|
function InStream() {
|
|
stream.Readable.call(this)
|
|
}
|
|
|
|
module.exports = InStream
|
|
|
|
util.inherits(InStream, stream.Readable)
|
|
|
|
/**
|
|
* No logic here, the pushs are made outside _read
|
|
* @private
|
|
*/
|
|
InStream.prototype._read = function () {}
|
|
|
|
/**
|
|
* Add more data to the stream and fires "readable" event
|
|
* @param {Buffer} data
|
|
* @private
|
|
*/
|
|
InStream.prototype.addData = function (data) {
|
|
this.push(data)
|
|
}
|
|
|
|
/**
|
|
* Indicates there is no more data to add to the stream
|
|
* @private
|
|
*/
|
|
InStream.prototype.end = function () {
|
|
this.push(null)
|
|
} |