omron-fins
Advanced tools
Comparing version 0.5.0-beta.0 to 0.5.0-beta.1
module.exports = { | ||
"env": { | ||
"commonjs": true, | ||
"es2021": true, | ||
"node": true | ||
env: { | ||
commonjs: true, | ||
es2021: true, | ||
node: true, | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 12 | ||
extends: 'eslint:recommended', | ||
parserOptions: { | ||
ecmaVersion: 12, | ||
}, | ||
"rules": { | ||
} | ||
rules: { | ||
indent: ['error', 4], | ||
}, | ||
}; |
@@ -9,5 +9,5 @@ | ||
module.exports.DefaultOptions = { | ||
timeout: 2000, | ||
max_queue: 50, | ||
protocol: "udp" | ||
timeout: 2000, | ||
max_queue: 50, | ||
protocol: "udp" | ||
}; | ||
@@ -183,6 +183,6 @@ | ||
switch (memoryArea) { | ||
case "C": | ||
return memoryAddress+ 0x8000; | ||
default: | ||
return memoryAddress; | ||
case "C": | ||
return memoryAddress+ 0x8000; | ||
default: | ||
return memoryAddress; | ||
} | ||
@@ -235,6 +235,6 @@ } | ||
switch (memoryArea) { | ||
case "C": | ||
return memoryAddress + 0x8000; | ||
default: | ||
return memoryAddress; | ||
case "C": | ||
return memoryAddress + 0x8000; | ||
default: | ||
return memoryAddress; | ||
} | ||
@@ -268,6 +268,6 @@ } | ||
switch (memoryArea) { | ||
case "C": | ||
return memoryAddress + 0x0800; | ||
default: | ||
return memoryAddress; | ||
case "C": | ||
return memoryAddress + 0x0800; | ||
default: | ||
return memoryAddress; | ||
} | ||
@@ -300,6 +300,6 @@ } | ||
switch (memoryArea) { | ||
case "C": | ||
return memoryAddress + 0x0800; | ||
default: | ||
return memoryAddress; | ||
case "C": | ||
return memoryAddress + 0x0800; | ||
default: | ||
return memoryAddress; | ||
} | ||
@@ -306,0 +306,0 @@ } |
@@ -78,19 +78,19 @@ const dgram = require('dgram'); | ||
switch (self.protocol) { | ||
case 'udp': | ||
/** @type {dgram.Socket} */ self.socket = dgram.createSocket('udp4'); | ||
self.socket.on('message', receive); | ||
self.socket.on('listening', listening); | ||
self.socket.on('close', close); | ||
self.socket.on('error', error); | ||
self.socket.connect(self.port, self.host) | ||
// self.socket.send("\n", 0, 1, self.port, self.host);//cause `listening` to be triggered | ||
break; | ||
case 'tcp': | ||
/** @type {net.Socket} */ self.tcp_socket = net.createConnection(self.port, self.host, tcp_init_listen_handler); | ||
self.tcp_socket.on('data', tcp_init_receive); | ||
self.tcp_socket.on('close', close); | ||
self.tcp_socket.on('error', error); | ||
break; | ||
default: | ||
throw new Error('invalid protocol option specified', options.protocol, 'protocol must be "udp" or "tcp"'); | ||
case 'udp': | ||
/** @type {dgram.Socket} */ self.socket = dgram.createSocket('udp4'); | ||
self.socket.on('message', receive); | ||
self.socket.on('listening', listening); | ||
self.socket.on('close', close); | ||
self.socket.on('error', error); | ||
self.socket.connect(self.port, self.host) | ||
// self.socket.send("\n", 0, 1, self.port, self.host);//cause `listening` to be triggered | ||
break; | ||
case 'tcp': | ||
/** @type {net.Socket} */ self.tcp_socket = net.createConnection(self.port, self.host, tcp_init_listen_handler); | ||
self.tcp_socket.on('data', tcp_init_receive); | ||
self.tcp_socket.on('close', close); | ||
self.tcp_socket.on('error', error); | ||
break; | ||
default: | ||
throw new Error('invalid protocol option specified', options.protocol, 'protocol must be "udp" or "tcp"'); | ||
} | ||
@@ -671,3 +671,3 @@ | ||
*/ | ||
FinsClient.prototype.command = function (commandCode, params, opts, tag) { | ||
FinsClient.prototype.command = function (commandCode, params, opts, tag) { | ||
/** @type {FinsClient}*/ const self = this; | ||
@@ -1093,21 +1093,21 @@ const { options, callback } = _normaliseCommandOptions(opts); | ||
switch (responseCommandCode) { | ||
case CPU_UNIT_STATUS_READ: | ||
processResult = _processStatusRead(buf, rinfo, sequenceManager); | ||
break; | ||
case CPU_UNIT_DATA_READ: | ||
processResult = _processCpuUnitDataRead(buf, rinfo, sequenceManager); | ||
break; | ||
case MEMORY_AREA_READ: | ||
processResult = _processMemoryAreaRead(buf, rinfo, sequenceManager); | ||
break; | ||
case MEMORY_AREA_READ_MULTI: | ||
processResult = _processMultipleMemoryAreaRead(buf, rinfo, sequenceManager); | ||
break; | ||
case MEMORY_AREA_WRITE: | ||
case MEMORY_AREA_FILL: | ||
case MEMORY_AREA_TRANSFER: | ||
processResult = _processDefault(buf, rinfo, sequenceManager); | ||
break; | ||
default: //MEMORY_AREA_WRITE MEMORY_AREA_FILL MEMORY_AREA_TRANSFER | ||
throw new Error(`Unrecognised response code '${responseCommandCode}'`); | ||
case CPU_UNIT_STATUS_READ: | ||
processResult = _processStatusRead(buf, rinfo, sequenceManager); | ||
break; | ||
case CPU_UNIT_DATA_READ: | ||
processResult = _processCpuUnitDataRead(buf, rinfo, sequenceManager); | ||
break; | ||
case MEMORY_AREA_READ: | ||
processResult = _processMemoryAreaRead(buf, rinfo, sequenceManager); | ||
break; | ||
case MEMORY_AREA_READ_MULTI: | ||
processResult = _processMultipleMemoryAreaRead(buf, rinfo, sequenceManager); | ||
break; | ||
case MEMORY_AREA_WRITE: | ||
case MEMORY_AREA_FILL: | ||
case MEMORY_AREA_TRANSFER: | ||
processResult = _processDefault(buf, rinfo, sequenceManager); | ||
break; | ||
default: //MEMORY_AREA_WRITE MEMORY_AREA_FILL MEMORY_AREA_TRANSFER | ||
throw new Error(`Unrecognised response code '${responseCommandCode}'`); | ||
} | ||
@@ -1114,0 +1114,0 @@ processResult.endCode = processEndCode.endCode; |
@@ -9,3 +9,3 @@ module.exports = SequenceManager; | ||
*/ | ||
function SequenceManager(opts, callback) { | ||
function SequenceManager(opts, callback) { | ||
/** @type {SequenceManager}*/const self = this; | ||
@@ -12,0 +12,0 @@ |
{ | ||
"name": "omron-fins", | ||
"description": "Node.js implementation of the Omron FINS protocol", | ||
"version": "0.5.0-beta.0", | ||
"version": "0.5.0-beta.1", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "author": { |
2225
112845