зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 7251fc4dce99 (bug 1220121)
This commit is contained in:
Родитель
ca229888f4
Коммит
ecd9413df1
|
@ -363,7 +363,7 @@ BluetoothServiceBluedroid::StopLeScanInternal(
|
|||
|
||||
void
|
||||
BluetoothServiceBluedroid::ConnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -376,12 +376,18 @@ BluetoothServiceBluedroid::ConnectGattClientInternal(
|
|||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->Connect(appUuid, aDeviceAddress, aRunnable);
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->Connect(appUuid, deviceAddress, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::DisconnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -394,7 +400,13 @@ BluetoothServiceBluedroid::DisconnectGattClientInternal(
|
|||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->Disconnect(appUuid, aDeviceAddress, aRunnable);
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->Disconnect(appUuid, deviceAddress, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -466,7 +478,7 @@ BluetoothServiceBluedroid::UnregisterGattClientInternal(
|
|||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattClientReadRemoteRssiInternal(
|
||||
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
||||
int aClientIf, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -476,7 +488,13 @@ BluetoothServiceBluedroid::GattClientReadRemoteRssiInternal(
|
|||
BluetoothGattManager* gatt = BluetoothGattManager::Get();
|
||||
ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
|
||||
|
||||
gatt->ReadRemoteRssi(aClientIf, aDeviceAddress, aRunnable);
|
||||
BluetoothAddress deviceAddress;
|
||||
if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->ReadRemoteRssi(aClientIf, deviceAddress, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -571,7 +589,7 @@ BluetoothServiceBluedroid::GattClientWriteDescriptorValueInternal(
|
|||
// GATT Server
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid, const BluetoothAddress& aAddress,
|
||||
const nsAString& aAppUuid, const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -584,12 +602,18 @@ BluetoothServiceBluedroid::GattServerConnectPeripheralInternal(
|
|||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->ConnectPeripheral(appUuid, aAddress, aRunnable);
|
||||
BluetoothAddress address;
|
||||
if (NS_FAILED(StringToAddress(aAddress, address))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->ConnectPeripheral(appUuid, address, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid, const BluetoothAddress& aAddress,
|
||||
const nsAString& aAppUuid, const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -602,7 +626,13 @@ BluetoothServiceBluedroid::GattServerDisconnectPeripheralInternal(
|
|||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
gatt->DisconnectPeripheral(appUuid, aAddress, aRunnable);
|
||||
BluetoothAddress address;
|
||||
if (NS_FAILED(StringToAddress(aAddress, address))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->DisconnectPeripheral(appUuid, address, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -776,7 +806,7 @@ BluetoothServiceBluedroid::GattServerStopServiceInternal(
|
|||
void
|
||||
BluetoothServiceBluedroid::GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
|
@ -792,14 +822,20 @@ BluetoothServiceBluedroid::GattServerSendResponseInternal(
|
|||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
BluetoothAddress address;
|
||||
if (NS_FAILED(StringToAddress(aAddress, address))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->ServerSendResponse(
|
||||
appUuid, aAddress, aStatus, aRequestId, aRsp, aRunnable);
|
||||
appUuid, address, aStatus, aRequestId, aRsp, aRunnable);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
|
@ -815,8 +851,14 @@ BluetoothServiceBluedroid::GattServerSendIndicationInternal(
|
|||
BluetoothUuid appUuid;
|
||||
StringToUuid(aAppUuid, appUuid);
|
||||
|
||||
BluetoothAddress address;
|
||||
if (NS_FAILED(StringToAddress(aAddress, address))) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
gatt->ServerSendIndication(appUuid,
|
||||
aAddress,
|
||||
address,
|
||||
aCharacteristicHandle,
|
||||
aConfirm,
|
||||
aValue,
|
||||
|
|
|
@ -283,12 +283,12 @@ public:
|
|||
|
||||
virtual void
|
||||
ConnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
DisconnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
|
@ -315,7 +315,7 @@ public:
|
|||
|
||||
virtual void
|
||||
GattClientReadRemoteRssiInternal(
|
||||
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
||||
int aClientIf, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
|
@ -354,13 +354,13 @@ public:
|
|||
virtual void
|
||||
GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
|
@ -420,7 +420,7 @@ public:
|
|||
virtual void
|
||||
GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
|
@ -429,7 +429,7 @@ public:
|
|||
virtual void
|
||||
GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
|
|
|
@ -4309,14 +4309,14 @@ BluetoothDBusService::StopLeScanInternal(
|
|||
|
||||
void
|
||||
BluetoothDBusService::ConnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::DisconnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
@ -4349,7 +4349,7 @@ BluetoothDBusService::UnregisterGattClientInternal(
|
|||
|
||||
void
|
||||
BluetoothDBusService::GattClientReadRemoteRssiInternal(
|
||||
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
||||
int aClientIf, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
@ -4521,14 +4521,14 @@ BluetoothDBusService::ReplyToMapMessageUpdate(long aMasId, bool aStatus,
|
|||
|
||||
void
|
||||
BluetoothDBusService::GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid, const BluetoothAddress& aAddress,
|
||||
const nsAString& aAppUuid, const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid, const BluetoothAddress& aAddress,
|
||||
const nsAString& aAppUuid, const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
@ -4606,7 +4606,7 @@ BluetoothDBusService::GattServerStopServiceInternal(
|
|||
void
|
||||
BluetoothDBusService::GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
|
@ -4617,7 +4617,7 @@ BluetoothDBusService::GattServerSendIndicationInternal(
|
|||
void
|
||||
BluetoothDBusService::GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
|
|
|
@ -294,12 +294,12 @@ public:
|
|||
|
||||
virtual void
|
||||
ConnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
DisconnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
|
@ -326,7 +326,7 @@ public:
|
|||
|
||||
virtual void
|
||||
GattClientReadRemoteRssiInternal(
|
||||
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
||||
int aClientIf, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
|
@ -365,13 +365,13 @@ public:
|
|||
virtual void
|
||||
GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
|
@ -431,7 +431,7 @@ public:
|
|||
virtual void
|
||||
GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
|
@ -440,7 +440,7 @@ public:
|
|||
virtual void
|
||||
GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
|
|
|
@ -442,7 +442,7 @@ public:
|
|||
*/
|
||||
virtual void
|
||||
ConnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
|
@ -451,7 +451,7 @@ public:
|
|||
*/
|
||||
virtual void
|
||||
DisconnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
|
@ -494,7 +494,7 @@ public:
|
|||
*/
|
||||
virtual void
|
||||
GattClientReadRemoteRssiInternal(int aClientIf,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
|
@ -549,13 +549,13 @@ public:
|
|||
virtual void
|
||||
GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
|
@ -618,7 +618,7 @@ public:
|
|||
virtual void
|
||||
GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
|
@ -627,7 +627,7 @@ public:
|
|||
virtual void
|
||||
GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
|
|
|
@ -112,12 +112,6 @@ BluetoothGatt::Connect(ErrorResult& aRv)
|
|||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothAddress deviceAddr;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
if (mAppUuid.IsEmpty()) {
|
||||
nsresult rv = GenerateUuid(mAppUuid);
|
||||
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(rv) && !mAppUuid.IsEmpty(),
|
||||
|
@ -128,7 +122,7 @@ BluetoothGatt::Connect(ErrorResult& aRv)
|
|||
|
||||
UpdateConnectionState(BluetoothConnectionState::Connecting);
|
||||
bs->ConnectGattClientInternal(
|
||||
mAppUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
mAppUuid, mDeviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
|
@ -153,15 +147,9 @@ BluetoothGatt::Disconnect(ErrorResult& aRv)
|
|||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothAddress deviceAddr;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
UpdateConnectionState(BluetoothConnectionState::Disconnecting);
|
||||
bs->DisconnectGattClientInternal(
|
||||
mAppUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
mAppUuid, mDeviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
|
@ -208,14 +196,8 @@ BluetoothGatt::ReadRemoteRssi(ErrorResult& aRv)
|
|||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothAddress deviceAddr;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
|
||||
promise,
|
||||
NS_ERROR_DOM_OPERATION_ERR);
|
||||
|
||||
bs->GattClientReadRemoteRssiInternal(
|
||||
mClientIf, deviceAddr, new ReadRemoteRssiTask(promise));
|
||||
mClientIf, mDeviceAddr, new ReadRemoteRssiTask(promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
|
|
|
@ -319,18 +319,12 @@ BluetoothGattServer::Connect(const nsAString& aAddress, ErrorResult& aRv)
|
|||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
BluetoothAddress address;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(aAddress, address)),
|
||||
promise,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bs->GattServerConnectPeripheralInternal(
|
||||
mAppUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
mAppUuid, aAddress, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
|
@ -347,18 +341,12 @@ BluetoothGattServer::Disconnect(const nsAString& aAddress, ErrorResult& aRv)
|
|||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
BluetoothAddress address;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(aAddress, address)),
|
||||
promise,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bs->GattServerDisconnectPeripheralInternal(
|
||||
mAppUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
mAppUuid, aAddress, new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
|
@ -810,12 +798,6 @@ BluetoothGattServer::NotifyCharacteristicChanged(
|
|||
|
||||
BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
BluetoothAddress address;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(aAddress, address)),
|
||||
promise,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
|
@ -826,7 +808,7 @@ BluetoothGattServer::NotifyCharacteristicChanged(
|
|||
NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bs->GattServerSendIndicationInternal(
|
||||
mAppUuid, address, aCharacteristic.GetCharacteristicHandle(), aConfirm,
|
||||
mAppUuid, aAddress, aCharacteristic.GetCharacteristicHandle(), aConfirm,
|
||||
aCharacteristic.GetValue(),
|
||||
new BluetoothVoidReplyRunnable(nullptr, promise));
|
||||
|
||||
|
@ -848,12 +830,6 @@ BluetoothGattServer::SendResponse(const nsAString& aAddress,
|
|||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
BluetoothAddress address;
|
||||
BT_ENSURE_TRUE_REJECT(
|
||||
NS_SUCCEEDED(StringToAddress(aAddress, address)),
|
||||
promise,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
RequestData* requestData;
|
||||
|
@ -886,7 +862,7 @@ BluetoothGattServer::SendResponse(const nsAString& aAddress,
|
|||
|
||||
bs->GattServerSendResponseInternal(
|
||||
mAppUuid,
|
||||
address,
|
||||
aAddress,
|
||||
aStatus,
|
||||
aRequestId,
|
||||
response,
|
||||
|
|
|
@ -550,20 +550,20 @@ BluetoothServiceChildProcess::SendPlayStatus(int64_t aDuration,
|
|||
|
||||
void
|
||||
BluetoothServiceChildProcess::ConnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable, ConnectGattClientRequest(nsString(aAppUuid),
|
||||
aDeviceAddress));
|
||||
nsString(aDeviceAddress)));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::DisconnectGattClientInternal(
|
||||
const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aAppUuid, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
DisconnectGattClientRequest(nsString(aAppUuid), aDeviceAddress));
|
||||
DisconnectGattClientRequest(nsString(aAppUuid), nsString(aDeviceAddress)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -601,11 +601,12 @@ BluetoothServiceChildProcess::UnregisterGattClientInternal(
|
|||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattClientReadRemoteRssiInternal(
|
||||
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
||||
int aClientIf, const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattClientReadRemoteRssiRequest(aClientIf, aDeviceAddress));
|
||||
GattClientReadRemoteRssiRequest(aClientIf,
|
||||
nsString(aDeviceAddress)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -673,21 +674,23 @@ BluetoothServiceChildProcess::GattClientWriteDescriptorValueInternal(
|
|||
void
|
||||
BluetoothServiceChildProcess::GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerConnectPeripheralRequest(nsString(aAppUuid), aAddress));
|
||||
GattServerConnectPeripheralRequest(nsString(aAppUuid),
|
||||
nsString(aAddress)));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerDisconnectPeripheralRequest(nsString(aAppUuid), aAddress));
|
||||
GattServerDisconnectPeripheralRequest(nsString(aAppUuid),
|
||||
nsString(aAddress)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -788,7 +791,7 @@ BluetoothServiceChildProcess::GattServerStopServiceInternal(
|
|||
void
|
||||
BluetoothServiceChildProcess::GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
|
@ -796,13 +799,13 @@ BluetoothServiceChildProcess::GattServerSendResponseInternal(
|
|||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerSendResponseRequest(
|
||||
nsString(aAppUuid), aAddress, aStatus, aRequestId, aRsp));
|
||||
nsString(aAppUuid), nsString(aAddress), aStatus, aRequestId, aRsp));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
|
@ -810,7 +813,7 @@ BluetoothServiceChildProcess::GattServerSendIndicationInternal(
|
|||
{
|
||||
SendRequest(aRunnable,
|
||||
GattServerSendIndicationRequest(nsString(aAppUuid),
|
||||
aAddress,
|
||||
nsString(aAddress),
|
||||
aCharacteristicHandle,
|
||||
aConfirm,
|
||||
aValue));
|
||||
|
|
|
@ -285,12 +285,12 @@ public:
|
|||
|
||||
virtual void
|
||||
ConnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
DisconnectGattClientInternal(const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
|
@ -317,7 +317,7 @@ public:
|
|||
|
||||
virtual void
|
||||
GattClientReadRemoteRssiInternal(int aClientIf,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
|
@ -356,13 +356,13 @@ public:
|
|||
virtual void
|
||||
GattServerConnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
GattServerDisconnectPeripheralInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void
|
||||
|
@ -422,7 +422,7 @@ public:
|
|||
virtual void
|
||||
GattServerSendResponseInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
uint16_t aStatus,
|
||||
int32_t aRequestId,
|
||||
const BluetoothGattResponse& aRsp,
|
||||
|
@ -431,7 +431,7 @@ public:
|
|||
virtual void
|
||||
GattServerSendIndicationInternal(
|
||||
const nsAString& aAppUuid,
|
||||
const BluetoothAddress& aAddress,
|
||||
const nsAString& aAddress,
|
||||
const BluetoothAttributeHandle& aCharacteristicHandle,
|
||||
bool aConfirm,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
|
|
|
@ -276,13 +276,13 @@ struct SendPlayStatusRequest
|
|||
struct ConnectGattClientRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothAddress deviceAddress;
|
||||
nsString deviceAddress;
|
||||
};
|
||||
|
||||
struct DisconnectGattClientRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothAddress deviceAddress;
|
||||
nsString deviceAddress;
|
||||
};
|
||||
|
||||
struct DiscoverGattServicesRequest
|
||||
|
@ -312,7 +312,7 @@ struct UnregisterGattClientRequest
|
|||
struct GattClientReadRemoteRssiRequest
|
||||
{
|
||||
int clientIf;
|
||||
BluetoothAddress deviceAddress;
|
||||
nsString deviceAddress;
|
||||
};
|
||||
|
||||
struct GattClientReadCharacteristicValueRequest
|
||||
|
@ -351,13 +351,13 @@ struct GattClientWriteDescriptorValueRequest
|
|||
struct GattServerConnectPeripheralRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothAddress address;
|
||||
nsString address;
|
||||
};
|
||||
|
||||
struct GattServerDisconnectPeripheralRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothAddress address;
|
||||
nsString address;
|
||||
};
|
||||
|
||||
struct UnregisterGattServerRequest
|
||||
|
@ -418,7 +418,7 @@ struct GattServerStopServiceRequest
|
|||
struct GattServerSendResponseRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothAddress address;
|
||||
nsString address;
|
||||
uint16_t status;
|
||||
int32_t requestId;
|
||||
BluetoothGattResponse response;
|
||||
|
@ -427,7 +427,7 @@ struct GattServerSendResponseRequest
|
|||
struct GattServerSendIndicationRequest
|
||||
{
|
||||
nsString appUuid;
|
||||
BluetoothAddress address;
|
||||
nsString address;
|
||||
BluetoothAttributeHandle characteristicHandle;
|
||||
bool confirm;
|
||||
uint8_t[] value;
|
||||
|
|
Загрузка…
Ссылка в новой задаче