![]() |
VR-Vantage 2.2 API Documentation
|
A driver accessory is an interface for executing code when a driver starts.
An accessory is registered with the display engine and can support any driver class that it knows how to interface with. This example accessory installs itself into DtVrlinkDriver objects and prints out the entity state repositories of entities as they are discovered.
When the exampleAccessoryPlugin gets loaded, it's passed a DtDe (display engine). At that point we connect the post initialize signal (which will get emitted after the display engine has been initialized) to the function we want to call, loadAccessory.
When loadAccessory gets called after the display engine is initialized we add our accessory. In this case, it prints out something when entities are discovered.
An accessory has three pure virtual methods that need to be implemented. When it's time to install accessories, the display engine goes through its list of accessors and tries to install each one on every driver. The accessory has a method, isCompatible() that determines if the accessory can be installed on the driver. If so, then it's installed. Later, the accessories are uninstalled from the driver.
Once deemed compatible, the display engine gives the driver to the accessory, which installs itself. From there the accessory can do what it wants. Here, we connect to a signal on the VR-Link driver which causes a DtPrintVisualizer to get created.
VR-Vantage includes pre-built versions of the example plug-in. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.
This example is a plug-in. You can run it by running ./bin/exampleAccessory_stealth.bat (on Windows) or ./bin/exampleAccessory_stealth.sh (on Linux). For more information about running examples, please see Running Applications and Examples.