mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 919913: Converted BluetoothDBusService to new Send methods, r=echou
This patch changes BluetoothDBusService to use the new send methods that have been added to RawDBusConnection. The conversion from the old functions is - dbus_func_send to Send, - dbus_func_send_async to SendWithReply, - dbus_func_args_async to SendWithReply, - dbus_func_args to SendWithError, and - dbus_func_args_timeout to SendWithError. References to DBusCallback have been removed.
This commit is contained in:
parent
59b461412b
commit
114f1f976d
@ -890,12 +890,12 @@ AppendDeviceName(BluetoothSignal& aSignal)
|
|||||||
nsRefPtr<AppendDeviceNameReplyHandler> handler =
|
nsRefPtr<AppendDeviceNameReplyHandler> handler =
|
||||||
new AppendDeviceNameReplyHandler(nsCString(DBUS_DEVICE_IFACE),
|
new AppendDeviceNameReplyHandler(nsCString(DBUS_DEVICE_IFACE),
|
||||||
devicePath, aSignal);
|
devicePath, aSignal);
|
||||||
bool success = dbus_func_args_async(threadConnection->GetConnection(), 1000,
|
|
||||||
AppendDeviceNameReplyHandler::Callback,
|
bool success = threadConnection->SendWithReply(
|
||||||
handler.get(),
|
AppendDeviceNameReplyHandler::Callback, handler.get(), 1000,
|
||||||
NS_ConvertUTF16toUTF8(devicePath).get(),
|
NS_ConvertUTF16toUTF8(devicePath).get(), DBUS_DEVICE_IFACE,
|
||||||
DBUS_DEVICE_IFACE, "GetProperties",
|
"GetProperties", DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE_VOID(success);
|
NS_ENSURE_TRUE_VOID(success);
|
||||||
|
|
||||||
handler.forget();
|
handler.forget();
|
||||||
@ -1237,14 +1237,14 @@ private:
|
|||||||
new RegisterAgentReplyHandler(aAgentVTable);
|
new RegisterAgentReplyHandler(aAgentVTable);
|
||||||
MOZ_ASSERT(handler.get());
|
MOZ_ASSERT(handler.get());
|
||||||
|
|
||||||
bool success = dbus_func_args_async(threadConnection->GetConnection(), -1,
|
bool success = threadConnection->SendWithReply(
|
||||||
RegisterAgentReplyHandler::Callback,
|
RegisterAgentReplyHandler::Callback, handler.get(), -1,
|
||||||
handler.get(),
|
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
||||||
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
DBUS_ADAPTER_IFACE, "RegisterAgent",
|
||||||
DBUS_ADAPTER_IFACE, "RegisterAgent",
|
DBUS_TYPE_OBJECT_PATH, &agentPath,
|
||||||
DBUS_TYPE_OBJECT_PATH, &agentPath,
|
DBUS_TYPE_STRING, &capabilities,
|
||||||
DBUS_TYPE_STRING, &capabilities,
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE(success, false);
|
NS_ENSURE_TRUE(success, false);
|
||||||
|
|
||||||
handler.forget();
|
handler.forget();
|
||||||
@ -1286,13 +1286,13 @@ public:
|
|||||||
|
|
||||||
const dbus_uint32_t* services = sServices;
|
const dbus_uint32_t* services = sServices;
|
||||||
|
|
||||||
bool success = dbus_func_args_async(threadConnection->GetConnection(), -1,
|
bool success = threadConnection->SendWithReply(
|
||||||
DBusReplyHandler::Callback, handler.get(),
|
DBusReplyHandler::Callback, handler.get(), -1,
|
||||||
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
||||||
DBUS_ADAPTER_IFACE, "AddReservedServiceRecords",
|
DBUS_ADAPTER_IFACE, "AddReservedServiceRecords",
|
||||||
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32,
|
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32,
|
||||||
&services, NS_ARRAY_LENGTH(sServices),
|
&services, NS_ARRAY_LENGTH(sServices), DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
handler.forget();
|
handler.forget();
|
||||||
@ -1587,14 +1587,12 @@ GetDefaultAdapterPath(BluetoothValue& aValue, nsString& aError)
|
|||||||
DBusError err;
|
DBusError err;
|
||||||
dbus_error_init(&err);
|
dbus_error_init(&err);
|
||||||
|
|
||||||
DBusMessage* msg = dbus_func_args_timeout(gThreadConnection->GetConnection(),
|
DBusMessage* msg;
|
||||||
1000,
|
bool success = gThreadConnection->SendWithError(&msg, &err, 1000, "/",
|
||||||
&err,
|
DBUS_MANAGER_IFACE,
|
||||||
"/",
|
"DefaultAdapter",
|
||||||
DBUS_MANAGER_IFACE,
|
DBUS_TYPE_INVALID);
|
||||||
"DefaultAdapter",
|
NS_ENSURE_TRUE(success, false);
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE(msg, false);
|
|
||||||
|
|
||||||
UnpackObjectPathMessage(msg, &err, aValue, aError);
|
UnpackObjectPathMessage(msg, &err, aValue, aError);
|
||||||
|
|
||||||
@ -1826,14 +1824,13 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool success = dbus_func_args_async(threadConnection->GetConnection(), 1000,
|
bool success = threadConnection->SendWithReply(
|
||||||
DefaultAdapterPathReplyHandler::Callback,
|
DefaultAdapterPathReplyHandler::Callback, handler.get(), 1000,
|
||||||
handler.get(),
|
NS_ConvertUTF16toUTF8(mAdapterPath).get(),
|
||||||
NS_ConvertUTF16toUTF8(mAdapterPath).get(),
|
DBUS_ADAPTER_IFACE, "GetProperties", DBUS_TYPE_INVALID);
|
||||||
DBUS_ADAPTER_IFACE, "GetProperties",
|
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
aReplyError = NS_LITERAL_STRING("dbus_func_args_async failed");
|
aReplyError = NS_LITERAL_STRING("SendWithReply failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1887,12 +1884,12 @@ BluetoothDBusService::GetDefaultAdapterPathInternal(
|
|||||||
|
|
||||||
nsRefPtr<DefaultAdapterPathReplyHandler> handler =
|
nsRefPtr<DefaultAdapterPathReplyHandler> handler =
|
||||||
new DefaultAdapterPathReplyHandler(aRunnable);
|
new DefaultAdapterPathReplyHandler(aRunnable);
|
||||||
bool success = dbus_func_args_async(mConnection, 1000,
|
|
||||||
DefaultAdapterPathReplyHandler::Callback,
|
bool success = SendWithReply(DefaultAdapterPathReplyHandler::Callback,
|
||||||
handler.get(),
|
handler.get(), 1000,
|
||||||
"/",
|
"/", DBUS_MANAGER_IFACE, "DefaultAdapter",
|
||||||
DBUS_MANAGER_IFACE, "DefaultAdapter",
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
handler.forget();
|
handler.forget();
|
||||||
@ -1931,12 +1928,12 @@ BluetoothDBusService::SendDiscoveryMessage(const char* aMessageName,
|
|||||||
|
|
||||||
nsRefPtr<BluetoothReplyRunnable> runnable(aRunnable);
|
nsRefPtr<BluetoothReplyRunnable> runnable(aRunnable);
|
||||||
|
|
||||||
bool success = dbus_func_args_async(mConnection, -1,
|
bool success = SendWithReply(OnSendDiscoveryMessageReply,
|
||||||
OnSendDiscoveryMessageReply,
|
static_cast<void*>(aRunnable), -1,
|
||||||
static_cast<void*>(aRunnable),
|
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
||||||
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
DBUS_ADAPTER_IFACE, aMessageName,
|
||||||
DBUS_ADAPTER_IFACE, aMessageName,
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
runnable.forget();
|
runnable.forget();
|
||||||
@ -1948,7 +1945,7 @@ nsresult
|
|||||||
BluetoothDBusService::SendInputMessage(const nsAString& aDeviceAddress,
|
BluetoothDBusService::SendInputMessage(const nsAString& aDeviceAddress,
|
||||||
const nsAString& aMessage)
|
const nsAString& aMessage)
|
||||||
{
|
{
|
||||||
DBusCallback callback;
|
void (*callback)(DBusMessage*, void*);
|
||||||
if (aMessage.EqualsLiteral("Connect")) {
|
if (aMessage.EqualsLiteral("Connect")) {
|
||||||
callback = InputConnectCallback;
|
callback = InputConnectCallback;
|
||||||
} else if (aMessage.EqualsLiteral("Disconnect")) {
|
} else if (aMessage.EqualsLiteral("Disconnect")) {
|
||||||
@ -1966,7 +1963,7 @@ nsresult
|
|||||||
BluetoothDBusService::SendAsyncDBusMessage(const nsAString& aObjectPath,
|
BluetoothDBusService::SendAsyncDBusMessage(const nsAString& aObjectPath,
|
||||||
const char* aInterface,
|
const char* aInterface,
|
||||||
const nsAString& aMessage,
|
const nsAString& aMessage,
|
||||||
DBusCallback aCallback)
|
void (*aCallback)(DBusMessage*, void*))
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(mConnection);
|
MOZ_ASSERT(mConnection);
|
||||||
@ -1985,14 +1982,12 @@ BluetoothDBusService::SendAsyncDBusMessage(const nsAString& aObjectPath,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret = dbus_func_args_async(mConnection,
|
bool ret = SendWithReply(aCallback,
|
||||||
-1,
|
static_cast<void*>(serviceClass.forget()), -1,
|
||||||
aCallback,
|
NS_ConvertUTF16toUTF8(aObjectPath).get(),
|
||||||
static_cast<void*>(serviceClass.forget()),
|
aInterface, NS_ConvertUTF16toUTF8(aMessage).get(),
|
||||||
NS_ConvertUTF16toUTF8(aObjectPath).get(),
|
DBUS_TYPE_INVALID);
|
||||||
aInterface,
|
|
||||||
NS_ConvertUTF16toUTF8(aMessage).get(),
|
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE(ret, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(ret, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -2002,7 +1997,7 @@ nsresult
|
|||||||
BluetoothDBusService::SendSinkMessage(const nsAString& aDeviceAddress,
|
BluetoothDBusService::SendSinkMessage(const nsAString& aDeviceAddress,
|
||||||
const nsAString& aMessage)
|
const nsAString& aMessage)
|
||||||
{
|
{
|
||||||
DBusCallback callback;
|
void (*callback)(DBusMessage*, void*);
|
||||||
if (aMessage.EqualsLiteral("Connect")) {
|
if (aMessage.EqualsLiteral("Connect")) {
|
||||||
callback = SinkConnectCallback;
|
callback = SinkConnectCallback;
|
||||||
} else if (aMessage.EqualsLiteral("Disconnect")) {
|
} else if (aMessage.EqualsLiteral("Disconnect")) {
|
||||||
@ -2140,13 +2135,12 @@ protected:
|
|||||||
|
|
||||||
nsRefPtr<BluetoothArrayOfDevicePropertiesReplyHandler> handler = this;
|
nsRefPtr<BluetoothArrayOfDevicePropertiesReplyHandler> handler = this;
|
||||||
|
|
||||||
bool success =
|
bool success = threadConnection->SendWithReply(
|
||||||
dbus_func_args_async(threadConnection->GetConnection(), 1000,
|
BluetoothArrayOfDevicePropertiesReplyHandler::Callback,
|
||||||
BluetoothArrayOfDevicePropertiesReplyHandler::Callback,
|
handler.get(), 1000,
|
||||||
handler.get(),
|
NS_ConvertUTF16toUTF8(mObjectPath).get(),
|
||||||
NS_ConvertUTF16toUTF8(mObjectPath).get(),
|
DBUS_DEVICE_IFACE, "GetProperties",
|
||||||
DBUS_DEVICE_IFACE, "GetProperties",
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
|
|
||||||
NS_ENSURE_TRUE(success, false);
|
NS_ENSURE_TRUE(success, false);
|
||||||
|
|
||||||
@ -2299,13 +2293,9 @@ BluetoothDBusService::SetProperty(BluetoothObjectType aType,
|
|||||||
|
|
||||||
nsRefPtr<BluetoothReplyRunnable> runnable = aRunnable;
|
nsRefPtr<BluetoothReplyRunnable> runnable = aRunnable;
|
||||||
|
|
||||||
// msg is unref'd as part of dbus_func_send_async
|
// msg is unref'd as part of SendWithReply
|
||||||
if (!dbus_func_send_async(mConnection,
|
if (!SendWithReply(GetVoidCallback, (void*)aRunnable, 1000, msg)) {
|
||||||
msg,
|
BT_WARNING("SendWithReply failed");
|
||||||
1000,
|
|
||||||
GetVoidCallback,
|
|
||||||
(void*)aRunnable)) {
|
|
||||||
BT_WARNING("Could not start async function!");
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
runnable.forget();
|
runnable.forget();
|
||||||
@ -2333,17 +2323,10 @@ BluetoothDBusService::RemoveReservedServicesInternal(
|
|||||||
|
|
||||||
const uint32_t* services = aServiceHandles.Elements();
|
const uint32_t* services = aServiceHandles.Elements();
|
||||||
|
|
||||||
DBusMessage* reply =
|
return gThreadConnection->SendWithError(nullptr, nullptr, -1,
|
||||||
dbus_func_args(gThreadConnection->GetConnection(),
|
NS_ConvertUTF16toUTF8(sAdapterPath).get(), DBUS_ADAPTER_IFACE,
|
||||||
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
"RemoveReservedServiceRecords", DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32,
|
||||||
DBUS_ADAPTER_IFACE, "RemoveReservedServiceRecords",
|
&services, length, DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32,
|
|
||||||
&services, length, DBUS_TYPE_INVALID);
|
|
||||||
|
|
||||||
if (!reply) return false;
|
|
||||||
|
|
||||||
dbus_message_unref(reply);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@ -2373,19 +2356,17 @@ BluetoothDBusService::CreatePairedDeviceInternal(
|
|||||||
sIsPairing++;
|
sIsPairing++;
|
||||||
|
|
||||||
nsRefPtr<BluetoothReplyRunnable> runnable = aRunnable;
|
nsRefPtr<BluetoothReplyRunnable> runnable = aRunnable;
|
||||||
|
|
||||||
// Then send CreatePairedDevice, it will register a temp device agent then
|
// Then send CreatePairedDevice, it will register a temp device agent then
|
||||||
// unregister it after pairing process is over
|
// unregister it after pairing process is over
|
||||||
bool ret = dbus_func_args_async(mConnection,
|
bool ret = SendWithReply(GetObjectPathCallback, (void*)runnable, aTimeout,
|
||||||
aTimeout,
|
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
||||||
GetObjectPathCallback,
|
DBUS_ADAPTER_IFACE,
|
||||||
(void*)runnable,
|
"CreatePairedDevice",
|
||||||
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
DBUS_TYPE_STRING, &deviceAddress,
|
||||||
DBUS_ADAPTER_IFACE,
|
DBUS_TYPE_OBJECT_PATH, &deviceAgentPath,
|
||||||
"CreatePairedDevice",
|
DBUS_TYPE_STRING, &capabilities,
|
||||||
DBUS_TYPE_STRING, &deviceAddress,
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_OBJECT_PATH, &deviceAgentPath,
|
|
||||||
DBUS_TYPE_STRING, &capabilities,
|
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
BT_WARNING("Could not start async function!");
|
BT_WARNING("Could not start async function!");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -2429,13 +2410,13 @@ BluetoothDBusService::RemoveDeviceInternal(const nsAString& aDeviceAddress,
|
|||||||
|
|
||||||
nsRefPtr<BluetoothReplyRunnable> runnable(aRunnable);
|
nsRefPtr<BluetoothReplyRunnable> runnable(aRunnable);
|
||||||
|
|
||||||
bool success = dbus_func_args_async(mConnection, -1,
|
bool success = SendWithReply(OnRemoveDeviceReply,
|
||||||
OnRemoveDeviceReply,
|
static_cast<void*>(runnable.get()), -1,
|
||||||
static_cast<void*>(runnable.get()),
|
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
||||||
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
DBUS_ADAPTER_IFACE, "RemoveDevice",
|
||||||
DBUS_ADAPTER_IFACE, "RemoveDevice",
|
DBUS_TYPE_OBJECT_PATH, &cstrDeviceObjectPath,
|
||||||
DBUS_TYPE_OBJECT_PATH, &cstrDeviceObjectPath,
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
runnable.forget();
|
runnable.forget();
|
||||||
@ -2480,7 +2461,7 @@ BluetoothDBusService::SetPinCodeInternal(const nsAString& aDeviceAddress,
|
|||||||
errorStr.AssignLiteral("Couldn't append arguments to dbus message.");
|
errorStr.AssignLiteral("Couldn't append arguments to dbus message.");
|
||||||
result = false;
|
result = false;
|
||||||
} else {
|
} else {
|
||||||
result = dbus_func_send(mConnection, nullptr, reply);
|
result = Send(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_unref(msg);
|
dbus_message_unref(msg);
|
||||||
@ -2526,7 +2507,7 @@ BluetoothDBusService::SetPasskeyInternal(const nsAString& aDeviceAddress,
|
|||||||
errorStr.AssignLiteral("Couldn't append arguments to dbus message.");
|
errorStr.AssignLiteral("Couldn't append arguments to dbus message.");
|
||||||
result = false;
|
result = false;
|
||||||
} else {
|
} else {
|
||||||
result = dbus_func_send(mConnection, nullptr, reply);
|
result = Send(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_unref(msg);
|
dbus_message_unref(msg);
|
||||||
@ -2570,7 +2551,7 @@ BluetoothDBusService::SetPairingConfirmationInternal(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = dbus_func_send(mConnection, nullptr, reply);
|
bool result = Send(reply);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
errorStr.AssignLiteral("Can't send message!");
|
errorStr.AssignLiteral("Can't send message!");
|
||||||
}
|
}
|
||||||
@ -2783,13 +2764,13 @@ BluetoothDBusService::GetServiceChannel(const nsAString& aDeviceAddress,
|
|||||||
nsRefPtr<OnGetServiceChannelReplyHandler> handler =
|
nsRefPtr<OnGetServiceChannelReplyHandler> handler =
|
||||||
new OnGetServiceChannelReplyHandler(objectPath, aServiceUUID, aManager);
|
new OnGetServiceChannelReplyHandler(objectPath, aServiceUUID, aManager);
|
||||||
|
|
||||||
bool success = dbus_func_args_async(mConnection, -1,
|
bool success = SendWithReply(OnGetServiceChannelReplyHandler::Callback,
|
||||||
OnGetServiceChannelReplyHandler::Callback, handler,
|
handler, -1,
|
||||||
NS_ConvertUTF16toUTF8(objectPath).get(),
|
NS_ConvertUTF16toUTF8(objectPath).get(),
|
||||||
DBUS_DEVICE_IFACE, "GetServiceAttributeValue",
|
DBUS_DEVICE_IFACE, "GetServiceAttributeValue",
|
||||||
DBUS_TYPE_STRING, &cstrServiceUUID,
|
DBUS_TYPE_STRING, &cstrServiceUUID,
|
||||||
DBUS_TYPE_UINT16, &sProtocolDescriptorList,
|
DBUS_TYPE_UINT16, &sProtocolDescriptorList,
|
||||||
DBUS_TYPE_INVALID);
|
DBUS_TYPE_INVALID);
|
||||||
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
handler.forget();
|
handler.forget();
|
||||||
@ -2832,19 +2813,17 @@ BluetoothDBusService::UpdateSdpRecords(const nsAString& aDeviceAddress,
|
|||||||
nsString objectPath(GetObjectPathFromAddress(sAdapterPath, aDeviceAddress));
|
nsString objectPath(GetObjectPathFromAddress(sAdapterPath, aDeviceAddress));
|
||||||
|
|
||||||
// I choose to use raw pointer here because this is going to be passed as an
|
// I choose to use raw pointer here because this is going to be passed as an
|
||||||
// argument into dbus_func_args_async() at once.
|
// argument into SendWithReply() at once.
|
||||||
OnUpdateSdpRecordsRunnable* callbackRunnable =
|
OnUpdateSdpRecordsRunnable* callbackRunnable =
|
||||||
new OnUpdateSdpRecordsRunnable(objectPath, aManager);
|
new OnUpdateSdpRecordsRunnable(objectPath, aManager);
|
||||||
|
|
||||||
return dbus_func_args_async(mConnection,
|
return SendWithReply(DiscoverServicesCallback,
|
||||||
-1,
|
(void*)callbackRunnable, -1,
|
||||||
DiscoverServicesCallback,
|
NS_ConvertUTF16toUTF8(objectPath).get(),
|
||||||
(void*)callbackRunnable,
|
DBUS_DEVICE_IFACE,
|
||||||
NS_ConvertUTF16toUTF8(objectPath).get(),
|
"DiscoverServices",
|
||||||
DBUS_DEVICE_IFACE,
|
DBUS_TYPE_STRING, &EmptyCString(),
|
||||||
"DiscoverServices",
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_STRING, &EmptyCString(),
|
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@ -3053,20 +3032,16 @@ BluetoothDBusService::SendMetaData(const nsAString& aTitle,
|
|||||||
|
|
||||||
nsRefPtr<BluetoothReplyRunnable> runnable(aRunnable);
|
nsRefPtr<BluetoothReplyRunnable> runnable(aRunnable);
|
||||||
|
|
||||||
bool ret = dbus_func_args_async(mConnection,
|
bool ret = SendWithReply(GetVoidCallback, (void*)runnable.get(), -1,
|
||||||
-1,
|
NS_ConvertUTF16toUTF8(objectPath).get(),
|
||||||
GetVoidCallback,
|
DBUS_CTL_IFACE, "UpdateMetaData",
|
||||||
(void*)runnable.get(),
|
DBUS_TYPE_STRING, &title,
|
||||||
NS_ConvertUTF16toUTF8(objectPath).get(),
|
DBUS_TYPE_STRING, &artist,
|
||||||
DBUS_CTL_IFACE,
|
DBUS_TYPE_STRING, &album,
|
||||||
"UpdateMetaData",
|
DBUS_TYPE_STRING, &mediaNumber,
|
||||||
DBUS_TYPE_STRING, &title,
|
DBUS_TYPE_STRING, &totalMediaCount,
|
||||||
DBUS_TYPE_STRING, &artist,
|
DBUS_TYPE_STRING, &duration,
|
||||||
DBUS_TYPE_STRING, &album,
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_STRING, &mediaNumber,
|
|
||||||
DBUS_TYPE_STRING, &totalMediaCount,
|
|
||||||
DBUS_TYPE_STRING, &duration,
|
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE_VOID(ret);
|
NS_ENSURE_TRUE_VOID(ret);
|
||||||
|
|
||||||
runnable.forget();
|
runnable.forget();
|
||||||
@ -3154,17 +3129,13 @@ BluetoothDBusService::SendPlayStatus(int64_t aDuration,
|
|||||||
|
|
||||||
nsRefPtr<BluetoothReplyRunnable> runnable(aRunnable);
|
nsRefPtr<BluetoothReplyRunnable> runnable(aRunnable);
|
||||||
|
|
||||||
bool ret = dbus_func_args_async(mConnection,
|
bool ret = SendWithReply(GetVoidCallback, (void*)runnable.get(), -1,
|
||||||
-1,
|
NS_ConvertUTF16toUTF8(objectPath).get(),
|
||||||
GetVoidCallback,
|
DBUS_CTL_IFACE, "UpdatePlayStatus",
|
||||||
(void*)runnable.get(),
|
DBUS_TYPE_UINT32, &aDuration,
|
||||||
NS_ConvertUTF16toUTF8(objectPath).get(),
|
DBUS_TYPE_UINT32, &aPosition,
|
||||||
DBUS_CTL_IFACE,
|
DBUS_TYPE_UINT32, &tempPlayStatus,
|
||||||
"UpdatePlayStatus",
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_UINT32, &aDuration,
|
|
||||||
DBUS_TYPE_UINT32, &aPosition,
|
|
||||||
DBUS_TYPE_UINT32, &tempPlayStatus,
|
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE_VOID(ret);
|
NS_ENSURE_TRUE_VOID(ret);
|
||||||
|
|
||||||
runnable.forget();
|
runnable.forget();
|
||||||
@ -3204,17 +3175,14 @@ BluetoothDBusService::UpdatePlayStatus(uint32_t aDuration,
|
|||||||
GetObjectPathFromAddress(sAdapterPath, address);
|
GetObjectPathFromAddress(sAdapterPath, address);
|
||||||
|
|
||||||
uint32_t tempPlayStatus = aPlayStatus;
|
uint32_t tempPlayStatus = aPlayStatus;
|
||||||
bool ret = dbus_func_args_async(mConnection,
|
|
||||||
-1,
|
bool ret = SendWithReply(ControlCallback, nullptr, -1,
|
||||||
ControlCallback,
|
NS_ConvertUTF16toUTF8(objectPath).get(),
|
||||||
nullptr,
|
DBUS_CTL_IFACE, "UpdatePlayStatus",
|
||||||
NS_ConvertUTF16toUTF8(objectPath).get(),
|
DBUS_TYPE_UINT32, &aDuration,
|
||||||
DBUS_CTL_IFACE,
|
DBUS_TYPE_UINT32, &aPosition,
|
||||||
"UpdatePlayStatus",
|
DBUS_TYPE_UINT32, &tempPlayStatus,
|
||||||
DBUS_TYPE_UINT32, &aDuration,
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_UINT32, &aPosition,
|
|
||||||
DBUS_TYPE_UINT32, &tempPlayStatus,
|
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE_VOID(ret);
|
NS_ENSURE_TRUE_VOID(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3236,15 +3204,12 @@ BluetoothDBusService::UpdateNotification(ControlEventId aEventId,
|
|||||||
GetObjectPathFromAddress(sAdapterPath, address);
|
GetObjectPathFromAddress(sAdapterPath, address);
|
||||||
uint16_t eventId = aEventId;
|
uint16_t eventId = aEventId;
|
||||||
|
|
||||||
bool ret = dbus_func_args_async(mConnection,
|
bool ret = SendWithReply(ControlCallback, nullptr, -1,
|
||||||
-1,
|
NS_ConvertUTF16toUTF8(objectPath).get(),
|
||||||
ControlCallback,
|
DBUS_CTL_IFACE,
|
||||||
nullptr,
|
"UpdateNotification",
|
||||||
NS_ConvertUTF16toUTF8(objectPath).get(),
|
DBUS_TYPE_UINT16, &eventId,
|
||||||
DBUS_CTL_IFACE,
|
DBUS_TYPE_UINT64, &aData,
|
||||||
"UpdateNotification",
|
DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_UINT16, &eventId,
|
|
||||||
DBUS_TYPE_UINT64, &aData,
|
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
NS_ENSURE_TRUE_VOID(ret);
|
NS_ENSURE_TRUE_VOID(ret);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user