NOTICE

My involvement with xPL has come to an end. Automation has moved on considerably over the past few years, and it is now possible to buy a stand-alone controller off the shelf for a reasonable price, without having to spend hours writing your own code.

This website is being maintained as a record of my xPL development work up until 2011.

I have released the full source code of all my xPL projects into the public domain. You can download the archive from here.

Mal





Control Your Home
Turn on your heating or perhaps water the garden without leaving your armchair. Unused buttons on the MCE remote control can be assigned to send xPL messages to other Home Automation devices.





External Commands
Don't want to have to turn on the TV to listen to music? Avoid those clunky Media Center menus and control Media Center via your intranet and webpad or PDA. xPLMCE responds to xPL messages to directly control playback of media.





Monitor Media Center Events
xPLMCE broadcasts xPL messages to your network reporting the playback state of Media Center and the details of the current media. This information can be used to turn on a projector, automatically dim the lights when a move starts or to drive a front panel display, for example.






On-Screen Notifications
xPLMCE responds to Caller ID and On-Screen-Display messages sent to it by other xPL applications, poping up a dialog to display the message.

 

 

 

 


  Installation

xPLMCE does not work in isolation. To be useful it needs to be part of an xPL network. The basic software requirements for the network are the xPLHub (which must be installed on every computer running xPL applications), and xPLHal, which is the "brains" of the system. Scripts running under xPLHal read incoming xPL events and send out commands to control other devices.

For example, xPLMCE sends a message when a DVD starts to play. xPLHal can take this and issue commands to dim the room lights to a level suitable for movie watching.

If you just want to experiment, all these applications can be installed directly on the Media Center PC. For serious use in a home automation installation, there should be a server running 24/7 that hosts xPLHal and has the interfaces for X10, ZWave etc connected to it. In that case, all that needs to be installed on the Media Center PC are an xPLHub and the xPLMCE add-in.

Follow the links below to download the applications that you require:

xPLMCE
xPLHub
xPLHal

Important
If you are planning to use xPLMCE with a Media Center Extender, you must install the software for Everyone, as circled in red below.

 

 


  Configuration

A shortcut to the xPLMCE Configure application is installed in your Program Menu under xPL\xPLMCE. Running the program produces the following dialog

You can choose whether to have xPLMCE report the playback current position in a media file. If this option is checked, a media.mptrnspt xPL message will be sent once per second while a media file is playing. If you do not require this information, it is best to uncheck the option to reduce the amount of message traffic.

Unused buttons on the xPL remote control can be assigned to send xPL messages, either directly or by producing a popup menu that can contain up to three buttons, with one xPL message assigned to each, as shown here.

To set this feature up, first click the "Add" button. You will be prompted to press the button you wish to use on the MCE remote control.

Note that most of the buttons on the remote control are already used to trigger activity in Media Center. Since there is no way to block Media Center from receiving these button presses, only unused buttons should be assigned. European users have an advantage here since there MCE remote contains additional buttons for teletext, including the four coloured buttons, which are not used by Media Center.

Once a button has been chosen, a dialog appears allowing you to edit the activities associated with it. This same dialog is also produced by selecting on an existing command and clicking the Properties button on the main Configure dialog.

Use the radio buttons to choose between using the remote control to trigger a popup menu or sending a single xPL message without any on-screen activity or other interruption. Once you have chosen the type of event to trigger, click the Edit button.

If a single message was chosen, a screen will appear allowing you to define the xPL message to be sent.

The screenshot shows the dialog as it might look when filled with a complete xPL message (in this case using the X10 schema to turn on a light). Details of all the xPL message schemas can be found on the xPL Wiki.

If the popup dialog was selected, a screen will appear with boxes where you can enter the labels for the buttons on the popup. Clicking on the associated Edit button will take you to the xPL message editor screen, where you can specify the xPL message that should be sent when that popup menu button is pressed.

When you have finished defining your configuration, clicking "Save and Exit" will save the configuration to a file called config.xml in the application's installation folder.

 

 


  Operation

The operation of xPLMCE is entirely concerned with the sending and receiving of xPL messages.

Sending commands to Media Center.
For xPLMCE to respond to commands, the xPL messages must be specifically targeted to it. Messages with a target=* are ignored. xPL addresses are of the form "vendor-device.instance". For xPLMCE, the vendor and device are "mal" and "mce" respectively. Usually the instance name can be modified, but this is not supported in xPLMCE, because it consists of several components that cannot be configured in xPLHal and need to assume what the target address of the main xPLMCE application will be. The instance is therefore derived automatically, using the computer name, except when running as a remote client (such as a media center extender), where the default user name is used instead. The complete address is displayed in xPLHal.

Media Playback
xPL commands to control media playback use the media.basic schema. The schema uses the concept of "Media Players", where each player can be responsible for a different class of media. xPLMCE reports Media Center as having five different media players - Audio, Video, Photo, TV and Radio.

Messages should be targeted to the appropriate player for the media. Audio covers both streaming audio from a network share, from shoutcast stream or playing directly from a CD drive. Video supports playback of pre-recorded video files (including DVD data from a hard drive) as well as playback from a DVD drive, while the TV player is only concerned with live TV.

Note: At this stage there is no xPL support for recording live TV, because recording commands in Media Center have to be programmed via the EPG, and cannot be started and stopped directly.

An example message is shown below. This message will cause the audio player to start playing the mp3 file, with the specified visualization. Note: The visualization elements are a Media Center specific extension to the schema (and are therefore not mentioned in the official schema definition). The names used must be separated by a colon and are case sensitive (this is a Media Center restriction that cannot be avoided).


xpl-cmnd
media.basic
{
command=queue
mp=audio
url=c:/music/rock - pop/muse/absolution/08 - Hysteria.mp3
playnow=true
visualization=Battery:Randomization
}

On screen notifications
Aside from the media schema, xPLMCE also responds to two other kinds of message - cid.basic and osd.basic. These message schemas are used for Caller ID and On-Screen-Display notifications respectively.

Caller ID messages are always trigger messages rather than commands, and do not need to be targeted explicitly at xPLMCE. When a Caller ID message is received, the phone number is displayed in a popup dialog until cancelled using the remote. If you do not want caller id messages to trigger popups, this feature can be unchecked in the Configure application.

If using the Meteor Caller ID system, the popup will only appear when the message body contains ccs=cid or ccs=nocid, as described in the cid.meteor schema.

OSD messages are displayed if received in a command message specifically targeted at xPLMCE. Media Center does not support a true On-Screen-Display, so these messages are displayed in a popup dialog instead. For this reason, only osd.basic messages with command=write are accepted, and the entire text element is displayed, with any row and column elements ignored.

Messages sent by Media Center
Aside from the user-defined messages triggered via the remote control and popup menu, all messages broadcast by xPLMCE are status or trigger messages from the media schema family. Status messages are sent only in response to incoming media.request commands. Trigger messages are sent when there is a change in the status of Media Center. To minimise the size of individual messages, three different triggers messages are used:

media.mpmedia:
sent when a new media file is started (provides the album, artist, track etc). Note that due to shortcomings in Media Center, no media information is available when playing DVD files.

media.mptrnspt:
sent when the playback mode changes (play, stop, pause, forward, rewind),
or when the position in the media changes (if position updates were enabled during configuration),
or when a DVD starts a new chapter.

media.mpconfig:
sent when the media player configuration changes (volume, mute, etc).

For example, to dim the lights when a movie starts, xPLHal would only need to watch for media.mptrnspt messages containing both mp=video and command=play.

These messages are sent regardless of whether the Media Center activity was triggered by the user via the Media Center menus or by an external xPL command.

 

 


  Technical Notes

The xPLMCE package installs four components -

xPLMCE.dll - a C# .NET assembly that provides the core functionality of the add-in. It receives Media Center events from xPLMSAS and turns them into xPL messages that are broadcast over the network. xPLMCE receives remote control events from xPLMCEInput, sending xPL messages or displaying a popup menu as appropriate. xPLMCE also listens for xPL commands, and triggers Media Center activity in response to them.

xPLMSAS.dll - a C++ COM component that uses Media Center's "Media State Aggregation Service" to track and report the status of Media Center. Messages are passed to xPLMCE using a modified form of the xPL protocol, which are sent only to the local machine, rather than broadcast to the whole network as is usual with xPL. This is to prevent excess network traffic. Note that if you are running xPLHal on the Media Center PC, xPLMSAS will show up as MCESTAT in its list of xPL applications.

xPLMCEInput.exe - a C++ Windows application that monitors the Media Center remote control, setting global events when any of the buttons that trigger xPL activities have been pressed. This application is spawned by the xPLMCE addin and runs hidden, with no visible window or taskbar entry.

Configure.exe - An MFC application used to configure xPLMCE. Most xPL applications can be configured via xPLHal. Since xPLMCE contains some non-xPL components, this is not possible, so instead the entire configuration is managed through this stand-alone application.