1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include
"nsISupports.idl"
7 interface nsIMobileCallForwardingOptions
;
8 interface nsITelephonyCallInfo
;
10 [scriptable
, uuid(3cdc0b98
-0c5f
-489d
-9190-083d137f40da
)]
11 interface nsITelephonyListener
: nsISupports
14 * Called when enumeration asked by nsITelephonyService::enumerateCalls
17 void enumerateCallStateComplete
();
20 * Called when nsITelephonyService is asked to enumerate the current
21 * telephony call state (nsITelephonyService::enumerateCalls). This is
22 * called once per call that is currently managed by the RIL.
24 void enumerateCallState
(in nsITelephonyCallInfo info
);
27 * Notified when a telephony call changes state.
29 void callStateChanged
(in nsITelephonyCallInfo info
);
32 * Called when participants of a conference call have been updated, and the
33 * conference call state changes.
36 * Possible values are: nsITelephonyService::CALL_STATE_UNKNOWN,
37 * nsITelephonyService::CALL_STATE_HELD,
38 * nsITelephonyService::CALL_STATE_CONNECTED.
40 void conferenceCallStateChanged
(in unsigned short callState
);
43 * Notify when RIL receives supplementary service notification.
46 Indicate the RIL client, 0 ~ (number of client - 1).
48 * Call identifier assigned by the RIL. -1 if not specified
50 * One of the nsITelephonyService::NOTIFICATION_* values.
52 void supplementaryServiceNotification
(in unsigned long clientId
,
54 in unsigned short notification
);
57 * Called when RIL error occurs.
60 Indicate the RIL client, 0 ~ (number of client - 1).
62 * Call identifier assigned by the RIL. -1 if no connection
66 void notifyError
(in unsigned long clientId
,
71 * Called when a waiting call comes in CDMA networks.
74 Indicate the RIL client, 0 ~ (number of client - 1).
76 * Number of the other party.
77 * @param numberPresentation
78 * Presentation of the call number.
79 * One of the nsITelephonyProvider::CALL_PRESENTATION_* values.
81 * Name of the other party.
82 * @param namePresentation
83 * Presentation of the call name.
84 * One of the nsITelephonyProvider::CALL_PRESENTATION_* values.
86 void notifyCdmaCallWaiting
(in unsigned long clientId
,
88 in unsigned short numberPresentation
,
90 in unsigned short namePresentation
);
93 * Called when RIL error occurs to creating or separating a conference call.
96 * Error name. Possible values are addError and removeError.
98 * Detailed error message from RIL.
100 void notifyConferenceError
(in AString name
,
105 * A callback interface for handling asynchronous response.
107 [scriptable
, uuid(cffc3f9d
-2c88
-4a14
-8ebc
-f216caf0cc1d
)]
108 interface nsITelephonyCallback
: nsISupports
110 void notifySuccess
();
111 void notifyError
(in AString error
);
115 * A callback interface for handling asynchronous response for telephony.dial.
117 [scriptable
, uuid(e16c6e6f
-93c6
-4e1e
-99bf
-592b98f67e15
)]
118 interface nsITelephonyDialCallback
: nsITelephonyCallback
121 * Called when a dial request is treated as an MMI code and it is about to
122 * process the request.
125 * MMI service code key string that defined in MMI_KS_SC_*
127 void notifyDialMMI
(in AString serviceCode
);
130 * Called when a dial request is treated as a call setup and the result
134 Indicate the RIL client, 0 ~ (number of client - 1).
136 * Call index from RIL.
138 * Dialed out phone number (ex: Temporary CLIR prefix will be removed)
140 void notifyDialCallSuccess
(in unsigned long cliendId
,
141 in unsigned long callIndex
,
145 * Called when a MMI code request succeeds.
146 * The function should only be called after notifyDialMMI.
148 void notifyDialMMISuccess
(in AString statusMessage
);
149 void notifyDialMMISuccessWithInteger
(in AString statusMessage
,
150 in unsigned short aAdditionalInformation
);
151 void notifyDialMMISuccessWithStrings
(in AString statusMessage
,
152 in unsigned long aLength
,
153 [array
, size_is(aLength
)] in wstring aAdditionalInformation
);
154 void notifyDialMMISuccessWithCallForwardingOptions
(in AString statusMessage
,
155 in unsigned long aLength
,
156 [array
, size_is(aLength
)] in nsIMobileCallForwardingOptions aAdditionalInformation
);
159 * Called when a MMI code request fails.
160 * The function should only be called after notifyDialMMI.
162 void notifyDialMMIError
(in AString error
);
163 void notifyDialMMIErrorWithInfo
(in AString error
, in unsigned short info
);
167 #define TELEPHONY_SERVICE_CID \
168 { 0x9cf8aa52, 0x7c1c, 0x4cde, { 0x97, 0x4e, 0xed, 0x2a, 0xa0, 0xe7, 0x35, 0xfa } }
169 #define TELEPHONY_SERVICE_CONTRACTID \
170 "@mozilla.org/telephony/telephonyservice;1"
174 * XPCOM component (in the content process) that provides the telephony
177 [scriptable
, uuid(a91fa6be
-0acc
-4d36
-99f1
-3e3a88e83ae9
)]
178 interface nsITelephonyService
: nsISupports
180 const unsigned short CALL_STATE_UNKNOWN
= 0;
181 const unsigned short CALL_STATE_DIALING
= 1;
182 const unsigned short CALL_STATE_ALERTING
= 2;
183 const unsigned short CALL_STATE_CONNECTING
= 3;
184 const unsigned short CALL_STATE_CONNECTED
= 4;
185 const unsigned short CALL_STATE_HOLDING
= 5;
186 const unsigned short CALL_STATE_HELD
= 6;
187 const unsigned short CALL_STATE_RESUMING
= 7;
188 const unsigned short CALL_STATE_DISCONNECTING
= 8;
189 const unsigned short CALL_STATE_DISCONNECTED
= 9;
190 const unsigned short CALL_STATE_INCOMING
= 10;
192 const unsigned short NOTIFICATION_REMOTE_HELD
= 0;
193 const unsigned short NOTIFICATION_REMOTE_RESUMED
= 1;
195 const unsigned short CALL_PRESENTATION_ALLOWED
= 0;
196 const unsigned short CALL_PRESENTATION_RESTRICTED
= 1;
197 const unsigned short CALL_PRESENTATION_UNKNOWN
= 2;
198 const unsigned short CALL_PRESENTATION_PAYPHONE
= 3;
200 readonly attribute
unsigned long defaultServiceId
;
203 * Called when a content process registers receiving unsolicited messages from
204 * RadioInterfaceLayer in the chrome process. Only a content process that has
205 * the 'telephony' permission is allowed to register.
207 void registerListener
(in nsITelephonyListener listener
);
208 void unregisterListener
(in nsITelephonyListener listener
);
211 * Will continue calling listener.enumerateCallState until the listener
214 void enumerateCalls
(in nsITelephonyListener listener
);
217 * Functionality for making and managing phone calls.
219 void dial
(in unsigned long clientId
, in DOMString number
,
220 in boolean isEmergency
, in nsITelephonyDialCallback
callback);
222 void sendTones
(in unsigned long clientId
, in DOMString dtmfChars
,
223 in unsigned long pauseDuration
, in unsigned long toneDuration
,
224 in nsITelephonyCallback
callback);
226 void startTone
(in unsigned long clientId
, in DOMString dtmfChar
);
227 void stopTone
(in unsigned long clientId
);
229 void answerCall
(in unsigned long clientId
,
230 in unsigned long callIndex
,
231 in nsITelephonyCallback
callback);
232 void rejectCall
(in unsigned long clientId
,
233 in unsigned long callIndex
,
234 in nsITelephonyCallback
callback);
235 void hangUpCall
(in unsigned long clientId
,
236 in unsigned long callIndex
,
237 in nsITelephonyCallback
callback);
238 void holdCall
(in unsigned long clientId
,
239 in unsigned long callIndex
,
240 in nsITelephonyCallback
callback);
241 void resumeCall
(in unsigned long clientId
,
242 in unsigned long callIndex
,
243 in nsITelephonyCallback
callback);
245 void conferenceCall
(in unsigned long clientId
);
246 void separateCall
(in unsigned long clientId
, in unsigned long callIndex
);
247 void hangUpConference
(in unsigned long clientId
,
248 in nsITelephonyCallback
callback);
249 void holdConference
(in unsigned long clientId
);
250 void resumeConference
(in unsigned long clientId
);
253 * Send an USSD on existing session. It results in error if the session is
256 * If successful, callback.notifySuccess() will be called.
257 * Otherwise, callback.notifyError() will be called.
259 void sendUSSD
(in unsigned long clientId
, in DOMString ussd
,
260 in nsITelephonyCallback
callback);
263 * Cancel an existing USSD session.
265 * If successful, callback.notifySuccess() will be called.
266 * Otherwise, callback.notifyError() will be called.
268 void cancelUSSD
(in unsigned long cliendId
, in nsITelephonyCallback
callback);
270 attribute bool microphoneMuted
;
271 attribute bool speakerEnabled
;
275 template
<typename T
> struct already_AddRefed
;
277 already_AddRefed
<nsITelephonyService
>
278 NS_CreateTelephonyService
();