Bug 1220121: Convert IPDL of Bluetooth GATT API to |BluetoothUuid|, r=joliu

This commit is contained in:
Thomas Zimmermann 2015-11-13 15:26:50 +01:00
Родитель 0d85c6c530
Коммит c89087189f
15 изменённых файлов: 387 добавлений и 324 удалений

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

@ -326,7 +326,7 @@ BluetoothServiceBluedroid::StopInternal(BluetoothReplyRunnable* aRunnable)
void
BluetoothServiceBluedroid::StartLeScanInternal(
const nsTArray<nsString>& aServiceUuids,
const nsTArray<BluetoothUuid>& aServiceUuids,
BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
@ -335,18 +335,12 @@ BluetoothServiceBluedroid::StartLeScanInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
nsTArray<BluetoothUuid> serviceUuids(aServiceUuids.Length());
for (auto i = 0ul; i < aServiceUuids.Length(); ++i) {
StringToUuid(aServiceUuids[i], serviceUuids[i]);
}
gatt->StartLeScan(serviceUuids, aRunnable);
gatt->StartLeScan(aServiceUuids, aRunnable);
}
void
BluetoothServiceBluedroid::StopLeScanInternal(
const nsAString& aScanUuid,
const BluetoothUuid& aScanUuid,
BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
@ -355,15 +349,12 @@ BluetoothServiceBluedroid::StopLeScanInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid scanUuid;
StringToUuid(aScanUuid, scanUuid);
gatt->StopLeScan(scanUuid, aRunnable);
gatt->StopLeScan(aScanUuid, aRunnable);
}
void
BluetoothServiceBluedroid::ConnectGattClientInternal(
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
@ -373,15 +364,12 @@ BluetoothServiceBluedroid::ConnectGattClientInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->Connect(appUuid, aDeviceAddress, aRunnable);
gatt->Connect(aAppUuid, aDeviceAddress, aRunnable);
}
void
BluetoothServiceBluedroid::DisconnectGattClientInternal(
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
@ -391,15 +379,12 @@ BluetoothServiceBluedroid::DisconnectGattClientInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->Disconnect(appUuid, aDeviceAddress, aRunnable);
gatt->Disconnect(aAppUuid, aDeviceAddress, aRunnable);
}
void
BluetoothServiceBluedroid::DiscoverGattServicesInternal(
const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
const BluetoothUuid& aAppUuid, BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
@ -408,15 +393,12 @@ BluetoothServiceBluedroid::DiscoverGattServicesInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->Discover(appUuid, aRunnable);
gatt->Discover(aAppUuid, aRunnable);
}
void
BluetoothServiceBluedroid::GattClientStartNotificationsInternal(
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
@ -426,15 +408,12 @@ BluetoothServiceBluedroid::GattClientStartNotificationsInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->RegisterNotifications(appUuid, aServId, aCharId, aRunnable);
gatt->RegisterNotifications(aAppUuid, aServId, aCharId, aRunnable);
}
void
BluetoothServiceBluedroid::GattClientStopNotificationsInternal(
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
@ -444,10 +423,7 @@ BluetoothServiceBluedroid::GattClientStopNotificationsInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->DeregisterNotifications(appUuid, aServId, aCharId, aRunnable);
gatt->DeregisterNotifications(aAppUuid, aServId, aCharId, aRunnable);
}
void
@ -481,7 +457,7 @@ BluetoothServiceBluedroid::GattClientReadRemoteRssiInternal(
void
BluetoothServiceBluedroid::GattClientReadCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
BluetoothReplyRunnable* aRunnable)
@ -493,16 +469,13 @@ BluetoothServiceBluedroid::GattClientReadCharacteristicValueInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ReadCharacteristicValue(appUuid, aServiceId, aCharacteristicId,
gatt->ReadCharacteristicValue(aAppUuid, aServiceId, aCharacteristicId,
aRunnable);
}
void
BluetoothServiceBluedroid::GattClientWriteCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattWriteType& aWriteType,
@ -516,16 +489,13 @@ BluetoothServiceBluedroid::GattClientWriteCharacteristicValueInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->WriteCharacteristicValue(appUuid, aServiceId, aCharacteristicId,
gatt->WriteCharacteristicValue(aAppUuid, aServiceId, aCharacteristicId,
aWriteType, aValue, aRunnable);
}
void
BluetoothServiceBluedroid::GattClientReadDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -538,16 +508,13 @@ BluetoothServiceBluedroid::GattClientReadDescriptorValueInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ReadDescriptorValue(appUuid, aServiceId, aCharacteristicId,
gatt->ReadDescriptorValue(aAppUuid, aServiceId, aCharacteristicId,
aDescriptorId, aRunnable);
}
void
BluetoothServiceBluedroid::GattClientWriteDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -561,17 +528,14 @@ BluetoothServiceBluedroid::GattClientWriteDescriptorValueInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->WriteDescriptorValue(appUuid, aServiceId, aCharacteristicId,
gatt->WriteDescriptorValue(aAppUuid, aServiceId, aCharacteristicId,
aDescriptorId, aValue, aRunnable);
}
// GATT Server
void
BluetoothServiceBluedroid::GattServerConnectPeripheralInternal(
const nsAString& aAppUuid, const BluetoothAddress& aAddress,
const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
@ -581,15 +545,12 @@ BluetoothServiceBluedroid::GattServerConnectPeripheralInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ConnectPeripheral(appUuid, aAddress, aRunnable);
gatt->ConnectPeripheral(aAppUuid, aAddress, aRunnable);
}
void
BluetoothServiceBluedroid::GattServerDisconnectPeripheralInternal(
const nsAString& aAppUuid, const BluetoothAddress& aAddress,
const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
@ -599,10 +560,7 @@ BluetoothServiceBluedroid::GattServerDisconnectPeripheralInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->DisconnectPeripheral(appUuid, aAddress, aRunnable);
gatt->DisconnectPeripheral(aAppUuid, aAddress, aRunnable);
}
void
@ -621,7 +579,7 @@ BluetoothServiceBluedroid::UnregisterGattServerInternal(
void
BluetoothServiceBluedroid::GattServerAddServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
uint16_t aHandleCount,
BluetoothReplyRunnable* aRunnable)
@ -633,15 +591,12 @@ BluetoothServiceBluedroid::GattServerAddServiceInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ServerAddService(appUuid, aServiceId, aHandleCount, aRunnable);
gatt->ServerAddService(aAppUuid, aServiceId, aHandleCount, aRunnable);
}
void
BluetoothServiceBluedroid::GattServerAddIncludedServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aIncludedServiceHandle,
BluetoothReplyRunnable* aRunnable)
@ -653,10 +608,7 @@ BluetoothServiceBluedroid::GattServerAddIncludedServiceInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ServerAddIncludedService(appUuid,
gatt->ServerAddIncludedService(aAppUuid,
aServiceHandle,
aIncludedServiceHandle,
aRunnable);
@ -664,7 +616,7 @@ BluetoothServiceBluedroid::GattServerAddIncludedServiceInternal(
void
BluetoothServiceBluedroid::GattServerAddCharacteristicInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothUuid& aCharacteristicUuid,
BluetoothGattAttrPerm aPermissions,
@ -678,10 +630,7 @@ BluetoothServiceBluedroid::GattServerAddCharacteristicInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ServerAddCharacteristic(appUuid,
gatt->ServerAddCharacteristic(aAppUuid,
aServiceHandle,
aCharacteristicUuid,
aPermissions,
@ -691,7 +640,7 @@ BluetoothServiceBluedroid::GattServerAddCharacteristicInternal(
void
BluetoothServiceBluedroid::GattServerAddDescriptorInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aCharacteristicHandle,
const BluetoothUuid& aDescriptorUuid,
@ -705,10 +654,7 @@ BluetoothServiceBluedroid::GattServerAddDescriptorInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ServerAddDescriptor(appUuid,
gatt->ServerAddDescriptor(aAppUuid,
aServiceHandle,
aCharacteristicHandle,
aDescriptorUuid,
@ -718,7 +664,7 @@ BluetoothServiceBluedroid::GattServerAddDescriptorInternal(
void
BluetoothServiceBluedroid::GattServerRemoveServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable)
{
@ -729,15 +675,12 @@ BluetoothServiceBluedroid::GattServerRemoveServiceInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ServerRemoveService(appUuid, aServiceHandle, aRunnable);
gatt->ServerRemoveService(aAppUuid, aServiceHandle, aRunnable);
}
void
BluetoothServiceBluedroid::GattServerStartServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable)
{
@ -748,15 +691,12 @@ BluetoothServiceBluedroid::GattServerStartServiceInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ServerStartService(appUuid, aServiceHandle, aRunnable);
gatt->ServerStartService(aAppUuid, aServiceHandle, aRunnable);
}
void
BluetoothServiceBluedroid::GattServerStopServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable)
{
@ -767,15 +707,12 @@ BluetoothServiceBluedroid::GattServerStopServiceInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ServerStopService(appUuid, aServiceHandle, aRunnable);
gatt->ServerStopService(aAppUuid, aServiceHandle, aRunnable);
}
void
BluetoothServiceBluedroid::GattServerSendResponseInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
uint16_t aStatus,
int32_t aRequestId,
@ -789,16 +726,13 @@ BluetoothServiceBluedroid::GattServerSendResponseInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ServerSendResponse(
appUuid, aAddress, aStatus, aRequestId, aRsp, aRunnable);
aAppUuid, aAddress, aStatus, aRequestId, aRsp, aRunnable);
}
void
BluetoothServiceBluedroid::GattServerSendIndicationInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
const BluetoothAttributeHandle& aCharacteristicHandle,
bool aConfirm,
@ -812,10 +746,7 @@ BluetoothServiceBluedroid::GattServerSendIndicationInternal(
BluetoothGattManager* gatt = BluetoothGattManager::Get();
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
BluetoothUuid appUuid;
StringToUuid(aAppUuid, appUuid);
gatt->ServerSendIndication(appUuid,
gatt->ServerSendIndication(aAppUuid,
aAddress,
aCharacteristicHandle,
aConfirm,

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

@ -275,36 +275,36 @@ public:
// GATT Client
//
virtual void StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
virtual void StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
BluetoothReplyRunnable* aRunnable);
virtual void StopLeScanInternal(const nsAString& aScanUuid,
virtual void StopLeScanInternal(const BluetoothUuid& aScanUuid,
BluetoothReplyRunnable* aRunnable);
virtual void
ConnectGattClientInternal(const nsAString& aAppUuid,
ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable) override;
virtual void
DisconnectGattClientInternal(const nsAString& aAppUuid,
DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable) override;
virtual void
DiscoverGattServicesInternal(const nsAString& aAppUuid,
DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattClientStartNotificationsInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattClientStopNotificationsInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId,
BluetoothReplyRunnable* aRunnable) override;
@ -320,14 +320,14 @@ public:
virtual void
GattClientReadCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattClientWriteCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattWriteType& aWriteType,
@ -336,7 +336,7 @@ public:
virtual void
GattClientReadDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -344,7 +344,7 @@ public:
virtual void
GattClientWriteDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -353,13 +353,13 @@ public:
virtual void
GattServerConnectPeripheralInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerDisconnectPeripheralInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable) override;
@ -369,21 +369,21 @@ public:
virtual void
GattServerAddServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
uint16_t aHandleCount,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerAddIncludedServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aIncludedServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerAddCharacteristicInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothUuid& aCharacteristicUuid,
BluetoothGattAttrPerm aPermissions,
@ -392,7 +392,7 @@ public:
virtual void
GattServerAddDescriptorInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aCharacteristicHandle,
const BluetoothUuid& aDescriptorUuid,
@ -401,25 +401,25 @@ public:
virtual void
GattServerRemoveServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerStartServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerStopServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerSendResponseInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
uint16_t aStatus,
int32_t aRequestId,
@ -428,7 +428,7 @@ public:
virtual void
GattServerSendIndicationInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
const BluetoothAttributeHandle& aCharacteristicHandle,
bool aConfirm,

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

@ -4295,48 +4295,48 @@ BluetoothDBusService::UpdateNotification(ControlEventId aEventId,
void
BluetoothDBusService::StartLeScanInternal(
const nsTArray<nsString>& aServiceUuids,
const nsTArray<BluetoothUuid>& aServiceUuids,
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::StopLeScanInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::ConnectGattClientInternal(
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::DisconnectGattClientInternal(
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::DiscoverGattServicesInternal(
const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
const BluetoothUuid& aAppUuid, BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::GattClientStartNotificationsInternal(
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::GattClientStopNotificationsInternal(
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
{
}
@ -4356,7 +4356,7 @@ BluetoothDBusService::GattClientReadRemoteRssiInternal(
void
BluetoothDBusService::GattClientReadCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
BluetoothReplyRunnable* aRunnable)
@ -4365,7 +4365,7 @@ BluetoothDBusService::GattClientReadCharacteristicValueInternal(
void
BluetoothDBusService::GattClientWriteCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattWriteType& aWriteType,
@ -4376,7 +4376,7 @@ BluetoothDBusService::GattClientWriteCharacteristicValueInternal(
void
BluetoothDBusService::GattClientReadDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -4386,7 +4386,7 @@ BluetoothDBusService::GattClientReadDescriptorValueInternal(
void
BluetoothDBusService::GattClientWriteDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -4521,14 +4521,14 @@ BluetoothDBusService::ReplyToMapMessageUpdate(long aMasId, bool aStatus,
void
BluetoothDBusService::GattServerConnectPeripheralInternal(
const nsAString& aAppUuid, const BluetoothAddress& aAddress,
const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::GattServerDisconnectPeripheralInternal(
const nsAString& aAppUuid, const BluetoothAddress& aAddress,
const BluetoothUuid& aAppUuid, const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable)
{
}
@ -4541,7 +4541,7 @@ BluetoothDBusService::UnregisterGattServerInternal(
void
BluetoothDBusService::GattServerAddServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
uint16_t aHandleCount,
BluetoothReplyRunnable* aRunnable)
@ -4550,7 +4550,7 @@ BluetoothDBusService::GattServerAddServiceInternal(
void
BluetoothDBusService::GattServerAddIncludedServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aIncludedServiceHandle,
BluetoothReplyRunnable* aRunnable)
@ -4559,7 +4559,7 @@ BluetoothDBusService::GattServerAddIncludedServiceInternal(
void
BluetoothDBusService::GattServerAddCharacteristicInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothUuid& aCharacteristicUuid,
BluetoothGattAttrPerm aPermissions,
@ -4570,7 +4570,7 @@ BluetoothDBusService::GattServerAddCharacteristicInternal(
void
BluetoothDBusService::GattServerAddDescriptorInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aCharacteristicHandle,
const BluetoothUuid& aDescriptorUuid,
@ -4581,7 +4581,7 @@ BluetoothDBusService::GattServerAddDescriptorInternal(
void
BluetoothDBusService::GattServerRemoveServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable)
{
@ -4589,7 +4589,7 @@ BluetoothDBusService::GattServerRemoveServiceInternal(
void
BluetoothDBusService::GattServerStartServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable)
{
@ -4597,7 +4597,7 @@ BluetoothDBusService::GattServerStartServiceInternal(
void
BluetoothDBusService::GattServerStopServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable)
{
@ -4605,7 +4605,7 @@ BluetoothDBusService::GattServerStopServiceInternal(
void
BluetoothDBusService::GattServerSendIndicationInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
const BluetoothAttributeHandle& aCharacteristicHandle,
bool aConfirm,
@ -4616,7 +4616,7 @@ BluetoothDBusService::GattServerSendIndicationInternal(
void
BluetoothDBusService::GattServerSendResponseInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
uint16_t aStatus,
int32_t aRequestId,

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

@ -285,37 +285,37 @@ public:
const nsAString& aMessage) override;
virtual void
StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
BluetoothReplyRunnable* aRunnable) override;
virtual void
StopLeScanInternal(const nsAString& aAppUuid,
StopLeScanInternal(const BluetoothUuid& aAppUuid,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ConnectGattClientInternal(const nsAString& aAppUuid,
ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable) override;
virtual void
DisconnectGattClientInternal(const nsAString& aAppUuid,
DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable) override;
virtual void
DiscoverGattServicesInternal(const nsAString& aAppUuid,
DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattClientStartNotificationsInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattClientStopNotificationsInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId,
BluetoothReplyRunnable* aRunnable) override;
@ -331,14 +331,14 @@ public:
virtual void
GattClientReadCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattClientWriteCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattWriteType& aWriteType,
@ -347,7 +347,7 @@ public:
virtual void
GattClientReadDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -355,7 +355,7 @@ public:
virtual void
GattClientWriteDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -364,13 +364,13 @@ public:
virtual void
GattServerConnectPeripheralInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerDisconnectPeripheralInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable) override;
@ -380,21 +380,21 @@ public:
virtual void
GattServerAddServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
uint16_t aHandleCount,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerAddIncludedServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aIncludedServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerAddCharacteristicInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothUuid& aCharacteristicUuid,
BluetoothGattAttrPerm aPermissions,
@ -403,7 +403,7 @@ public:
virtual void
GattServerAddDescriptorInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aCharacteristicHandle,
const BluetoothUuid& aDescriptorUuid,
@ -412,25 +412,25 @@ public:
virtual void
GattServerRemoveServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerStartServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerStopServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerSendResponseInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
uint16_t aStatus,
int32_t aRequestId,
@ -439,7 +439,7 @@ public:
virtual void
GattServerSendIndicationInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
const BluetoothAttributeHandle& aCharacteristicHandle,
bool aConfirm,

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

@ -189,14 +189,14 @@ public:
* Stops an ongoing Bluetooth LE device scan.
*/
virtual void
StopLeScanInternal(const nsAString& aScanUuid,
StopLeScanInternal(const BluetoothUuid& aScanUuid,
BluetoothReplyRunnable* aRunnable) = 0;
/**
* Starts a Bluetooth LE device scan.
*/
virtual void
StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
BluetoothReplyRunnable* aRunnable) = 0;
/**
@ -441,7 +441,7 @@ public:
* Connect to a remote GATT server. (platform specific implementation)
*/
virtual void
ConnectGattClientInternal(const nsAString& aAppUuid,
ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable) = 0;
@ -450,7 +450,7 @@ public:
* (platform specific implementation)
*/
virtual void
DisconnectGattClientInternal(const nsAString& aAppUuid,
DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable) = 0;
@ -459,7 +459,7 @@ public:
* server. (platform specific implementation)
*/
virtual void
DiscoverGattServicesInternal(const nsAString& aAppUuid,
DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
BluetoothReplyRunnable* aRunnable) = 0;
/**
@ -467,7 +467,7 @@ public:
* (platform specific implementation)
*/
virtual void
GattClientStartNotificationsInternal(const nsAString& aAppUuid,
GattClientStartNotificationsInternal(const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId,
BluetoothReplyRunnable* aRunnable) = 0;
@ -477,7 +477,7 @@ public:
* (platform specific implementation)
*/
virtual void
GattClientStopNotificationsInternal(const nsAString& aAppUuid,
GattClientStopNotificationsInternal(const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId,
BluetoothReplyRunnable* aRunnable) = 0;
@ -503,7 +503,7 @@ public:
*/
virtual void
GattClientReadCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
BluetoothReplyRunnable* aRunnable) = 0;
@ -514,7 +514,7 @@ public:
*/
virtual void
GattClientWriteCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattWriteType& aWriteType,
@ -527,7 +527,7 @@ public:
*/
virtual void
GattClientReadDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -539,7 +539,7 @@ public:
*/
virtual void
GattClientWriteDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -548,13 +548,13 @@ public:
virtual void
GattServerConnectPeripheralInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
GattServerDisconnectPeripheralInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable) = 0;
@ -567,21 +567,21 @@ public:
virtual void
GattServerAddServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
uint16_t aHandleCount,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
GattServerAddIncludedServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aIncludedServiceHandle,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
GattServerAddCharacteristicInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothUuid& aCharacteristicUuid,
BluetoothGattAttrPerm aPermissions,
@ -590,7 +590,7 @@ public:
virtual void
GattServerAddDescriptorInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aCharacteristicHandle,
const BluetoothUuid& aDescriptorUuid,
@ -599,25 +599,25 @@ public:
virtual void
GattServerRemoveServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
GattServerStartServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
GattServerStopServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
GattServerSendResponseInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
uint16_t aStatus,
int32_t aRequestId,
@ -626,7 +626,7 @@ public:
virtual void
GattServerSendIndicationInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
const BluetoothAttributeHandle& aCharacteristicHandle,
bool aConfirm,

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

@ -245,15 +245,18 @@ UuidToString(const BluetoothUuid& aUuid, nsAString& aString)
aString.AssignLiteral(uuidStr);
}
void
nsresult
StringToUuid(const nsAString& aString, BluetoothUuid& aUuid)
{
uint32_t uuid0, uuid4;
uint16_t uuid1, uuid2, uuid3, uuid5;
sscanf(NS_ConvertUTF16toUTF8(aString).get(),
"%08x-%04hx-%04hx-%04hx-%08x%04hx",
&uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
auto res = sscanf(NS_ConvertUTF16toUTF8(aString).get(),
"%08x-%04hx-%04hx-%04hx-%08x%04hx",
&uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
if (res == EOF || res < 6) {
return NS_ERROR_ILLEGAL_VALUE;
}
uuid0 = htonl(uuid0);
uuid1 = htons(uuid1);
@ -268,6 +271,8 @@ StringToUuid(const nsAString& aString, BluetoothUuid& aUuid)
memcpy(&aUuid.mUuid[8], &uuid3, sizeof(uint16_t));
memcpy(&aUuid.mUuid[10], &uuid4, sizeof(uint32_t));
memcpy(&aUuid.mUuid[14], &uuid5, sizeof(uint16_t));
return NS_OK;
}
nsresult

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

@ -100,7 +100,7 @@ UuidToString(const BluetoothUuid& aUuid, nsAString& aString);
* Note: This utility function is used by gecko internal only to convert uuid
* string created by gecko back to BluetoothUuid representation.
*/
void
nsresult
StringToUuid(const nsAString& aString, BluetoothUuid& aUuid);
/**

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

@ -366,12 +366,16 @@ BluetoothAdapter::Cleanup()
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs);
nsString uuid;
nsString uuidStr;
for (uint32_t i = 0; i < mLeScanHandleArray.Length(); ++i) {
mLeScanHandleArray[i]->GetLeScanUuid(uuid);
mLeScanHandleArray[i]->GetLeScanUuid(uuidStr);
RefPtr<BluetoothVoidReplyRunnable> results =
new BluetoothVoidReplyRunnable(nullptr);
bs->StopLeScanInternal(uuid, results);
BluetoothUuid uuid;
if (NS_SUCCEEDED(StringToUuid(uuidStr, uuid))) {
bs->StopLeScanInternal(uuid, results);
}
}
mLeScanHandleArray.Clear();
}
@ -682,6 +686,16 @@ BluetoothAdapter::StartLeScan(const nsTArray<nsString>& aServiceUuids,
RefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
nsTArray<BluetoothUuid> serviceUuids;
serviceUuids.SetLength(aServiceUuids.Length());
for (size_t i = 0; i < serviceUuids.Length(); ++i) {
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(aServiceUuids[i],
serviceUuids[i])),
promise,
NS_ERROR_DOM_OPERATION_ERR);
}
BT_ENSURE_TRUE_REJECT(mState == BluetoothAdapterState::Enabled,
promise,
NS_ERROR_DOM_INVALID_STATE_ERR);
@ -691,7 +705,7 @@ BluetoothAdapter::StartLeScan(const nsTArray<nsString>& aServiceUuids,
RefPtr<BluetoothReplyRunnable> result =
new StartLeScanTask(this, promise, aServiceUuids);
bs->StartLeScanInternal(aServiceUuids, result);
bs->StartLeScanInternal(serviceUuids, result);
return promise.forget();
}
@ -721,10 +735,16 @@ BluetoothAdapter::StopLeScan(BluetoothDiscoveryHandle& aDiscoveryHandle,
promise,
NS_ERROR_DOM_BLUETOOTH_DONE);
nsString scanUuid;
aDiscoveryHandle.GetLeScanUuid(scanUuid);
nsString scanUuidStr;
aDiscoveryHandle.GetLeScanUuid(scanUuidStr);
BluetoothUuid scanUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(scanUuidStr, scanUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
RefPtr<BluetoothReplyRunnable> result =
new StopLeScanTask(this, promise, scanUuid);
new StopLeScanTask(this, promise, scanUuidStr);
bs->StopLeScanInternal(scanUuid, result);
return promise.forget();

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

@ -112,6 +112,11 @@ BluetoothGatt::Connect(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
BluetoothAddress deviceAddr;
BT_ENSURE_TRUE_REJECT(
NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
@ -128,7 +133,7 @@ BluetoothGatt::Connect(ErrorResult& aRv)
UpdateConnectionState(BluetoothConnectionState::Connecting);
bs->ConnectGattClientInternal(
mAppUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
appUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -153,6 +158,11 @@ BluetoothGatt::Disconnect(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
BluetoothAddress deviceAddr;
BT_ENSURE_TRUE_REJECT(
NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
@ -161,7 +171,7 @@ BluetoothGatt::Disconnect(ErrorResult& aRv)
UpdateConnectionState(BluetoothConnectionState::Disconnecting);
bs->DisconnectGattClientInternal(
mAppUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
appUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -232,6 +242,11 @@ BluetoothGatt::DiscoverServices(ErrorResult& aRv)
RefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
BT_ENSURE_TRUE_REJECT(
mConnectionState == BluetoothConnectionState::Connected &&
!mDiscoveringServices,
@ -246,7 +261,7 @@ BluetoothGatt::DiscoverServices(ErrorResult& aRv)
BluetoothGattBinding::ClearCachedServicesValue(this);
bs->DiscoverGattServicesInternal(
mAppUuid, new BluetoothVoidReplyRunnable(nullptr, promise));
appUuid, new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}

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

@ -154,8 +154,14 @@ BluetoothGattCharacteristic::StartNotifications(ErrorResult& aRv)
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BT_ENSURE_TRUE_REJECT(mService, promise, NS_ERROR_NOT_AVAILABLE);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
bs->GattClientStartNotificationsInternal(
mService->GetAppUuid(), mService->GetServiceId(), mCharId,
appUuid, mService->GetServiceId(), mCharId,
new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
@ -181,8 +187,14 @@ BluetoothGattCharacteristic::StopNotifications(ErrorResult& aRv)
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BT_ENSURE_TRUE_REJECT(mService, promise, NS_ERROR_NOT_AVAILABLE);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
bs->GattClientStopNotificationsInternal(
mService->GetAppUuid(), mService->GetServiceId(), mCharId,
appUuid, mService->GetServiceId(), mCharId,
new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
@ -362,8 +374,14 @@ BluetoothGattCharacteristic::ReadValue(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
bs->GattClientReadCharacteristicValueInternal(
mService->GetAppUuid(), mService->GetServiceId(), mCharId,
appUuid, mService->GetServiceId(), mCharId,
new ReadValueTask(this, promise));
return promise.forget();
@ -405,9 +423,14 @@ BluetoothGattCharacteristic::WriteValue(const ArrayBuffer& aValue,
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mService->GetAppUuid(),
appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
bs->GattClientWriteCharacteristicValueInternal(
mService->GetAppUuid(), mService->GetServiceId(),
mCharId, mWriteType, value,
appUuid, mService->GetServiceId(), mCharId, mWriteType, value,
new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();

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

@ -232,6 +232,12 @@ BluetoothGattDescriptor::ReadValue(ErrorResult& aRv)
RefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(
mCharacteristic->Service()->GetAppUuid(), appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
if (mAttRole == ATT_SERVER_ROLE) {
promise->MaybeResolve(mValue);
return promise.forget();
@ -241,7 +247,7 @@ BluetoothGattDescriptor::ReadValue(ErrorResult& aRv)
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
bs->GattClientReadDescriptorValueInternal(
mCharacteristic->Service()->GetAppUuid(),
appUuid,
mCharacteristic->Service()->GetServiceId(),
mCharacteristic->GetCharacteristicId(),
mDescriptorId,
@ -263,6 +269,12 @@ BluetoothGattDescriptor::WriteValue(
RefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(
mCharacteristic->Service()->GetAppUuid(), appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
aValue.ComputeLengthAndData();
if (mAttRole == ATT_SERVER_ROLE) {
@ -280,7 +292,7 @@ BluetoothGattDescriptor::WriteValue(
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
bs->GattClientWriteDescriptorValueInternal(
mCharacteristic->Service()->GetAppUuid(),
appUuid,
mCharacteristic->Service()->GetServiceId(),
mCharacteristic->GetCharacteristicId(),
mDescriptorId,

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

@ -319,6 +319,11 @@ BluetoothGattServer::Connect(const nsAString& aAddress, ErrorResult& aRv)
RefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
BluetoothAddress address;
BT_ENSURE_TRUE_REJECT(
NS_SUCCEEDED(StringToAddress(aAddress, address)),
@ -330,7 +335,7 @@ BluetoothGattServer::Connect(const nsAString& aAddress, ErrorResult& aRv)
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
bs->GattServerConnectPeripheralInternal(
mAppUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
appUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -347,6 +352,11 @@ BluetoothGattServer::Disconnect(const nsAString& aAddress, ErrorResult& aRv)
RefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
BluetoothAddress address;
BT_ENSURE_TRUE_REJECT(
NS_SUCCEEDED(StringToAddress(aAddress, address)),
@ -358,7 +368,7 @@ BluetoothGattServer::Disconnect(const nsAString& aAddress, ErrorResult& aRv)
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
bs->GattServerDisconnectPeripheralInternal(
mAppUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
appUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -384,8 +394,13 @@ public:
return false;
}
BluetoothUuid appUuid;
if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
return false;
}
bs->GattServerAddIncludedServiceInternal(
mServer->mAppUuid,
appUuid,
mService->GetServiceHandle(),
mIncludedService->GetServiceHandle(),
GetReply());
@ -420,10 +435,15 @@ public:
return false;
}
BluetoothUuid appUuid;
if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
return false;
}
BluetoothUuid uuid;
mCharacteristic->GetUuid(uuid);
bs->GattServerAddCharacteristicInternal(
mServer->mAppUuid,
appUuid,
mService->GetServiceHandle(),
uuid,
mCharacteristic->GetPermissions(),
@ -462,10 +482,15 @@ public:
return false;
}
BluetoothUuid appUuid;
if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
return false;
}
BluetoothUuid uuid;
mDescriptor->GetUuid(uuid);
bs->GattServerAddDescriptorInternal(
mServer->mAppUuid,
appUuid,
mService->GetServiceHandle(),
mCharacteristic->GetCharacteristicHandle(),
uuid,
@ -501,8 +526,13 @@ public:
return false;
}
BluetoothUuid appUuid;
if (NS_FAILED(StringToUuid(mServer->mAppUuid, appUuid))) {
return false;
}
bs->GattServerStartServiceInternal(
mServer->mAppUuid,
appUuid,
mService->GetServiceHandle(),
GetReply());
@ -628,8 +658,14 @@ private:
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT_VOID(bs, mPromise, NS_ERROR_NOT_AVAILABLE);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT_VOID(NS_SUCCEEDED(StringToUuid(mServer->mAppUuid,
appUuid)),
mPromise,
NS_ERROR_DOM_OPERATION_ERR);
bs->GattServerRemoveServiceInternal(
mServer->mAppUuid,
appUuid,
mService->GetServiceHandle(),
new CancelAddServiceTask(mServer, mService, mPromise));
}
@ -716,7 +752,12 @@ BluetoothGattServer::AddService(BluetoothGattService& aService,
mPendingService = &aService;
bs->GattServerAddServiceInternal(mAppUuid,
BluetoothUuid appUuid;
if (NS_FAILED(StringToUuid(mAppUuid, appUuid))) {
return false;
}
bs->GattServerAddServiceInternal(appUuid,
mPendingService->GetServiceId(),
mPendingService->GetHandleCount(),
new AddServiceTask(this,
@ -784,8 +825,13 @@ BluetoothGattServer::RemoveService(BluetoothGattService& aService,
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
bs->GattServerRemoveServiceInternal(
mAppUuid, aService.GetServiceHandle(), new RemoveServiceTask(this,
appUuid, aService.GetServiceHandle(), new RemoveServiceTask(this,
&aService,
promise));
@ -810,6 +856,11 @@ BluetoothGattServer::NotifyCharacteristicChanged(
BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
BluetoothAddress address;
BT_ENSURE_TRUE_REJECT(
NS_SUCCEEDED(StringToAddress(aAddress, address)),
@ -826,7 +877,7 @@ BluetoothGattServer::NotifyCharacteristicChanged(
NS_ERROR_NOT_AVAILABLE);
bs->GattServerSendIndicationInternal(
mAppUuid, address, aCharacteristic.GetCharacteristicHandle(), aConfirm,
appUuid, address, aCharacteristic.GetCharacteristicHandle(), aConfirm,
aCharacteristic.GetValue(),
new BluetoothVoidReplyRunnable(nullptr, promise));
@ -848,6 +899,11 @@ BluetoothGattServer::SendResponse(const nsAString& aAddress,
RefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
BluetoothAddress address;
BT_ENSURE_TRUE_REJECT(
NS_SUCCEEDED(StringToAddress(aAddress, address)),
@ -885,7 +941,7 @@ BluetoothGattServer::SendResponse(const nsAString& aAddress,
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
bs->GattServerSendResponseInternal(
mAppUuid,
appUuid,
address,
aStatus,
aRequestId,

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

@ -163,15 +163,15 @@ BluetoothServiceChildProcess::StartDiscoveryInternal(
void
BluetoothServiceChildProcess::StopLeScanInternal(
const nsAString& aScanUuid,
const BluetoothUuid& aScanUuid,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable, StopLeScanRequest(nsString(aScanUuid)));
SendRequest(aRunnable, StopLeScanRequest(aScanUuid));
}
void
BluetoothServiceChildProcess::StartLeScanInternal(
const nsTArray<nsString>& aServiceUuids,
const nsTArray<BluetoothUuid>& aServiceUuids,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable, StartLeScanRequest(aServiceUuids));
@ -550,46 +550,44 @@ BluetoothServiceChildProcess::SendPlayStatus(int64_t aDuration,
void
BluetoothServiceChildProcess::ConnectGattClientInternal(
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable, ConnectGattClientRequest(nsString(aAppUuid),
aDeviceAddress));
SendRequest(aRunnable, ConnectGattClientRequest(aAppUuid, aDeviceAddress));
}
void
BluetoothServiceChildProcess::DisconnectGattClientInternal(
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
DisconnectGattClientRequest(nsString(aAppUuid), aDeviceAddress));
DisconnectGattClientRequest(aAppUuid, aDeviceAddress));
}
void
BluetoothServiceChildProcess::DiscoverGattServicesInternal(
const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
const BluetoothUuid& aAppUuid, BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
DiscoverGattServicesRequest(nsString(aAppUuid)));
SendRequest(aRunnable, DiscoverGattServicesRequest(aAppUuid));
}
void
BluetoothServiceChildProcess::GattClientStartNotificationsInternal(
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattClientStartNotificationsRequest(nsString(aAppUuid), aServId, aCharId));
GattClientStartNotificationsRequest(aAppUuid, aServId, aCharId));
}
void
BluetoothServiceChildProcess::GattClientStopNotificationsInternal(
const nsAString& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattClientStopNotificationsRequest(nsString(aAppUuid), aServId, aCharId));
GattClientStopNotificationsRequest(aAppUuid, aServId, aCharId));
}
void
@ -610,20 +608,20 @@ BluetoothServiceChildProcess::GattClientReadRemoteRssiInternal(
void
BluetoothServiceChildProcess::GattClientReadCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattClientReadCharacteristicValueRequest(nsString(aAppUuid),
GattClientReadCharacteristicValueRequest(aAppUuid,
aServiceId,
aCharacteristicId));
}
void
BluetoothServiceChildProcess::GattClientWriteCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattWriteType& aWriteType,
@ -631,7 +629,7 @@ BluetoothServiceChildProcess::GattClientWriteCharacteristicValueInternal(
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattClientWriteCharacteristicValueRequest(nsString(aAppUuid),
GattClientWriteCharacteristicValueRequest(aAppUuid,
aServiceId,
aCharacteristicId,
aWriteType,
@ -640,14 +638,14 @@ BluetoothServiceChildProcess::GattClientWriteCharacteristicValueInternal(
void
BluetoothServiceChildProcess::GattClientReadDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattClientReadDescriptorValueRequest(nsString(aAppUuid),
GattClientReadDescriptorValueRequest(aAppUuid,
aServiceId,
aCharacteristicId,
aDescriptorId));
@ -655,7 +653,7 @@ BluetoothServiceChildProcess::GattClientReadDescriptorValueInternal(
void
BluetoothServiceChildProcess::GattClientWriteDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -663,7 +661,7 @@ BluetoothServiceChildProcess::GattClientWriteDescriptorValueInternal(
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattClientWriteDescriptorValueRequest(nsString(aAppUuid),
GattClientWriteDescriptorValueRequest(aAppUuid,
aServiceId,
aCharacteristicId,
aDescriptorId,
@ -672,22 +670,22 @@ BluetoothServiceChildProcess::GattClientWriteDescriptorValueInternal(
void
BluetoothServiceChildProcess::GattServerConnectPeripheralInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerConnectPeripheralRequest(nsString(aAppUuid), aAddress));
GattServerConnectPeripheralRequest(aAppUuid, aAddress));
}
void
BluetoothServiceChildProcess::GattServerDisconnectPeripheralInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerDisconnectPeripheralRequest(nsString(aAppUuid), aAddress));
GattServerDisconnectPeripheralRequest(aAppUuid, aAddress));
}
void
@ -699,31 +697,31 @@ BluetoothServiceChildProcess::UnregisterGattServerInternal(
void
BluetoothServiceChildProcess::GattServerAddServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
uint16_t aHandleCount,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerAddServiceRequest(nsString(aAppUuid), aServiceId, aHandleCount));
GattServerAddServiceRequest(aAppUuid, aServiceId, aHandleCount));
}
void
BluetoothServiceChildProcess::GattServerAddIncludedServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aIncludedServiceHandle,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerAddIncludedServiceRequest(nsString(aAppUuid),
GattServerAddIncludedServiceRequest(aAppUuid,
aServiceHandle,
aIncludedServiceHandle));
}
void
BluetoothServiceChildProcess::GattServerAddCharacteristicInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothUuid& aCharacteristicUuid,
BluetoothGattAttrPerm aPermissions,
@ -731,7 +729,7 @@ BluetoothServiceChildProcess::GattServerAddCharacteristicInternal(
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerAddCharacteristicRequest(nsString(aAppUuid),
GattServerAddCharacteristicRequest(aAppUuid,
aServiceHandle,
aCharacteristicUuid,
aPermissions,
@ -740,7 +738,7 @@ BluetoothServiceChildProcess::GattServerAddCharacteristicInternal(
void
BluetoothServiceChildProcess::GattServerAddDescriptorInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aCharacteristicHandle,
const BluetoothUuid& aDescriptorUuid,
@ -748,7 +746,7 @@ BluetoothServiceChildProcess::GattServerAddDescriptorInternal(
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerAddDescriptorRequest(nsString(aAppUuid),
GattServerAddDescriptorRequest(aAppUuid,
aServiceHandle,
aCharacteristicHandle,
aDescriptorUuid,
@ -757,37 +755,37 @@ BluetoothServiceChildProcess::GattServerAddDescriptorInternal(
void
BluetoothServiceChildProcess::GattServerRemoveServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerRemoveServiceRequest(nsString(aAppUuid), aServiceHandle));
GattServerRemoveServiceRequest(aAppUuid, aServiceHandle));
}
void
BluetoothServiceChildProcess::GattServerStartServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerStartServiceRequest(nsString(aAppUuid), aServiceHandle));
GattServerStartServiceRequest(aAppUuid, aServiceHandle));
}
void
BluetoothServiceChildProcess::GattServerStopServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerStopServiceRequest(nsString(aAppUuid), aServiceHandle));
GattServerStopServiceRequest(aAppUuid, aServiceHandle));
}
void
BluetoothServiceChildProcess::GattServerSendResponseInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
uint16_t aStatus,
int32_t aRequestId,
@ -795,13 +793,16 @@ BluetoothServiceChildProcess::GattServerSendResponseInternal(
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerSendResponseRequest(
nsString(aAppUuid), aAddress, aStatus, aRequestId, aRsp));
GattServerSendResponseRequest(aAppUuid,
aAddress,
aStatus,
aRequestId,
aRsp));
}
void
BluetoothServiceChildProcess::GattServerSendIndicationInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
const BluetoothAttributeHandle& aCharacteristicHandle,
bool aConfirm,
@ -809,7 +810,7 @@ BluetoothServiceChildProcess::GattServerSendIndicationInternal(
BluetoothReplyRunnable* aRunnable)
{
SendRequest(aRunnable,
GattServerSendIndicationRequest(nsString(aAppUuid),
GattServerSendIndicationRequest(aAppUuid,
aAddress,
aCharacteristicHandle,
aConfirm,

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

@ -60,11 +60,11 @@ public:
StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) override;
virtual void
StopLeScanInternal(const nsAString& aScanUuid,
StopLeScanInternal(const BluetoothUuid& aScanUuid,
BluetoothReplyRunnable* aRunnable) override;
virtual void
StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
StartLeScanInternal(const nsTArray<BluetoothUuid>& aServiceUuids,
BluetoothReplyRunnable* aRunnable) override;
virtual nsresult
@ -284,29 +284,29 @@ public:
const nsAString& aMessage) override;
virtual void
ConnectGattClientInternal(const nsAString& aAppUuid,
ConnectGattClientInternal(const BluetoothUuid& aAppUuid,
const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable) override;
virtual void
DisconnectGattClientInternal(const nsAString& aAppUuid,
DisconnectGattClientInternal(const BluetoothUuid& aAppUuid,
const BluetoothAddress& aDeviceAddress,
BluetoothReplyRunnable* aRunnable) override;
virtual void
DiscoverGattServicesInternal(const nsAString& aAppUuid,
DiscoverGattServicesInternal(const BluetoothUuid& aAppUuid,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattClientStartNotificationsInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattClientStopNotificationsInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServId,
const BluetoothGattId& aCharId,
BluetoothReplyRunnable* aRunnable) override;
@ -322,14 +322,14 @@ public:
virtual void
GattClientReadCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattClientWriteCharacteristicValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattWriteType& aWriteType,
@ -338,7 +338,7 @@ public:
virtual void
GattClientReadDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -346,7 +346,7 @@ public:
virtual void
GattClientWriteDescriptorValueInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharacteristicId,
const BluetoothGattId& aDescriptorId,
@ -355,13 +355,13 @@ public:
virtual void
GattServerConnectPeripheralInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerDisconnectPeripheralInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
BluetoothReplyRunnable* aRunnable) override;
@ -371,21 +371,21 @@ public:
virtual void
GattServerAddServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothGattServiceId& aServiceId,
uint16_t aHandleCount,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerAddIncludedServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aIncludedServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerAddCharacteristicInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothUuid& aCharacteristicUuid,
BluetoothGattAttrPerm aPermissions,
@ -394,7 +394,7 @@ public:
virtual void
GattServerAddDescriptorInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
const BluetoothAttributeHandle& aCharacteristicHandle,
const BluetoothUuid& aDescriptorUuid,
@ -403,25 +403,25 @@ public:
virtual void
GattServerRemoveServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerStartServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerStopServiceInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAttributeHandle& aServiceHandle,
BluetoothReplyRunnable* aRunnable) override;
virtual void
GattServerSendResponseInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
uint16_t aStatus,
int32_t aRequestId,
@ -430,7 +430,7 @@ public:
virtual void
GattServerSendIndicationInternal(
const nsAString& aAppUuid,
const BluetoothUuid& aAppUuid,
const BluetoothAddress& aAddress,
const BluetoothAttributeHandle& aCharacteristicHandle,
bool aConfirm,

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

@ -62,12 +62,12 @@ struct StopDiscoveryRequest
struct StartLeScanRequest
{
nsString[] serviceUuids;
BluetoothUuid[] serviceUuids;
};
struct StopLeScanRequest
{
nsString scanUuid;
BluetoothUuid scanUuid;
};
struct PairRequest
@ -275,31 +275,31 @@ struct SendPlayStatusRequest
struct ConnectGattClientRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAddress deviceAddress;
};
struct DisconnectGattClientRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAddress deviceAddress;
};
struct DiscoverGattServicesRequest
{
nsString appUuid;
BluetoothUuid appUuid;
};
struct GattClientStartNotificationsRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothGattServiceId servId;
BluetoothGattId charId;
};
struct GattClientStopNotificationsRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothGattServiceId servId;
BluetoothGattId charId;
};
@ -317,14 +317,14 @@ struct GattClientReadRemoteRssiRequest
struct GattClientReadCharacteristicValueRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothGattServiceId serviceId;
BluetoothGattId charId;
};
struct GattClientWriteCharacteristicValueRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothGattServiceId serviceId;
BluetoothGattId charId;
BluetoothGattWriteType writeType;
@ -333,7 +333,7 @@ struct GattClientWriteCharacteristicValueRequest
struct GattClientReadDescriptorValueRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothGattServiceId serviceId;
BluetoothGattId charId;
BluetoothGattId descId;
@ -341,7 +341,7 @@ struct GattClientReadDescriptorValueRequest
struct GattClientWriteDescriptorValueRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothGattServiceId serviceId;
BluetoothGattId charId;
BluetoothGattId descId;
@ -350,13 +350,13 @@ struct GattClientWriteDescriptorValueRequest
struct GattServerConnectPeripheralRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAddress address;
};
struct GattServerDisconnectPeripheralRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAddress address;
};
@ -367,21 +367,21 @@ struct UnregisterGattServerRequest
struct GattServerAddServiceRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothGattServiceId serviceId;
uint16_t handleCount;
};
struct GattServerAddIncludedServiceRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAttributeHandle serviceHandle;
BluetoothAttributeHandle includedServiceHandle;
};
struct GattServerAddCharacteristicRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAttributeHandle serviceHandle;
BluetoothUuid characteristicUuid;
BluetoothGattAttrPerm permissions;
@ -390,7 +390,7 @@ struct GattServerAddCharacteristicRequest
struct GattServerAddDescriptorRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAttributeHandle serviceHandle;
BluetoothAttributeHandle characteristicHandle;
BluetoothUuid descriptorUuid;
@ -399,25 +399,25 @@ struct GattServerAddDescriptorRequest
struct GattServerRemoveServiceRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAttributeHandle serviceHandle;
};
struct GattServerStartServiceRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAttributeHandle serviceHandle;
};
struct GattServerStopServiceRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAttributeHandle serviceHandle;
};
struct GattServerSendResponseRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAddress address;
uint16_t status;
int32_t requestId;
@ -426,7 +426,7 @@ struct GattServerSendResponseRequest
struct GattServerSendIndicationRequest
{
nsString appUuid;
BluetoothUuid appUuid;
BluetoothAddress address;
BluetoothAttributeHandle characteristicHandle;
bool confirm;