SerafinTech / ST-node-ethernet-ip

Connect to PLC controllers with Node and Ethernet/ip
MIT License
38 stars 19 forks source link

Append data to getAttributeSingle #64

Open greg9504 opened 6 months ago

greg9504 commented 6 months ago

For explicit messages sent using getAttributeSingle it would be useful to add an optional parameter with a buffer. This buffer is appended to the message. Some ethernet/IP devices require additional information beyond the class/instance/attribute. See this issue for a description for such a case for a SEW drive https://github.com/SerafinTech/ST-node-ethernet-ip/issues/62 Code/documentation change for PR is here: https://github.com/greg9504/ST-node-ethernet-ip/tree/ExplicitMsgWithData

SerafinTech commented 5 months ago

for connecting to a device for explicit messaging that is not a PLC I put Buffer.alloc(0) as the slot number. This will blank out the slot part of the path.

controller.connect('192.168.1.1', Buffer.alloc(0), false)

The devices I have tested will throw a error if you put a 0 for slot number

and I pushed your PR with a little change. I didn't add any documentation yet.