diff --git a/src/handler/server/ReadCoils.js b/src/handler/server/ReadCoils.js index e2e16fd..6726bd6 100644 --- a/src/handler/server/ReadCoils.js +++ b/src/handler/server/ReadCoils.js @@ -19,7 +19,7 @@ module.exports = stampit() this.log.debug('handling read coils request.') if (pdu.length !== 5) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x81, 0) buf.writeUInt8(0x02, 1) @@ -35,7 +35,7 @@ module.exports = stampit() var mem = this.getCoils() if (start > mem.length * 8 || start + quantity > mem.length * 8) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x81, 0) buf.writeUInt8(0x02, 1) cb(buf) diff --git a/src/handler/server/ReadDiscreteInputs.js b/src/handler/server/ReadDiscreteInputs.js index 1634def..7d1c35f 100644 --- a/src/handler/server/ReadDiscreteInputs.js +++ b/src/handler/server/ReadDiscreteInputs.js @@ -21,7 +21,7 @@ var handler = stampit() if (pdu.length !== 5) { this.log.debug('wrong pdu length.') - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x82, 0) buf.writeUInt8(0x02, 1) @@ -40,7 +40,7 @@ var handler = stampit() if (start > mem.length * 8 || start + quantity > mem.length * 8) { this.log.debug('wrong pdu length.') - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x82, 0) buf.writeUInt8(0x02, 1) diff --git a/src/handler/server/ReadHoldingRegisters.js b/src/handler/server/ReadHoldingRegisters.js index 7f6485c..c2543f1 100644 --- a/src/handler/server/ReadHoldingRegisters.js +++ b/src/handler/server/ReadHoldingRegisters.js @@ -21,7 +21,7 @@ module.exports = stampit() if (pdu.length !== 5) { this.log.debug('wrong pdu length.') - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x83, 0) buf.writeUInt8(0x02, 1) @@ -40,7 +40,7 @@ module.exports = stampit() if (byteStart > mem.length || byteStart + (quantity * 2) > mem.length) { this.log.debug('request outside register boundaries.') - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x83, 0) buf.writeUInt8(0x02, 1) diff --git a/src/handler/server/ReadInputRegisters.js b/src/handler/server/ReadInputRegisters.js index 52f22c2..cb58b75 100644 --- a/src/handler/server/ReadInputRegisters.js +++ b/src/handler/server/ReadInputRegisters.js @@ -19,7 +19,7 @@ module.exports = stampit() this.log.debug('handling read input registers request.') if (pdu.length !== 5) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x84, 0) buf.writeUInt8(0x02, 1) @@ -36,7 +36,7 @@ module.exports = stampit() var mem = this.getInput() if (byteStart > mem.length || byteStart + (quantity * 2) > mem.length) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x84, 0) buf.writeUInt8(0x02, 1) diff --git a/src/handler/server/WriteMultipleCoils.js b/src/handler/server/WriteMultipleCoils.js index 9c0e369..eb5b665 100644 --- a/src/handler/server/WriteMultipleCoils.js +++ b/src/handler/server/WriteMultipleCoils.js @@ -19,7 +19,7 @@ module.exports = stampit() this.log.debug('handling write multiple coils request.') if (pdu.length < 3) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x8F, 0) buf.writeUInt8(0x02, 1) @@ -37,7 +37,7 @@ module.exports = stampit() // error response if (start > mem.length * 8 || start + quantity > mem.length * 8) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x8F, 0) buf.writeUInt8(0x02, 1) diff --git a/src/handler/server/WriteMultipleRegisters.js b/src/handler/server/WriteMultipleRegisters.js index a274292..039de34 100644 --- a/src/handler/server/WriteMultipleRegisters.js +++ b/src/handler/server/WriteMultipleRegisters.js @@ -19,7 +19,7 @@ module.exports = stampit() this.log.debug('handling write multiple registers request.') if (pdu.length < 3) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x90, 0) buf.writeUInt8(0x02, 1) @@ -33,7 +33,7 @@ module.exports = stampit() var byteCount = pdu.readUInt8(5) if (quantity > 0x007b) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x90, 0) buf.writeUInt8(0x03, 1) diff --git a/src/handler/server/WriteSingleCoil.js b/src/handler/server/WriteSingleCoil.js index 68a42b3..9171579 100644 --- a/src/handler/server/WriteSingleCoil.js +++ b/src/handler/server/WriteSingleCoil.js @@ -19,7 +19,7 @@ module.exports = stampit() this.log.debug('handling write single coil request.') if (pdu.length !== 5) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x85, 0) buf.writeUInt8(0x02, 1) @@ -31,7 +31,7 @@ module.exports = stampit() var value = !(pdu.readUInt16BE(3) === 0x0000) if (pdu.readUInt16BE(3) !== 0x0000 && pdu.readUInt16BE(3) !== 0xFF00) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x85, 0) buf.writeUInt8(0x03, 1) diff --git a/src/handler/server/WriteSingleRegister.js b/src/handler/server/WriteSingleRegister.js index 00697b0..1f8e687 100644 --- a/src/handler/server/WriteSingleRegister.js +++ b/src/handler/server/WriteSingleRegister.js @@ -19,7 +19,7 @@ module.exports = stampit() this.log.debug('handling write single register request.') if (pdu.length !== 5) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x86, 0) buf.writeUInt8(0x02, 1) @@ -36,7 +36,7 @@ module.exports = stampit() var mem = this.getHolding() if (byteAddress > mem.length) { - var buf = Buffer.allocUnsafe(2) + let buf = Buffer.allocUnsafe(2) buf.writeUInt8(0x86, 0) buf.writeUInt8(0x02, 1)