dom/telephony/nsITelephonyProvider.idl
author Kyle Machulis <kyle@nonpolynomial.com>
Fri, 29 Mar 2013 13:56:18 -0700
changeset 126734 03452b187c1406f07556cf5f0db7e99cc3a93aae
parent 123919 099a31538e9ff230cafb4f12b127613e12841e9f
child 131492 03e1ea0f973572dd5a3730e1fda6e8811ba9a899
permissions -rw-r--r--
Bug 855465 - Add emacs python mode comments to moz.build files; r=gps

/* 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(2ab9abfe-09fb-4fea-985f-acf29fc7376a)]
interface nsITelephonyListener : nsISupports
{
  /**
   * Notified when a telephony call changes state.
   *
   * @param callIndex
   *        Call identifier assigned by the RIL.
   * @param callState
   *        One of the nsITelephonyProvider::CALL_STATE_* values.
   * @param number
   *        Number of the other party.
   * @param isActive
   *        Indicates whether this call is the currently active one.
   */
  void callStateChanged(in unsigned long callIndex,
                        in unsigned short callState,
                        in AString number,
                        in boolean isActive);

  /**
   * Called when nsITelephonyProvider is asked to enumerate the current
   * telephony call state (nsITelephonyProvider::enumerateCalls). This is
   * called once per call that is currently managed by the RIL.
   *
   * @param callIndex
   *        Call identifier assigned by the RIL.
   * @param callState
   *        One of the nsITelephonyProvider::CALL_STATE_* values.
   * @param number
   *        Number of the other party.
   * @param isActive
   *        Indicates whether this call is the active one.
   *
   * @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);

  /**
   * Called when RIL error occurs.
   *
   * @param callIndex
   *        Call identifier assigned by the RIL. -1 if no connection
   * @param error
   *        Error from RIL.
   */
  void notifyError(in long callIndex,
                   in AString error);
};

/**
 * XPCOM component (in the content process) that provides the telephony
 * information.
 */
[scriptable, uuid(099e1d81-f247-4ebb-89d8-cd89dd5f6ed4)]
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_BUSY = 3;
  const unsigned short CALL_STATE_CONNECTING = 4;
  const unsigned short CALL_STATE_CONNECTED = 5;
  const unsigned short CALL_STATE_HOLDING = 6;
  const unsigned short CALL_STATE_HELD = 7;
  const unsigned short CALL_STATE_RESUMING = 8;
  const unsigned short CALL_STATE_DISCONNECTING = 9;
  const unsigned short CALL_STATE_DISCONNECTED = 10;
  const unsigned short CALL_STATE_INCOMING = 11;

  /**
   * 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);

  /**
   * 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 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);
  void resumeCall(in unsigned long callIndex);

  attribute bool microphoneMuted;
  attribute bool speakerEnabled;
};