chromium/device/bluetooth/floss/floss_gatt_manager_client.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "device/bluetooth/floss/floss_gatt_manager_client.h"

#include "base/logging.h"
#include "base/notreached.h"

namespace floss {
namespace {
constexpr char kCharacteristics[] =;
constexpr char kDescriptors[] =;
constexpr char kIncludedServices[] =;
constexpr char kInstanceId[] =;
constexpr char kKeySize[] =;
constexpr char kPermissions[] =;
constexpr char kProperties[] =;
constexpr char kServiceType[] =;
constexpr char kUuid[] =;
constexpr char kWriteType[] =;
}  // namespace

namespace {
// Randomly generated UUID for use in this client.
constexpr char kDefaultGattManagerClientUuid[] =// Ash and LaCrOS should use the different APP UUID, otherwise the latter one
// (usually LaCrOS) fails on registering.
#if BUILDFLAG(IS_CHROMEOS_ASH)
    "e060b902508c485f8b0e27639c7f2d41";
#else
    "58523f357dbc4390ab78ed075b15a634";
#endif

// Default to not requesting eatt support with gatt client.
constexpr bool kDefaultEattSupport =;

void HandleResponse(const char* method, DBusResult<Void> result) {}
}  // namespace

// Template specializations for dbus parsing

template <>
bool FlossDBusClient::ReadDBusParam(dbus::MessageReader* reader,
                                    LeDiscoverableMode* mode) {}

template <>
const DBusTypeInfo& GetDBusTypeInfo(const LeDiscoverableMode*) {}

template <>
void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer,
                                     const LeDiscoverableMode& mode) {}

template <>
bool FlossDBusClient::ReadDBusParam(dbus::MessageReader* reader, LePhy* phy) {}

template <>
const DBusTypeInfo& GetDBusTypeInfo(const LePhy*) {}

template <>
void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer,
                                     const LePhy& phy) {}

template <>
bool FlossDBusClient::ReadDBusParam(dbus::MessageReader* reader,
                                    GattStatus* status) {}

template <>
void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer,
                                     const GattStatus& status) {}

template <>
const DBusTypeInfo& GetDBusTypeInfo(const GattStatus*) {}

template <>
bool FlossDBusClient::ReadDBusParam(dbus::MessageReader* reader,
                                    GattWriteRequestStatus* status) {}

template <>
const DBusTypeInfo& GetDBusTypeInfo(const GattWriteRequestStatus*) {}

template <>
void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer,
                                     const AuthRequired& auth_req) {}

template <>
bool FlossDBusClient::ReadDBusParam(dbus::MessageReader* reader,
                                    WriteType* write_type) {}

template <>
const DBusTypeInfo& GetDBusTypeInfo(const WriteType*) {}

template <>
void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer,
                                     const WriteType& write_type) {}

template <>
void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer,
                                     const GattService& service) {}

template <>
void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer,
                                     const GattCharacteristic& characteristic) {}

template <>
void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer,
                                     const GattDescriptor& descriptor) {}

template <>
bool FlossDBusClient::ReadDBusParam(dbus::MessageReader* reader,
                                    GattDescriptor* descriptor) {}

template <>
const DBusTypeInfo& GetDBusTypeInfo(const GattDescriptor*) {}

template <>
bool FlossDBusClient::ReadDBusParam(dbus::MessageReader* reader,
                                    GattCharacteristic* characteristic) {}

template <>
const DBusTypeInfo& GetDBusTypeInfo(const GattCharacteristic*) {}

template <>
bool FlossDBusClient::ReadDBusParam(dbus::MessageReader* reader,
                                    GattService* service) {}

template <>
const DBusTypeInfo& GetDBusTypeInfo(const GattService*) {}

GattDescriptor::GattDescriptor() = default;
GattDescriptor::~GattDescriptor() = default;

GattCharacteristic::GattCharacteristic() = default;
GattCharacteristic::GattCharacteristic(const GattCharacteristic&) = default;
GattCharacteristic::~GattCharacteristic() = default;

GattService::GattService() = default;
GattService::GattService(const GattService&) = default;
GattService::~GattService() = default;

const char FlossGattManagerClient::kExportedCallbacksPath[] ="/org/chromium/bluetooth/gatt/callback/lacros";
#else
    "/org/chromium/bluetooth/gatt/callback";
#endif

// static
std::unique_ptr<FlossGattManagerClient> FlossGattManagerClient::Create() {}

FlossGattManagerClient::FlossGattManagerClient() = default;
FlossGattManagerClient::~FlossGattManagerClient() {}

void FlossGattManagerClient::AddObserver(FlossGattClientObserver* observer) {}

void FlossGattManagerClient::AddServerObserver(
    FlossGattServerObserver* observer) {}

void FlossGattManagerClient::RemoveObserver(FlossGattClientObserver* observer) {}

void FlossGattManagerClient::RemoveServerObserver(
    FlossGattServerObserver* observer) {}

void FlossGattManagerClient::Connect(ResponseCallback<Void> callback,
                                     const std::string& remote_device,
                                     const BluetoothTransport& transport,
                                     bool is_direct) {}

void FlossGattManagerClient::Disconnect(ResponseCallback<Void> callback,
                                        const std::string& remote_device) {}

void FlossGattManagerClient::BeginReliableWrite(
    ResponseCallback<Void> callback,
    const std::string& remote_device) {}

void FlossGattManagerClient::EndReliableWrite(ResponseCallback<Void> callback,
                                              const std::string& remote_device,
                                              bool execute) {}

void FlossGattManagerClient::Refresh(ResponseCallback<Void> callback,
                                     const std::string& remote_device) {}

void FlossGattManagerClient::DiscoverAllServices(
    ResponseCallback<Void> callback,
    const std::string& remote_device) {}

void FlossGattManagerClient::DiscoverServiceByUuid(
    ResponseCallback<Void> callback,
    const std::string& remote_device,
    const device::BluetoothUUID& uuid) {}

void FlossGattManagerClient::ReadCharacteristic(
    ResponseCallback<Void> callback,
    const std::string& remote_device,
    const int32_t handle,
    const AuthRequired auth_required) {}

void FlossGattManagerClient::ReadUsingCharacteristicUuid(
    ResponseCallback<Void> callback,
    const std::string& remote_device,
    const device::BluetoothUUID& uuid,
    const int32_t start_handle,
    const int32_t end_handle,
    const AuthRequired auth_required) {}

void FlossGattManagerClient::WriteCharacteristic(
    ResponseCallback<GattWriteRequestStatus> callback,
    const std::string& remote_device,
    const int32_t handle,
    const WriteType write_type,
    const AuthRequired auth_required,
    const std::vector<uint8_t> data) {}

void FlossGattManagerClient::ReadDescriptor(ResponseCallback<Void> callback,
                                            const std::string& remote_device,
                                            const int32_t handle,
                                            const AuthRequired auth_required) {}

void FlossGattManagerClient::WriteDescriptor(ResponseCallback<Void> callback,
                                             const std::string& remote_device,
                                             const int32_t handle,
                                             const AuthRequired auth_required,
                                             const std::vector<uint8_t> data) {}

void FlossGattManagerClient::RegisterForNotification(
    ResponseCallback<GattStatus> callback,
    const std::string& remote_device,
    const int32_t handle) {}

void FlossGattManagerClient::UnregisterNotification(
    ResponseCallback<GattStatus> callback,
    const std::string& remote_device,
    const int32_t handle) {}

void FlossGattManagerClient::ReadRemoteRssi(ResponseCallback<Void> callback,
                                            const std::string& remote_device) {}

void FlossGattManagerClient::ConfigureMTU(ResponseCallback<Void> callback,
                                          const std::string& remote_device,
                                          const int32_t mtu) {}

void FlossGattManagerClient::UpdateConnectionParameters(
    ResponseCallback<Void> callback,
    const std::string& remote_device,
    const int32_t min_interval,
    const int32_t max_interval,
    const int32_t latency,
    const int32_t timeout,
    const uint16_t min_ce_len,
    const uint16_t max_ce_len) {}

void FlossGattManagerClient::ServerConnect(
    ResponseCallback<Void> callback,
    const std::string& remote_device,
    const BluetoothTransport& transport) {}

void FlossGattManagerClient::ServerDisconnect(
    ResponseCallback<Void> callback,
    const std::string& remote_device) {}

void FlossGattManagerClient::ServerSetPreferredPhy(
    ResponseCallback<Void> callback,
    const std::string& remote_device,
    LePhy tx_phy,
    LePhy rx_phy,
    int32_t phy_options) {}

void FlossGattManagerClient::ServerReadPhy(ResponseCallback<Void> callback,
                                           const std::string& remote_device) {}

void FlossGattManagerClient::AddService(ResponseCallback<Void> callback,
                                        GattService service) {}

void FlossGattManagerClient::RemoveService(ResponseCallback<Void> callback,
                                           int32_t handle) {}

void FlossGattManagerClient::ClearServices(ResponseCallback<Void> callback) {}

void FlossGattManagerClient::SendResponse(ResponseCallback<Void> callback,
                                          const std::string& remote_device,
                                          int32_t request_id,
                                          GattStatus status,
                                          int32_t offset,
                                          std::vector<uint8_t> value) {}

void FlossGattManagerClient::ServerSendNotification(
    ResponseCallback<Void> callback,
    const std::string& remote_device,
    int32_t handle,
    bool confirm,
    std::vector<uint8_t> value) {}

void FlossGattManagerClient::Init(dbus::Bus* bus,
                                  const std::string& service_name,
                                  const int adapter_index,
                                  base::Version version,
                                  base::OnceClosure on_ready) {}

void FlossGattManagerClient::RegisterClient() {}

void FlossGattManagerClient::RegisterServer() {}

void FlossGattManagerClient::CompleteInit() {}

void FlossGattManagerClient::GattClientRegistered(GattStatus status,
                                                  int32_t client_id) {}

void FlossGattManagerClient::GattClientConnectionState(GattStatus status,
                                                       int32_t client_id,
                                                       bool connected,
                                                       std::string address) {}

void FlossGattManagerClient::GattPhyUpdate(std::string address,
                                           LePhy tx,
                                           LePhy rx,
                                           GattStatus status) {}

void FlossGattManagerClient::GattPhyRead(std::string address,
                                         LePhy tx,
                                         LePhy rx,
                                         GattStatus status) {}

void FlossGattManagerClient::GattSearchComplete(
    std::string address,
    const std::vector<GattService>& services,
    GattStatus status) {}

void FlossGattManagerClient::GattCharacteristicRead(
    std::string address,
    GattStatus status,
    int32_t handle,
    const std::vector<uint8_t>& data) {}

void FlossGattManagerClient::GattCharacteristicWrite(std::string address,
                                                     GattStatus status,
                                                     int32_t handle) {}

void FlossGattManagerClient::GattExecuteWrite(std::string address,
                                              GattStatus status) {}

void FlossGattManagerClient::GattDescriptorRead(
    std::string address,
    GattStatus status,
    int32_t handle,
    const std::vector<uint8_t>& data) {}

void FlossGattManagerClient::GattDescriptorWrite(std::string address,
                                                 GattStatus status,
                                                 int32_t handle) {}

void FlossGattManagerClient::GattNotify(std::string address,
                                        int32_t handle,
                                        const std::vector<uint8_t>& data) {}

void FlossGattManagerClient::GattReadRemoteRssi(std::string address,
                                                int32_t rssi,
                                                GattStatus status) {}

void FlossGattManagerClient::GattConfigureMtu(std::string address,
                                              int32_t mtu,
                                              GattStatus status) {}

void FlossGattManagerClient::GattConnectionUpdated(std::string address,
                                                   int32_t interval,
                                                   int32_t latency,
                                                   int32_t timeout,
                                                   GattStatus status) {}

void FlossGattManagerClient::GattServiceChanged(std::string address) {}

// TODO(b/193685841) - Floss currently doesn't emit a callback when
// a notification registers. Once a callback is available, we should report that
// via the callback here instead.
void FlossGattManagerClient::OnRegisterNotificationResponse(
    ResponseCallback<GattStatus> callback,
    bool is_registering,
    DBusResult<Void> result) {}

void FlossGattManagerClient::GattServerRegistered(GattStatus status,
                                                  int32_t server_id) {}

void FlossGattManagerClient::GattServerConnectionState(int32_t server_id,
                                                       bool connected,
                                                       std::string address) {}

void FlossGattManagerClient::GattServerServiceAdded(GattStatus status,
                                                    GattService service) {}

void FlossGattManagerClient::GattServerServiceRemoved(GattStatus status,
                                                      int32_t handle) {}

void FlossGattManagerClient::GattServerCharacteristicReadRequest(
    std::string address,
    int32_t request_id,
    int32_t offset,
    bool is_long,
    int32_t handle) {}

void FlossGattManagerClient::GattServerDescriptorReadRequest(
    std::string address,
    int32_t request_id,
    int32_t offset,
    bool is_long,
    int32_t handle) {}

void FlossGattManagerClient::GattServerCharacteristicWriteRequest(
    std::string address,
    int32_t request_id,
    int32_t offset,
    int32_t length,
    bool is_prepared_write,
    bool needs_response,
    int32_t handle,
    std::vector<uint8_t> value) {}

void FlossGattManagerClient::GattServerDescriptorWriteRequest(
    std::string address,
    int32_t request_id,
    int32_t offset,
    int32_t length,
    bool is_prepared_write,
    bool needs_response,
    int32_t handle,
    std::vector<uint8_t> value) {}

void FlossGattManagerClient::GattServerExecuteWrite(std::string address,
                                                    int32_t request_id,
                                                    bool execute_write) {}

void FlossGattManagerClient::GattServerNotificationSent(std::string address,
                                                        GattStatus status) {}

void FlossGattManagerClient::GattServerMtuChanged(std::string address,
                                                  int32_t mtu) {}

void FlossGattManagerClient::GattServerPhyUpdate(std::string address,
                                                 LePhy tx_phy,
                                                 LePhy rx_phy,
                                                 GattStatus status) {}

void FlossGattManagerClient::GattServerPhyRead(std::string address,
                                               LePhy tx_phy,
                                               LePhy rx_phy,
                                               GattStatus status) {}

void FlossGattManagerClient::GattServerConnectionUpdate(std::string address,
                                                        int32_t interval,
                                                        int32_t latency,
                                                        int32_t timeout,
                                                        GattStatus status) {}

void FlossGattManagerClient::GattServerSubrateChange(std::string address,
                                                     int32_t subrate_factor,
                                                     int32_t latency,
                                                     int32_t continuation_num,
                                                     int32_t timeout,
                                                     GattStatus status) {}

}  // namespace floss