mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 789428: Fix object path setting for BluetoothDevice; r=echou
--HG-- extra : rebase_source : 7712835dfa55640910721f9a04bb4ee48e8168b4
This commit is contained in:
parent
8ceb251ab2
commit
3b1ee2b065
@ -61,6 +61,17 @@ BluetoothDevice::BluetoothDevice(nsPIDOMWindow* aOwner,
|
||||
aValue.get_ArrayOfBluetoothNamedValue();
|
||||
for (uint32_t i = 0; i < values.Length(); ++i) {
|
||||
SetPropertyByValue(values[i]);
|
||||
if (values[i].name().EqualsLiteral("Path")) {
|
||||
// Since this is our signal handler string, set it as we set the property
|
||||
// in the object. Odd place to do it, but makes more sense than in
|
||||
// SetPropertyByValue.
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
NS_WARNING("BluetoothService not available!");
|
||||
} else {
|
||||
bs->RegisterBluetoothSignalHandler(mPath, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,14 +111,8 @@ BluetoothDevice::SetPropertyByValue(const BluetoothNamedValue& aValue)
|
||||
if (name.EqualsLiteral("Name")) {
|
||||
mName = value.get_nsString();
|
||||
} else if (name.EqualsLiteral("Path")) {
|
||||
MOZ_ASSERT(value.get_nsString().Length() > 0);
|
||||
mPath = value.get_nsString();
|
||||
NS_WARNING(NS_ConvertUTF16toUTF8(mPath).get());
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
NS_WARNING("BluetoothService not available!");
|
||||
} else {
|
||||
bs->RegisterBluetoothSignalHandler(mPath, this);
|
||||
}
|
||||
} else if (name.EqualsLiteral("Address")) {
|
||||
mAddress = value.get_nsString();
|
||||
} else if (name.EqualsLiteral("Class")) {
|
||||
|
@ -1156,9 +1156,19 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
|
||||
// a dict value. After we parse out the properties, we need to go back
|
||||
// and add the address to the ipdl dict we've created to make sure we
|
||||
// have all of the information to correctly build the device.
|
||||
nsString addrstr = NS_ConvertUTF8toUTF16(addr);
|
||||
nsString path = GetObjectPathFromAddress(signalPath, addrstr);
|
||||
|
||||
v.get_ArrayOfBluetoothNamedValue()
|
||||
.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("Address"),
|
||||
NS_ConvertUTF8toUTF16(addr)));
|
||||
addrstr));
|
||||
|
||||
// We also need to create a path for the device, to make sure we know
|
||||
// where to access it later.
|
||||
v.get_ArrayOfBluetoothNamedValue()
|
||||
.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("Path"),
|
||||
path));
|
||||
|
||||
}
|
||||
} else {
|
||||
errorStr.AssignLiteral("DBus device found message structure not as expected!");
|
||||
@ -1571,8 +1581,15 @@ public:
|
||||
// for agent events "RequestConfirmation", "RequestPinCode", and "RequestPasskey"
|
||||
InfallibleTArray<BluetoothNamedValue> parameters = v.get_ArrayOfBluetoothNamedValue();
|
||||
|
||||
// For consistency, append path
|
||||
nsString path = parameters[0].value();
|
||||
BluetoothNamedValue pathprop;
|
||||
pathprop.name().AssignLiteral("Path");
|
||||
pathprop.value() = path;
|
||||
parameters.AppendElement(pathprop);
|
||||
|
||||
// Replace object path with device address
|
||||
nsString address = GetAddressFromObjectPath(parameters[0].value());
|
||||
nsString address = GetAddressFromObjectPath(path);
|
||||
parameters[0].value() = address;
|
||||
|
||||
uint8_t i;
|
||||
|
Loading…
Reference in New Issue
Block a user