Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a stub device class for Floss. Currently, it's only really useful for displaying address and name (which is provided by the DeviceFound callback in the adapter client). BUG=b:189499077 TEST=autoninja chrome on entire chain Change-Id: I2e34589161c6153def0aca3c217edad6b80d31d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3027302 Commit-Queue: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org> Reviewed-by: Chris Mumford <cmumford@google.com> Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org> Cr-Commit-Position: refs/heads/master@{#906554}
- Loading branch information
Showing
3 changed files
with
461 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,322 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "device/bluetooth/floss/bluetooth_device_floss.h" | ||
|
||
#include <memory> | ||
|
||
#include "base/bind.h" | ||
#include "base/notreached.h" | ||
#include "dbus/bus.h" | ||
#include "device/bluetooth/bluetooth_device.h" | ||
#include "device/bluetooth/bluetooth_gatt_connection.h" | ||
#include "device/bluetooth/floss/bluetooth_adapter_floss.h" | ||
#include "device/bluetooth/floss/floss_dbus_client.h" | ||
|
||
namespace floss { | ||
|
||
using AddressType = device::BluetoothDevice::AddressType; | ||
using VendorIDSource = device::BluetoothDevice::VendorIDSource; | ||
|
||
BluetoothDeviceFloss::~BluetoothDeviceFloss() = default; | ||
|
||
uint32_t BluetoothDeviceFloss::GetBluetoothClass() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return 0; | ||
} | ||
|
||
device::BluetoothTransport BluetoothDeviceFloss::GetType() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return device::BluetoothTransport::BLUETOOTH_TRANSPORT_INVALID; | ||
} | ||
|
||
std::string BluetoothDeviceFloss::GetAddress() const { | ||
return address_; | ||
} | ||
|
||
AddressType BluetoothDeviceFloss::GetAddressType() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return AddressType::ADDR_TYPE_UNKNOWN; | ||
} | ||
|
||
VendorIDSource BluetoothDeviceFloss::GetVendorIDSource() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return VendorIDSource::VENDOR_ID_UNKNOWN; | ||
} | ||
|
||
uint16_t BluetoothDeviceFloss::GetVendorID() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return 0; | ||
} | ||
|
||
uint16_t BluetoothDeviceFloss::GetProductID() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return 0; | ||
} | ||
|
||
uint16_t BluetoothDeviceFloss::GetDeviceID() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return 0; | ||
} | ||
|
||
uint16_t BluetoothDeviceFloss::GetAppearance() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return 0; | ||
} | ||
|
||
absl::optional<std::string> BluetoothDeviceFloss::GetName() const { | ||
if (name_.length() == 0) | ||
return absl::nullopt; | ||
|
||
return name_; | ||
} | ||
|
||
bool BluetoothDeviceFloss::IsPaired() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return false; | ||
} | ||
|
||
bool BluetoothDeviceFloss::IsConnected() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return false; | ||
} | ||
|
||
bool BluetoothDeviceFloss::IsGattConnected() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return false; | ||
} | ||
|
||
bool BluetoothDeviceFloss::IsConnectable() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return false; | ||
} | ||
|
||
bool BluetoothDeviceFloss::IsConnecting() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return false; | ||
} | ||
|
||
#if defined(OS_CHROMEOS) | ||
bool BluetoothDeviceFloss::IsBlockedByPolicy() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return false; | ||
} | ||
#endif | ||
|
||
device::BluetoothDevice::UUIDSet BluetoothDeviceFloss::GetUUIDs() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return {}; | ||
} | ||
|
||
absl::optional<int8_t> BluetoothDeviceFloss::GetInquiryRSSI() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return absl::nullopt; | ||
} | ||
|
||
absl::optional<int8_t> BluetoothDeviceFloss::GetInquiryTxPower() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return absl::nullopt; | ||
} | ||
|
||
bool BluetoothDeviceFloss::ExpectingPinCode() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return false; | ||
} | ||
|
||
bool BluetoothDeviceFloss::ExpectingPasskey() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return false; | ||
} | ||
|
||
bool BluetoothDeviceFloss::ExpectingConfirmation() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return false; | ||
} | ||
|
||
void BluetoothDeviceFloss::GetConnectionInfo(ConnectionInfoCallback callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::SetConnectionLatency( | ||
ConnectionLatency connection_latency, | ||
base::OnceClosure callback, | ||
ErrorCallback error_callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::Connect( | ||
device::BluetoothDevice::PairingDelegate* pairing_delegate, | ||
ConnectCallback callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::SetPinCode(const std::string& pincode) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::SetPasskey(uint32_t passkey) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::ConfirmPairing() { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::RejectPairing() { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::CancelPairing() { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::Disconnect(base::OnceClosure callback, | ||
ErrorCallback error_callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::Forget(base::OnceClosure callback, | ||
ErrorCallback error_callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::ConnectToService( | ||
const device::BluetoothUUID& uuid, | ||
ConnectToServiceCallback callback, | ||
ConnectToServiceErrorCallback error_callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::ConnectToServiceInsecurely( | ||
const device::BluetoothUUID& uuid, | ||
ConnectToServiceCallback callback, | ||
ConnectToServiceErrorCallback error_callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
std::unique_ptr<device::BluetoothGattConnection> | ||
BluetoothDeviceFloss::CreateBluetoothGattConnectionObject() { | ||
NOTIMPLEMENTED(); | ||
|
||
return nullptr; | ||
} | ||
|
||
void BluetoothDeviceFloss::SetGattServicesDiscoveryComplete(bool complete) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
bool BluetoothDeviceFloss::IsGattServicesDiscoveryComplete() const { | ||
NOTIMPLEMENTED(); | ||
|
||
return false; | ||
} | ||
|
||
void BluetoothDeviceFloss::Pair( | ||
device::BluetoothDevice::PairingDelegate* pairing_delegate, | ||
ConnectCallback callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
#if BUILDFLAG(IS_CHROMEOS_ASH) | ||
void BluetoothDeviceFloss::ExecuteWrite( | ||
base::OnceClosure callback, | ||
ExecuteWriteErrorCallback error_callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::AbortWrite(base::OnceClosure callback, | ||
AbortWriteErrorCallback error_callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
#endif | ||
|
||
void BluetoothDeviceFloss::SetName(const std::string& name) { | ||
name_ = name; | ||
} | ||
|
||
void BluetoothDeviceFloss::CreateGattConnectionImpl( | ||
absl::optional<device::BluetoothUUID> service_uuid) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::DisconnectGatt() { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
BluetoothDeviceFloss::BluetoothDeviceFloss(BluetoothAdapterFloss* adapter, | ||
const FlossDeviceId& device) | ||
: BluetoothDevice(adapter), address_(device.address), name_(device.name) { | ||
// TODO(abps): Add observers and cache data here. | ||
} | ||
|
||
void BluetoothDeviceFloss::ConnectInternal(ConnectCallback callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::OnConnect(ConnectCallback callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::OnConnectError(ConnectCallback callback, | ||
const Error& error) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::OnPairDuringConnect(ConnectCallback callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::OnPairDuringConnectError(ConnectCallback callback, | ||
const Error& error) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::OnDisconnect(base::OnceClosure callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::OnDisconnectError(ErrorCallback error_callback, | ||
const Error& error) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::OnPair(ConnectCallback callback) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::OnPairError(ConnectCallback callback, | ||
const Error& error) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::OnCancelPairingError(const Error& error) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
void BluetoothDeviceFloss::OnForgetError(ErrorCallback error_callback, | ||
const Error& error) { | ||
NOTIMPLEMENTED(); | ||
} | ||
|
||
} // namespace floss |
Oops, something went wrong.