From e40faf5dddbfb3ee7ef8f2761bcee81f65d72048 Mon Sep 17 00:00:00 2001 From: Vibhav Pant Date: Mon, 11 Sep 2023 17:43:50 +0530 Subject: [PATCH] Rename GattCharacteristic to GattCharacteristicServer. --- .../implementation/linux/ble_gatt_server.cc | 4 ++-- .../linux/bluez_gatt_characteristic_server.cc | 14 +++++++------- .../linux/bluez_gatt_characteristic_server.h | 14 +++++++------- .../implementation/linux/bluez_gatt_service.cc | 6 +++--- .../implementation/linux/bluez_gatt_service.h | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/internal/platform/implementation/linux/ble_gatt_server.cc b/internal/platform/implementation/linux/ble_gatt_server.cc index 88362275..37dc51a9 100644 --- a/internal/platform/implementation/linux/ble_gatt_server.cc +++ b/internal/platform/implementation/linux/ble_gatt_server.cc @@ -80,7 +80,7 @@ GattServer::CreateCharacteristic( bool GattServer::UpdateCharacteristic( const api::ble_v2::GattCharacteristic& characteristic, const nearby::ByteArray& value) { - std::shared_ptr chr = nullptr; + std::shared_ptr chr = nullptr; { absl::ReaderMutexLock lock(&services_mutex_); if (services_.count(characteristic.service_uuid) == 0) { @@ -107,7 +107,7 @@ bool GattServer::UpdateCharacteristic( absl::Status GattServer::NotifyCharacteristicChanged( const api::ble_v2::GattCharacteristic& characteristic, bool confirm, const ByteArray& new_value) { - std::shared_ptr chr = nullptr; + std::shared_ptr chr = nullptr; { absl::ReaderMutexLock lock(&services_mutex_); if (services_.count(characteristic.service_uuid) == 0) { diff --git a/internal/platform/implementation/linux/bluez_gatt_characteristic_server.cc b/internal/platform/implementation/linux/bluez_gatt_characteristic_server.cc index 71768c4e..79c1b3e6 100644 --- a/internal/platform/implementation/linux/bluez_gatt_characteristic_server.cc +++ b/internal/platform/implementation/linux/bluez_gatt_characteristic_server.cc @@ -24,7 +24,7 @@ namespace nearby { namespace linux { namespace bluez { -void GattCharacteristic::Update(const nearby::ByteArray &value) { +void GattCharacteristicServer::Update(const nearby::ByteArray &value) { std::vector bytes(value.size()); const auto *buf = value.data(); for (auto i = 0; i < value.size(); i++) bytes[i] = buf[i]; @@ -33,7 +33,7 @@ void GattCharacteristic::Update(const nearby::ByteArray &value) { static_value_ = std::move(bytes); } -absl::Status GattCharacteristic::NotifyChanged(bool confirm, +absl::Status GattCharacteristicServer::NotifyChanged(bool confirm, const ByteArray &new_value) { std::vector bytes(new_value.size()); const auto *buf = new_value.data(); @@ -69,7 +69,7 @@ absl::Status GattCharacteristic::NotifyChanged(bool confirm, } } -void GattCharacteristic::ReadValue( +void GattCharacteristicServer::ReadValue( sdbus::Result> &&result, std::map options) { { @@ -127,7 +127,7 @@ void GattCharacteristic::ReadValue( }); } -void GattCharacteristic::WriteValue( +void GattCharacteristicServer::WriteValue( sdbus::Result<> &&result, std::vector value, std::map options) { uint16_t offset = options["offset"]; @@ -172,7 +172,7 @@ void GattCharacteristic::WriteValue( } } -void GattCharacteristic::StartNotify() { +void GattCharacteristicServer::StartNotify() { if ((characteristic_.property | api::ble_v2::GattCharacteristic::Property::kNotify) == api::ble_v2::GattCharacteristic::Property::kNotify) { @@ -183,7 +183,7 @@ void GattCharacteristic::StartNotify() { } } -void GattCharacteristic::StopNotify() { +void GattCharacteristicServer::StopNotify() { if ((characteristic_.property | api::ble_v2::GattCharacteristic::Property::kNotify) == api::ble_v2::GattCharacteristic::Property::kNotify) { @@ -194,7 +194,7 @@ void GattCharacteristic::StopNotify() { } } -std::vector GattCharacteristic::Flags() { +std::vector GattCharacteristicServer::Flags() { auto characteristic = characteristic_; std::vector flags; diff --git a/internal/platform/implementation/linux/bluez_gatt_characteristic_server.h b/internal/platform/implementation/linux/bluez_gatt_characteristic_server.h index 92837e0d..6f7d5c16 100644 --- a/internal/platform/implementation/linux/bluez_gatt_characteristic_server.h +++ b/internal/platform/implementation/linux/bluez_gatt_characteristic_server.h @@ -38,17 +38,17 @@ namespace nearby { namespace linux { namespace bluez { -class GattCharacteristic final +class GattCharacteristicServer final : public sdbus::AdaptorInterfaces { public: - GattCharacteristic(const GattCharacteristic &) = delete; - GattCharacteristic(GattCharacteristic &&) = delete; - GattCharacteristic &operator=(const GattCharacteristic &) = delete; - GattCharacteristic &operator=(GattCharacteristic &&) = delete; + GattCharacteristicServer(const GattCharacteristicServer &) = delete; + GattCharacteristicServer(GattCharacteristicServer &&) = delete; + GattCharacteristicServer &operator=(const GattCharacteristicServer &) = delete; + GattCharacteristicServer &operator=(GattCharacteristicServer &&) = delete; - GattCharacteristic( + GattCharacteristicServer( sdbus::IConnection &system_bus, const sdbus::ObjectPath &service_object_path, size_t num, const api::ble_v2::GattCharacteristic &characteristic, @@ -68,7 +68,7 @@ class GattCharacteristic final << org::bluez::GattCharacteristic1_adaptor::INTERFACE_NAME << " object at " << getObjectPath(); } - ~GattCharacteristic() { unregisterAdaptor(); } + ~GattCharacteristicServer() { unregisterAdaptor(); } void Update(const nearby::ByteArray &value) ABSL_LOCKS_EXCLUDED(static_value_mutex_); diff --git a/internal/platform/implementation/linux/bluez_gatt_service.cc b/internal/platform/implementation/linux/bluez_gatt_service.cc index d8ae5b0b..17b94158 100644 --- a/internal/platform/implementation/linux/bluez_gatt_service.cc +++ b/internal/platform/implementation/linux/bluez_gatt_service.cc @@ -30,8 +30,8 @@ bool GattService::AddCharacteristic( api::ble_v2::GattCharacteristic characteristic{ characteristic_uuid, service_uuid, permission, property}; auto count = characteristics_.size(); - std::shared_ptr chr = - std::make_shared( + std::shared_ptr chr = + std::make_shared( getObject().getConnection(), getObjectPath(), count, characteristic, server_cb_, devices_); try { @@ -50,7 +50,7 @@ bool GattService::AddCharacteristic( return true; } -std::shared_ptr GattService::GetCharacteristic( +std::shared_ptr GattService::GetCharacteristic( const Uuid &uuid) { absl::ReaderMutexLock lock(&characterstics_mutex_); if (characteristics_.count(uuid) == 0) { diff --git a/internal/platform/implementation/linux/bluez_gatt_service.h b/internal/platform/implementation/linux/bluez_gatt_service.h index 9390b151..eb5ba51e 100644 --- a/internal/platform/implementation/linux/bluez_gatt_service.h +++ b/internal/platform/implementation/linux/bluez_gatt_service.h @@ -83,7 +83,7 @@ class GattService final api::ble_v2::GattCharacteristic::Permission permission, api::ble_v2::GattCharacteristic::Property property) ABSL_LOCKS_EXCLUDED(characterstics_mutex_); - std::shared_ptr GetCharacteristic(const Uuid &uuid) + std::shared_ptr GetCharacteristic(const Uuid &uuid) ABSL_LOCKS_EXCLUDED(characterstics_mutex_); private: @@ -94,7 +94,7 @@ class GattService final std::vector Includes() override { return {}; } absl::Mutex characterstics_mutex_; - absl::flat_hash_map> + absl::flat_hash_map> characteristics_ ABSL_GUARDED_BY(characterstics_mutex_); std::shared_ptr devices_;