grid-x / modbus

BSD 3-Clause "New" or "Revised" License
78 stars 26 forks source link

Expose packager and transporter structs for use with NewClient2 #59

Closed andig closed 1 year ago

andig commented 1 year ago

Fix https://github.com/grid-x/modbus/issues/56

This PR exposes packers and transporters. It does not modify existing api:

Notes on implementation:

TODO

Alternatives:

Add a Clone() method that clones the entire client handler, sharing the underlying transport https://github.com/grid-x/modbus/pull/70.

Maybe think about something like:

// WithPackager returns a new TCPClientHandler with given packager.
func (h *TCPClientHandler) WithPackager(p TCPPackager) {
    h.TCPPackager = p
}