Daxbot / node-canopen

CANopen implementation for NodeJS
MIT License
32 stars 11 forks source link

Writes to SDO server #2

Closed SibertDekimo closed 4 years ago

SibertDekimo commented 4 years ago

Whenever a client writes SDO data to a server, I would like to act on this new data. I cannot find any provisions in the code to do this. I have implemented a callback in the SDO server myself, but I was wondering if there is a supported way to do this, without continiously checking the object dictionary for changes?

Thanks in advance!

wilkinsw commented 4 years ago

Having a callback for an SDO makes sense to me, I'll add one

wilkinsw commented 4 years ago

A signal is now emitted from the Device object whenever a SDO transfer results in an update to the local object dictionary. The param will be entry that was updated, so you should be able switch off of entry.name or entry.index if you want to target a specific data object.

If this does not work for your use case feel free to reopen the issue and make a pull request with your solution!