Hardware Reference
In-Depth Information
The concept of a device relates to the protocol in question and allows you to pass the command to an alternate
machine for processing. This is useful in cases where the server cannot be physically located in the best position,
which includes the example given in Chapter 4 where the Computer-to-X10 gateway (such as a CM11) is unable to
communicate with the rest of the appliances because of other electrics suppressing the signal. It can also include
cases where you want to play the music from a machine that isn't the local /dev/dsp device or to control the CD player
in a different machine. It is part of Marple . Consequently, most commands begin with the following:
DEVICE=`$MINBIN/finddev x10 $*`
if [ $? == 0 ]; then
echo $DEVICE
exit 0;
fi
Under the hood, the finddev script looks through the $MINBASE/house/marple/x10/devlist file to discover
how to address the X10 module on the current machine, that is, localhost. The devlist file might appear as follows,
indicating that the module is attached to /dev/ttyS0 :
localhost dev /dev/ttyS0 - -
You will see how this is able to communicate with other machines in the “Marple” section later in this chapter.
Additionally, all Bearskin commands support init as a command argument so that it can prepare temporary log
files, adjust ownership permissions, and launch any daemons as necessary.
Typical Application Abstractions
The currently supported abstractions are held in $MINBASE/bin and include all the necessary functionality. I'll cover
these briefly, pointing out the subtleties as necessary:
homedevice : This is a simple abstraction that invokes heyu (for X10 control) to switch lamps
and appliances on and off and dim lights. Because the arguments are unified between all
Bearskin commands, the invocation of this looks reversed to heyu , making a typical call of
heyu turn bedroom_light on look like homedevice default on bedroom_light .
cdplayer : For those still in love with those shiny plastic discs, this controls the CD player
(with cdcd ) and retrieves its track listing using the cddb-tool package. Because the retrieval
of this data can be quite slow, the track data is temporarily stored in /var/log/minerva so
that it can be queried instantly with commands such as cdplayer default currentname .
mp3player : This is a general-purpose media player that also processes the ID3 tags inside
the MP3 to report the current artist and album with mp3player default artist , for
example. It uses /var/log/minerva to store this information, along with the current process
ID, which allows you to move through the tracks with mp3player default next . It abstracts
mplayer , while making use of mp3info to parse the ID3 tags.
wavplayer : This is a simpler, primarily synchronous, audio player used for general house
alerts using play .
mixer : This adjusts the relative volumes of each channel in the audio mixer, the names
of which have also been abstracted so that user-friendly words such as master , cd , and
recording can be used. It allows you to set the volumes as either a relative or absolute value
between 0 and 100 percent, even when the underlying mixer application doesn't. The current
implementation uses aumix .
Search WWH ::




Custom Search