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

ecowitt-gateway

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecowitt-gateway - npm Package Compare versions

Comparing version

to
1.0.1

2

package.json
{
"name": "ecowitt-gateway",
"version": "1.0.0",
"version": "1.0.1",
"description": "Retrieve data and get and set settings for Ecowitt Gateways",

@@ -5,0 +5,0 @@ "main": "src/EWGateway.js",

@@ -8,8 +8,11 @@ const dgram = require('dgram');

class EWGateway {
constructor(ipAddr, port = 45000) {
constructor(ipAddr, port = 45000, debug = false) {
this.ipAddr = ipAddr;
this.port = port;
this.debug = debug;
this.utils = new GWUtils();
const gateway = this;
const buildPacket = (command, data) => {

@@ -40,3 +43,5 @@ var size = (data !== null ? data.length : 0) + 3;

client.connect(port, ipAddr, function () {
console.debug(`Connected. Executing CMD 0x${command.toString(16)}`);
if (gateway.debug) {
console.debug(`Connected. Executing CMD 0x${command.toString(16)}`);
}

@@ -47,3 +52,5 @@ client.write(buildPacket(command, data));

client.on('data', function (buffer) {
console.debug(`Received Data: ${buffer != null ? buffer.length : 0} bytes`);
if (gateway.debug) {
console.debug(`Received Data: ${buffer != null ? buffer.length : 0} bytes`);
}
client.destroy(); // kill client after server's response as to not mix up commands

@@ -57,3 +64,5 @@

client.on('close', function () {
console.debug('Connection closed');
if (gateway.debug) {
console.debug('Connection closed');
}
});

@@ -60,0 +69,0 @@ });