Bug 711671 - Rename nsTelephonyWorker / nsITelephone to nsIRadioInterfaceLayer

--HG--
rename : dom/telephony/nsTelephonyWorker.js => dom/system/b2g/RadioInterfaceLayer.js
rename : dom/telephony/nsTelephonyWorker.manifest => dom/system/b2g/RadioInterfaceLayer.manifest
rename : dom/telephony/nsITelephone.idl => dom/system/b2g/nsIRadioInterfaceLayer.idl
rename : dom/telephony/nsTelephonyWorker.h => dom/system/b2g/nsRadioInterfaceLayer.h
rename : dom/telephony/ril_consts.js => dom/system/b2g/ril_consts.js
rename : dom/telephony/ril_worker.js => dom/system/b2g/ril_worker.js
This commit is contained in:
Philipp von Weitershausen 2012-01-19 12:53:32 -08:00
parent 80b95ec625
commit ca460e2371
16 changed files with 184 additions and 136 deletions

View File

@ -40,7 +40,7 @@
#include "nsISmsService.h"
#include "nsCOMPtr.h"
#include "nsITelephone.h"
#include "nsIRadioInterfaceLayer.h"
namespace mozilla {
namespace dom {
@ -54,7 +54,7 @@ public:
SmsService();
protected:
nsCOMPtr<nsITelephone> mRIL;
nsCOMPtr<nsIRadioInterfaceLayer> mRIL;
};
} // namespace sms

View File

@ -63,6 +63,7 @@ endif
XPIDLSRCS = \
nsIAudioManager.idl \
nsIRadioInterfaceLayer.idl \
nsIWorkerHolder.idl \
$(NULL)
@ -74,4 +75,14 @@ LOCAL_INCLUDES = \
-I$(topsrcdir)/content/events/src \
$(NULL)
EXTRA_COMPONENTS = \
RadioInterfaceLayer.manifest \
RadioInterfaceLayer.js \
$(NULL)
EXTRA_JS_MODULES = \
ril_consts.js \
ril_worker.js \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -14,13 +14,14 @@
* The Original Code is Telephony.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com> (Original Author)
* Philipp von Weitershausen <philipp@weitershausen.de>
* Sinker Li <thinker@codemud.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -48,13 +49,13 @@ Cu.import("resource://gre/modules/ril_consts.js", RIL);
const DEBUG = true; // set to false to suppress debug messages
const TELEPHONYWORKER_CID =
const RADIOINTERFACELAYER_CID =
Components.ID("{2d831c8d-6017-435b-a80c-e5d422810cea}");
const DATACALLINFO_CID =
Components.ID("{ef474cd9-94f7-4c05-a31b-29b9de8a10d2}");
const nsIAudioManager = Ci.nsIAudioManager;
const nsITelephone = Ci.nsITelephone;
const nsIRadioInterfaceLayer = Ci.nsIRadioInterfaceLayer;
const kSmsReceivedObserverTopic = "sms-received";
const DOM_SMS_DELIVERY_RECEIVED = "received";
@ -66,17 +67,17 @@ XPCOMUtils.defineLazyServiceGetter(this, "gSmsService",
function convertRILCallState(state) {
switch (state) {
case RIL.CALL_STATE_ACTIVE:
return nsITelephone.CALL_STATE_CONNECTED;
return nsIRadioInterfaceLayer.CALL_STATE_CONNECTED;
case RIL.CALL_STATE_HOLDING:
return nsITelephone.CALL_STATE_HELD;
return nsIRadioInterfaceLayer.CALL_STATE_HELD;
case RIL.CALL_STATE_DIALING:
return nsITelephone.CALL_STATE_DIALING;
return nsIRadioInterfaceLayer.CALL_STATE_DIALING;
case RIL.CALL_STATE_ALERTING:
return nsITelephone.CALL_STATE_RINGING;
return nsIRadioInterfaceLayer.CALL_STATE_RINGING;
case RIL.CALL_STATE_INCOMING:
return nsITelephone.CALL_STATE_INCOMING;
return nsIRadioInterfaceLayer.CALL_STATE_INCOMING;
case RIL.CALL_STATE_WAITING:
return nsITelephone.CALL_STATE_HELD; // XXX This may not be right...
return nsIRadioInterfaceLayer.CALL_STATE_HELD; // XXX This may not be right...
default:
throw new Error("Unknown rilCallState: " + state);
}
@ -126,7 +127,7 @@ DataCallInfo.protoptype = {
};
function nsTelephonyWorker() {
function RadioInterfaceLayer() {
this.worker = new ChromeWorker("resource://gre/modules/ril_worker.js");
this.worker.onerror = this.onerror.bind(this);
this.worker.onmessage = this.onmessage.bind(this);
@ -138,16 +139,16 @@ function nsTelephonyWorker() {
cardState: null
};
}
nsTelephonyWorker.prototype = {
RadioInterfaceLayer.prototype = {
classID: TELEPHONYWORKER_CID,
classInfo: XPCOMUtils.generateCI({classID: TELEPHONYWORKER_CID,
classDescription: "Telephone",
classID: RADIOINTERFACELAYER_CID,
classInfo: XPCOMUtils.generateCI({classID: RADIOINTERFACELAYER_CID,
classDescription: "RadioInterfaceLayer",
interfaces: [Ci.nsIWorkerHolder,
Ci.nsITelephone]}),
Ci.nsIRadioInterfaceLayer]}),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWorkerHolder,
Ci.nsITelephone]),
Ci.nsIRadioInterfaceLayer]),
onerror: function onerror(event) {
debug("Got an error: " + event.filename + ":" +
@ -219,12 +220,12 @@ nsTelephonyWorker.prototype = {
return;
}
switch (this._activeCall.state) {
case nsITelephone.CALL_STATE_INCOMING:
case nsIRadioInterfaceLayer.CALL_STATE_INCOMING:
gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_RINGTONE;
debug("Incoming call, put audio system into PHONE_STATE_RINGTONE.");
break;
case nsITelephone.CALL_STATE_DIALING: // Fall through...
case nsITelephone.CALL_STATE_CONNECTED:
case nsIRadioInterfaceLayer.CALL_STATE_DIALING: // Fall through...
case nsIRadioInterfaceLayer.CALL_STATE_CONNECTED:
gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_IN_CALL;
gAudioManager.setForceForUse(nsIAudioManager.USE_COMMUNICATION,
nsIAudioManager.FORCE_NONE);
@ -240,7 +241,7 @@ nsTelephonyWorker.prototype = {
handleCallStateChange: function handleCallStateChange(call) {
debug("handleCallStateChange: " + JSON.stringify(call));
call.state = convertRILCallState(call.state);
if (call.state == nsITelephone.CALL_STATE_CONNECTED) {
if (call.state == nsIRadioInterfaceLayer.CALL_STATE_CONNECTED) {
// This is now the active call.
this._activeCall = call;
}
@ -259,7 +260,8 @@ nsTelephonyWorker.prototype = {
}
this.updateCallAudioState();
this._deliverCallback("callStateChanged",
[call.callIndex, nsITelephone.CALL_STATE_DISCONNECTED,
[call.callIndex,
nsIRadioInterfaceLayer.CALL_STATE_DISCONNECTED,
call.number]);
},
@ -327,7 +329,7 @@ nsTelephonyWorker.prototype = {
worker: null,
// nsITelephone
// nsIRadioInterfaceLayer
currentState: null,
@ -540,12 +542,12 @@ nsTelephonyWorker.prototype = {
};
const NSGetFactory = XPCOMUtils.generateNSGetFactory([nsTelephonyWorker]);
const NSGetFactory = XPCOMUtils.generateNSGetFactory([RadioInterfaceLayer]);
let debug;
if (DEBUG) {
debug = function (s) {
dump("-*- TelephonyWorker component: " + s + "\n");
dump("-*- RadioInterfaceLayer: " + s + "\n");
};
} else {
debug = function (s) {};

View File

@ -0,0 +1 @@
component {2d831c8d-6017-435b-a80c-e5d422810cea} RadioInterfaceLayer.js

View File

@ -41,7 +41,7 @@
#include "nsIObserverService.h"
#include "nsIJSContextStack.h"
#include "nsITelephone.h"
#include "nsIRadioInterfaceLayer.h"
#include "nsIWifi.h"
#include "nsIWorkerHolder.h"
#include "nsIXPConnect.h"
@ -51,8 +51,8 @@
#include "mozilla/ipc/Ril.h"
#include "nsContentUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsTelephonyWorker.h"
#include "nsThreadUtils.h"
#include "nsRadioInterfaceLayer.h"
#include "nsWifiWorker.h"
USING_TELEPHONY_NAMESPACE
@ -61,7 +61,7 @@ using namespace mozilla::ipc;
namespace {
NS_DEFINE_CID(kTelephonyWorkerCID, NS_TELEPHONYWORKER_CID);
NS_DEFINE_CID(kRadioInterfaceLayerCID, NS_RADIOINTERFACELAYER_CID);
NS_DEFINE_CID(kWifiWorkerCID, NS_WIFIWORKER_CID);
// Doesn't carry a reference, we're owned by services.
@ -224,7 +224,7 @@ SystemWorkerManager::Init()
return NS_ERROR_FAILURE;
}
rv = InitTelephone(cx);
rv = InitRIL(cx);
NS_ENSURE_SUCCESS(rv, rv);
rv = InitWifi(cx);
@ -252,7 +252,7 @@ SystemWorkerManager::Shutdown()
StopRil();
mTelephoneWorker = nsnull;
mRILWorker = nsnull;
mWifiWorker = nsnull;
nsCOMPtr<nsIObserverService> obs =
@ -295,9 +295,9 @@ SystemWorkerManager::GetInterface(const nsIID &aIID, void **aResult)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
if (aIID.Equals(NS_GET_IID(nsITelephone))) {
return CallQueryInterface(mTelephoneWorker,
reinterpret_cast<nsITelephone**>(aResult));
if (aIID.Equals(NS_GET_IID(nsIRadioInterfaceLayer))) {
return CallQueryInterface(mRILWorker,
reinterpret_cast<nsIRadioInterfaceLayer**>(aResult));
}
if (aIID.Equals(NS_GET_IID(nsIWifi))) {
@ -310,12 +310,12 @@ SystemWorkerManager::GetInterface(const nsIID &aIID, void **aResult)
}
nsresult
SystemWorkerManager::InitTelephone(JSContext *cx)
SystemWorkerManager::InitRIL(JSContext *cx)
{
// We're keeping as much of this implementation as possible in JS, so the real
// worker lives in nsTelephonyWorker.js. All we do here is hold it alive and
// worker lives in RadioInterfaceLayer.js. All we do here is hold it alive and
// hook it up to the RIL thread.
nsCOMPtr<nsIWorkerHolder> worker = do_CreateInstance(kTelephonyWorkerCID);
nsCOMPtr<nsIWorkerHolder> worker = do_CreateInstance(kRadioInterfaceLayerCID);
NS_ENSURE_TRUE(worker, NS_ERROR_FAILURE);
jsval workerval;
@ -345,7 +345,7 @@ SystemWorkerManager::InitTelephone(JSContext *cx)
mozilla::RefPtr<RILReceiver> receiver = new RILReceiver(wctd);
StartRil(receiver);
mTelephoneWorker = worker;
mRILWorker = worker;
return NS_OK;
}

View File

@ -70,10 +70,10 @@ private:
SystemWorkerManager();
~SystemWorkerManager();
nsresult InitTelephone(JSContext *cx);
nsresult InitRIL(JSContext *cx);
nsresult InitWifi(JSContext *cx);
nsCOMPtr<nsIWorkerHolder> mTelephoneWorker;
nsCOMPtr<nsIWorkerHolder> mRILWorker;
nsCOMPtr<nsIWorkerHolder> mWifiWorker;
bool mShutdown;

View File

@ -19,7 +19,9 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Philipp von Weitershausen <philipp@weitershausen.de>
* Philipp von Weitershausen <philipp@weitershausen.de>
* Ben Turner <bent.mozilla@gmail.com>
* Sinker Li <thinker@codemud.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -37,48 +39,85 @@
#include "nsISupports.idl"
[scriptable, uuid(9b7e3a01-9c45-4af3-81bb-1bf08a842226)]
interface nsITelephoneCallback : nsISupports
[scriptable, uuid(03eafd60-d138-4f09-81b4-90cd4996b3c7)]
interface nsIRILTelephonyCallback : nsISupports
{
// 'callState' uses the CALL_STATE values from nsITelephone.
/**
* Notified when a telephony call changes state.
*
* @param callIndex
* Call identifier assigned by the RIL.
* @param callState
* One of the nsIRadioInterfaceLayer::CALL_STATE_* values.
* @param number
* Number of the other party.
*/
void callStateChanged(in unsigned long callIndex,
in unsigned short callState,
in AString number);
// 'callState' uses the CALL_STATE values from nsITelephone. Return true to
// continue enumeration or false to cancel.
/**
* Called when nsIRadioInterfaceLayer is asked to enumerate the current
* telephony call state (nsIRadioInterfaceLayer::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 nsIRadioInterfaceLayer::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);
};
[scriptable, uuid(8399fddd-471c-41ac-8f35-99f7dbb738ec)]
interface nsIDataCallInfo : nsISupports
[scriptable, uuid(66a55943-e63b-4731-aece-9c04bfc14019)]
interface nsIRILDataCallInfo : nsISupports
{
readonly attribute unsigned long callState;
readonly attribute AString cid;
readonly attribute AString apn;
};
[scriptable, uuid(36cc4b89-0338-4ff7-a3c2-d78e60f2ea98)]
interface nsIPhoneDataCallCallback : nsISupports
[scriptable, uuid(cea91bcb-3cfb-42bb-8638-dae89e8870fc)]
interface nsIRILDataCallback : nsISupports
{
/**
* This method is called when the state of a data call is changed.
* Notified when a data call changes state.
*
* @param dataState use DATACALL_STATE_* values from nsITelephone.
* @param cid
* The CID of the data call.
* @param interfaceName
* Name of the associated network interface.
* @param dataState
* One of the nsIRadioInterfaceLayer::DATACALL_STATE_* values.
*/
void dataCallStateChanged(in AString cid,
in AString interfaceName,
in unsigned short callState);
void receiveDataCallList([array,size_is(aLength)] in nsIDataCallInfo aDataCalls,
in unsigned long aLength);
/**
* Called when nsIRadioInterfaceLayer is asked to enumerate the current
* data call state.
*
* @param datacalls
* Array of nsIRILDataCallInfo objects.
* @param length
* Lenght of the aforementioned array.
*/
void receiveDataCallList([array,size_is(length)] in nsIRILDataCallInfo dataCalls,
in unsigned long length);
};
[scriptable, uuid(78ed0beb-d6ad-42f8-929a-8d003285784f)]
interface nsITelephone : nsISupports
[scriptable, uuid(9b7e3a01-9c45-4af3-81bb-1bf08a842226)]
interface nsIRadioInterfaceLayer : nsISupports
{
const unsigned short CALL_STATE_UNKNOWN = 0;
const unsigned short CALL_STATE_DIALING = 1;
@ -102,14 +141,14 @@ interface nsITelephone : nsISupports
readonly attribute jsval currentState;
void registerCallback(in nsITelephoneCallback callback);
void unregisterCallback(in nsITelephoneCallback callback);
void registerCallback(in nsIRILTelephonyCallback callback);
void unregisterCallback(in nsIRILTelephonyCallback callback);
/**
* Will continue calling callback.enumerateCallState until the callback
* returns false.
*/
void enumerateCalls(in nsITelephoneCallback callback);
void enumerateCalls(in nsIRILTelephonyCallback callback);
/**
* Functionality for making and managing phone calls.
@ -126,7 +165,9 @@ interface nsITelephone : nsISupports
attribute bool microphoneMuted;
attribute bool speakerEnabled;
// PDP APIs
/**
* PDP APIs
*/
void setupDataCall(in long radioTech,
in DOMString apn,
in DOMString user,
@ -137,8 +178,8 @@ interface nsITelephone : nsISupports
in DOMString reason);
void getDataCallList();
void registerDataCallCallback(in nsIPhoneDataCallCallback callback);
void unregisterDataCallCallback(in nsIPhoneDataCallCallback callback);
void registerDataCallCallback(in nsIRILDataCallback callback);
void unregisterDataCallCallback(in nsIRILDataCallback callback);
/**
* SMS-related functionality.

View File

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
// This must always match the CID given in nsTelephonyWorker.manifest!
#define NS_TELEPHONYWORKER_CID \
// This must always match the CID given in RadioInterfaceLayer.manifest!
#define NS_RADIOINTERFACELAYER_CID \
{ 0x2d831c8d, 0x6017, 0x435b, \
{ 0xa8, 0x0c, 0xe5, 0xd4, 0x22, 0x81, 0x0c, 0xea } }

View File

@ -61,18 +61,12 @@ XPIDLSRCS = \
nsIDOMTelephony.idl \
nsIDOMTelephonyCall.idl \
nsIDOMCallEvent.idl \
nsITelephone.idl \
$(NULL)
EXTRA_COMPONENTS = \
nsTelephonyWorker.manifest \
nsTelephonyWorker.js \
$(NULL)
EXTRA_JS_MODULES = \
ril_consts.js \
ril_worker.js \
$(NULL)
#LOCAL_INCLUDES = \
# -I$(topsrcdir)/dom/base \
# -I$(topsrcdir)/dom/system/b2g \
# -I$(topsrcdir)/content/events/src \
# $(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -112,8 +112,8 @@ nsTArrayToJSArray(JSContext* aCx, JSObject* aGlobal,
Telephony::~Telephony()
{
if (mTelephone && mTelephoneCallback) {
mTelephone->UnregisterCallback(mTelephoneCallback);
if (mRIL && mRILTelephonyCallback) {
mRIL->UnregisterCallback(mRILTelephonyCallback);
}
if (mRooted) {
@ -123,10 +123,10 @@ Telephony::~Telephony()
// static
already_AddRefed<Telephony>
Telephony::Create(nsPIDOMWindow* aOwner, nsITelephone* aTelephone)
Telephony::Create(nsPIDOMWindow* aOwner, nsIRadioInterfaceLayer* aRIL)
{
NS_ASSERTION(aOwner, "Null owner!");
NS_ASSERTION(aTelephone, "Null telephone!");
NS_ASSERTION(aRIL, "Null RIL!");
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aOwner);
NS_ENSURE_TRUE(sgo, nsnull);
@ -138,13 +138,13 @@ Telephony::Create(nsPIDOMWindow* aOwner, nsITelephone* aTelephone)
telephony->mOwner = aOwner;
telephony->mScriptContext.swap(scriptContext);
telephony->mTelephone = aTelephone;
telephony->mTelephoneCallback = new TelephoneCallback(telephony);
telephony->mRIL = aRIL;
telephony->mRILTelephonyCallback = new RILTelephonyCallback(telephony);
nsresult rv = aTelephone->EnumerateCalls(telephony->mTelephoneCallback);
nsresult rv = aRIL->EnumerateCalls(telephony->mRILTelephonyCallback);
NS_ENSURE_SUCCESS(rv, nsnull);
rv = aTelephone->RegisterCallback(telephony->mTelephoneCallback);
rv = aRIL->RegisterCallback(telephony->mRILTelephonyCallback);
NS_ENSURE_SUCCESS(rv, nsnull);
return telephony.forget();
@ -195,7 +195,7 @@ NS_IMPL_RELEASE_INHERITED(Telephony, nsDOMEventTargetWrapperCache)
DOMCI_DATA(Telephony, Telephony)
NS_IMPL_ISUPPORTS1(Telephony::TelephoneCallback, nsITelephoneCallback)
NS_IMPL_ISUPPORTS1(Telephony::RILTelephonyCallback, nsIRILTelephonyCallback)
NS_IMETHODIMP
Telephony::Dial(const nsAString& aNumber, nsIDOMTelephonyCall** aResult)
@ -205,7 +205,7 @@ Telephony::Dial(const nsAString& aNumber, nsIDOMTelephonyCall** aResult)
for (PRUint32 index = 0; index < mCalls.Length(); index++) {
const nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
if (tempCall->IsOutgoing() &&
tempCall->CallState() < nsITelephone::CALL_STATE_CONNECTED) {
tempCall->CallState() < nsIRadioInterfaceLayer::CALL_STATE_CONNECTED) {
// One call has been dialed already and we only support one outgoing call
// at a time.
NS_WARNING("Only permitted to dial one call at a time!");
@ -213,11 +213,11 @@ Telephony::Dial(const nsAString& aNumber, nsIDOMTelephonyCall** aResult)
}
}
nsresult rv = mTelephone->Dial(aNumber);
nsresult rv = mRIL->Dial(aNumber);
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<TelephonyCall> call =
TelephonyCall::Create(this, aNumber, nsITelephone::CALL_STATE_DIALING);
TelephonyCall::Create(this, aNumber, nsIRadioInterfaceLayer::CALL_STATE_DIALING);
NS_ASSERTION(call, "This should never fail!");
NS_ASSERTION(mCalls.Contains(call), "Should have auto-added new call!");
@ -229,7 +229,7 @@ Telephony::Dial(const nsAString& aNumber, nsIDOMTelephonyCall** aResult)
NS_IMETHODIMP
Telephony::GetMuted(bool* aMuted)
{
nsresult rv = mTelephone->GetMicrophoneMuted(aMuted);
nsresult rv = mRIL->GetMicrophoneMuted(aMuted);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -238,7 +238,7 @@ Telephony::GetMuted(bool* aMuted)
NS_IMETHODIMP
Telephony::SetMuted(bool aMuted)
{
nsresult rv = mTelephone->SetMicrophoneMuted(aMuted);
nsresult rv = mRIL->SetMicrophoneMuted(aMuted);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -247,7 +247,7 @@ Telephony::SetMuted(bool aMuted)
NS_IMETHODIMP
Telephony::GetSpeakerEnabled(bool* aSpeakerEnabled)
{
nsresult rv = mTelephone->GetSpeakerEnabled(aSpeakerEnabled);
nsresult rv = mRIL->GetSpeakerEnabled(aSpeakerEnabled);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -256,7 +256,7 @@ Telephony::GetSpeakerEnabled(bool* aSpeakerEnabled)
NS_IMETHODIMP
Telephony::SetSpeakerEnabled(bool aSpeakerEnabled)
{
nsresult rv = mTelephone->SetSpeakerEnabled(aSpeakerEnabled);
nsresult rv = mRIL->SetSpeakerEnabled(aSpeakerEnabled);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -339,7 +339,7 @@ Telephony::StartTone(const nsAString& aDTMFChar)
return NS_ERROR_INVALID_ARG;
}
nsresult rv = mTelephone->StartTone(aDTMFChar);
nsresult rv = mRIL->StartTone(aDTMFChar);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -348,7 +348,7 @@ Telephony::StartTone(const nsAString& aDTMFChar)
NS_IMETHODIMP
Telephony::StopTone()
{
nsresult rv = mTelephone->StopTone();
nsresult rv = mRIL->StopTone();
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -378,7 +378,7 @@ Telephony::CallStateChanged(PRUint32 aCallIndex, PRUint16 aCallState,
nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
if (tempCall->CallIndex() == kOutgoingPlaceholderCallIndex) {
NS_ASSERTION(!outgoingCall, "More than one outgoing call not supported!");
NS_ASSERTION(tempCall->CallState() == nsITelephone::CALL_STATE_DIALING,
NS_ASSERTION(tempCall->CallState() == nsIRadioInterfaceLayer::CALL_STATE_DIALING,
"Something really wrong here!");
// Stash this for later, we may need it if aCallIndex doesn't match one of
// our other calls.
@ -395,7 +395,7 @@ Telephony::CallStateChanged(PRUint32 aCallIndex, PRUint16 aCallState,
// an outgoing call then we must be seeing a status update for our outgoing
// call.
if (!modifiedCall &&
aCallState != nsITelephone::CALL_STATE_INCOMING &&
aCallState != nsIRadioInterfaceLayer::CALL_STATE_INCOMING &&
outgoingCall) {
outgoingCall->UpdateCallIndex(aCallIndex);
modifiedCall.swap(outgoingCall);
@ -406,7 +406,7 @@ Telephony::CallStateChanged(PRUint32 aCallIndex, PRUint16 aCallState,
modifiedCall->ChangeState(aCallState);
// See if this should replace our current active call.
if (aCallState == nsITelephone::CALL_STATE_CONNECTED) {
if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_CONNECTED) {
SwitchActiveCall(modifiedCall);
}
@ -414,7 +414,7 @@ Telephony::CallStateChanged(PRUint32 aCallIndex, PRUint16 aCallState,
}
// Didn't know anything about this call before now, must be incoming.
NS_ASSERTION(aCallState == nsITelephone::CALL_STATE_INCOMING,
NS_ASSERTION(aCallState == nsIRadioInterfaceLayer::CALL_STATE_INCOMING,
"Serious logic problem here!");
nsRefPtr<TelephonyCall> call =
@ -511,10 +511,10 @@ NS_NewTelephony(nsPIDOMWindow* aWindow, nsIDOMTelephony** aTelephony)
nsIInterfaceRequestor* ireq = SystemWorkerManager::GetInterfaceRequestor();
NS_ENSURE_TRUE(ireq, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsITelephone> telephone = do_GetInterface(ireq);
NS_ENSURE_TRUE(telephone, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIRadioInterfaceLayer> ril = do_GetInterface(ireq);
NS_ENSURE_TRUE(ril, NS_ERROR_UNEXPECTED);
nsRefPtr<Telephony> telephony = Telephony::Create(innerWindow, telephone);
nsRefPtr<Telephony> telephony = Telephony::Create(innerWindow, ril);
NS_ENSURE_TRUE(telephony, NS_ERROR_UNEXPECTED);
telephony.forget(aTelephony);

View File

@ -44,7 +44,7 @@
#include "nsIDOMTelephony.h"
#include "nsIDOMTelephonyCall.h"
#include "nsITelephone.h"
#include "nsIRadioInterfaceLayer.h"
class nsIScriptContext;
class nsPIDOMWindow;
@ -54,8 +54,8 @@ BEGIN_TELEPHONY_NAMESPACE
class Telephony : public nsDOMEventTargetWrapperCache,
public nsIDOMTelephony
{
nsCOMPtr<nsITelephone> mTelephone;
nsCOMPtr<nsITelephoneCallback> mTelephoneCallback;
nsCOMPtr<nsIRadioInterfaceLayer> mRIL;
nsCOMPtr<nsIRILTelephonyCallback> mRILTelephonyCallback;
NS_DECL_EVENT_HANDLER(incoming);
@ -71,14 +71,14 @@ class Telephony : public nsDOMEventTargetWrapperCache,
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMTELEPHONY
NS_DECL_NSITELEPHONECALLBACK
NS_DECL_NSIRILTELEPHONYCALLBACK
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetWrapperCache::)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
Telephony,
nsDOMEventTargetWrapperCache)
static already_AddRefed<Telephony>
Create(nsPIDOMWindow* aOwner, nsITelephone* aTelephone);
Create(nsPIDOMWindow* aOwner, nsIRadioInterfaceLayer* aRIL);
nsIDOMEventTarget*
ToIDOMEventTarget() const
@ -109,10 +109,10 @@ public:
mCallsArray = nsnull;
}
nsITelephone*
Telephone() const
nsIRadioInterfaceLayer*
RIL() const
{
return mTelephone;
return mRIL;
}
nsPIDOMWindow*
@ -137,15 +137,15 @@ private:
void
SwitchActiveCall(TelephonyCall* aCall);
class TelephoneCallback : public nsITelephoneCallback
class RILTelephonyCallback : public nsIRILTelephonyCallback
{
Telephony* mTelephony;
public:
NS_DECL_ISUPPORTS
NS_FORWARD_NSITELEPHONECALLBACK(mTelephony->)
NS_FORWARD_NSIRILTELEPHONYCALLBACK(mTelephony->)
TelephoneCallback(Telephony* aTelephony)
RILTelephonyCallback(Telephony* aTelephony)
: mTelephony(aTelephony)
{
NS_ASSERTION(mTelephony, "Null pointer!");

View File

@ -75,37 +75,37 @@ TelephonyCall::ChangeStateInternal(PRUint16 aCallState, bool aFireEvents)
nsString stateString;
switch (aCallState) {
case nsITelephone::CALL_STATE_DIALING:
case nsIRadioInterfaceLayer::CALL_STATE_DIALING:
stateString.AssignLiteral("dialing");
break;
case nsITelephone::CALL_STATE_RINGING:
case nsIRadioInterfaceLayer::CALL_STATE_RINGING:
stateString.AssignLiteral("ringing");
break;
case nsITelephone::CALL_STATE_BUSY:
case nsIRadioInterfaceLayer::CALL_STATE_BUSY:
stateString.AssignLiteral("busy");
break;
case nsITelephone::CALL_STATE_CONNECTING:
case nsIRadioInterfaceLayer::CALL_STATE_CONNECTING:
stateString.AssignLiteral("connecting");
break;
case nsITelephone::CALL_STATE_CONNECTED:
case nsIRadioInterfaceLayer::CALL_STATE_CONNECTED:
stateString.AssignLiteral("connected");
break;
case nsITelephone::CALL_STATE_HOLDING:
case nsIRadioInterfaceLayer::CALL_STATE_HOLDING:
stateString.AssignLiteral("holding");
break;
case nsITelephone::CALL_STATE_HELD:
case nsIRadioInterfaceLayer::CALL_STATE_HELD:
stateString.AssignLiteral("held");
break;
case nsITelephone::CALL_STATE_RESUMING:
case nsIRadioInterfaceLayer::CALL_STATE_RESUMING:
stateString.AssignLiteral("resuming");
break;
case nsITelephone::CALL_STATE_DISCONNECTING:
case nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTING:
stateString.AssignLiteral("disconnecting");
break;
case nsITelephone::CALL_STATE_DISCONNECTED:
case nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED:
stateString.AssignLiteral("disconnected");
break;
case nsITelephone::CALL_STATE_INCOMING:
case nsIRadioInterfaceLayer::CALL_STATE_INCOMING:
stateString.AssignLiteral("incoming");
break;
default:
@ -115,11 +115,11 @@ TelephonyCall::ChangeStateInternal(PRUint16 aCallState, bool aFireEvents)
mState = stateString;
mCallState = aCallState;
if (aCallState == nsITelephone::CALL_STATE_DIALING) {
if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_DIALING) {
mOutgoing = true;
}
if (aCallState == nsITelephone::CALL_STATE_DISCONNECTED) {
if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED) {
NS_ASSERTION(mLive, "Should be live!");
mTelephony->RemoveCall(this);
mLive = false;
@ -208,33 +208,33 @@ TelephonyCall::GetState(nsAString& aState)
NS_IMETHODIMP
TelephonyCall::Answer()
{
if (mCallState != nsITelephone::CALL_STATE_INCOMING) {
if (mCallState != nsIRadioInterfaceLayer::CALL_STATE_INCOMING) {
NS_WARNING("Answer on non-incoming call ignored!");
return NS_OK;
}
nsresult rv = mTelephony->Telephone()->AnswerCall(mCallIndex);
nsresult rv = mTelephony->RIL()->AnswerCall(mCallIndex);
NS_ENSURE_SUCCESS(rv, rv);
ChangeStateInternal(nsITelephone::CALL_STATE_CONNECTING, true);
ChangeStateInternal(nsIRadioInterfaceLayer::CALL_STATE_CONNECTING, true);
return NS_OK;
}
NS_IMETHODIMP
TelephonyCall::HangUp()
{
if (mCallState == nsITelephone::CALL_STATE_DISCONNECTING ||
mCallState == nsITelephone::CALL_STATE_DISCONNECTED) {
if (mCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTING ||
mCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED) {
NS_WARNING("HangUp on previously disconnected call ignored!");
return NS_OK;
}
nsresult rv = mCallState == nsITelephone::CALL_STATE_INCOMING ?
mTelephony->Telephone()->RejectCall(mCallIndex) :
mTelephony->Telephone()->HangUp(mCallIndex);
nsresult rv = mCallState == nsIRadioInterfaceLayer::CALL_STATE_INCOMING ?
mTelephony->RIL()->RejectCall(mCallIndex) :
mTelephony->RIL()->HangUp(mCallIndex);
NS_ENSURE_SUCCESS(rv, rv);
ChangeStateInternal(nsITelephone::CALL_STATE_DISCONNECTING, true);
ChangeStateInternal(nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTING, true);
return NS_OK;
}

View File

@ -43,7 +43,7 @@
#include "TelephonyCommon.h"
#include "nsIDOMTelephonyCall.h"
#include "nsITelephone.h"
#include "nsIRadioInterfaceLayer.h"
class nsPIDOMWindow;
@ -131,7 +131,7 @@ public:
private:
TelephonyCall()
: mCallIndex(kOutgoingPlaceholderCallIndex),
mCallState(nsITelephone::CALL_STATE_UNKNOWN), mLive(false), mOutgoing(false)
mCallState(nsIRadioInterfaceLayer::CALL_STATE_UNKNOWN), mLive(false), mOutgoing(false)
{ }
~TelephonyCall()

View File

@ -1 +0,0 @@
component {2d831c8d-6017-435b-a80c-e5d422810cea} nsTelephonyWorker.js