nimbuscontrols / EIPScanner

Free implementation of EtherNet/IP in C++
https://eipscanner.readthedocs.io/en/latest/
MIT License
233 stars 93 forks source link

IOConnection: Add a callback before data is sent #26

Closed nefethael closed 4 years ago

nefethael commented 4 years ago

This allows to refresh current output assembly buffer before it is sent, for example this way

            ptr->setSendDataListener(
                    [this, id](auto& data)
                        {
                            std::unique_lock<std::mutex> lock(_mutex);
                            data = _map[id].GetBytes();
                        }
            );

Signed-off-by: Vincent Prince vincent.prince.external@saftbatteries.com

atimin commented 4 years ago

Good idea! Thank you!