Commit f7274b44 authored by Qiyu Hu's avatar Qiyu Hu Committed by Commit Bot

arc: bluetooth: Forward the MTU received to android

Two relevant patches are ag/4013275 and crosreview.com/1043496.

Bug: b:78593133
Test: Pass test CtsVerifier test on MTU exchange
Change-Id: I527dee3d105d3b3db744f550c2c7003789d65c57
CQ-DEPEND: CL:1050621
Reviewed-on: https://chromium-review.googlesource.com/1058328Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
Reviewed-by: default avatarGreg Kerr <kerrnel@chromium.org>
Reviewed-by: default avatarLuis Hector Chavez <lhchavez@chromium.org>
Commit-Queue: Qiyu Hu <qiyuh@google.com>
Cr-Commit-Position: refs/heads/master@{#558735}
parent ce2f20aa
......@@ -559,6 +559,17 @@ void ArcBluetoothBridge::DevicePairedChanged(BluetoothAdapter* adapter,
}
}
void ArcBluetoothBridge::DeviceMTUChanged(BluetoothAdapter* adapter,
BluetoothDevice* device,
uint16_t mtu) {
auto* bluetooth_instance = ARC_GET_INSTANCE_FOR_METHOD(
arc_bridge_service_->bluetooth(), OnMTUReceived);
if (!device->IsConnected() || bluetooth_instance == nullptr)
return;
bluetooth_instance->OnMTUReceived(
mojom::BluetoothAddress::From(device->GetAddress()), mtu);
}
void ArcBluetoothBridge::DeviceRemoved(BluetoothAdapter* adapter,
BluetoothDevice* device) {
if (!IsInstanceUp())
......
......@@ -94,6 +94,10 @@ class ArcBluetoothBridge
device::BluetoothDevice* device,
bool new_paired_status) override;
void DeviceMTUChanged(device::BluetoothAdapter* adapter,
device::BluetoothDevice* device,
uint16_t mtu) override;
void DeviceRemoved(device::BluetoothAdapter* adapter,
device::BluetoothDevice* device) override;
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Next MinVersion: 10
// Next MinVersion: 11
module arc.mojom;
......@@ -405,7 +405,7 @@ interface BluetoothHost {
=> (BluetoothGattStatus status);
};
// Next Method ID: 19
// Next Method ID: 20
interface BluetoothInstance {
// DEPRECATED: Please use Init@18 instead.
InitDeprecated@0(BluetoothHost host_ptr);
......@@ -465,10 +465,11 @@ interface BluetoothInstance {
array<uint8> value,
[MinVersion=9] BluetoothGattDBAttributeType attribute_type)
=> (BluetoothGattStatus status);
[MinVersion=10] OnMTUReceived@19(BluetoothAddress remote_addr, uint16 mtu);
// Bluetooth SDP function
[MinVersion=5] OnGetSdpRecords@17(BluetoothStatus status,
BluetoothAddress remove_addr,
BluetoothAddress remote_addr,
BluetoothUUID target_uuid,
array<BluetoothSdpRecord> records);
};
......@@ -126,8 +126,12 @@ void FakeBluetoothInstance::RequestGattWrite(
void FakeBluetoothInstance::OnGetSdpRecords(
mojom::BluetoothStatus status,
mojom::BluetoothAddressPtr remove_addr,
mojom::BluetoothAddressPtr remote_addr,
const device::BluetoothUUID& target_uuid,
std::vector<mojom::BluetoothSdpRecordPtr> records) {}
void FakeBluetoothInstance::OnMTUReceived(
mojom::BluetoothAddressPtr remote_addr,
uint16_t mtu) {}
} // namespace arc
......@@ -128,10 +128,13 @@ class FakeBluetoothInstance : public mojom::BluetoothInstance {
void OnGetSdpRecords(
mojom::BluetoothStatus status,
mojom::BluetoothAddressPtr remove_addr,
mojom::BluetoothAddressPtr remote_addr,
const device::BluetoothUUID& target_uuid,
std::vector<mojom::BluetoothSdpRecordPtr> records) override;
void OnMTUReceived(mojom::BluetoothAddressPtr remote_addr,
uint16_t mtu) override;
const std::vector<std::vector<mojom::BluetoothPropertyPtr>>&
device_found_data() const {
return device_found_data_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment