Bug 1206686: Use |BluetoothUuid| throughout Bluetooth backend interfaces, r=btian

This patch converts all public interfaces of the Bluetooth backend code
to take UUIDs as |BluetoothUuid|. The code currently uses a mixture of
|BluetoothUuid| and arrays/pointers.
This commit is contained in:
Thomas Zimmermann 2015-09-22 13:04:05 +02:00
parent c00e41b074
commit 052db18ce5
9 changed files with 23 additions and 23 deletions

View File

@ -226,7 +226,7 @@ BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd(
nsresult
BluetoothDaemonCoreModule::GetRemoteServiceRecordCmd(
const nsAString& aRemoteAddr, const uint8_t aUuid[16],
const nsAString& aRemoteAddr, const BluetoothUuid& aUuid,
BluetoothResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -237,7 +237,7 @@ BluetoothDaemonCoreModule::GetRemoteServiceRecordCmd(
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr),
PackArray<uint8_t>(aUuid, 16), *pdu);
aUuid, *pdu);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -97,7 +97,7 @@ public:
BluetoothResultHandler* aRes);
nsresult GetRemoteServiceRecordCmd(const nsAString& aRemoteAddr,
const uint8_t aUuid[16],
const BluetoothUuid& aUuid,
BluetoothResultHandler* aRes);
nsresult GetRemoteServicesCmd(const nsAString& aRemoteAddr,

View File

@ -704,7 +704,7 @@ BluetoothDaemonInterface::SetRemoteDeviceProperty(
void
BluetoothDaemonInterface::GetRemoteServiceRecord(const nsAString& aRemoteAddr,
const uint8_t aUuid[16],
const BluetoothUuid& aUuid,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>

View File

@ -74,7 +74,7 @@ public:
/* Remote Services */
void GetRemoteServiceRecord(const nsAString& aRemoteAddr,
const uint8_t aUuid[16],
const BluetoothUuid& aUuid,
BluetoothResultHandler* aRes) override;
void GetRemoteServices(const nsAString& aRemoteAddr,
BluetoothResultHandler* aRes) override;

View File

@ -25,7 +25,7 @@ const int BluetoothDaemonSocketModule::MAX_NUM_CLIENTS = 1;
nsresult
BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
const nsAString& aServiceName,
const uint8_t aServiceUuid[16],
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt,
bool aAuth,
BluetoothSocketResultHandler* aRes)
@ -39,7 +39,7 @@ BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
nsresult rv = PackPDU(
aType,
PackConversion<nsAString, BluetoothServiceName>(aServiceName),
PackArray<uint8_t>(aServiceUuid, 16),
aServiceUuid,
PackConversion<int, int32_t>(aChannel),
SocketFlags(aEncrypt, aAuth), *pdu);
if (NS_FAILED(rv)) {
@ -56,7 +56,7 @@ BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
nsresult
BluetoothDaemonSocketModule::ConnectCmd(const nsAString& aBdAddr,
BluetoothSocketType aType,
const uint8_t aUuid[16],
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt,
bool aAuth,
BluetoothSocketResultHandler* aRes)
@ -70,7 +70,7 @@ BluetoothDaemonSocketModule::ConnectCmd(const nsAString& aBdAddr,
nsresult rv = PackPDU(
PackConversion<nsAString, BluetoothAddress>(aBdAddr),
aType,
PackArray<uint8_t>(aUuid, 16),
aServiceUuid,
PackConversion<int, int32_t>(aChannel),
SocketFlags(aEncrypt, aAuth), *pdu);
if (NS_FAILED(rv)) {
@ -305,7 +305,7 @@ BluetoothDaemonSocketInterface::~BluetoothDaemonSocketInterface()
void
BluetoothDaemonSocketInterface::Listen(BluetoothSocketType aType,
const nsAString& aServiceName,
const uint8_t aServiceUuid[16],
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt,
bool aAuth,
BluetoothSocketResultHandler* aRes)
@ -322,14 +322,14 @@ BluetoothDaemonSocketInterface::Listen(BluetoothSocketType aType,
void
BluetoothDaemonSocketInterface::Connect(const nsAString& aBdAddr,
BluetoothSocketType aType,
const uint8_t aUuid[16],
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt,
bool aAuth,
BluetoothSocketResultHandler* aRes)
{
MOZ_ASSERT(mModule);
nsresult rv = mModule->ConnectCmd(aBdAddr, aType, aUuid, aChannel,
nsresult rv = mModule->ConnectCmd(aBdAddr, aType, aServiceUuid, aChannel,
aEncrypt, aAuth, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);

View File

@ -40,13 +40,13 @@ public:
nsresult ListenCmd(BluetoothSocketType aType,
const nsAString& aServiceName,
const uint8_t aServiceUuid[16],
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes);
nsresult ConnectCmd(const nsAString& aBdAddr,
BluetoothSocketType aType,
const uint8_t aUuid[16],
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes);
@ -108,13 +108,13 @@ public:
void Listen(BluetoothSocketType aType,
const nsAString& aServiceName,
const uint8_t aServiceUuid[16],
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes) override;
void Connect(const nsAString& aBdAddr,
BluetoothSocketType aType,
const uint8_t aUuid[16],
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes) override;

View File

@ -898,7 +898,7 @@ public:
void CancelDiscovery() override
{
// Disabled discovery mode, now perform SDP operation.
sBtInterface->GetRemoteServiceRecord(mDeviceAddress, mUuid.mUuid, this);
sBtInterface->GetRemoteServiceRecord(mDeviceAddress, mUuid, this);
}
private:
@ -941,7 +941,7 @@ BluetoothServiceBluedroid::GetServiceChannel(
sBtInterface->CancelDiscovery(res);
} else {
sBtInterface->GetRemoteServiceRecord(
aDeviceAddress, uuid.mUuid, res);
aDeviceAddress, uuid, res);
}
return NS_OK;

View File

@ -665,7 +665,7 @@ BluetoothSocket::Connect(const nsAString& aDeviceAddress,
sBluetoothSocketInterface->Connect(
aDeviceAddress, aType,
aServiceUuid.mUuid, aChannel,
aServiceUuid, aChannel,
aEncrypt, aAuth, res);
return NS_OK;
@ -729,7 +729,7 @@ BluetoothSocket::Listen(const nsAString& aServiceName,
sBluetoothSocketInterface->Listen(
aType,
aServiceName, aServiceUuid.mUuid, aChannel,
aServiceName, aServiceUuid, aChannel,
aEncrypt, aAuth, res);
return NS_OK;

View File

@ -57,13 +57,13 @@ public:
virtual void Listen(BluetoothSocketType aType,
const nsAString& aServiceName,
const uint8_t aServiceUuid[16],
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes) = 0;
virtual void Connect(const nsAString& aBdAddr,
BluetoothSocketType aType,
const uint8_t aUuid[16],
const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes) = 0;
@ -1052,7 +1052,7 @@ public:
/* Remote Services */
virtual void GetRemoteServiceRecord(const nsAString& aRemoteAddr,
const uint8_t aUuid[16],
const BluetoothUuid& aUuid,
BluetoothResultHandler* aRes) = 0;
virtual void GetRemoteServices(const nsAString& aRemoteAddr,
BluetoothResultHandler* aRes) = 0;