mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Remove unused method.
PiperOrigin-RevId: 756045245
This commit is contained in:
committed by
Copybara-Service
parent
94ddb09a7f
commit
4beed5b72a
@@ -257,10 +257,6 @@ class GattServer final {
|
||||
// it is not safe to call any other method.
|
||||
bool IsValid() const { return impl_ != nullptr; }
|
||||
|
||||
BleV2Peripheral GetBlePeripheral() {
|
||||
return BleV2Peripheral(medium_, impl_->GetBlePeripheral());
|
||||
}
|
||||
|
||||
// Returns reference to platform implementation.
|
||||
// This is used to communicate with platform code, and for debugging
|
||||
// purposes.
|
||||
|
||||
@@ -626,7 +626,7 @@ TEST_F(BleV2MediumTest, GattClientConnectToGattServerWorks) {
|
||||
|
||||
// Start GattClient
|
||||
BleV2Peripheral ble_peripheral =
|
||||
ble_b.GetRemotePeripheral(*gatt_server->GetBlePeripheral().GetAddress());
|
||||
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
|
||||
std::unique_ptr<GattClient> gatt_client =
|
||||
ble_b.ConnectToGattServer(BleV2Peripheral(ble_peripheral), kTxPowerLevel,
|
||||
/*ClientGattConnectionCallback=*/{});
|
||||
@@ -661,7 +661,7 @@ TEST_F(BleV2MediumTest, GattClientConnectToStoppedGattServerFails) {
|
||||
ble_a.StartGattServer(/*ServerGattConnectionCallback=*/{});
|
||||
ASSERT_NE(gatt_server, nullptr);
|
||||
BleV2Peripheral ble_peripheral =
|
||||
ble_b.GetRemotePeripheral(*gatt_server->GetBlePeripheral().GetAddress());
|
||||
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
|
||||
|
||||
gatt_server->Stop();
|
||||
std::unique_ptr<GattClient> gatt_client =
|
||||
@@ -685,7 +685,7 @@ TEST_F(BleV2MediumTest, GattClientNotifiedWhenServerDisconnects) {
|
||||
CountDownLatch disconnected_latch(1);
|
||||
// Start GattClient
|
||||
BleV2Peripheral ble_peripheral =
|
||||
ble_b.GetRemotePeripheral(*gatt_server->GetBlePeripheral().GetAddress());
|
||||
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
|
||||
std::unique_ptr<GattClient> gatt_client = ble_b.ConnectToGattServer(
|
||||
BleV2Peripheral(ble_peripheral), kTxPowerLevel,
|
||||
/*ClientGattConnectionCallback=*/{.disconnected_cb = [&]() {
|
||||
@@ -721,11 +721,10 @@ TEST_F(BleV2MediumTest, GattClientOperatiosOnCharacteristic) {
|
||||
callback(absl::OkStatus());
|
||||
}});
|
||||
ASSERT_NE(gatt_server, nullptr);
|
||||
BleV2Peripheral server_ble = gatt_server->GetBlePeripheral();
|
||||
|
||||
// Start GattClient.
|
||||
BleV2Peripheral ble_peripheral =
|
||||
ble_b.GetRemotePeripheral(*server_ble.GetAddress());
|
||||
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
|
||||
ASSERT_TRUE(ble_peripheral.IsValid());
|
||||
std::unique_ptr<GattClient> gatt_client =
|
||||
ble_b.ConnectToGattServer(BleV2Peripheral(ble_peripheral), kTxPowerLevel,
|
||||
@@ -798,7 +797,6 @@ TEST_F(BleV2MediumTest, GattClientSubscribeNotificationGattServerCanNotify) {
|
||||
ble_a.StartGattServer(/*ServerGattConnectionCallback=*/{});
|
||||
|
||||
ASSERT_NE(gatt_server, nullptr);
|
||||
BleV2Peripheral server_ble = gatt_server->GetBlePeripheral();
|
||||
// Add characteristic and its value.
|
||||
// NOLINTNEXTLINE(google3-legacy-absl-backports)
|
||||
std::optional<GattCharacteristic> server_characteristic =
|
||||
@@ -809,7 +807,7 @@ TEST_F(BleV2MediumTest, GattClientSubscribeNotificationGattServerCanNotify) {
|
||||
|
||||
// Start GattClient
|
||||
BleV2Peripheral ble_peripheral =
|
||||
ble_b.GetRemotePeripheral(*server_ble.GetAddress());
|
||||
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
|
||||
ASSERT_TRUE(ble_peripheral.IsValid());
|
||||
std::unique_ptr<GattClient> gatt_client =
|
||||
ble_b.ConnectToGattServer(BleV2Peripheral(ble_peripheral), kTxPowerLevel,
|
||||
@@ -824,7 +822,7 @@ TEST_F(BleV2MediumTest, GattClientSubscribeNotificationGattServerCanNotify) {
|
||||
server_characteristic.value(), true,
|
||||
[](absl::string_view value) { EXPECT_EQ(value, "hello"); }));
|
||||
|
||||
// Sends notifiction
|
||||
// Sends notification
|
||||
EXPECT_EQ(gatt_server->NotifyCharacteristicChanged(
|
||||
server_characteristic.value(), false, ByteArray("hello")),
|
||||
absl::OkStatus());
|
||||
|
||||
@@ -36,12 +36,6 @@ class GattServer : public api::ble_v2::GattServer {
|
||||
explicit GattServer(GNCBLEGATTServer *gatt_server_);
|
||||
~GattServer() override = default;
|
||||
|
||||
// Returns an empty BlePeripheral object.
|
||||
//
|
||||
// Use of this method should be avoided and its only purpose seems to be a check that the GATT
|
||||
// server is valid.
|
||||
api::ble_v2::BlePeripheral &GetBlePeripheral() override;
|
||||
|
||||
// Creates a characteristic and adds it to the GATT server under the given characteristic and
|
||||
// service UUIDs.
|
||||
//
|
||||
|
||||
@@ -95,10 +95,5 @@ void GattServer::Stop() {
|
||||
[gatt_server_ stop];
|
||||
}
|
||||
|
||||
// TODO(b/290385712): Implement.
|
||||
api::ble_v2::BlePeripheral &GattServer::GetBlePeripheral() {
|
||||
return BlePeripheral::DefaultBlePeripheral();
|
||||
}
|
||||
|
||||
} // namespace apple
|
||||
} // namespace nearby
|
||||
|
||||
@@ -270,9 +270,6 @@ class GattServer {
|
||||
public:
|
||||
virtual ~GattServer() = default;
|
||||
|
||||
// Returns the local BlePeripheral.
|
||||
virtual BlePeripheral& GetBlePeripheral() = 0;
|
||||
|
||||
// Creates a characteristic and adds it to the GATT server under the given
|
||||
// characteristic and service UUIDs. Returns no value upon error.
|
||||
//
|
||||
|
||||
@@ -209,9 +209,6 @@ class BleV2Medium : public api::ble_v2::BleMedium {
|
||||
api::ble_v2::ServerGattConnectionCallback callback);
|
||||
~GattServer() override;
|
||||
|
||||
api::ble_v2::BlePeripheral& GetBlePeripheral() override {
|
||||
return ble_peripheral_;
|
||||
}
|
||||
std::optional<api::ble_v2::GattCharacteristic> CreateCharacteristic(
|
||||
const Uuid& service_uuid, const Uuid& characteristic_uuid,
|
||||
api::ble_v2::GattCharacteristic::Permission permission,
|
||||
|
||||
@@ -115,7 +115,6 @@ std::string ConvertGattStatusToString(
|
||||
BleGattServer::BleGattServer(api::BluetoothAdapter* adapter,
|
||||
api::ble_v2::ServerGattConnectionCallback callback)
|
||||
: adapter_(dynamic_cast<BluetoothAdapter*>(adapter)),
|
||||
peripheral_(adapter_->mac_address().address(), adapter_->mac_address()),
|
||||
gatt_connection_callback_(std::move(callback)) {
|
||||
DCHECK(adapter_ != nullptr);
|
||||
}
|
||||
|
||||
@@ -70,10 +70,6 @@ class BleGattServer : public api::ble_v2::GattServer {
|
||||
void SetCloseNotifier(absl::AnyInvocable<void()> notifier)
|
||||
ABSL_LOCKS_EXCLUDED(mutex_);
|
||||
|
||||
api::ble_v2::BlePeripheral& GetBlePeripheral() override {
|
||||
return peripheral_;
|
||||
}
|
||||
|
||||
private:
|
||||
// Used to save native data related to the GATT characteristic.
|
||||
struct GattCharacteristicData {
|
||||
@@ -131,7 +127,6 @@ class BleGattServer : public api::ble_v2::GattServer {
|
||||
absl::Mutex mutex_;
|
||||
|
||||
BluetoothAdapter* const adapter_ = nullptr;
|
||||
api::ble_v2::BlePeripheral peripheral_;
|
||||
api::ble_v2::ServerGattConnectionCallback gatt_connection_callback_{};
|
||||
|
||||
::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile::
|
||||
|
||||
Reference in New Issue
Block a user