core: add message handler

This patch adds a small message handler to the core which enables
clients to list available handlers via the list-handlers message.
Command: pacmd send-message /core list-handlers
pactl can be used with the same parameters.

The patch also introduces a convention for the return string.
It consists of a list of elements where curly braces are used
to separate elements. Each element can itself contain further
elements. For example consider a message that returns multiple
elements which each contain an integer and an array of float.
A response string would look like that:
{{Integer} {{1st float} {2nd float} ...}}{...}

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/51>
This commit is contained in:
Georg Chini 2020-01-14 11:00:20 +01:00 committed by Tanu Kaskinen
parent 68f2f1395d
commit 5c0ab52145
3 changed files with 84 additions and 6 deletions

View file

@ -6,10 +6,19 @@ PA_COMMAND_SEND_OBJECT_MESSAGE. A message consists at least of an object path
and a message command, both specified as strings. Additional parameters can
be specified using a single string, but are not mandatory. The message handler
returns an error number as defined in def.h and also returns a string in
the "response" variable. The following reference lists available messages,
their parameters and return values.
the "response" variable. If the string is not empty it consists of elements.
Curly braces are used to separate elements. Each element can itself contain
further elements. For example consider a message that returns multiple elements
which each contain an integer and an array of float. A response string would
look like that:
{{Integer} {{1st float} {2nd float} ...}}{...}
Any characters that are not enclosed in curly braces are ignored (all characters
between { and {, between } and } and between } and {). The same syntax is used
to specify message parameters. The following reference lists available messages,
their parameters and return values. If a return value is enclosed in {}, this
means that multiple elements of the same type may be returned.
Recipient:
Message:
Parameters:
Return value:
Object path: /core
Message: list-handlers
Parameters: None
Return value: {{{Handler name} {Description}} ...}