Lancelot - PVR/Home Automation

Lancelot Command Protocol v. 0.04




To-Do List




Command Protocol

The following type of commands are currently available:

General Commands
Tuner Commands
State Change Messages

The structure of all commands is as follows:

<message id>\n<command name>\n[<parameter>\n]*\n

Success Replies:
<message id>\nsuccess\n[<return value>\n]*\n

Failure Replies:
<message id>\nfailure\n<failure reason>\n\n

<message id>: positive integer
<command name>: denotes the command
<parameter>: command dependend parameter
<failure reason>: human readable reason for the failure of the command
<return value>: command depended return value

Commands are case insensitive ascii strings and must begin with a message identifier followed by a new line character (ascii: 10, denoted here by \n). Message identifiers are used to identify which replies belongs to which requests, and therefore must be unique within the client. For all practical purposes messageId := messageId + 1 mod <some high number> will do, since the number of pending messages will be low. Message id 0 (zero) is reserved for messages from the Lancelot server, which is not the result of a request (command). These messages indicate a state change of the server caused by another client. Example: One client changes the channel from 3 to 4. This state change is propagated to all other clients so they are able to change their user interface to reflect this change.

The command name must follow immediately after the new line character terminating the message identifier and must be followed by one new line character.

If the command takes any parameters then the parameters must follow immediately after the new line character terminating the command name. Parameters are separated by one new line character.

All commands are terminated with one new line character (besides the one terminating the command name and/or parameters).

All references to DirectX related parameters and return types are as defined by DirectX version 9.0.

All commands are responded with either a success or a failure reply.