New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

homeduino

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homeduino - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

61

lib/board.js

@@ -37,6 +37,8 @@ var Board, Promise, SerialPort, assert, events, rfcontrol, serialport,

this.serialPort.on("data", (function(_this) {
return function(line) {
var args, cmd;
return function(_line) {
var args, cmd, line;
line = _line.replace(/\0/g, '').trim();
_this.emit("data", line);
if (line === "ready") {
_this.emit('ready');
return;

@@ -57,3 +59,3 @@ }

default:
return console.log("unknown message received: " + data);
return console.log("unknown message received: " + line);
}

@@ -64,10 +66,17 @@ };

Board.prototype.connect = function() {
return this.serialPort.openAsync().then((function(_this) {
Board.prototype.connect = function(timeout) {
if (timeout == null) {
timeout = 20000;
}
return this.pendingConnect = this.serialPort.openAsync().then((function(_this) {
return function() {
var resolver;
resolver = null;
return new Promise(function(resolve, reject) {
return _this.serialPort.once("data", function(line) {
return resolve();
});
}).timeout(3000);
resolver = resolve;
return _this.once("ready", resolve);
}).timeout(timeout)["catch"](function(err) {
_this.removeListener("ready", resolver);
throw err;
});
};

@@ -77,2 +86,9 @@ })(this));

Board.prototype.whenReady = function() {
if (this.pendingConnect == null) {
return Promise.reject(new Error("First call connect!"));
}
return this.pendingConnect;
};
Board.prototype.digitalWrite = function(pin, value) {

@@ -111,4 +127,4 @@ assert(typeof pin === "number");

return {
temperature: args[0],
humidity: args[1]
temperature: parseFloat(args[0]),
humidity: parseFloat(args[1])
};

@@ -124,8 +140,15 @@ });

Board.prototype.rfControlSend = function(pin, pulseLengths, pulses) {
var i, pl, pulseLengthsArgs, _i, _len;
assert(typeof pin === "numer");
assert(Array.isArray(pulseLengths));
assert(pulseLengths.length <= 8);
assert(typeof pulses === "string");
Board.prototype.rfControlSendMessage = function(pin, protocolName, message) {
var result;
result = rfcontrol.encodeMessage(protocolName, message);
return this.rfControlSendPulses(pin, result.pulseLengths, result.pulses);
};
Board.prototype.rfControlSendPulses = function(pin, pulseLengths, pulses) {
var i, pl, pulseLengthsArgs, repeats, _i, _len;
assert(typeof pin === "number", "pin should be a number");
assert(Array.isArray(pulseLengths), "pulseLengths should be an array");
assert(pulseLengths.length <= 8, "pulseLengths.length should be <= 8");
assert(typeof pulses === "string", "pulses should be a string");
repeats = 5;
pulseLengthsArgs = "";

@@ -142,3 +165,3 @@ i = 0;

}
return this.serialPort.writeAsync("RF send " + pin + " " + pulseLengthsArgs + " " + pulses + "\n").then(this._waitForAcknowledge);
return this.serialPort.writeAsync("RF send " + pin + " " + repeats + " " + pulseLengthsArgs + " " + pulses + "\n").then(this._waitForAcknowledge);
};

@@ -203,3 +226,3 @@

this.emit('rfReceive', info);
results = rfcontrol.parsePulseSquence(info.pulseLengths, info.pulses);
results = rfcontrol.decodePulses(info.pulseLengths, info.pulses);
for (_j = 0, _len1 = results.length; _j < _len1; _j++) {

@@ -206,0 +229,0 @@ r = results[_j];

{
"name": "homeduino",
"version": "0.0.1",
"version": "0.0.2",
"description": "Node.js library for interfacing with the homeduino ardunio library",

@@ -31,3 +31,3 @@ "main": "index.js",

"bluebird": "~2.2.2",
"rfcontroljs": "git+https://github.com/pimatic/rfcontroljs.git"
"rfcontroljs": "0.0.4"
},

@@ -34,0 +34,0 @@ "devDependencies": {

@@ -13,4 +13,5 @@ homeduinojs

Board = require('../index').Board
board = new Board('/dev/ttyUSB0', 9600)
homeduino = require('homeduino')
Board = homeduino.Board
board = new Board('/dev/ttyUSB0', 115200)

@@ -17,0 +18,0 @@ board.connect().then( ->

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc