author | Ben Tian <btian@mozilla.com> |
Mon, 09 Sep 2013 19:54:56 +0800 | |
changeset 146333 | 28c292c41cb72a6c86b8a0c17dddfbb84e9e36fe |
parent 146332 | d5802977fc329cf6df1a58ff6099cc55e1978017 |
child 146334 | 680c89c761007e26015ac3450820d28463b97dff |
child 146335 | cc5b600110d1911ca70ce216ce893164ec06bb6e |
push id | 25253 |
push user | cbook@mozilla.com |
push date | Tue, 10 Sep 2013 08:29:16 +0000 |
treeherder | mozilla-central@680c89c76100 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | echou |
bugs | 911986 |
milestone | 26.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/bluetooth/BluetoothHfpManager.cpp | file | annotate | diff | comparison | revisions | |
dom/bluetooth/BluetoothHfpManager.h | file | annotate | diff | comparison | revisions | |
dom/bluetooth/BluetoothRilListener.cpp | file | annotate | diff | comparison | revisions | |
dom/bluetooth/BluetoothRilListener.h | file | annotate | diff | comparison | revisions | |
dom/bluetooth/BluetoothTelephonyListener.cpp | file | annotate | diff | comparison | revisions | |
dom/bluetooth/BluetoothTelephonyListener.h | file | annotate | diff | comparison | revisions | |
dom/bluetooth/moz.build | file | annotate | diff | comparison | revisions |
--- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -49,18 +49,16 @@ * ril_consts.js */ #define TOA_UNKNOWN 0x81 #define TOA_INTERNATIONAL 0x91 #define CR_LF "\xd\xa"; #define MOZSETTINGS_CHANGED_ID "mozsettings-changed" -#define MOBILE_CONNECTION_ICCINFO_CHANGED_ID "mobile-connection-iccinfo-changed" -#define MOBILE_CONNECTION_VOICE_CHANGED_ID "mobile-connection-voice-changed" #define AUDIO_VOLUME_BT_SCO_ID "audio.volume.bt_sco" using namespace mozilla; using namespace mozilla::ipc; USING_BLUETOOTH_NAMESPACE namespace { StaticRefPtr<BluetoothHfpManager> sBluetoothHfpManager; @@ -198,20 +196,16 @@ NS_IMETHODIMP BluetoothHfpManager::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData) { if (!strcmp(aTopic, MOZSETTINGS_CHANGED_ID)) { HandleVolumeChanged(nsDependentString(aData)); } else if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { HandleShutdown(); - } else if (!strcmp(aTopic, MOBILE_CONNECTION_ICCINFO_CHANGED_ID)) { - HandleIccInfoChanged(); - } else if (!strcmp(aTopic, MOBILE_CONNECTION_VOICE_CHANGED_ID)) { - HandleVoiceConnectionChanged(); } else { MOZ_ASSERT(false, "BluetoothHfpManager got unexpected topic!"); return NS_ERROR_UNEXPECTED; } return NS_OK; } @@ -367,26 +361,24 @@ bool BluetoothHfpManager::Init() { MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr<nsIObserverService> obs = services::GetObserverService(); NS_ENSURE_TRUE(obs, false); if (NS_FAILED(obs->AddObserver(this, MOZSETTINGS_CHANGED_ID, false)) || - NS_FAILED(obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false)) || - NS_FAILED(obs->AddObserver(this, MOBILE_CONNECTION_ICCINFO_CHANGED_ID, false)) || - NS_FAILED(obs->AddObserver(this, MOBILE_CONNECTION_VOICE_CHANGED_ID, false))) { + NS_FAILED(obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false))) { BT_WARNING("Failed to add observers!"); return false; } hal::RegisterBatteryObserver(this); - mListener = new BluetoothTelephonyListener(); + mListener = new BluetoothRilListener(); if (!mListener->StartListening()) { NS_WARNING("Failed to start listening RIL"); return false; } nsCOMPtr<nsISettingsService> settings = do_GetService("@mozilla.org/settingsService;1"); NS_ENSURE_TRUE(settings, false); @@ -416,19 +408,17 @@ BluetoothHfpManager::~BluetoothHfpManage NS_WARNING("Failed to stop listening RIL"); } mListener = nullptr; nsCOMPtr<nsIObserverService> obs = services::GetObserverService(); NS_ENSURE_TRUE_VOID(obs); if (NS_FAILED(obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) || - NS_FAILED(obs->RemoveObserver(this, MOZSETTINGS_CHANGED_ID)) || - NS_FAILED(obs->RemoveObserver(this, MOBILE_CONNECTION_ICCINFO_CHANGED_ID)) || - NS_FAILED(obs->RemoveObserver(this, MOBILE_CONNECTION_VOICE_CHANGED_ID))) { + NS_FAILED(obs->RemoveObserver(this, MOZSETTINGS_CHANGED_ID))) { BT_WARNING("Failed to remove observers!"); } hal::UnregisterBatteryObserver(this); } //static BluetoothHfpManager* @@ -1449,16 +1439,17 @@ BluetoothHfpManager::HandleCallStateChan break; } } void BluetoothHfpManager::OnSocketConnectSuccess(BluetoothSocket* aSocket) { MOZ_ASSERT(aSocket); + MOZ_ASSERT(mListener); // Success to create a SCO socket if (aSocket == mScoSocket) { OnScoConnectSuccess(); return; } /** @@ -1477,20 +1468,18 @@ BluetoothHfpManager::OnSocketConnectSucc } else if (aSocket == mHeadsetSocket) { MOZ_ASSERT(!mSocket); mHeadsetSocket.swap(mSocket); mHandsfreeSocket->Disconnect(); mHandsfreeSocket = nullptr; } - nsCOMPtr<nsITelephonyProvider> provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE_VOID(provider); - provider->EnumerateCalls(mListener->GetListener()); + // Enumerate current calls + mListener->EnumerateCalls(); mFirstCKPD = true; // Cache device path for NotifySettings() since we can't get socket address // when a headset disconnect with us mSocket->GetAddress(mDeviceAddress); NotifyConnectionStatusChanged(NS_LITERAL_STRING(BLUETOOTH_HFP_STATUS_CHANGED_ID)); DispatchConnectionStatusChanged(NS_LITERAL_STRING(HFP_STATUS_CHANGED_ID));
--- a/dom/bluetooth/BluetoothHfpManager.h +++ b/dom/bluetooth/BluetoothHfpManager.h @@ -4,18 +4,18 @@ * 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/. */ #ifndef mozilla_dom_bluetooth_bluetoothhfpmanager_h__ #define mozilla_dom_bluetooth_bluetoothhfpmanager_h__ #include "BluetoothCommon.h" #include "BluetoothProfileManagerBase.h" +#include "BluetoothRilListener.h" #include "BluetoothSocketObserver.h" -#include "BluetoothTelephonyListener.h" #include "mozilla/ipc/UnixSocket.h" #include "mozilla/Hal.h" BEGIN_BLUETOOTH_NAMESPACE class BluetoothReplyRunnable; class BluetoothSocket; class Call; @@ -87,16 +87,18 @@ public: bool ListenSco(); /** * @param aSend A boolean indicates whether we need to notify headset or not */ void HandleCallStateChanged(uint32_t aCallIndex, uint16_t aCallState, const nsAString& aError, const nsAString& aNumber, const bool aIsOutgoing, bool aSend); + void HandleIccInfoChanged(); + void HandleVoiceConnectionChanged(); bool IsConnected(); bool IsScoConnected(); private: class CloseScoTask; class GetVolumeTask; class RespondToBLDNTask; @@ -104,20 +106,18 @@ private: friend class CloseScoTask; friend class GetVolumeTask; friend class RespondToBLDNTask; friend class SendRingIndicatorTask; friend class BluetoothHfpManagerObserver; BluetoothHfpManager(); - void HandleIccInfoChanged(); void HandleShutdown(); void HandleVolumeChanged(const nsAString& aData); - void HandleVoiceConnectionChanged(); bool Init(); void Notify(const hal::BatteryInformation& aBatteryInfo); void Reset(); void ResetCallArray(); uint32_t FindFirstCall(uint16_t aState); uint32_t GetNumberOfCalls(uint16_t aState); @@ -145,17 +145,17 @@ private: bool mDialingRequestProcessed; bool mIsHandsfree; bool mNeedsUpdatingSdpRecords; nsString mDeviceAddress; nsString mMsisdn; nsString mOperatorName; nsTArray<Call> mCurrentCallArray; - nsAutoPtr<BluetoothTelephonyListener> mListener; + nsAutoPtr<BluetoothRilListener> mListener; nsRefPtr<BluetoothReplyRunnable> mRunnable; BluetoothProfileController* mController; nsRefPtr<BluetoothReplyRunnable> mScoRunnable; // If a connection has been established, mSocket will be the socket // communicating with the remote socket. We maintain the invariant that if // mSocket is non-null, mHandsfreeSocket and mHeadsetSocket must be null (and // vice versa).
new file mode 100644 --- /dev/null +++ b/dom/bluetooth/BluetoothRilListener.cpp @@ -0,0 +1,336 @@ +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* 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 "BluetoothRilListener.h" + +#include "BluetoothHfpManager.h" +#include "nsIIccProvider.h" +#include "nsIMobileConnectionProvider.h" +#include "nsITelephonyProvider.h" +#include "nsRadioInterfaceLayer.h" +#include "nsServiceManagerUtils.h" +#include "nsString.h" + +USING_BLUETOOTH_NAMESPACE + +namespace { + +/** + * IccListener + */ +class IccListener : public nsIIccListener +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIICCLISTENER + + IccListener() { } +}; + +NS_IMPL_ISUPPORTS1(IccListener, nsIIccListener) + +NS_IMETHODIMP +IccListener::NotifyIccInfoChanged() +{ + BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); + hfp->HandleIccInfoChanged(); + + return NS_OK; +} + +NS_IMETHODIMP +IccListener::NotifyStkCommand(const nsAString & aMessage) +{ + return NS_OK; +} + +NS_IMETHODIMP +IccListener::NotifyStkSessionEnd() +{ + return NS_OK; +} + +NS_IMETHODIMP +IccListener::NotifyIccCardLockError(const nsAString & lockType, + uint32_t retryCount) +{ + return NS_OK; +} + +NS_IMETHODIMP +IccListener::NotifyCardStateChanged() +{ + return NS_OK; +} + +/** + * MobileConnectionListener + */ +class MobileConnectionListener : public nsIMobileConnectionListener +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIMOBILECONNECTIONLISTENER + + MobileConnectionListener() { } +}; + +NS_IMPL_ISUPPORTS1(MobileConnectionListener, nsIMobileConnectionListener) + +NS_IMETHODIMP +MobileConnectionListener::NotifyVoiceChanged() +{ + BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); + hfp->HandleVoiceConnectionChanged(); + + return NS_OK; +} + +NS_IMETHODIMP +MobileConnectionListener::NotifyDataChanged() +{ + return NS_OK; +} + +NS_IMETHODIMP +MobileConnectionListener::NotifyUssdReceived(const nsAString & message, + bool sessionEnded) +{ + return NS_OK; +} + +NS_IMETHODIMP +MobileConnectionListener::NotifyDataError(const nsAString & message) +{ + return NS_OK; +} + +NS_IMETHODIMP +MobileConnectionListener::NotifyCFStateChange(bool success, + uint16_t action, + uint16_t reason, + const nsAString& number, + uint16_t timeSeconds, + uint16_t serviceClass) +{ + return NS_OK; +} + +NS_IMETHODIMP +MobileConnectionListener::NotifyEmergencyCbModeChanged(bool active, + uint32_t timeoutMs) +{ + return NS_OK; +} + +NS_IMETHODIMP +MobileConnectionListener::NotifyOtaStatusChanged(const nsAString & status) +{ + return NS_OK; +} + +/** + * TelephonyListener Implementation + */ +class TelephonyListener : public nsITelephonyListener +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSITELEPHONYLISTENER + + TelephonyListener() { } +}; + +NS_IMPL_ISUPPORTS1(TelephonyListener, nsITelephonyListener) + +NS_IMETHODIMP +TelephonyListener::CallStateChanged(uint32_t aCallIndex, + uint16_t aCallState, + const nsAString& aNumber, + bool aIsActive, + bool aIsOutgoing, + bool aIsEmergency, + bool aIsConference) +{ + BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); + hfp->HandleCallStateChanged(aCallIndex, aCallState, EmptyString(), aNumber, + aIsOutgoing, true); + + return NS_OK; +} + +NS_IMETHODIMP +TelephonyListener::EnumerateCallState(uint32_t aCallIndex, + uint16_t aCallState, + const nsAString_internal& aNumber, + bool aIsActive, + bool aIsOutgoing, + bool aIsEmergency, + bool aIsConference) +{ + BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); + hfp->HandleCallStateChanged(aCallIndex, aCallState, EmptyString(), aNumber, + aIsOutgoing, false); + return NS_OK; +} + +NS_IMETHODIMP +TelephonyListener::NotifyError(int32_t aCallIndex, + const nsAString& aError) +{ + BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); + + if (aCallIndex > 0) { + // In order to not miss any related call state transition. + // It's possible that 3G network signal lost for unknown reason. + // If a call is released abnormally, NotifyError() will be called, + // instead of CallStateChanged(). We need to reset the call array state + // via setting CALL_STATE_DISCONNECTED + hfp->HandleCallStateChanged(aCallIndex, + nsITelephonyProvider::CALL_STATE_DISCONNECTED, + aError, EmptyString(), false, true); + NS_WARNING("Reset the call state due to call transition ends abnormally"); + } + + NS_WARNING(NS_ConvertUTF16toUTF8(aError).get()); + return NS_OK; +} + +NS_IMETHODIMP +TelephonyListener::ConferenceCallStateChanged(uint16_t aCallState) +{ + return NS_OK; +} + +NS_IMETHODIMP +TelephonyListener::EnumerateCallStateComplete() +{ + return NS_OK; +} + +NS_IMETHODIMP +TelephonyListener::SupplementaryServiceNotification(int32_t aCallIndex, + uint16_t aNotification) +{ + return NS_OK; +} + +NS_IMETHODIMP +TelephonyListener::NotifyCdmaCallWaiting(const nsAString& aNumber) +{ + return NS_OK; +} + +} // anonymous namespace + +/** + * BluetoothRilListener + */ +BluetoothRilListener::BluetoothRilListener() +{ + mIccListener = new IccListener(); + mMobileConnectionListener = new MobileConnectionListener(); + mTelephonyListener = new TelephonyListener(); +} + +bool +BluetoothRilListener::StartListening() +{ + NS_ENSURE_TRUE(StartIccListening(), false); + NS_ENSURE_TRUE(StartMobileConnectionListening(), false); + NS_ENSURE_TRUE(StartTelephonyListening(), false); + + return true; +} + +bool +BluetoothRilListener::StopListening() +{ + NS_ENSURE_TRUE(StopIccListening(), false); + NS_ENSURE_TRUE(StopMobileConnectionListening(), false); + NS_ENSURE_TRUE(StopTelephonyListening(), false); + + return true; +} + +void +BluetoothRilListener::EnumerateCalls() +{ + nsCOMPtr<nsITelephonyProvider> provider = + do_GetService(TELEPHONY_PROVIDER_CONTRACTID); + NS_ENSURE_TRUE_VOID(provider); + + provider->EnumerateCalls(mTelephonyListener); +} + +// private +bool +BluetoothRilListener::StartIccListening() +{ + nsCOMPtr<nsIIccProvider> provider = + do_GetService(NS_RILCONTENTHELPER_CONTRACTID); + NS_ENSURE_TRUE(provider, false); + + nsresult rv = provider->RegisterIccMsg(mIccListener); + return NS_SUCCEEDED(rv); +} + +bool +BluetoothRilListener::StopIccListening() +{ + nsCOMPtr<nsIIccProvider> provider = + do_GetService(NS_RILCONTENTHELPER_CONTRACTID); + NS_ENSURE_TRUE(provider, false); + + nsresult rv = provider->UnregisterIccMsg(mIccListener); + return NS_SUCCEEDED(rv); +} + +bool +BluetoothRilListener::StartMobileConnectionListening() +{ + nsCOMPtr<nsIMobileConnectionProvider> provider = + do_GetService(NS_RILCONTENTHELPER_CONTRACTID); + NS_ENSURE_TRUE(provider, false); + + nsresult rv = provider-> + RegisterMobileConnectionMsg(mMobileConnectionListener); + return NS_SUCCEEDED(rv); +} + +bool +BluetoothRilListener::StopMobileConnectionListening() +{ + nsCOMPtr<nsIMobileConnectionProvider> provider = + do_GetService(NS_RILCONTENTHELPER_CONTRACTID); + NS_ENSURE_TRUE(provider, false); + + nsresult rv = provider-> + UnregisterMobileConnectionMsg(mMobileConnectionListener); + return NS_SUCCEEDED(rv); +} + +bool +BluetoothRilListener::StartTelephonyListening() +{ + nsCOMPtr<nsITelephonyProvider> provider = + do_GetService(TELEPHONY_PROVIDER_CONTRACTID); + NS_ENSURE_TRUE(provider, false); + + nsresult rv = provider->RegisterListener(mTelephonyListener); + return NS_SUCCEEDED(rv); +} + +bool +BluetoothRilListener::StopTelephonyListening() +{ + nsCOMPtr<nsITelephonyProvider> provider = + do_GetService(TELEPHONY_PROVIDER_CONTRACTID); + NS_ENSURE_TRUE(provider, false); + + nsresult rv = provider->UnregisterListener(mTelephonyListener); + return NS_SUCCEEDED(rv); +} \ No newline at end of file
new file mode 100644 --- /dev/null +++ b/dom/bluetooth/BluetoothRilListener.h @@ -0,0 +1,47 @@ +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef mozilla_dom_bluetooth_bluetoothrillistener_h__ +#define mozilla_dom_bluetooth_bluetoothrillistener_h__ + +#include "BluetoothCommon.h" + +#include "nsCOMPtr.h" + +class nsIIccListener; +class nsIMobileConnectionListener; +class nsITelephonyListener; + +BEGIN_BLUETOOTH_NAMESPACE + +class BluetoothRilListener +{ +public: + BluetoothRilListener(); + + bool StartListening(); + bool StopListening(); + + void EnumerateCalls(); + +private: + bool StartIccListening(); + bool StopIccListening(); + + bool StartMobileConnectionListening(); + bool StopMobileConnectionListening(); + + bool StartTelephonyListening(); + bool StopTelephonyListening(); + + nsCOMPtr<nsIIccListener> mIccListener; + nsCOMPtr<nsIMobileConnectionListener> mMobileConnectionListener; + nsCOMPtr<nsITelephonyListener> mTelephonyListener; +}; + +END_BLUETOOTH_NAMESPACE + +#endif
deleted file mode 100644 --- a/dom/bluetooth/BluetoothTelephonyListener.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* 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 "BluetoothTelephonyListener.h" - -#include "BluetoothHfpManager.h" -#include "nsRadioInterfaceLayer.h" -#include "nsServiceManagerUtils.h" -#include "nsString.h" - -USING_BLUETOOTH_NAMESPACE - -namespace { - -class TelephonyListener : public nsITelephonyListener -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSITELEPHONYLISTENER - - TelephonyListener() { } -}; - -NS_IMPL_ISUPPORTS1(TelephonyListener, nsITelephonyListener) - -NS_IMETHODIMP -TelephonyListener::CallStateChanged(uint32_t aCallIndex, - uint16_t aCallState, - const nsAString& aNumber, - bool aIsActive, - bool aIsOutgoing, - bool aIsEmergency, - bool aIsConference) -{ - BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); - hfp->HandleCallStateChanged(aCallIndex, aCallState, EmptyString(), aNumber, - aIsOutgoing, true); - - return NS_OK; -} - -NS_IMETHODIMP -TelephonyListener::ConferenceCallStateChanged(uint16_t aCallState) -{ - return NS_OK; -} - -NS_IMETHODIMP -TelephonyListener::EnumerateCallStateComplete() -{ - return NS_OK; -} - -NS_IMETHODIMP -TelephonyListener::EnumerateCallState(uint32_t aCallIndex, - uint16_t aCallState, - const nsAString_internal& aNumber, - bool aIsActive, - bool aIsOutgoing, - bool aIsEmergency, - bool aIsConference) -{ - BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); - hfp->HandleCallStateChanged(aCallIndex, aCallState, EmptyString(), aNumber, - aIsOutgoing, false); - return NS_OK; -} - -NS_IMETHODIMP -TelephonyListener::SupplementaryServiceNotification(int32_t aCallIndex, - uint16_t aNotification) -{ - return NS_OK; -} - -NS_IMETHODIMP -TelephonyListener::NotifyError(int32_t aCallIndex, - const nsAString& aError) -{ - BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); - - if (aCallIndex > 0) { - // In order to not miss any related call state transition. - // It's possible that 3G network signal lost for unknown reason. - // If a call is released abnormally, NotifyError() will be called, - // instead of CallStateChanged(). We need to reset the call array state - // via setting CALL_STATE_DISCONNECTED - hfp->HandleCallStateChanged(aCallIndex, - nsITelephonyProvider::CALL_STATE_DISCONNECTED, - aError, EmptyString(), false, true); - NS_WARNING("Reset the call state due to call transition ends abnormally"); - } - - NS_WARNING(NS_ConvertUTF16toUTF8(aError).get()); - return NS_OK; -} - -NS_IMETHODIMP -TelephonyListener::NotifyCdmaCallWaiting(const nsAString& aNumber) -{ - return NS_OK; -} - -} // anonymous namespace - -BluetoothTelephonyListener::BluetoothTelephonyListener() -{ - mTelephonyListener = new TelephonyListener(); -} - -bool -BluetoothTelephonyListener::StartListening() -{ - nsCOMPtr<nsITelephonyProvider> provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, false); - - nsresult rv = provider->RegisterListener(mTelephonyListener); - NS_ENSURE_SUCCESS(rv, false); - - return true; -} - -bool -BluetoothTelephonyListener::StopListening() -{ - nsCOMPtr<nsITelephonyProvider> provider = - do_GetService(TELEPHONY_PROVIDER_CONTRACTID); - NS_ENSURE_TRUE(provider, false); - - nsresult rv = provider->UnregisterListener(mTelephonyListener); - - return NS_FAILED(rv) ? false : true; -} - -nsITelephonyListener* -BluetoothTelephonyListener::GetListener() -{ - return mTelephonyListener; -}
deleted file mode 100644 --- a/dom/bluetooth/BluetoothTelephonyListener.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef mozilla_dom_bluetooth_bluetoothtelephonylistener_h__ -#define mozilla_dom_bluetooth_bluetoothtelephonylistener_h__ - -#include "BluetoothCommon.h" - -#include "nsCOMPtr.h" -#include "nsITelephonyProvider.h" - -BEGIN_BLUETOOTH_NAMESPACE - -class BluetoothTelephonyListener -{ -public: - BluetoothTelephonyListener(); - - bool StartListening(); - bool StopListening(); - - nsITelephonyListener* GetListener(); - -private: - nsCOMPtr<nsITelephonyListener> mTelephonyListener; -}; - -END_BLUETOOTH_NAMESPACE - -#endif
--- a/dom/bluetooth/moz.build +++ b/dom/bluetooth/moz.build @@ -44,17 +44,17 @@ if CONFIG['MOZ_B2G_BT']: 'ObexBase.cpp', 'BluetoothUuid.cpp', 'BluetoothSocket.cpp', 'BluetoothProfileController.cpp' ] if CONFIG['MOZ_B2G_RIL']: CPP_SOURCES += [ - 'BluetoothTelephonyListener.cpp', + 'BluetoothRilListener.cpp', ] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': CPP_SOURCES += [ 'BluetoothDBusService.cpp', 'BluetoothGonkService.cpp', ] else: