mathiask88 / node-snap7

node.js wrapper for snap7
MIT License
162 stars 59 forks source link

Type Error in WriteArea funtion #38

Closed lukas-staab closed 6 years ago

lukas-staab commented 6 years ago

I am using following code to write to DB1 a byte

var snap7 = require('node-snap7');
var s7client = new snap7.S7Client();
s7client.WriteArea(0x84, 1, 2, 1, 0x02, 10);
s7client.ConnectTo('192.168.1.123', 0, 1);
s7client.WriteArea(0x84, 1, 2, 1, 0x02, 10);

Connection can be established successfully but the following error is thrown

  s7client.WriteArea(0x84, 1, 2, 1, 0x02, 10);
            ^

TypeError: Wrong arguments
    at TypeError (native)
    at /var/www/zcr-www/spsconnect.js:18:13

(I already substituted s7client.S7AreaDB for debugging purpose) am I just using it wrong, or is there a bug in the module? Thanks!

mathiask88 commented 6 years ago

The last argument needs to be a node buffer.

lukas-staab commented 6 years ago

Thanks for quick response! Works finde now, may you should add it to the doc :)