Bug 827212 - Patch 1: Move functions from public to private in BluetoothHfpManager, r=echou

This commit is contained in:
Gina Yeh 2013-01-16 14:13:41 +08:00
parent efe0de99ea
commit fb12b3fab9
2 changed files with 29 additions and 24 deletions

View File

@ -171,7 +171,7 @@ public:
}
};
class GetVolumeTask : public nsISettingsServiceCallback
class BluetoothHfpManager::GetVolumeTask : public nsISettingsServiceCallback
{
public:
NS_DECL_ISUPPORTS
@ -190,7 +190,7 @@ public:
}
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
hfp->SetVolume(aResult.toNumber());
hfp->mCurrentVgs = aResult.toNumber();
return NS_OK;
}
@ -203,7 +203,8 @@ public:
}
};
NS_IMPL_ISUPPORTS1(GetVolumeTask, nsISettingsServiceCallback);
NS_IMPL_ISUPPORTS1(BluetoothHfpManager::GetVolumeTask,
nsISettingsServiceCallback);
NS_IMETHODIMP
BluetoothHfpManagerObserver::Observe(nsISupports* aSubject,
@ -249,15 +250,20 @@ public:
return;
}
gBluetoothHfpManager->SendLine("RING");
const char* kHfpCrlf = "\xd\xa";
nsAutoCString ringMsg(kHfpCrlf);
ringMsg += "RING";
ringMsg += kHfpCrlf;
gBluetoothHfpManager->SendSocketData(ringMsg);
if (!mNumber.IsEmpty()) {
nsAutoCString resultCode("+CLIP: \"");
resultCode += mNumber;
resultCode += "\",";
resultCode.AppendInt(mType);
gBluetoothHfpManager->SendLine(resultCode.get());
nsAutoCString clipMsg(kHfpCrlf);
clipMsg += "+CLIP: \"";
clipMsg += mNumber;
clipMsg += "\",";
clipMsg.AppendInt(mType);
clipMsg += kHfpCrlf;
gBluetoothHfpManager->SendSocketData(clipMsg);
}
MessageLoop::current()->
@ -300,7 +306,7 @@ CloseScoSocket()
sco->Disconnect();
}
bool
static bool
IsValidDtmf(const char aChar) {
// Valid DTMF: [*#0-9ABCD]
if (aChar == '*' || aChar == '#') {
@ -403,12 +409,6 @@ BluetoothHfpManager::Get()
return gBluetoothHfpManager;
}
void
BluetoothHfpManager::SetVolume(const int aVolume)
{
mCurrentVgs = aVolume;
}
void
BluetoothHfpManager::NotifySettings()
{

View File

@ -50,28 +50,28 @@ enum BluetoothCmeError {
class BluetoothHfpManager : public mozilla::ipc::UnixSocketConsumer
{
public:
~BluetoothHfpManager();
static BluetoothHfpManager* Get();
virtual void ReceiveSocketData(mozilla::ipc::UnixSocketRawData* aMessage)
MOZ_OVERRIDE;
bool Connect(const nsAString& aDeviceObjectPath,
const bool aIsHandsfree,
BluetoothReplyRunnable* aRunnable);
void Disconnect();
bool SendLine(const char* aMessage);
bool SendCommand(const char* aCommand, const int aValue);
bool Listen();
void CallStateChanged(int aCallIndex, int aCallState,
const char* aNumber, bool aIsActive);
void EnumerateCallState(int aCallIndex, int aCallState,
const char* aNumber, bool aIsActive);
void SetupCIND(int aCallIndex, int aCallState,
const char* aPhoneNumber, bool aInitial);
bool Listen();
void SetVolume(int aVolume);
private:
class GetVolumeTask;
friend class GetVolumeTask;
friend class BluetoothHfpManagerObserver;
BluetoothHfpManager();
~BluetoothHfpManager();
nsresult HandleIccInfoChanged();
nsresult HandleShutdown();
nsresult HandleVolumeChanged(const nsAString& aData);
@ -81,6 +81,11 @@ private:
void Cleanup();
void NotifyDialer(const nsAString& aCommand);
void NotifySettings();
bool SendCommand(const char* aCommand, const int aValue);
bool SendLine(const char* aMessage);
void SetupCIND(int aCallIndex, int aCallState,
const char* aPhoneNumber, bool aInitial);
virtual void OnConnectSuccess() MOZ_OVERRIDE;
virtual void OnConnectError() MOZ_OVERRIDE;
virtual void OnDisconnect() MOZ_OVERRIDE;