Introduction to the LinuxMCE Architecture
LinuxMCE includes hundreds of scripts and utilities that were forked from Pluto's linux distribution in 2006. Pluto wrote these to create a 'turn it on and press play' appliance, rather than a traditional software application.
This guide explains the architecture of the main C++ code. There is Doxygen documentation for all the scripts and utilities that make up the pluto distribution here. We'll create our own Doxygen documentation soon...
LinuxMCE uses a modular architecture. The heart of LinuxMCE, the 'main application' DCERouter is nothing but a general-purpose message router. It has absolutely no code relating to any of LinuxMCE's functionality--it just relays messages between "Devices". The functionality of LinuxMCE is entirely in separate programs (aka "Devices") which all run independently and communicate with each other by passing messages through DCERouter over sockets. There can be hundreds of these "Devices" in a smart home, that do all sorts of things. As shown in the diagram below, many of LinuxMCE's devices are actually 'wrappers' we have written for existing open source programs to allow them to work together seamlessly in a LinuxMCE system. For example, the wrapper for Asterisk that sends event messages to DCERouter whenever a phone call comes in, and receives command messages when it is time to place a call. How the wrapper communicates with the open source program depends on that project. For example, the Asterisk wrapper communicates with Asterisk over a socket. It is really a translator converting messages from its socket connection with DCERouter into messages from its socket connection with Asterisk. The wrapper for the Xine media player links in Xine's own library and calls Xine functions directly, while the wrapper for MythTV communicates via a special telnet interface.
[Need diagram of software modules here].
Since there are literally thousands of home automation components and pieces of A/V equipment that require controlling with serial port, USB and Ethernet LinuxMCE communicates with these using GSD. It's fast and simple to use and it can be used to support lighting control systems, climate and pool systems, external devices like IR blasters, cameras, etc.
Programmer's Guide Sections
- Why should I use the LinuxMCE platform for my project?
- Developing a DCE Device
- ZWave implementation
- AVWizard specifications
- Window manager
- Window controller
- X11 locking
- X11 pointer shapes
- LinuxMCE Plugins
- I want my software to run on LinuxMCE but it isn't open source
- GSD - Ruby codes
- Apex Destiny 6100 (alarm panel)
The goal of LinuxMCE is to create a Linux distribution that presents a common user interface and orchestrates all the numerous OSS applications that make up a home PC in the 21st century home. To the end user it should appear to be one single application with a single user interface. Unlike Pluto, LinuxMCE's primary mission is not to be a platform for developing "smart home modules that all work together"; but, we hope to benefit from this work at Pluto and elsewhere by making sure our DCERouter is 100% compatible with theirs. We are trying to do something bigger than an Asterisk distro or a MythTV distro, we're combining many applications into an integrated whole. But we're doing this the UNIX way, using a messaging protocol over sockets so that these applications can still be developed independently and added and removed from LinuxMCE as desired by the end user.
The functionality in LinuxMCE is provided by a variety of open source projects and it's our mission to make them work together. LinuxMCE uses the GPL home automation engine and UI front-end developed by Pluto, the GPL PVR developed by the MythTV folks, the GPL phone system Asterisk originally developed by Mark Spencer at Digium, the GPL Xine program, etc. All of these have disparate histories and development roadmaps, the DCERouter combines them into a whole, but the wrappers need to be kept up to date as these applications develop and hopefully we can get some of these applications to talk directly to the DCERouter in the future.
The DCE message router and the controllers for the various applications are modular by nature which means you can just modify small module at a time and compile and test it in the system quickly. Right now (10-10-07), the build system is a little cumbersome because we inherited it from a commercial company that paid their developers and could expect them to learn a custom build system, but one of the immediate development goals is to switch to a more traditional OSS build system so any developer can just jump in and start making changes using a simple "make; sudo make install" for the whole distribution or just one program or library within the whole.
So the DCE Router lets applications communicate, so what?
Say you set up a LinuxMCE system in your living room and want the lights to dim when you start watching a movie. With a regular Linux distribution, without the DCERouter, you would need to write a launch script for Xine that tells MisterHouse to dim the lights on entry and restore them on exit. If you want this to be delayed so that when you exit one movie and enter another shortly thereafter the lights don't dim, the script becomes rather complicated. You will need to adapt the script for watching TV in MythTV and any other media application you want to use. With Linux MCE you just listen for the the start and stop DCE events in a small module and send out DCE events for the light control. Still for this one task you might just write a script. But you might also want to notify yourself of a call and pause the media player based on who is calling. You can do this with Asterisk and MythTV without a DCERouter, but you need to learn about how Asterisk handles events and MythTV handled OSD notifications; and, you need to write a notifier for Xine because it doesn't have built in notifications. With LinuxMCE you only have to learn a single interface, DCE, and you simply intercept the DCE message sent from Asterisk then send a DCE message out to the Orbiter UI and send out a pause DCE message to all media players. This means that these tasks can all be handled with just some knowledge of the DCE rather than learning a bunch of protocols and API's. The "Devices" handle the translation of DCE messages to the various API's and remote control protocols of all the applications involved.
Some of this can even be done by an ordinary users without any programming knowledge by just hooking up events using the tools that Pluto wrote, but for programmers this means you don't need domain knowledge of all the different applications you wish to integrate, you just need to learn about DCE messages, and optionally about the Orbiter overlay UI.
DCE does what DBUS and many other protocols are supposed to do. But it works now. The wrappers for various applications that we inherited from Pluto mean that applications don't need to commit to DCE or DBUS or another protocol for LinuxMCE to communicate with them. If they do, it's less work for us maintaining the wrappers, but DCE messages work today.