Display example README
To download the code of this example please refer to the CVS repository at $CIAO_ROOT/DAnCE/examples/Display
.
Example Description
This example is an imaginary car
(software) instrument assembly which updates the display of
current coordination of the airplane periodically. It consists of
the following three components:
- The RateGen component sends periodic
Pulse events to consumers according to the
rate specified in its attribute Rate, it
allows a client (CORBA client controller) to
start and stop the rate generating event.
- The GPS component interacts with a GPS
hardware. When the GPS component receives
Refresh events from
RateGen, it queries the GPS hardware and updates the internal cached
coordination (so that the current location can be read by accessing the
MyLocation interface) and generates an event
on its Ready port to inform the event
consumers that a new GPS reading is available.
- The NavDisplay component displays the
current location of the vehicle on the windshield. When a
NavDisplay receives an event notifying the
availability of new data on its Refresh port,
it will acquire the current location of the vehicle by querying the interface
connected to the GPSLocation receptacle.
- The NavDisplayGUI directory contains
implementations for a NavDisplay with
graphical interface. To use this graphical interface you need to install qt
libraries and have qt enabled (qt = 1) in your
$ACE_ROOT/bin/MakeProjectCreator/config/global.features.
In some Linux distributions qt is installed by default. There is a
non-commercial version of qt libraries for Windows
here and more information about qt
here.
- If you just want to run the application, just go to the last section of
this page.
The files you will find.
1. The interfaces,
data types and exceptions used by the components of this application are
specified in the
HUDisplay.idl
file, placed in this example root directory ($CIAO_ROOT/examples/Display_Base).
This is a IDL2 file and uses the familiar CORBA data types. The lib generated
from HUDisplay.idl is linked to all the components of this example.
2. mpc files for each of the components
are available in the components directories. We use the MPC
to generate makefiles and Visual C++ project/solutions files for
all ACE,
TAO and
CIAO libraries.
3. idl and cidl files for each component are placed in components directory.
4. The _exec.h
and _exec.cpp
files are the actual implementation of the components.
5. The NavDisplayGUI_exec
directory:
The NavDisplayGUI_exec.cpp
is just an executor version
for NavDisplay. In NavDisplayGUI_exec directory you'll find only the the
NavDisplayGUI_exec (and files for the GUI), which can be deployed with the
NavDisplay stub and servant. So, if you deploy the NavDisplay component
using NavDisplay_exec you'll be able to see the application running in the shell
you triggered the NodeDaemon, and if you deploy the NavDisplay component using
NavDisplayGUI_exec
a graphical interface will show you a red dot moving over a
map according to the location being generated by GPS component when you start
the application. Notice that the NavDisplayGUI.mpc
file includes qt, used for
graphical interface. You must give the right location of qt libraries in your mpc file.
6. The controller
:
The RateGen
component is started and stopped by the controller
, a CORBA client application.
The controller
source is in RateGen
directory, so the RateGen.mpc
file also
include instructions for the controller
build.
Make
Go to the directory $CIAO_ROOT/DAnCE/examples/Display
and do:
$ACE_ROOT/bin/mwc.pl
(use -type option if you are using a compiler/IDE other than gnuace -which by default generates GNU makefiles)
For example, using $ACE_ROOT/bin/mwc.pl -type vc71
if you are using Visual C++ 7.1 IDE.
Assemble
Now we can step forward to build the assembly.
In the descriptor subdirectory, you'll find a XML descriptor file that describes your deployment plan, the flattened_deploymentplan.cdp:
This file declaratively specifies how the component assembly is
constructed. Specifically, it specifies the component types, component
instances, component connections and implementation artifact
descriptions.
Please make sure that the Modified_Deployment.xsd and XMI.xsd files are in the
Display/descriptors directory.
The former file could be found in $CIAO_ROOT/docs/schema directory.
Note: Creating the deployment plan descriptor is a tedious and error-prone job, you can download CoSMIC to assist you in this step.
Run
Finally you are ready to test the application you have made. From different shells in $CIAO_ROOT/DAnCE/examples/Display/descriptors/
directory:
- Start NodeManagers (NodeDameon) by running
basicNodeDaemons.pl
- Start the execution manager:
$CIAO_ROOT/DAnCE/ExecutionManager/Execution_Manager -o EM.ior -i NodeManagerMap.dat
The NodeManagerMap.dat file describes the deployment daemons CIAO's Execution_Manager
will contact to instantiate ComponentServer's, home's, and component
instances. Each line specify the name of a installation
"destination" and the corresponding IOR for
the CIAO_Daemon. For example, the NodeManagerMap.dat contains:
AirFrameDevice corbaloc:iiop:localhost:10000/NodeManager
TimerDevice corbaloc:iiop:localhost:12000/NodeManager
You can copy and modify the copy to deploy the components in various
different locations to let the application truely "distributed".
Remember to start up the Execution_Manager using the
revised .dat file you created, and start up the CIAO_Daemon according to the specification.
- NOTE: As one can see, we use the "NodeManagerMap.dat" file to instruct the
Execution_Manager how to find the endpoint of each individual NodeManager (i.e., Node Daemon) where
component(s) will be deployed, so this is non-standard. We plan to use Naming Service to do this in the future.
- Start the plan_launcher:
$CIAO_ROOT/DAnCE/Plan_Launcher/plan_launcher -p flattened_deploymentplan.cdp -k file://EM.ior
After this, components should be deployed successfully.
- The Assembly_Manager is instructed to write the IOR of the RateGen
component to a file called "rategen.ior" in this
directory. You will then need to use a controller program in a
separate shell window to switch on/off the Rate Generator.
Go to the $CIAO_ROOT/DAnCE/examples/Display/descriptor directory and run the
$CIAO_ROOT/DAnCE/examples/Display/RateGen/controller
-o
to start the application. To stop the application run $CIAO_ROOT/DAnCE/examples/Display/RateGen/controller
-f
Email: ciao-users@cse.wustl.edu