"Add UDP receive callback feature and example for implicit messaging event processing #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR - Add UDP callback feature for implicit messaging
Use Case
This PR adds support for user-defined UDP receive callbacks in the EEIP Python package, enabling applications to process implicit messaging events (such as sensor triggers) from a PLC in real time. The main use case is to allow a client application to react to sensor data sent by a PLC using EtherNet/IP implicit messaging, process the data, and optionally send an acknowledgment or response back to the PLC.
Changes Made
Added the ability to register a user-defined callback function via set_udp_receive_callback(). This callback is invoked automatically whenever a UDP implicit message is received from the PLC.
Added examples/example_udp_callback.py, which demonstrates how to use the callback mechanism. The example includes a MessageProcessor class that processes incoming UDP data and sends an acknowledgment back to the PLC when a sensor event is detected.
When a callback is set, automatic UDP sending is disabled to allow the user full control over outgoing UDP packets in response to received data.