******************************************
Integrating Application-specific Behavior
******************************************

The existing set of supported devices and possible configurations is
often enough to get simple meaningful applications up and running.
However, the real strength of Dia is as a launching point for adding
your own additional application-specific device support and business
logic.

There are many ways that Dia can be extended and the best approach may
be unclear.  While you are free to take the approach that works best
for your solution, here are some guidelines that may help make design
choices that work well in the system.

Devices
--------------------

The core role of device drivers in Dia is to populate the channel
database.  Data populated in the channel database may be the result of
interaction with a real physical device, or through logical
manipulation of data such as that performed by the
:doc:`/user/devices/transforms` driver.

If you have a new unsupported device that you wish to collect data
from, creating a device driver to manage that device is required.  As
demonstrated by the *transforms* driver, you may also consider using
a device driver to create new and unique views into the data in your
system.  Logical devices can be created to take data from multiple
channels in the system and manipulate it to generate new values useful
for your application, to filter or qualify the data from other devices
as well.

Services
--------------------

Services are probably the least used module that the system provides.
Since they do not deal with populating or presenting data in the
system, they tend to be a fallback that may be appropriate when you
wish to consume and act on data locally in the system.  The
:doc:`/user/services/watchdog_service` module is a good example of this type of
use.  It provides the ability to perform validation that ensures the
correct operation of the device and its operation is not reliant on
communicating any characteristic of the system externally.


Presentations
--------------------

Presentations are responsible for collecting and presenting
information from the channel database.  As such, they are the ideal
location for most of the higher level decisions that your application
may wish to perform locally.  

The existing presentations are very heavily focused on the delivery of
information from the channel database, either through interaction
directly with a user, or through simple rules.  Due to your knowledge
of the needs and constraints of when and how information needs to flow
through the total system, customization or creation of presentations
provides the best single point of modification to the system to pull
all the pieces of your unique needs together in one place.

