CybrDisplay - xPL_Connector driver
xPL Home Automation Protocol Connector
xPL connector information and supported xPL schemas
The xPL connector impliments an xPL device, with VendorID = "mportal" and DeviceID = "cdisplay", that can be used to determine the current state of, and to control the operation of, MediaPortal.
Status output messages
osd.basic
The xPL connector driver sends an xpl-cmnd structure using the osd.basic schema to indicate changes to the status of MediaPortal. This is analogous to the other CybrDisplay drivers sending text to a connected display device.
osd.basic
{
command=clear
text=<line 1 text>\n<line 2 text>
}
media.basic schema messages
The xPL connector sends an xpl-trig structure when the media playback or recording state in MediaPortal changes. The following schema messages are supported:
media.devstate
{
power=on
connected=true
volume=<current volume level (0 - 100)>
mute=<true|false>
}
media.mptrnspt
{
command=<stop|play|paused|forward|rewind>
[position=<current media position in seconds>]
}
media.mpmedia
{
duration=<current media duration in seconds>
format=<current media format (may be a comma seperated list... ie: format=mpg, mp3>
}
Control Input
The xPL connector can be used to control the basic operation of MediaPortal and to obtain detailed status information. The xPL connector device will respond to specific commands in the media.basic and remote.basic schemas. This allows a xPL frontend application to excercise control of MediaPortal.
When a supported media.basic command is received and processed, the appropriate action is performed, and any changes to the MediaPortal state are indicated with the appropriate xpl-trig structures, as outlined in the "Status output messages" section.
When a supported remote.basic command is received and processed, the appropriate action is performed, and the connector responds with a xpr-trig message with the remote.confirm schema to indicate that the action was supported and performed.
When a supported media.request command is received, the appropriate detailed status information is returned using xpl-stat messages.
The supported media.basic commands are:
media.basic
{
command=play
[url=...]
}
The "play" command will cause playback of any file supported by MediaPortal.
The "url" parameter specifies the file to play. Specifying the filename of the currently palying media, or omitting the "url=" parameter will cause MediaPortal to resume playback of the current file from the paused state.
media.basic
{
command=stop
}
The "stop" command will cause MediaPortal to stop playback of the cureent media file.
media.basic
{
command=pause
}
The "pause" command will cause MediaPortal to pause playback of the cureent media file.
media.basic
{
command=forward
}
The "forward" command will cause MediaPortal to fast-forward playback of the currently playing media file. The "speed" parameter is used to specify the fast-forward speed. Omitting the "speed" parameter will cause MediaPortal to use the next higher fast-forward speed. Valid speed specifiers are 1x, 2x, 4x, 8x, 16x, and 32x (the "x" is optional and may be omitted)
media.basic
{
command=rewind
}
The "rewind" command will cause MediaPortal to fast-rewind playback of the currently playing media file. The "speed" parameter is used to specify the fast-rewind speed. Omitting the "speed" parameter will cause MediaPortal to use the next higher fast-rewind speed. Valid speed specifiers are 1x, 2x, 4x, 8x, 16x, and 32x (the "x" is optional and may be omitted)
media.basic
{
command=next
}
The "next" command will cause MediaPortal to move to the next chapter (in a DVD) or next item (in a playlist)
media.basic
{
command=back
}
The "back" command will cause MediaPortal to move to the previous chapter (in a DVD) or previous item (in a playlist)
media.basic
{
command=mute
state=<on|off>
}
The "mute" command is used to control the state of the system volume muting. The "state" specifier must be provided.
media.basic
{
command=volume
level=<level specifier>
}
The "volume" command is used to control the system volume level. The "level" parameter must be provided. The "level" parameter can be an absolute value between 0 (zero) and 100, or a relative value prefixed with "+" or "-".
The supported media.request commands are:
media.request
{
request=devinfo|devstate|mpinfo|mptrnspt|mpmedia|mpconfig|mpqueue
}
request=devinfo - returns the MediaPortal device information
request=devstate - returns the MediaPortal device state information
request=mpinfo - returns the MediaPortal Player device and Recorder device information
request=mptrnspt - returns the current media transport state information
request=mpmedia - returns the currently playing media information
request=mpconfig - returns the current xPL connector configuration details
The supported remote.basic commands are:
remote.basic
{
keys=<Window name or key names or button names or keycodes> - comma seperated values
}
The remote.basic command is supported in several different ways, depending on the parameter(s) contained in the command. Currently, only the "keys" parameter is supported, but the data passed is this parameter can be of several types. Each specified item is tested, in order, for compliance with each type and is processed as the first type that is matched.
Type 1 - MediaPortal Window specification Passing a MediaPortal Window name in the keys parameter will cause MediaPortal to switch to and activate the specified window. Use this command type with caution, as there is currently no filtering of undesirable windows. The window name is specified as the complete window specification, as defined in the MediaPortal.GUI.Library.GUIWindow.Window enumeration. For example, to have MediaPortal switch to the "My Music" files screen, you would send a remote.basic command with a keys=WINDOW_MUSIC_FILES parameter.
Type 2 - a keyboard key name Passing a keyboard key name in the keys parameter will cause MediaPortal to perform the appropriate action that is mapped to the specified key. The key mapping is taken from the current MediaPortal keymap file. Key names are specified as defined in the System.Windows.Form.Keys enumeration. Any keys that are not mapped to an action will not be processed as a type 2 parameter. The key names ARE case sensitive.
Type 3 - a remote button name. Passing a remote button name in the keys parameter will cause mediaportal to perform the appropriate action that is mapped to the specified button. The remote button mapping is taken from the mapping file for the Microsoft MCE remote (as configured in the MediaPortal configuration under Remotes). Any keys that are not mapped in the remote mapping file are not processed. The remote button names are NOT case sensitive.
NOTE: A type 2 key name and a type 3 remote button name may have identical names (ie: the keyboard back (backspace) key and the remote back button). To diferentiate between the keyboard key and the remote button, the remote button names may be (optionally) prefixed with the string "remote_".
Type 4 - a ascii decimal key code specifier Passing a ascii decimal key code specifier in the keys parameter will cause MediaPortal to simulate the appropriate keypress. IE: keys=27 will cause MediaPortal to simulate pressing the escape key.
A (rough) xPL Vendor file for use with xPLhal is available: mportal.xml
(place it in the xPL plugin directory - C:\Documents and Settings\All Users\Application Data\xPL\Plugins\ [with a standard installation on Windows XP])
MediaPortal Wiki 