mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 780812 - [b2g-bluetooth] Implement function to get RFCOMM channel of specific Bluetooth service; r=qdot
This commit is contained in:
parent
b4c6de65bf
commit
20aa3fc5b1
@ -187,6 +187,11 @@ public:
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath) = 0;
|
||||
|
||||
virtual int
|
||||
GetDeviceServiceChannelInternal(const nsAString& aObjectPath,
|
||||
const nsAString& aPattern,
|
||||
int aAttributeId) = 0;
|
||||
|
||||
protected:
|
||||
BluetoothService()
|
||||
{
|
||||
|
@ -868,3 +868,24 @@ BluetoothDBusService::GetDevicePath(const nsAString& aAdapterPath,
|
||||
aDevicePath = GetObjectPathFromAddress(aAdapterPath, aDeviceAddress);
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
BluetoothDBusService::GetDeviceServiceChannelInternal(const nsAString& aObjectPath,
|
||||
const nsAString& aPattern,
|
||||
int aAttributeId)
|
||||
{
|
||||
// This is a blocking call, should not be run on main thread.
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
const char* deviceObjectPath = NS_ConvertUTF16toUTF8(aObjectPath).get();
|
||||
const char* pattern = NS_ConvertUTF16toUTF8(aPattern).get();
|
||||
|
||||
DBusMessage *reply =
|
||||
dbus_func_args(mConnection, deviceObjectPath,
|
||||
DBUS_DEVICE_IFACE, "GetServiceAttributeValue",
|
||||
DBUS_TYPE_STRING, &pattern,
|
||||
DBUS_TYPE_UINT16, &aAttributeId,
|
||||
DBUS_TYPE_INVALID);
|
||||
|
||||
return reply ? dbus_returns_int32(reply) : -1;
|
||||
}
|
||||
|
@ -44,6 +44,10 @@ public:
|
||||
GetDevicePath(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath);
|
||||
virtual int
|
||||
GetDeviceServiceChannelInternal(const nsAString& aObjectPath,
|
||||
const nsAString& aPattern,
|
||||
int aAttributeId);
|
||||
|
||||
private:
|
||||
nsresult SendGetPropertyMessage(const nsAString& aPath,
|
||||
|
@ -260,5 +260,21 @@ DBusMessage * dbus_func_args_error(DBusConnection *conn,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int dbus_returns_int32(DBusMessage *reply)
|
||||
{
|
||||
DBusError err;
|
||||
int ret = -1;
|
||||
|
||||
dbus_error_init(&err);
|
||||
if (!dbus_message_get_args(reply, &err,
|
||||
DBUS_TYPE_INT32, &ret,
|
||||
DBUS_TYPE_INVALID)) {
|
||||
LOG_AND_FREE_DBUS_ERROR_WITH_MSG(&err, reply);
|
||||
}
|
||||
|
||||
dbus_message_unref(reply);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ DBusMessage* dbus_func_args_timeout_valist(DBusConnection* conn,
|
||||
int first_arg_type,
|
||||
va_list args);
|
||||
|
||||
int dbus_returns_int32(DBusMessage *reply);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user