openenergysolutions / modbus-cpp

Modbus TCP master library in modern C++
https://aegis4ics.github.io/modbus-cpp/
Apache License 2.0
2 stars 0 forks source link

Eliminate session level response handler in favor of poll specific response handlers #7

Closed jadamcrain closed 6 years ago

jadamcrain commented 6 years ago

Not a blocking issue ATM, but recording this here for another iteration. Just a placeholder for future discussion.

I found myself wanting to be able to differentiate which scheduled poll completed/failed/etc. Making this switch will allow context specific handlers for scheduled polls.

emgre commented 6 years ago

The response handler could be registered in the ScheduledRequest class, shouldn't be too difficult. Would you remove the ISessionResponseHandler altogether?

jadamcrain commented 6 years ago

Yeah, I think so. If somebody wants the same action for a set of polls, they can just pass the same response handler to all of them.

In retrospect, I wish opendnp3 had this for polls and only had the global one for unsolicited responses.