Bug 864485 - 1/3: B2G Telephony - move to IPDL. Interface changes. sr=sicking, r=hsinyi,khuey
authorVicamo Yang <vyang@mozilla.com>
Sat, 07 Sep 2013 14:19:50 +0800
changeset 146085 6e322f9d3e5388069afe0e7bcf62f5a03a9d9d7d
parent 146084 36880bc561d6e0c9ddcde317d4c7c1324842ca19
child 146086 7105ab97280117841886b4c6524126ce218ed8e6
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssicking, hsinyi, khuey
bugs864485
milestone26.0a1
Bug 864485 - 1/3: B2G Telephony - move to IPDL. Interface changes. sr=sicking, r=hsinyi,khuey
dom/ipc/PContent.ipdl
dom/telephony/ipc/PTelephony.ipdl
dom/telephony/ipc/PTelephonyRequest.ipdl
dom/telephony/ipc/TelephonyTypes.ipdlh
dom/telephony/nsITelephonyProvider.idl
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -15,16 +15,17 @@ include protocol PFMRadio;
 include protocol PHal;
 include protocol PImageBridge;
 include protocol PIndexedDB;
 include protocol PMemoryReportRequest;
 include protocol PNecko;
 include protocol PSms;
 include protocol PSpeechSynthesis;
 include protocol PStorage;
+include protocol PTelephony;
 include protocol PTestShell;
 include protocol PJavaScript;
 include DOMTypes;
 include JavaScriptTypes;
 include InputStreamParams;
 include PTabContext;
 include URIParams;
 
@@ -192,16 +193,17 @@ rpc protocol PContent
     manages PFMRadio;
     manages PHal;
     manages PIndexedDB;
     manages PMemoryReportRequest;
     manages PNecko;
     manages PSms;
     manages PSpeechSynthesis;
     manages PStorage;
+    manages PTelephony;
     manages PTestShell;
     manages PJavaScript;
 
 both:
     // Depending on exactly how the new browser is being created, it might be
     // created from either the child or parent process!
     //
     // The child creates the PBrowser as part of
@@ -348,16 +350,18 @@ parent:
     PNecko();
 
     PSms();
 
     PSpeechSynthesis();
 
     PStorage();
 
+    PTelephony();
+
     PBluetooth();
 
     PFMRadio();
 
     // Services remoting
 
     async StartVisitedQuery(URIParams uri);
     async VisitURI(URIParams uri, OptionalURIParams referrer, uint32_t flags);
new file mode 100644
--- /dev/null
+++ b/dom/telephony/ipc/PTelephony.ipdl
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set sw=2 ts=8 et ft=cpp : */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+include protocol PContent;
+include protocol PTelephonyRequest;
+include TelephonyTypes;
+
+namespace mozilla {
+namespace dom {
+namespace telephony {
+
+sync protocol PTelephony {
+  manager PContent;
+  manages PTelephonyRequest;
+
+child:
+  NotifyCallError(int32_t aCallIndex, nsString aError);
+
+  NotifyCallStateChanged(IPCCallStateData aData);
+
+  NotifyCdmaCallWaiting(nsString aNumber);
+
+  NotifyConferenceCallStateChanged(uint16_t aCallState);
+
+  NotifySupplementaryService(int32_t aCallIndex, uint16_t aNotification);
+
+parent:
+  /**
+   * Sent when the child no longer needs to use PTelephony.
+   */
+  __delete__();
+
+  /**
+   * Sent when the child makes an asynchronous request to the parent.  It's
+   * currently only for request call enumeration.
+   */
+  PTelephonyRequest();
+
+  RegisterListener();
+
+  UnregisterListener();
+
+  DialCall(nsString aNumber, bool aIsEmergency);
+
+  HangUpCall(uint32_t aCallIndex);
+
+  AnswerCall(uint32_t aCallIndex);
+
+  RejectCall(uint32_t aCallIndex);
+
+  HoldCall(uint32_t aCallIndex);
+
+  ResumeCall(uint32_t aCallIndex);
+
+  ConferenceCall();
+
+  SeparateCall(uint32_t aCallIndex);
+
+  HoldConference();
+
+  ResumeConference();
+
+  StartTone(nsString aTone);
+
+  StopTone();
+
+  sync GetMicrophoneMuted()
+    returns (bool aMuted);
+
+  SetMicrophoneMuted(bool aMuted);
+
+  sync GetSpeakerEnabled()
+    returns (bool aEnabled);
+
+  SetSpeakerEnabled(bool aEnabled);
+};
+
+} /* namespace telephony */
+} /* namespace dom */
+} /* namespace mozilla */
new file mode 100644
--- /dev/null
+++ b/dom/telephony/ipc/PTelephonyRequest.ipdl
@@ -0,0 +1,30 @@
+/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+include protocol PTelephony;
+include TelephonyTypes;
+
+namespace mozilla {
+namespace dom {
+namespace telephony {
+
+protocol PTelephonyRequest
+{
+  manager PTelephony;
+
+child:
+  NotifyEnumerateCallState(IPCCallStateData aData);
+
+  /**
+   * Sent when the asynchronous request has completed. It's currently only for
+   * request call enumeration.
+   */
+  __delete__();
+};
+
+} /* namespace telephony */
+} /* namespace dom */
+} /* namespace mozilla */
new file mode 100644
--- /dev/null
+++ b/dom/telephony/ipc/TelephonyTypes.ipdlh
@@ -0,0 +1,24 @@
+/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+namespace mozilla {
+namespace dom {
+namespace telephony {
+
+struct IPCCallStateData
+{
+  uint32_t callIndex;
+  uint16_t callState;
+  nsString number;
+  bool     isActive;
+  bool     isOutGoing;
+  bool     isEmergency;
+  bool     isConference;
+};
+
+} /* namespace telephony */
+} /* namespace dom */
+} /* namespace mozilla */
--- a/dom/telephony/nsITelephonyProvider.idl
+++ b/dom/telephony/nsITelephonyProvider.idl
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
-[scriptable, uuid(a5818719-e1b6-4fdc-8551-006055fa9996)]
+[scriptable, uuid(3aa42e77-7c2b-43a1-b105-7be094b0817a)]
 interface nsITelephonyListener : nsISupports
 {
   /**
    * Notified when a telephony call changes state.
    *
    * @param callIndex
    *        Call identifier assigned by the RIL.
    * @param callState
@@ -62,25 +62,24 @@ interface nsITelephonyListener : nsISupp
    * @param number
    *        Number of the other party.
    * @param isActive
    *        Indicates whether this call is the active one.
    * @param isOutgoing
    *        Indicates whether this call is outgoing or incoming.
    * @param isConference
    *        Indicates whether this call is a conference call.
-   * @return true to continue enumeration or false to cancel.
    */
-  boolean enumerateCallState(in unsigned long callIndex,
-                             in unsigned short callState,
-                             in AString number,
-                             in boolean isActive,
-                             in boolean isOutgoing,
-                             in boolean isEmergency,
-                             in boolean isConference);
+  void enumerateCallState(in unsigned long callIndex,
+                          in unsigned short callState,
+                          in AString number,
+                          in boolean isActive,
+                          in boolean isOutgoing,
+                          in boolean isEmergency,
+                          in boolean isConference);
 
   /**
    * Notify when RIL receives supplementary service notification.
    *
    * @param callIndex
    *        Call identifier assigned by the RIL. -1 if not specified
    * @param notification
    *        One of the nsITelephonyProvider::NOTIFICATION_* values.
@@ -103,21 +102,28 @@ interface nsITelephonyListener : nsISupp
    * Called when a waiting call comes in CDMA networks.
    *
    * @param number
    *        Number of the other party.
    */
   void notifyCdmaCallWaiting(in AString number);
 };
 
+%{C++
+#define TELEPHONY_PROVIDER_CID \
+  { 0x9cf8aa52, 0x7c1c, 0x4cde, { 0x97, 0x4e, 0xed, 0x2a, 0xa0, 0xe7, 0x35, 0xfa } }
+#define TELEPHONY_PROVIDER_CONTRACTID \
+  "@mozilla.org/telephony/telephonyprovider;1"
+%}
+
 /**
  * XPCOM component (in the content process) that provides the telephony
  * information.
  */
-[scriptable, uuid(45a2f856-4e07-499a-94c6-624f90c3345b)]
+[scriptable, uuid(effca006-1ca8-47f7-9bab-1323f90a14ec)]
 interface nsITelephonyProvider : nsISupports
 {
   const unsigned short CALL_STATE_UNKNOWN = 0;
   const unsigned short CALL_STATE_DIALING = 1;
   const unsigned short CALL_STATE_ALERTING = 2;
   const unsigned short CALL_STATE_CONNECTING = 3;
   const unsigned short CALL_STATE_CONNECTED = 4;
   const unsigned short CALL_STATE_HOLDING = 5;
@@ -130,30 +136,30 @@ interface nsITelephonyProvider : nsISupp
   const unsigned short NOTIFICATION_REMOTE_HELD = 0;
   const unsigned short NOTIFICATION_REMOTE_RESUMED = 1;
 
   /**
    * Called when a content process registers receiving unsolicited messages from
    * RadioInterfaceLayer in the chrome process. Only a content process that has
    * the 'telephony' permission is allowed to register.
    */
-  void registerTelephonyMsg(in nsITelephonyListener listener);
-  void unregisterTelephonyMsg(in nsITelephonyListener listener);
+  void registerListener(in nsITelephonyListener listener);
+  void unregisterListener(in nsITelephonyListener listener);
 
   /**
    * Will continue calling listener.enumerateCallState until the listener
    * returns false.
    */
   void enumerateCalls(in nsITelephonyListener listener);
 
   /**
    * Functionality for making and managing phone calls.
    */
-  void dial(in DOMString number);
-  void dialEmergency(in DOMString number);
+  void dial(in DOMString number,
+            in boolean isEmergency);
   void hangUp(in unsigned long callIndex);
 
   void startTone(in DOMString dtmfChar);
   void stopTone();
 
   void answerCall(in unsigned long callIndex);
   void rejectCall(in unsigned long callIndex);
   void holdCall(in unsigned long callIndex);