-
-
Notifications
You must be signed in to change notification settings - Fork 81
VT Client: Add a way to select VT object pool(s) to use based on VT server version #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This change makes it possible for a consumer of the library to choose at runtime which object pool(s) to use based on the version of the VT server.
…bject pools at runtime based on the VT server version
cf01769 to
5861d49
Compare
|
| virtualTerminalClient = std::make_shared<isobus::VirtualTerminalClient>(TestPartnerVT, TestInternalECU); | ||
| virtualTerminalClient->get_vt_soft_key_event_dispatcher().add_listener(handle_softkey_event); | ||
| virtualTerminalClient->get_vt_button_event_dispatcher().add_listener(handle_button_event); | ||
| virtualTerminalClient->set_on_ready_for_object_pool_callback([&version3pool, &version4pool, objectPoolHash](isobus::VirtualTerminalClient::VTVersion version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a (void)version to suppress the unused parameter warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, I'd say we remove the "version" parameter of the callback altogether. There are many more requirements possible as can be seen in #376. We can just let the application access those via more member functions like get_connected_vt_version() does for the version
|



Describe your changes
This change enables a consumer of our VT client interface to dynamically choose which object pool(s) they want to use by looking at the version reported by the VT server in an event-driven way.
How it works
set_on_ready_for_object_pool_callbackon the VT Client. Once the server's version has been learned, if no object pools have been set by the user for upload, we will call this callback (if its valid). Inside this callback, the user can inspect the version of the VT server (which is passed in) and callset_object_poolorregister_object_pool_data_chunk_callbackto register any number and order of object pools they wish.The user remains free to use the library exactly the same way as before as well. This enhancement is entirely optional to utilize. The actual number of changes to the library itself are pretty minimal to support this.
How has this been tested?
I've added a new example application to the repo that extends the original VT client example to demonstrate this use-case. I validated that when this example is run, two separate pool transfers occur to a VT with version 6 (in my case) and everything seems to work as intended.