michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: [scriptable, uuid(c25d3993-6481-4e12-acee-55e32f6e1454)] michael@0: interface nsITelephonyListener : nsISupports michael@0: { michael@0: /** michael@0: * Notified when a telephony call changes state. michael@0: * michael@0: * @param clientId michael@0: Indicate the RIL client, 0 ~ (number of client - 1). michael@0: * @param callIndex michael@0: * Call identifier assigned by the RIL. michael@0: * @param callState michael@0: * One of the nsITelephonyProvider::CALL_STATE_* values. michael@0: * @param number michael@0: * Number of the other party. michael@0: * @param isActive michael@0: * Indicates whether this call is the currently active one. michael@0: * @param isOutgoing michael@0: * Indicates whether this call is outgoing or incoming. michael@0: * @param isEmergency michael@0: * Indicates whether this call is an emergency call. michael@0: * @param isConference michael@0: * Indicates whether this call is a conference call. michael@0: * @param isSwitchable michael@0: * Indicates whether this call can be switched between states of michael@0: * nsITelephonyProvider::CALL_STATE_CONNECTED and michael@0: * nsITelephonyProvider::CALL_STATE_HELD. michael@0: * @param isMergeable michael@0: * Indicates whether this call be be added into a conference. michael@0: */ michael@0: void callStateChanged(in unsigned long clientId, michael@0: in unsigned long callIndex, michael@0: in unsigned short callState, michael@0: in AString number, michael@0: in boolean isActive, michael@0: in boolean isOutgoing, michael@0: in boolean isEmergency, michael@0: in boolean isConference, michael@0: in boolean isSwitchable, michael@0: in boolean isMergeable); michael@0: michael@0: /** michael@0: * Called when participants of a conference call have been updated, and the michael@0: * conference call state changes. michael@0: * michael@0: * @param callState michael@0: * Possible values are: nsITelephonyProvider::CALL_STATE_UNKNOWN, michael@0: * nsITelephonyProvider::CALL_STATE_HELD, michael@0: * nsITelephonyProvider::CALL_STATE_CONNECTED. michael@0: */ michael@0: void conferenceCallStateChanged(in unsigned short callState); michael@0: michael@0: /** michael@0: * Called when enumeration asked by nsITelephonyProvider::enumerateCalls michael@0: * is completed. michael@0: */ michael@0: void enumerateCallStateComplete(); michael@0: michael@0: /** michael@0: * Called when nsITelephonyProvider is asked to enumerate the current michael@0: * telephony call state (nsITelephonyProvider::enumerateCalls). This is michael@0: * called once per call that is currently managed by the RIL. michael@0: * michael@0: * @param clientId michael@0: Indicate the RIL client, 0 ~ (number of client - 1). michael@0: * @param callIndex michael@0: * Call identifier assigned by the RIL. michael@0: * @param callState michael@0: * One of the nsITelephonyProvider::CALL_STATE_* values. michael@0: * @param number michael@0: * Number of the other party. michael@0: * @param isActive michael@0: * Indicates whether this call is the active one. michael@0: * @param isOutgoing michael@0: * Indicates whether this call is outgoing or incoming. michael@0: * @param isConference michael@0: * Indicates whether this call is a conference call. michael@0: * @param isSwitchable michael@0: * Indicates whether this call can be switched between states of michael@0: * nsITelephonyProvider::CALL_STATE_CONNECTED and michael@0: * nsITelephonyProvider::CALL_STATE_HELD. michael@0: * @param isMergeable michael@0: * Indicates whether this call be be added into a conference. michael@0: */ michael@0: void enumerateCallState(in unsigned long clientId, michael@0: in unsigned long callIndex, michael@0: in unsigned short callState, michael@0: in AString number, michael@0: in boolean isActive, michael@0: in boolean isOutgoing, michael@0: in boolean isEmergency, michael@0: in boolean isConference, michael@0: in boolean isSwitchable, michael@0: in boolean isMergeable); michael@0: michael@0: /** michael@0: * Notify when RIL receives supplementary service notification. michael@0: * michael@0: * @param clientId michael@0: Indicate the RIL client, 0 ~ (number of client - 1). michael@0: * @param callIndex michael@0: * Call identifier assigned by the RIL. -1 if not specified michael@0: * @param notification michael@0: * One of the nsITelephonyProvider::NOTIFICATION_* values. michael@0: */ michael@0: void supplementaryServiceNotification(in unsigned long clientId, michael@0: in long callIndex, michael@0: in unsigned short notification); michael@0: michael@0: /** michael@0: * Called when RIL error occurs. michael@0: * michael@0: * @param clientId michael@0: Indicate the RIL client, 0 ~ (number of client - 1). michael@0: * @param callIndex michael@0: * Call identifier assigned by the RIL. -1 if no connection michael@0: * @param error michael@0: * Error from RIL. michael@0: */ michael@0: void notifyError(in unsigned long clientId, michael@0: in long callIndex, michael@0: in AString error); michael@0: michael@0: /** michael@0: * Called when a waiting call comes in CDMA networks. michael@0: * michael@0: * @param clientId michael@0: Indicate the RIL client, 0 ~ (number of client - 1). michael@0: * @param number michael@0: * Number of the other party. michael@0: */ michael@0: void notifyCdmaCallWaiting(in unsigned long clientId, in AString number); michael@0: michael@0: /** michael@0: * Called when RIL error occurs to creating or separating a conference call. michael@0: * michael@0: * @param name michael@0: * Error name. Possible values are addError and removeError. michael@0: * @param message michael@0: * Detailed error message from RIL. michael@0: */ michael@0: void notifyConferenceError(in AString name, michael@0: in AString message); michael@0: }; michael@0: michael@0: [scriptable, uuid(c095aa82-aacb-4e53-a787-56a89c3f638e)] michael@0: interface nsITelephonyCallback : nsISupports michael@0: { michael@0: /** michael@0: * Called when a dial request fails. michael@0: * @param error michael@0: * Error from RIL. michael@0: */ michael@0: void notifyDialError(in AString error); michael@0: michael@0: /** michael@0: * Called when a dial request succeeds. michael@0: */ michael@0: void notifyDialSuccess(); michael@0: }; michael@0: michael@0: %{C++ michael@0: #define TELEPHONY_PROVIDER_CID \ michael@0: { 0x9cf8aa52, 0x7c1c, 0x4cde, { 0x97, 0x4e, 0xed, 0x2a, 0xa0, 0xe7, 0x35, 0xfa } } michael@0: #define TELEPHONY_PROVIDER_CONTRACTID \ michael@0: "@mozilla.org/telephony/telephonyprovider;1" michael@0: %} michael@0: michael@0: /** michael@0: * XPCOM component (in the content process) that provides the telephony michael@0: * information. michael@0: */ michael@0: [scriptable, uuid(b16ca98f-994f-4ae1-8c2d-e7b18e08d1f3)] michael@0: interface nsITelephonyProvider : nsISupports michael@0: { michael@0: const unsigned short CALL_STATE_UNKNOWN = 0; michael@0: const unsigned short CALL_STATE_DIALING = 1; michael@0: const unsigned short CALL_STATE_ALERTING = 2; michael@0: const unsigned short CALL_STATE_CONNECTING = 3; michael@0: const unsigned short CALL_STATE_CONNECTED = 4; michael@0: const unsigned short CALL_STATE_HOLDING = 5; michael@0: const unsigned short CALL_STATE_HELD = 6; michael@0: const unsigned short CALL_STATE_RESUMING = 7; michael@0: const unsigned short CALL_STATE_DISCONNECTING = 8; michael@0: const unsigned short CALL_STATE_DISCONNECTED = 9; michael@0: const unsigned short CALL_STATE_INCOMING = 10; michael@0: michael@0: const unsigned short NOTIFICATION_REMOTE_HELD = 0; michael@0: const unsigned short NOTIFICATION_REMOTE_RESUMED = 1; michael@0: michael@0: readonly attribute unsigned long defaultServiceId; michael@0: michael@0: /** michael@0: * Called when a content process registers receiving unsolicited messages from michael@0: * RadioInterfaceLayer in the chrome process. Only a content process that has michael@0: * the 'telephony' permission is allowed to register. michael@0: */ michael@0: void registerListener(in nsITelephonyListener listener); michael@0: void unregisterListener(in nsITelephonyListener listener); michael@0: michael@0: /** michael@0: * Will continue calling listener.enumerateCallState until the listener michael@0: * returns false. michael@0: */ michael@0: void enumerateCalls(in nsITelephonyListener listener); michael@0: michael@0: /** michael@0: * Functionality for making and managing phone calls. michael@0: */ michael@0: void dial(in unsigned long clientId, in DOMString number, michael@0: in boolean isEmergency, in nsITelephonyCallback callback); michael@0: void hangUp(in unsigned long clientId, in unsigned long callIndex); michael@0: michael@0: void startTone(in unsigned long clientId, in DOMString dtmfChar); michael@0: void stopTone(in unsigned long clientId); michael@0: michael@0: void answerCall(in unsigned long clientId, in unsigned long callIndex); michael@0: void rejectCall(in unsigned long clientId, in unsigned long callIndex); michael@0: void holdCall(in unsigned long clientId, in unsigned long callIndex); michael@0: void resumeCall(in unsigned long clientId, in unsigned long callIndex); michael@0: michael@0: void conferenceCall(in unsigned long clientId); michael@0: void separateCall(in unsigned long clientId, in unsigned long callIndex); michael@0: void holdConference(in unsigned long clientId); michael@0: void resumeConference(in unsigned long clientId); michael@0: michael@0: attribute bool microphoneMuted; michael@0: attribute bool speakerEnabled; michael@0: };