Skip to content

Library to publish and subscribe Vehicle Signal Specification signals via reliable multicast.

License

Notifications You must be signed in to change notification settings

jack-sanchez/vehicle_signal_distribution

 
 

Repository files navigation

VEHICLE SIGNAL DISTRIBUTION [VSD]

Library to publish and subscribe Vehicle Signal Specification signals via reliab le multicast.

VSD reads a signal specification CSV file, generated from the GENIVI Vehicle Signal Specification project, and provides API calls to set, publish, subscribe, and receive to these signals.

Please see Vehicle Signal Specification project for details on branches, signal structures and attributes.

A signal's value is set and published as two separate operations.

Publishing can be done on an individual signal level, or on a branch level. If a branch is published, the branch and all its children are published in an atomic operation. This allows complex signal structures to be easily transmitted.

Subscriptions can also be done an signal or on a branch level. If a branch is subscribed to, a callback will be made for any signal that is updated under that branch.

Using Vehicle Signal Distribution:

Be sure that you have built and deployed libraries for both dstc and reliable_multicast, as they are dependencies of the vsd project.

VSD currently will produce a shared object to link against, and also compiles two example programs to begin working with the project.

CALL FLOW - PUBLISHER

Below is an outline of how to:

  1. Load a VSS signal descriptor file.
  2. Locate a signal by a VSS signal path.
  3. Set the signal's value.
  4. Publish the signal.

Load VSS signal descriptor file

The VSD system is hosted by a context variable that is setup by the library. In order to initialize VSD, a pointer to a vsd_context_t pointer is provided to vsd_load_from_file() together with the VSS file to load.

vsd_context_t* ctx = 0;
vsd_load_from_file(&ctx, "vss_2.0.0.csv");

The vss_2.0.0.csv file is generated by the VSS project (link in introduction). Please note that the loaded CSV file needs to have signal IDs for branches, not only the signals themselves. To verify if this is the case, check that the second field in the CSV has a number (in quotes) for each line.

Locate a signal by its path

Before a signal can be set, a signal descriptor

res = vsd_find_desc_by_path(ctx, 0, argv[2], &desc);

if (res) {
    printf("Cannot find signal %s: %s\n", argv[2], strerror(res));
    exit(255);
}

if (vsd_elem_type(desc) == vsd_branch) {
    printf("Cannot signal %s is a branch: %s\n", argv[2], strerror(res));
    exit(255);
}

res = vsd_string_to_data(vsd_data_type(desc), argv[3], &val);

About

Library to publish and subscribe Vehicle Signal Specification signals via reliable multicast.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.2%
  • Makefile 1.8%