Expose call objects on DBus

This exports call objects on the session bus:

 $ gdbus monitor --session -d sm.puri.Calls
 …
 /sm/puri/Calls: org.freedesktop.DBus.ObjectManager.InterfacesAdded (objectpath '/sm/puri/Calls/Call/1', {'sm.puri.Calls.Call': {'Inbound': <false>, 'State': <uint32 0>, 'Id': <''>, 'Party': <''>}})
 /sm/puri/Calls/Call/1: org.freedesktop.DBus.Properties.PropertiesChanged ('sm.puri.Calls.Call', {'Id': <'0987654321'>, 'Inbound': <true>, 'State': <uint32 5>}, @as [])
 /sm/puri/Calls: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (objectpath '/sm/puri/Calls/Call/1', ['sm.puri.Calls.Call'])
 $ gdbus call --session --dest sm.puri.Calls --object-path /sm/puri/Calls/Call/1 --method sm.puri.Calls.Call.Hangup

Currenty hangup and accept methods are implemented as well as exposing
the current call state.
This commit is contained in:
Guido Günther
2021-04-02 09:52:14 +02:00
committed by Evangelos Ribeiro Tzaras
parent 8d937bedf6
commit 6f93b48ef4
8 changed files with 325 additions and 72 deletions

View File

@@ -1,14 +1,9 @@
generated_dbus_sources = []
# DBus server protocols
generated_dbus_sources += gnome.gdbus_codegen('calls-dbus',
'sm.puri.Calls.xml',
docbook: 'calls',
interface_prefix: 'sm.puri',
namespace: 'CallsDBus')
generated_dbus_sources += gnome.gdbus_codegen('calls-call-dbus',
'sm.puri.Calls.Call.xml',
docbook: 'calls',
interface_prefix: 'sm.puri',
namespace: 'CallsCallDBus')
object_manager: true,
namespace: 'CallsDBus')

View File

@@ -20,17 +20,20 @@
-->
<node>
<interface name="sm.puri.Calls.Call">
<method name="AcceptCall"/>
<method name="EndCall"/>
<method name="HoldCall"/>
<method name="UnholdCall"/>
<method name="SendDtmf">
<arg direction="in" type="s" name="tones"/>
</method>
<property name="CallParty" type="as" access="read"/>
<property name="CallIsConference" type="b" access="read"/>
<property name="CallState" type="u" access="read"/>
<property name="Origin" type="s" access="read"/>
<method name="Accept"/>
<method name="Hangup"/>
<property name="Inbound" type="b" access="read"/>
<property name="State" type="u" access="read"/>
<property name="Id" type="s" access="read">
<doc:doc>
<doc:description>
<doc:para>The Id identifying the call, e.g. a phone number</doc:para>
</doc:description>
</doc:doc>
</property>
<property name="Party" type="s" access="read"/>
</interface>
</node>

View File

@@ -1,53 +0,0 @@
<!DOCTYPE node PUBLIC
"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!--
Copyright (C) 2021 Purism SPC
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
-->
<node>
<interface name="sm.puri.Calls">
<method name="Dial">
<arg type="s" direction="in" name="number"/>
<arg type="b" direction="out" name="success"/>
</method>
<method name="GetCalls">
<arg type="ao" direction="out" name="calls">
<doc:doc>
<doc:summary>an array of ongoing calls</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>This gets a list of all <doc:ref type="interface" to="sm.puri.Calls.Call">Calls</doc:ref>
that are currently ongoing.</doc:para>
<doc:para>Each Call is an D-Bus object path for the object that implements the
<doc:ref type="interface" to="sm.puri.Calls.Call">Call</doc:ref> interface.</doc:para>
</doc:description>
</doc:doc>
</method>
<property name="HasOngoingCall" type="b" access="read"/>
<signal name="CallAdded">
<arg name="id" type="u"/>
<arg name="parameters" type="a{sv}"/>
</signal>
<signal name="CallRemoved">
<arg name="id" type="u"/>
<arg name="parameters" type="a{sv}"/>
</signal>
</interface>
</node>