1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/telephony/nsITelephonyProvider.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,234 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +[scriptable, uuid(c25d3993-6481-4e12-acee-55e32f6e1454)] 1.11 +interface nsITelephonyListener : nsISupports 1.12 +{ 1.13 + /** 1.14 + * Notified when a telephony call changes state. 1.15 + * 1.16 + * @param clientId 1.17 + Indicate the RIL client, 0 ~ (number of client - 1). 1.18 + * @param callIndex 1.19 + * Call identifier assigned by the RIL. 1.20 + * @param callState 1.21 + * One of the nsITelephonyProvider::CALL_STATE_* values. 1.22 + * @param number 1.23 + * Number of the other party. 1.24 + * @param isActive 1.25 + * Indicates whether this call is the currently active one. 1.26 + * @param isOutgoing 1.27 + * Indicates whether this call is outgoing or incoming. 1.28 + * @param isEmergency 1.29 + * Indicates whether this call is an emergency call. 1.30 + * @param isConference 1.31 + * Indicates whether this call is a conference call. 1.32 + * @param isSwitchable 1.33 + * Indicates whether this call can be switched between states of 1.34 + * nsITelephonyProvider::CALL_STATE_CONNECTED and 1.35 + * nsITelephonyProvider::CALL_STATE_HELD. 1.36 + * @param isMergeable 1.37 + * Indicates whether this call be be added into a conference. 1.38 + */ 1.39 + void callStateChanged(in unsigned long clientId, 1.40 + in unsigned long callIndex, 1.41 + in unsigned short callState, 1.42 + in AString number, 1.43 + in boolean isActive, 1.44 + in boolean isOutgoing, 1.45 + in boolean isEmergency, 1.46 + in boolean isConference, 1.47 + in boolean isSwitchable, 1.48 + in boolean isMergeable); 1.49 + 1.50 + /** 1.51 + * Called when participants of a conference call have been updated, and the 1.52 + * conference call state changes. 1.53 + * 1.54 + * @param callState 1.55 + * Possible values are: nsITelephonyProvider::CALL_STATE_UNKNOWN, 1.56 + * nsITelephonyProvider::CALL_STATE_HELD, 1.57 + * nsITelephonyProvider::CALL_STATE_CONNECTED. 1.58 + */ 1.59 + void conferenceCallStateChanged(in unsigned short callState); 1.60 + 1.61 + /** 1.62 + * Called when enumeration asked by nsITelephonyProvider::enumerateCalls 1.63 + * is completed. 1.64 + */ 1.65 + void enumerateCallStateComplete(); 1.66 + 1.67 + /** 1.68 + * Called when nsITelephonyProvider is asked to enumerate the current 1.69 + * telephony call state (nsITelephonyProvider::enumerateCalls). This is 1.70 + * called once per call that is currently managed by the RIL. 1.71 + * 1.72 + * @param clientId 1.73 + Indicate the RIL client, 0 ~ (number of client - 1). 1.74 + * @param callIndex 1.75 + * Call identifier assigned by the RIL. 1.76 + * @param callState 1.77 + * One of the nsITelephonyProvider::CALL_STATE_* values. 1.78 + * @param number 1.79 + * Number of the other party. 1.80 + * @param isActive 1.81 + * Indicates whether this call is the active one. 1.82 + * @param isOutgoing 1.83 + * Indicates whether this call is outgoing or incoming. 1.84 + * @param isConference 1.85 + * Indicates whether this call is a conference call. 1.86 + * @param isSwitchable 1.87 + * Indicates whether this call can be switched between states of 1.88 + * nsITelephonyProvider::CALL_STATE_CONNECTED and 1.89 + * nsITelephonyProvider::CALL_STATE_HELD. 1.90 + * @param isMergeable 1.91 + * Indicates whether this call be be added into a conference. 1.92 + */ 1.93 + void enumerateCallState(in unsigned long clientId, 1.94 + in unsigned long callIndex, 1.95 + in unsigned short callState, 1.96 + in AString number, 1.97 + in boolean isActive, 1.98 + in boolean isOutgoing, 1.99 + in boolean isEmergency, 1.100 + in boolean isConference, 1.101 + in boolean isSwitchable, 1.102 + in boolean isMergeable); 1.103 + 1.104 + /** 1.105 + * Notify when RIL receives supplementary service notification. 1.106 + * 1.107 + * @param clientId 1.108 + Indicate the RIL client, 0 ~ (number of client - 1). 1.109 + * @param callIndex 1.110 + * Call identifier assigned by the RIL. -1 if not specified 1.111 + * @param notification 1.112 + * One of the nsITelephonyProvider::NOTIFICATION_* values. 1.113 + */ 1.114 + void supplementaryServiceNotification(in unsigned long clientId, 1.115 + in long callIndex, 1.116 + in unsigned short notification); 1.117 + 1.118 + /** 1.119 + * Called when RIL error occurs. 1.120 + * 1.121 + * @param clientId 1.122 + Indicate the RIL client, 0 ~ (number of client - 1). 1.123 + * @param callIndex 1.124 + * Call identifier assigned by the RIL. -1 if no connection 1.125 + * @param error 1.126 + * Error from RIL. 1.127 + */ 1.128 + void notifyError(in unsigned long clientId, 1.129 + in long callIndex, 1.130 + in AString error); 1.131 + 1.132 + /** 1.133 + * Called when a waiting call comes in CDMA networks. 1.134 + * 1.135 + * @param clientId 1.136 + Indicate the RIL client, 0 ~ (number of client - 1). 1.137 + * @param number 1.138 + * Number of the other party. 1.139 + */ 1.140 + void notifyCdmaCallWaiting(in unsigned long clientId, in AString number); 1.141 + 1.142 + /** 1.143 + * Called when RIL error occurs to creating or separating a conference call. 1.144 + * 1.145 + * @param name 1.146 + * Error name. Possible values are addError and removeError. 1.147 + * @param message 1.148 + * Detailed error message from RIL. 1.149 + */ 1.150 + void notifyConferenceError(in AString name, 1.151 + in AString message); 1.152 +}; 1.153 + 1.154 +[scriptable, uuid(c095aa82-aacb-4e53-a787-56a89c3f638e)] 1.155 +interface nsITelephonyCallback : nsISupports 1.156 +{ 1.157 + /** 1.158 + * Called when a dial request fails. 1.159 + * @param error 1.160 + * Error from RIL. 1.161 + */ 1.162 + void notifyDialError(in AString error); 1.163 + 1.164 + /** 1.165 + * Called when a dial request succeeds. 1.166 + */ 1.167 + void notifyDialSuccess(); 1.168 +}; 1.169 + 1.170 +%{C++ 1.171 +#define TELEPHONY_PROVIDER_CID \ 1.172 + { 0x9cf8aa52, 0x7c1c, 0x4cde, { 0x97, 0x4e, 0xed, 0x2a, 0xa0, 0xe7, 0x35, 0xfa } } 1.173 +#define TELEPHONY_PROVIDER_CONTRACTID \ 1.174 + "@mozilla.org/telephony/telephonyprovider;1" 1.175 +%} 1.176 + 1.177 +/** 1.178 + * XPCOM component (in the content process) that provides the telephony 1.179 + * information. 1.180 + */ 1.181 +[scriptable, uuid(b16ca98f-994f-4ae1-8c2d-e7b18e08d1f3)] 1.182 +interface nsITelephonyProvider : nsISupports 1.183 +{ 1.184 + const unsigned short CALL_STATE_UNKNOWN = 0; 1.185 + const unsigned short CALL_STATE_DIALING = 1; 1.186 + const unsigned short CALL_STATE_ALERTING = 2; 1.187 + const unsigned short CALL_STATE_CONNECTING = 3; 1.188 + const unsigned short CALL_STATE_CONNECTED = 4; 1.189 + const unsigned short CALL_STATE_HOLDING = 5; 1.190 + const unsigned short CALL_STATE_HELD = 6; 1.191 + const unsigned short CALL_STATE_RESUMING = 7; 1.192 + const unsigned short CALL_STATE_DISCONNECTING = 8; 1.193 + const unsigned short CALL_STATE_DISCONNECTED = 9; 1.194 + const unsigned short CALL_STATE_INCOMING = 10; 1.195 + 1.196 + const unsigned short NOTIFICATION_REMOTE_HELD = 0; 1.197 + const unsigned short NOTIFICATION_REMOTE_RESUMED = 1; 1.198 + 1.199 + readonly attribute unsigned long defaultServiceId; 1.200 + 1.201 + /** 1.202 + * Called when a content process registers receiving unsolicited messages from 1.203 + * RadioInterfaceLayer in the chrome process. Only a content process that has 1.204 + * the 'telephony' permission is allowed to register. 1.205 + */ 1.206 + void registerListener(in nsITelephonyListener listener); 1.207 + void unregisterListener(in nsITelephonyListener listener); 1.208 + 1.209 + /** 1.210 + * Will continue calling listener.enumerateCallState until the listener 1.211 + * returns false. 1.212 + */ 1.213 + void enumerateCalls(in nsITelephonyListener listener); 1.214 + 1.215 + /** 1.216 + * Functionality for making and managing phone calls. 1.217 + */ 1.218 + void dial(in unsigned long clientId, in DOMString number, 1.219 + in boolean isEmergency, in nsITelephonyCallback callback); 1.220 + void hangUp(in unsigned long clientId, in unsigned long callIndex); 1.221 + 1.222 + void startTone(in unsigned long clientId, in DOMString dtmfChar); 1.223 + void stopTone(in unsigned long clientId); 1.224 + 1.225 + void answerCall(in unsigned long clientId, in unsigned long callIndex); 1.226 + void rejectCall(in unsigned long clientId, in unsigned long callIndex); 1.227 + void holdCall(in unsigned long clientId, in unsigned long callIndex); 1.228 + void resumeCall(in unsigned long clientId, in unsigned long callIndex); 1.229 + 1.230 + void conferenceCall(in unsigned long clientId); 1.231 + void separateCall(in unsigned long clientId, in unsigned long callIndex); 1.232 + void holdConference(in unsigned long clientId); 1.233 + void resumeConference(in unsigned long clientId); 1.234 + 1.235 + attribute bool microphoneMuted; 1.236 + attribute bool speakerEnabled; 1.237 +};