Description
The Simulator plugin is designed to simulate a real hardware device to the greatest extent possible. The current version of the Simulator does not currently support direct hardware events and is limited to simulating hardware events through the Simulator Event Injector Mechanisim.
The hardware definition used by the Simulator is currently hardcoded into the plugin. There is work under development that will separate the hardware definition from the plugin, but that work has yet to be completed. The current hard coded hardware defintion is based on a simple RSA type of system.
Running the Simulator Plugin
The Simulator Plugin is loaded into OpenHPI using the standard plugin configuration in the openhpi.conf file. The plugin is thread safe and multiple instances of the plugin can be loaded (with limitations concerning event injection). See the example openhpi.conf.example file for information on how to specify the Simulator configuration.
The Simulator defines many differents kinds of HPI resources and manages those resources to the extent possible without a real hardware event mechanism.
Event Injection Mechanism
Events can be injected into the Simulator Plugin via a standard Linux queue mechanism. The subdirectory openhpi/plugs/simulator/t2 has a number of examples on how to accomplish event injection. Currently, events need to be injected via a C program but other languages can be used since a standard Linux queue is used. There is an experimental Object Rexx injection mechanism in the t1 subdirectory that can also inject events.
There are some things you need to know before attempting to inject events into the Simulator.
- The userid of the OpenHPI applicationa and the injection program must be the same.
- The current subdirectory of the OpenHPI application and the injection application must be the same.
- Events injected into the Simulator are not limited to resources defined in the Simulator. Any plugin's resources can recieve an event injection.
- If you load multiple instances of the Simulator plugin only one of those instances will create a Linux queue for injection. Since injection requires that you target a specific instance of the plugin via its name, the injection application may need to be modified to reflect the correct plugin instance name.
