Closed j3kestrel closed 2 years ago
Please create a pull request. Callbacks dose better.
Hi @lishen2, would you consider the PR I opened? I'm using isotp-c in https://github.com/driftregion/iso14229/ and am encountering the need that @j3kestrel described.
Thanks
Have you considered implementing
isotp_send_can()
,isotp_user_get-ms()
andisotp_user_debug()
as callbacks that are registered as arguments toisotp_init_link()
and stored inIsoTpLink
? This would permit using different instances of the functions for each instance ofIsoTpLink
.In my case, I wish to manage CAN send buffer queue's differently for each
IsoTpLink
instance. I also wanted to pass a pointer my ownprintf()
function instead of writing a wrapper. For this I editedisotp_user.h
to makeisotp_user_debug
a macro that redirected to my function, but I can see cases where the debug console stream from eachIsoTpLink
instance may wish to be handled differently.I see little need for different
isotp_user_get_ms()
instances, but I like the clean implementation of dependency injection and treating this function the same way keeps the pattern uniform.I may implement this for myself. If there were interest I should be able to create a pull request.
I don't have
isotp-c
running yet, but it looks well done. Thank you!