Bug 1100883: Move helpers of |BluetoothServiceBluedroid| into its namespace, r=btian

This commit is contained in:
Thomas Zimmermann 2014-11-20 11:06:00 +01:00
Родитель 979eb405a7
Коммит 39334508d6
2 изменённых файлов: 64 добавлений и 26 удалений

Просмотреть файл

@ -67,7 +67,8 @@ static uint32_t sAdapterDiscoverableTimeout(0);
* Classes only used in this file
*/
class SetupAfterEnabledTask MOZ_FINAL : public nsRunnable
class BluetoothServiceBluedroid::SetupAfterEnabledTask MOZ_FINAL
: public nsRunnable
{
public:
class SetAdapterPropertyResultHandler MOZ_FINAL
@ -121,7 +122,7 @@ public:
* result handlers and calls |Proceed| after all results handlers
* have been run.
*/
class ProfileDeinitResultHandler MOZ_FINAL
class BluetoothServiceBluedroid::ProfileDeinitResultHandler MOZ_FINAL
: public BluetoothProfileResultHandler
{
public:
@ -154,7 +155,7 @@ private:
unsigned char mNumProfiles;
};
class CleanupTask MOZ_FINAL : public nsRunnable
class BluetoothServiceBluedroid::CleanupTask MOZ_FINAL : public nsRunnable
{
public:
NS_IMETHOD
@ -182,8 +183,8 @@ public:
/**
* Static callback functions
*/
static void
ClassToIcon(uint32_t aClass, nsAString& aRetIcon)
void
BluetoothServiceBluedroid::ClassToIcon(uint32_t aClass, nsAString& aRetIcon)
{
switch ((aClass & 0x1f00) >> 8) {
case 0x01:
@ -273,8 +274,9 @@ ClassToIcon(uint32_t aClass, nsAString& aRetIcon)
}
}
static ControlPlayStatus
PlayStatusStringToControlPlayStatus(const nsAString& aPlayStatus)
ControlPlayStatus
BluetoothServiceBluedroid::PlayStatusStringToControlPlayStatus(
const nsAString& aPlayStatus)
{
ControlPlayStatus playStatus = ControlPlayStatus::PLAYSTATUS_UNKNOWN;
if (aPlayStatus.EqualsLiteral("STOPPED")) {
@ -297,8 +299,8 @@ PlayStatusStringToControlPlayStatus(const nsAString& aPlayStatus)
/**
* Static functions
*/
static bool
EnsureBluetoothHalLoad()
bool
BluetoothServiceBluedroid::EnsureBluetoothHalLoad()
{
sBtInterface = BluetoothInterface::GetInstance();
NS_ENSURE_TRUE(sBtInterface, false);
@ -306,7 +308,8 @@ EnsureBluetoothHalLoad()
return true;
}
class EnableResultHandler MOZ_FINAL : public BluetoothResultHandler
class BluetoothServiceBluedroid::EnableResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -326,7 +329,7 @@ public:
* result handlers and calls |Proceed| after all results handlers
* have been run.
*/
class ProfileInitResultHandler MOZ_FINAL
class BluetoothServiceBluedroid::ProfileInitResultHandler MOZ_FINAL
: public BluetoothProfileResultHandler
{
public:
@ -359,7 +362,8 @@ private:
unsigned char mNumProfiles;
};
class InitResultHandler MOZ_FINAL : public BluetoothResultHandler
class BluetoothServiceBluedroid::InitResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
void Init() MOZ_OVERRIDE
@ -397,8 +401,8 @@ public:
}
};
static nsresult
StartGonkBluetooth()
nsresult
BluetoothServiceBluedroid::StartGonkBluetooth()
{
MOZ_ASSERT(NS_IsMainThread());
@ -422,7 +426,8 @@ StartGonkBluetooth()
return NS_OK;
}
class DisableResultHandler MOZ_FINAL : public BluetoothResultHandler
class BluetoothServiceBluedroid::DisableResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE
@ -438,8 +443,8 @@ public:
}
};
static nsresult
StopGonkBluetooth()
nsresult
BluetoothServiceBluedroid::StopGonkBluetooth()
{
MOZ_ASSERT(NS_IsMainThread());
@ -575,8 +580,8 @@ BluetoothServiceBluedroid::GetDefaultAdapterPathInternal(
return NS_OK;
}
class GetRemoteDevicePropertiesResultHandler MOZ_FINAL
: public BluetoothResultHandler
class BluetoothServiceBluedroid::GetRemoteDevicePropertiesResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
GetRemoteDevicePropertiesResultHandler(const nsAString& aDeviceAddress)
@ -677,7 +682,8 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal(
return NS_OK;
}
class StartDiscoveryResultHandler MOZ_FINAL : public BluetoothResultHandler
class BluetoothServiceBluedroid::StartDiscoveryResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
StartDiscoveryResultHandler(BluetoothReplyRunnable* aRunnable)
@ -712,7 +718,8 @@ BluetoothServiceBluedroid::StartDiscoveryInternal(
return NS_OK;
}
class CancelDiscoveryResultHandler MOZ_FINAL : public BluetoothResultHandler
class BluetoothServiceBluedroid::CancelDiscoveryResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
CancelDiscoveryResultHandler(BluetoothReplyRunnable* aRunnable)
@ -747,7 +754,8 @@ BluetoothServiceBluedroid::StopDiscoveryInternal(
return NS_OK;
}
class SetAdapterPropertyResultHandler MOZ_FINAL : public BluetoothResultHandler
class BluetoothServiceBluedroid::SetAdapterPropertyResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
SetAdapterPropertyResultHandler(BluetoothReplyRunnable* aRunnable)
@ -796,7 +804,8 @@ BluetoothServiceBluedroid::UpdateSdpRecords(
return true;
}
class CreateBondResultHandler MOZ_FINAL : public BluetoothResultHandler
class BluetoothServiceBluedroid::CreateBondResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
CreateBondResultHandler(BluetoothReplyRunnable* aRunnable)
@ -830,7 +839,8 @@ BluetoothServiceBluedroid::CreatePairedDeviceInternal(
return NS_OK;
}
class RemoveBondResultHandler MOZ_FINAL : public BluetoothResultHandler
class BluetoothServiceBluedroid::RemoveBondResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
RemoveBondResultHandler(BluetoothReplyRunnable* aRunnable)
@ -863,7 +873,8 @@ BluetoothServiceBluedroid::RemoveDeviceInternal(
return NS_OK;
}
class PinReplyResultHandler MOZ_FINAL : public BluetoothResultHandler
class BluetoothServiceBluedroid::PinReplyResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
PinReplyResultHandler(BluetoothReplyRunnable* aRunnable)
@ -907,7 +918,8 @@ BluetoothServiceBluedroid::SetPasskeyInternal(
return true;
}
class SspReplyResultHandler MOZ_FINAL : public BluetoothResultHandler
class BluetoothServiceBluedroid::SspReplyResultHandler MOZ_FINAL
: public BluetoothResultHandler
{
public:
SspReplyResultHandler(BluetoothReplyRunnable* aRunnable)

Просмотреть файл

@ -16,6 +16,22 @@ BEGIN_BLUETOOTH_NAMESPACE
class BluetoothServiceBluedroid : public BluetoothService
, public BluetoothNotificationHandler
{
class CancelDiscoveryResultHandler;
class CleanupTask;
class CreateBondResultHandler;
class DisableResultHandler;
class EnableResultHandler;
class GetRemoteDevicePropertiesResultHandler;
class InitResultHandler;
class PinReplyResultHandler;
class ProfileDeinitResultHandler;
class ProfileInitResultHandler;
class RemoveBondResultHandler;
class SetAdapterPropertyResultHandler;
class SetupAfterEnabledTask;
class SspReplyResultHandler;
class StartDiscoveryResultHandler;
public:
BluetoothServiceBluedroid();
~BluetoothServiceBluedroid();
@ -196,6 +212,16 @@ public:
uint8_t aLen) MOZ_OVERRIDE;
virtual void LeTestModeNotification(BluetoothStatus aStatus,
uint16_t aNumPackets) MOZ_OVERRIDE;
protected:
static nsresult StartGonkBluetooth();
static nsresult StopGonkBluetooth();
static bool EnsureBluetoothHalLoad();
static void ClassToIcon(uint32_t aClass, nsAString& aRetIcon);
static ControlPlayStatus PlayStatusStringToControlPlayStatus(
const nsAString& aPlayStatus);
};
END_BLUETOOTH_NAMESPACE