Thanks for you support.

I agree with your opinion and I changed my proposal with your advices.
I follow the SMS and Messaging implementation and I create two new interfaces named CallLog and Call.
CallLog contains all Call objects created.

All Call state are described in a schema that I've attached.

About call type specification, in GSM service there are two types of call: Voice Call and Data Call.
In AT Standard the ATD command is described as follow:

"ATD[<digits>][I/i][;]

[...]

When ';' is contained in this command, a voice call is initiated.
When ';' is not contained in this command, a data service call is initiated."

Data call is used for example with ZMODEM in order to trasfer files between two endpoint.

Thanks,

Riccardo Vangelisti - Sadel SpA
Software Development
Via Serenari 1, Castel Maggiore (BO)

Il 20/04/2015 15:51, Aleksander Morgado ha scritto:
Hey Riccardo,

in refer to opened bug https://bugs.freedesktop.org/show_bug.cgi?id=84981
I propose the attached patch, to implement voice or data call in MM core.

Please let me know what you think.

Thanks for moving this forward :)

 From my POV, this API should be managed very similar to how the
Messaging/SMS API works, clearly separating the modem actions (in the
Messaging interface) with the objects (in the SMS interface). In this
specific case, I'd suggest to have a new
"org.freedesktop.ModemManager1.Modem.Voice" interface for the modem
object, plus then a new "org.freedesktop.ModemManager1.Call" interface
for new "/org/freedesktop/ModemManager1/Call" objects.

Some of the methods defined already assume this, but I don't think it's
clearly explained. Having 2 separate interfaces would make more sense.

Also, I'd have also added the new enums in the
include/ModemManager-enums.h file already, and avoid explaining them in
the API file.

See my other comments inline.

 From 6cb13d8396c4e6fa3e6fc8d1e10c73664f3bfd12 Mon Sep 17 00:00:00 2001
From: Riccardo Vangelisti <[email protected]>
Date: Mon, 20 Apr 2015 12:58:16 +0200
Subject: [PATCH] Added API proposal of voice/data call handling

---
  .../org.freedesktop.ModemManager1.Modem.Call.xml   | 118 +++++++++++++++++++++
  1 file changed, 118 insertions(+)
  create mode 100644 introspection/org.freedesktop.ModemManager1.Modem.Call.xml

diff --git a/introspection/org.freedesktop.ModemManager1.Modem.Call.xml 
b/introspection/org.freedesktop.ModemManager1.Modem.Call.xml
new file mode 100644
index 0000000..3d8e08b
--- /dev/null
+++ b/introspection/org.freedesktop.ModemManager1.Modem.Call.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd";>
+
+  <!--
+      org.freedesktop.ModemManager1.Modem.Call:
+      @short_description: The ModemManager Call interface.
+
+      The Call interface handles sending calls and notification of new
+      incoming calls.
+  -->
+  <interface name="org.freedesktop.ModemManager1.Modem.Call">
+
+    <!--
+        Start:
+        @number: phone number
+        @type: The type of call, same as "Type" property
Why @type? This would all be voice calls.

+        @result: The call object path.
+
+        Start a new call to specified number
+    -->
+    <method name="Start">
+      <arg name="number" type="s" direction="in" />
+      <arg name="type" type="i" direction="in" />
+      <arg name="result" type="o" direction="out" />
+    </method>
+
When does this method exactly return? Will the method return even if the
call hasn't been accepted/rejected yet?

+    <!--
+        Answer:
+        @call: call object path
+
+        Answer to specified call
+    -->
+    <method name="Answer">
+      <arg name="call" type="o" direction="in" />
+    </method>
+
+    <!--
+        HangUp:
+        @call: call object path
+
+        Hangup specified call
+    -->
+    <method name="HangUp">
+      <arg name="call" type="o" direction="in" />
+    </method>
+
What would happen to calls that have been hungup? Will the DBus object
still be around with state "terminated"?

Shouldn't we have a method in the Modem-specific interface to list all
Call objects managed by the modem?

+    <!--
+        Incoming:
+        @path: Object path of the new Call.
+
+        Emitted when a new Call has been received.
+
+        Check the "Type" property to determine if the call is data or voice 
type.
+    -->
+    <signal name="Incoming">
+      <arg name="path" type="o" />
+    </signal>
+
+    <!--
+        StateChanged:
+        @old: Old object "State"
+        @new: New object "State"
+
+        Emitted when a message has been deleted.
+    -->
+    <signal name="StateChanged">
+      <arg name="old" type="i" />
+      <arg name="new" type="i" />
+    </signal>
+
What's this StateChanged here?

+    <!--
+        State:
+
+        The state of Call object paths.
+
+        MMCallState:
+          - MM_MODEM_CALL_STATE_INCOMING Incoming
+          - MM_MODEM_CALL_STATE_ACCEPTED Accepted
+          - MM_MODEM_CALL_STATE_TERMINATED Terminated
+          - MM_MODEM_CALL_STATE_REFUSED Refused
+          - MM_MODEM_CALL_STATE_ERROR Error
+          - MM_MODEM_CALL_STATE_INACTIVE Inactive
When does inactive happen?

+    -->
+    <property name="State" type="i" access="read" />
+
This state would belong in the "Call" object interface, not in the Modem
interface.

+    <!--
+        Type:
+
+        The call type.
+
+        MMCallType:
+          - MM_MODEM_CALL_TYPE_DATA Data call
Should we care about data calls here?

+          - MM_MODEM_CALL_TYPE_VOICE Voice call
+    -->
+    <property name="Type" type="i" access="read" />
+
This state would belong in the "Call" object interface, not in the Modem
interface.

+    <!--
+        Number:
+
+        The remote phone number.
+    -->
+    <property name="Number" type="s" access="read" />
+
This state would belong in the "Call" object interface, not in the Modem
interface.

+    <!--
+        Audio:
+
+        The audio device.
+
+        Example list:
+          - "analog" (PCM analog)
+          - "/dev/ttyUSB2" (sound device)
+          - "others?"
+    -->
+    <property name="Audio" type="s" access="read" />
+
+  </interface>
+</node>
--
2.1.4






>From 472bdb3c745bd9de75596dc70c19c8fd6c4af6dc Mon Sep 17 00:00:00 2001
From: Riccardo Vangelisti <[email protected]>
Date: Mon, 20 Apr 2015 18:22:29 +0200
Subject: [PATCH] Added CallLog and Call interfaces for voice/data call
 handling

---
 include/ModemManager-enums.h                       | 40 ++++++++++
 introspection/all.xml                              |  2 +
 .../org.freedesktop.ModemManager1.Call.xml         | 92 ++++++++++++++++++++++
 ...org.freedesktop.ModemManager1.Modem.CallLog.xml | 83 +++++++++++++++++++
 4 files changed, 217 insertions(+)
 create mode 100644 introspection/org.freedesktop.ModemManager1.Call.xml
 create mode 100644 introspection/org.freedesktop.ModemManager1.Modem.CallLog.xml

diff --git a/include/ModemManager-enums.h b/include/ModemManager-enums.h
index 57a2b27..b8f9254 100644
--- a/include/ModemManager-enums.h
+++ b/include/ModemManager-enums.h
@@ -1168,4 +1168,44 @@ typedef enum { /*< underscore_name=mm_oma_session_state_failed_reason >*/
     MM_OMA_SESSION_STATE_FAILED_REASON_SESSION_CANCELLED     = 5
 } MMOmaSessionStateFailedReason;
 
+/**
+ * MMCallState:
+ * MM_CALL_STATE_UNKNOWN: default state for a new outgoing call
+ * MM_CALL_STATE_RINGING: call is waiting for an answer 
+ * @MM_CALL_STATE_ACCEPTED: call is active between two peers
+ * @MM_CALL_STATE_TERMINATED: call is terminated
+ * @MM_CALL_STATE_REFUSED: call is refused or busy
+ * @MM_CALL_STATE_ERROR: call in error (wrong number, network unavailable, etc..)
+ * 
+ * State of Call
+ */
+typedef enum { /*< underscore_name=mm_call_state >*/
+    MM_CALL_STATE_UNKNOWN       = 0,
+    MM_CALL_STATE_RINGING       = 1,
+    MM_CALL_STATE_ACCEPTED      = 2,
+    MM_CALL_STATE_TERMINATED    = 3,
+    MM_CALL_STATE_REFUSED       = 4,
+    MM_CALL_STATE_ERROR         = 5
+} MMCallState;
+
+/**
+ * MMCallDirection:
+ * @MM_CALL_DIRECTION_INCOMING : call from network
+ * @MM_CALL_DIRECTION_OUTGOING : call to network
+ */
+typedef enum { /*< underscore_name=mm_call_direction >*/
+    MM_CALL_DIRECTION_INCOMING  = 0,
+    MM_CALL_DIRECTION_OUTGOING  = 1
+} MMCallDirection;
+
+/**
+ * MMCallType:
+ * @MM_CALL_TYPE_DATA: Data call
+ * @MM_CALL_TYPE_VOICE: Voice call
+ */
+typedef enum { /*< underscore_name=mm_call_type >*/
+    MM_CALL_TYPE_DATA             = 0,
+    MM_CALL_TYPE_VOICE            = 1
+} MMModemCallType;
+
 #endif /*  _MODEMMANAGER_ENUMS_H_ */
diff --git a/introspection/all.xml b/introspection/all.xml
index 4d277e3..4cb5869 100644
--- a/introspection/all.xml
+++ b/introspection/all.xml
@@ -6,7 +6,9 @@
   <xi:include href="org.freedesktop.ModemManager1.Sim.xml"/>
   <xi:include href="org.freedesktop.ModemManager1.Bearer.xml"/>
   <xi:include href="org.freedesktop.ModemManager1.Sms.xml"/>
+  <xi:include href="org.freedesktop.ModemManager1.Call.xml"/>
   <xi:include href="org.freedesktop.ModemManager1.Modem.xml"/>
+  <xi:include href="org.freedesktop.ModemManager1.Modem.CallLog.xml"/>
   <xi:include href="org.freedesktop.ModemManager1.Modem.Modem3gpp.xml"/>
   <xi:include href="org.freedesktop.ModemManager1.Modem.Modem3gpp.Ussd.xml"/>
   <xi:include href="org.freedesktop.ModemManager1.Modem.ModemCdma.xml"/>
diff --git a/introspection/org.freedesktop.ModemManager1.Call.xml b/introspection/org.freedesktop.ModemManager1.Call.xml
new file mode 100644
index 0000000..5ae588d
--- /dev/null
+++ b/introspection/org.freedesktop.ModemManager1.Call.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd";>
+
+  <!--
+      org.freedesktop.ModemManager1.Call:
+      @short_description: The ModemManager Call interface.
+
+      The Call interface Defines operations and properties of a single Call.
+  -->
+  <interface name="org.freedesktop.ModemManager1.Call">
+
+    <!--
+        Start:
+
+        If the outgoing call has not yet been started, start it.
+        Applicable only if state is MM_CALL_STATE_UNKNOWN and direction is MM_CALL_DIRECTION_OUTGOING.
+    -->
+    <method name="Start" />
+
+    <!--
+        Answer:
+
+        Answer incoming call.
+        Applicable only if state is MM_CALL_STATE_RINGING and direction is MM_CALL_DIRECTION_INCOMING
+    -->
+    <method name="Answer" />
+
+    <!--
+        HangUp:
+
+        Hangup the active call.
+        Applicable only if states are MM_CALL_STATE_RINGING and MM_CALL_STATE_ACCEPTED
+    -->
+    <method name="HangUp"/>
+
+    <!--
+        StateChanged:
+        @old: Old state MMCallState
+        @new: New state MMCallState
+
+        Emitted when call changes state
+    -->
+    <signal name="StateChanged">
+      <arg name="old" type="i" />
+      <arg name="new" type="i" />
+    </signal>
+
+    <!--
+        State:
+
+        A <link linkend="MMCallState">MMCallState</link> value,
+        describing the state of the call.
+    -->
+    <property name="State" type="i" access="read" />
+
+    <!--
+        Direction:
+
+        A <link linkend="MMCallDirection">MMCallDirection</link> value,
+        describing the direction of the call.
+    -->
+    <property name="Direction" type="i" access="read" />
+
+    <!--
+        Type:
+
+        A <link linkend="MMCallType">MMCallType</link> value,
+        describing the type of the call.
+    -->
+    <property name="Type" type="i" access="read" />
+
+    <!--
+        Number:
+
+        The remote phone number.
+    -->
+    <property name="Number" type="s" access="read" />
+
+    <!--
+        Audio:
+
+        The audio device.
+
+        Example list:
+        - "analog" (PCM analog)
+        - "/dev/ttyUSB2" (sound device)
+        - "others?"
+    -->
+    <property name="Audio" type="s" access="read" />
+  </interface>
+</node>
diff --git a/introspection/org.freedesktop.ModemManager1.Modem.CallLog.xml b/introspection/org.freedesktop.ModemManager1.Modem.CallLog.xml
new file mode 100644
index 0000000..65d5cf6
--- /dev/null
+++ b/introspection/org.freedesktop.ModemManager1.Modem.CallLog.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd";>
+
+  <!--
+      org.freedesktop.ModemManager1.Modem.CallLog:
+      @short_description: The ModemManager CallLog interface.
+
+      The CallLog interface handles Calls.
+  -->
+  <interface name="org.freedesktop.ModemManager1.Modem.CallLog">
+
+    <!--
+        List:
+        @result: The list of call object paths.
+
+        Retrieve all Calls.
+
+        This method should only be used once and subsequent information
+        retrieved either by listening for the
+        #org.freedesktop.ModemManager1.Modem.CallLog::Added signal,
+        or by querying the specific Call object of interest.
+    -->
+    <method name="List">
+      <arg name="result" type="ao" direction="out" />
+    </method>
+
+    <!--
+        Delete:
+        @path: The object path of the Call to delete.
+
+        Delete a Call.
+    -->
+    <method name="Delete">
+      <arg name="path" type="o" direction="in" />
+    </method>
+
+    <!--
+        Create:
+        @properties: Call properties from the <link linkend="gdbus-org.freedesktop.ModemManager1.Call">Call D-Bus interface</link>.
+        @path: The object path of the new call object.
+
+        Creates a new call object.
+
+        The '<link linkend="gdbus-property-org-freedesktop-ModemManager1-Call.Number">Number</link>' is mandatory
+        and '<link linkend="gdbus-property-org-freedesktop-ModemManager1-Call.Type">Type</link>' is optional (default voice).
+    -->
+    <method name="Create">
+      <arg name="properties" type="a{sv}" direction="in"  />
+      <arg name="path"       type="o"     direction="out" />
+    </method>
+
+    <!--
+        Added:
+        @path: Object path of the new call.
+        @received: %TRUE if the call was received from the network (incoming call), as opposed to being added locally (outgoing call).
+
+        Emitted when any part of a Call has been received or added.
+    -->
+    <signal name="Added">
+      <arg name="path" type="o" />
+      <arg name="received" type="b" />
+    </signal>
+
+    <!--
+        Deleted:
+        @path: Object path of the now deleted Call.
+
+        Emitted when a call has been deleted.
+    -->
+    <signal name="Deleted">
+      <arg name="path" type="o" />
+    </signal>
+
+    <!--
+        Calls:
+
+        The list of calls object paths.
+    -->
+    <property name="Calls" type="ao" access="read" />
+
+  </interface>
+</node>
-- 
2.1.4

_______________________________________________
ModemManager-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Reply via email to