Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Unified Diff: components/arc/bluetooth/arc_bluetooth_bridge.cc

Issue 2297903002: arc: bluetooth: Implement set discoverable state (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/arc/bluetooth/arc_bluetooth_bridge.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/bluetooth/arc_bluetooth_bridge.cc
diff --git a/components/arc/bluetooth/arc_bluetooth_bridge.cc b/components/arc/bluetooth/arc_bluetooth_bridge.cc
index 964f1986f31971bd6144b5708049f9f2f68fef93..ca16e8d9b1ca72f2cfb79886246c393c8f6b9db4 100644
--- a/components/arc/bluetooth/arc_bluetooth_bridge.cc
+++ b/components/arc/bluetooth/arc_bluetooth_bridge.cc
@@ -618,16 +618,43 @@ void ArcBluetoothBridge::GetAdapterProperty(mojom::BluetoothPropertyType type) {
mojom::BluetoothStatus::SUCCESS, std::move(properties));
}
+void ArcBluetoothBridge::OnAdapterPropertySuccess(
+ mojo::Array<mojom::BluetoothPropertyPtr> properties) const {
+ arc_bridge_service()->bluetooth()->instance()->OnAdapterProperties(
+ mojom::BluetoothStatus::SUCCESS, std::move(properties));
+}
+
+void ArcBluetoothBridge::OnAdapterPropertyError(
+ mojom::BluetoothStatus status) const {
+ arc_bridge_service()->bluetooth()->instance()->OnAdapterProperties(
+ status, mojo::Array<mojom::BluetoothPropertyPtr>::New(0));
+}
+
void ArcBluetoothBridge::SetAdapterProperty(
mojom::BluetoothPropertyPtr property) {
DCHECK(bluetooth_adapter_);
if (!HasBluetoothInstance())
return;
- // TODO(smbarber): Implement SetAdapterProperty
- arc_bridge_service()->bluetooth()->instance()->OnAdapterProperties(
- mojom::BluetoothStatus::FAIL,
- mojo::Array<mojom::BluetoothPropertyPtr>::New(0));
+ // TODO(puthik) Implement other case.
Miao 2016/08/30 22:05:38 nit: Move this comment to the unsupported case.
+ if (property->is_discovery_timeout()) {
+ uint32_t discovery_timeout = property->get_discovery_timeout();
+ mojo::Array<mojom::BluetoothPropertyPtr> success_result;
+ success_result.push_back(std::move(property));
+ if (discovery_timeout > 0) {
Miao 2016/08/30 22:05:38 nit: put a new line above.
+ // TODO(puthik) Add timer and turn this to off when timer end
+ bluetooth_adapter_->SetDiscoverable(
+ true,
+ base::Bind(&ArcBluetoothBridge::OnAdapterPropertySuccess,
+ weak_factory_.GetWeakPtr(), base::Passed(&success_result)),
+ base::Bind(&ArcBluetoothBridge::OnAdapterPropertyError,
+ weak_factory_.GetWeakPtr(), mojom::BluetoothStatus::FAIL));
+ } else {
+ OnAdapterPropertyError(mojom::BluetoothStatus::PARM_INVALID);
+ }
+ } else {
+ OnAdapterPropertyError(mojom::BluetoothStatus::UNSUPPORTED);
+ }
}
void ArcBluetoothBridge::GetRemoteDeviceProperty(
« no previous file with comments | « components/arc/bluetooth/arc_bluetooth_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698