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, ...@@ -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, void ArcBluetoothBridge::DeviceRemoved(BluetoothAdapter* adapter,
BluetoothDevice* device) { BluetoothDevice* device) {
if (!IsInstanceUp()) if (!IsInstanceUp())
......
...@@ -94,6 +94,10 @@ class ArcBluetoothBridge ...@@ -94,6 +94,10 @@ class ArcBluetoothBridge
device::BluetoothDevice* device, device::BluetoothDevice* device,
bool new_paired_status) override; bool new_paired_status) override;
void DeviceMTUChanged(device::BluetoothAdapter* adapter,
device::BluetoothDevice* device,
uint16_t mtu) override;
void DeviceRemoved(device::BluetoothAdapter* adapter, void DeviceRemoved(device::BluetoothAdapter* adapter,
device::BluetoothDevice* device) override; device::BluetoothDevice* device) override;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Next MinVersion: 10 // Next MinVersion: 11
module arc.mojom; module arc.mojom;
...@@ -405,7 +405,7 @@ interface BluetoothHost { ...@@ -405,7 +405,7 @@ interface BluetoothHost {
=> (BluetoothGattStatus status); => (BluetoothGattStatus status);
}; };
// Next Method ID: 19 // Next Method ID: 20
interface BluetoothInstance { interface BluetoothInstance {
// DEPRECATED: Please use Init@18 instead. // DEPRECATED: Please use Init@18 instead.
InitDeprecated@0(BluetoothHost host_ptr); InitDeprecated@0(BluetoothHost host_ptr);
...@@ -465,10 +465,11 @@ interface BluetoothInstance { ...@@ -465,10 +465,11 @@ interface BluetoothInstance {
array<uint8> value, array<uint8> value,
[MinVersion=9] BluetoothGattDBAttributeType attribute_type) [MinVersion=9] BluetoothGattDBAttributeType attribute_type)
=> (BluetoothGattStatus status); => (BluetoothGattStatus status);
[MinVersion=10] OnMTUReceived@19(BluetoothAddress remote_addr, uint16 mtu);
// Bluetooth SDP function // Bluetooth SDP function
[MinVersion=5] OnGetSdpRecords@17(BluetoothStatus status, [MinVersion=5] OnGetSdpRecords@17(BluetoothStatus status,
BluetoothAddress remove_addr, BluetoothAddress remote_addr,
BluetoothUUID target_uuid, BluetoothUUID target_uuid,
array<BluetoothSdpRecord> records); array<BluetoothSdpRecord> records);
}; };
...@@ -126,8 +126,12 @@ void FakeBluetoothInstance::RequestGattWrite( ...@@ -126,8 +126,12 @@ void FakeBluetoothInstance::RequestGattWrite(
void FakeBluetoothInstance::OnGetSdpRecords( void FakeBluetoothInstance::OnGetSdpRecords(
mojom::BluetoothStatus status, mojom::BluetoothStatus status,
mojom::BluetoothAddressPtr remove_addr, mojom::BluetoothAddressPtr remote_addr,
const device::BluetoothUUID& target_uuid, const device::BluetoothUUID& target_uuid,
std::vector<mojom::BluetoothSdpRecordPtr> records) {} std::vector<mojom::BluetoothSdpRecordPtr> records) {}
void FakeBluetoothInstance::OnMTUReceived(
mojom::BluetoothAddressPtr remote_addr,
uint16_t mtu) {}
} // namespace arc } // namespace arc
...@@ -128,10 +128,13 @@ class FakeBluetoothInstance : public mojom::BluetoothInstance { ...@@ -128,10 +128,13 @@ class FakeBluetoothInstance : public mojom::BluetoothInstance {
void OnGetSdpRecords( void OnGetSdpRecords(
mojom::BluetoothStatus status, mojom::BluetoothStatus status,
mojom::BluetoothAddressPtr remove_addr, mojom::BluetoothAddressPtr remote_addr,
const device::BluetoothUUID& target_uuid, const device::BluetoothUUID& target_uuid,
std::vector<mojom::BluetoothSdpRecordPtr> records) override; std::vector<mojom::BluetoothSdpRecordPtr> records) override;
void OnMTUReceived(mojom::BluetoothAddressPtr remote_addr,
uint16_t mtu) override;
const std::vector<std::vector<mojom::BluetoothPropertyPtr>>& const std::vector<std::vector<mojom::BluetoothPropertyPtr>>&
device_found_data() const { device_found_data() const {
return device_found_data_; 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