Bug 1121334 - [bluetooth2] Append device name to BluetoothDevice in BluetoothPairingEvent, r=shuang, f=jaliu

This commit is contained in:
Ben Tian 2015-01-16 10:53:55 +08:00
Родитель bc86bf960f
Коммит 313c39fbfe
2 изменённых файлов: 11 добавлений и 6 удалений

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

@ -92,18 +92,21 @@ BluetoothPairingListener::Notify(const BluetoothSignal& aData)
const InfallibleTArray<BluetoothNamedValue>& arr =
value.get_ArrayOfBluetoothNamedValue();
MOZ_ASSERT(arr.Length() == 3 &&
MOZ_ASSERT(arr.Length() == 4 &&
arr[0].value().type() == BluetoothValue::TnsString && // address
arr[1].value().type() == BluetoothValue::TnsString && // passkey
arr[2].value().type() == BluetoothValue::TnsString); // type
arr[1].value().type() == BluetoothValue::TnsString && // name
arr[2].value().type() == BluetoothValue::TnsString && // passkey
arr[3].value().type() == BluetoothValue::TnsString); // type
nsString deviceAddress = arr[0].value().get_nsString();
nsString passkey = arr[1].value().get_nsString();
nsString type = arr[2].value().get_nsString();
nsString deviceName = arr[1].value().get_nsString();
nsString passkey = arr[2].value().get_nsString();
nsString type = arr[3].value().get_nsString();
// Create a temporary device with deviceAddress for searching
// Create a temporary device with deviceAddress and deviceName
InfallibleTArray<BluetoothNamedValue> props;
BT_APPEND_NAMED_VALUE(props, "Address", deviceAddress);
BT_APPEND_NAMED_VALUE(props, "Name", deviceName);
nsRefPtr<BluetoothDevice> device =
BluetoothDevice::Create(GetOwner(), props);

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

@ -1500,6 +1500,7 @@ BluetoothServiceBluedroid::PinRequestNotification(const nsAString& aRemoteBdAddr
InfallibleTArray<BluetoothNamedValue> propertiesArray;
BT_APPEND_NAMED_VALUE(propertiesArray, "address", nsString(aRemoteBdAddr));
BT_APPEND_NAMED_VALUE(propertiesArray, "name", nsString(aBdName));
BT_APPEND_NAMED_VALUE(propertiesArray, "passkey", EmptyString());
BT_APPEND_NAMED_VALUE(propertiesArray, "type",
NS_LITERAL_STRING(PAIRING_REQ_TYPE_ENTERPINCODE));
@ -1546,6 +1547,7 @@ BluetoothServiceBluedroid::SspRequestNotification(
}
BT_APPEND_NAMED_VALUE(propertiesArray, "address", nsString(aRemoteBdAddr));
BT_APPEND_NAMED_VALUE(propertiesArray, "name", nsString(aBdName));
BT_APPEND_NAMED_VALUE(propertiesArray, "passkey", passkey);
BT_APPEND_NAMED_VALUE(propertiesArray, "type", pairingType);