Cloud-Automation / node-modbus

Modbus TCP Client/Server implementation for Node.JS
466 stars 174 forks source link

V3 Server - F16: Write Multiple Registers #189

Closed RenanGarcia closed 6 years ago

RenanGarcia commented 6 years ago

Request 1: F16, Address: 0, values: 0xD903 (1 registers)

Inicialization: 
holding: Buffer.alloc(12, 0x00)

on('writeMultipleRegisters'...     
    server.holding: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00>
on('postWriteMultipleRegisters'... 
    expected:       <Buffer d9 03 00 00 00 00 00 00 00 00 00 00>
    server.holding: <Buffer d9 03 d9 00 00 00 00 00 00 00 00 00>

Request 2: F16, Address: 0, values: [ 0xD903, 0xD903 ] (2 registers)

Inicialization: 
holding: Buffer.alloc(12, 0x00)

on('writeMultipleRegisters'...     
    server.holding: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00>
on('postWriteMultipleRegisters'... 
    expected:       <Buffer d9 03 d9 03 00 00 00 00 00 00 00 00>
    server.holding: <Buffer d9 03 d9 03 d9 00 00 00 00 00 00 00>

Request 3: F16, Address: 4, values: [ 0xD903, 0xD903 ] (2 registers)

Inicialization: 
holding: Buffer.alloc(12, 0x00)

     RangeError: Out of range index
      at Buffer.fill (buffer.js:836:11)
      at TCPResponseHandler.handle (src/tcp-server-response-handler.js:222:30)
      at ModbusTCPClient._onData (src/tcp-server-client.js:39:29)
      at Context.<anonymous> (test/tcp-server.test.js:367:14)