Bug 1171868 - Remove GeneratePathFromGattId(aId, aPath, aUuidStr); r=jocelyn

This commit is contained in:
Bruce Sun 2015-06-11 18:06:43 +08:00
parent efa6ebbf99
commit 39bbe8ff1d
5 changed files with 17 additions and 34 deletions

View File

@ -87,24 +87,16 @@ GenerateUuid(nsAString &aUuidString)
aUuidString.Assign(Substring(uuidString, 1, NSID_LENGTH - 3));
}
void
GeneratePathFromGattId(const BluetoothGattId& aId,
nsAString& aPath,
nsAString& aUuidStr)
{
UuidToString(aId.mUuid, aUuidStr);
aPath.Assign(aUuidStr);
aPath.AppendLiteral("_");
aPath.AppendInt(aId.mInstanceId);
}
void
GeneratePathFromGattId(const BluetoothGattId& aId,
nsAString& aPath)
{
nsString uuidStr;
GeneratePathFromGattId(aId, aPath, uuidStr);
UuidToString(aId.mUuid, uuidStr);
aPath.Assign(uuidStr);
aPath.AppendLiteral("_");
aPath.AppendInt(aId.mInstanceId);
}
void

View File

@ -50,18 +50,6 @@ GenerateUuid(nsAString &aUuidString);
// Generate bluetooth signal path from GattId
//
/**
* Generate bluetooth signal path and UUID string from a GattId.
*
* @param aId [in] GattId value to convert.
* @param aPath [out] Bluetooth signal path generated from aId.
* @param aUuidStr [out] UUID string generated from aId.
*/
void
GeneratePathFromGattId(const BluetoothGattId& aId,
nsAString& aPath,
nsAString& aUuidStr);
/**
* Generate bluetooth signal path from a GattId.
*

View File

@ -68,10 +68,11 @@ BluetoothGattCharacteristic::BluetoothGattCharacteristic(
MOZ_ASSERT(aOwner);
MOZ_ASSERT(mService);
// Generate bluetooth signal path and a string representation to provide uuid
// of this characteristic to applications
UuidToString(mCharId.mUuid, mUuidStr);
// Generate bluetooth signal path of this characteristic to applications
nsString path;
GeneratePathFromGattId(mCharId, path, mUuidStr);
GeneratePathFromGattId(mCharId, path);
RegisterBluetoothSignalHandler(path, this);
}

View File

@ -63,10 +63,11 @@ BluetoothGattDescriptor::BluetoothGattDescriptor(
MOZ_ASSERT(aOwner);
MOZ_ASSERT(aCharacteristic);
// Generate bluetooth signal path and a string representation to provide uuid
// of this descriptor to applications
UuidToString(mDescriptorId.mUuid, mUuidStr);
// Generate bluetooth signal path of this descriptor to applications
nsString path;
GeneratePathFromGattId(mDescriptorId, path, mUuidStr);
GeneratePathFromGattId(mDescriptorId, path);
RegisterBluetoothSignalHandler(path, this);
}

View File

@ -62,10 +62,11 @@ BluetoothGattService::BluetoothGattService(
MOZ_ASSERT(aOwner);
MOZ_ASSERT(!mAppUuid.IsEmpty());
// Generate bluetooth signal path and a string representation to provide
// uuid of this service to applications
UuidToString(mServiceId.mId.mUuid, mUuidStr);
// Generate bluetooth signal path of this service to applications
nsString path;
GeneratePathFromGattId(mServiceId.mId, path, mUuidStr);
GeneratePathFromGattId(mServiceId.mId, path);
RegisterBluetoothSignalHandler(path, this);
}