Skip to content

Conversation

@ad3154
Copy link
Member

@ad3154 ad3154 commented Sep 26, 2025

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

  • The VT version is determined by the response to the "Get Memory" message. Previously we were only sending the "Get Memory" message once at least one object pool was added. Now, we always request 0 bytes early in the connection process to ascertain the VT server's version.
  • I added a callback that can be set by the user by calling set_on_ready_for_object_pool_callback on 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 call set_object_pool or register_object_pool_data_chunk_callback to 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.

@ad3154 ad3154 self-assigned this Sep 26, 2025
@ad3154 ad3154 added enhancement New feature or request iso: virtual terminal Related to the ISO-11783:7 standard labels Sep 26, 2025
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
@ad3154 ad3154 force-pushed the adrian/vt-client-earlier-version-check branch from cf01769 to 5861d49 Compare September 26, 2025 01:00
@sonarqubecloud
Copy link

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) {
Copy link
Contributor

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?

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request iso: virtual terminal Related to the ISO-11783:7 standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants