WiimoteReal: Remove unused IsReady and IsScannerReady functions

The only call of `IsScannerReady` was removed by
81be0001a9, and most of the `IsReady`
functions were only called by `IsScannerReady`.

The one exception was in `WiimoteScannerLinux`, which is now a private
function instead of inheriting from the one in `WiimoteScannerBackend`.
This commit is contained in:
Dentomologist
2021-07-24 08:09:10 -07:00
parent c299144f1e
commit 7d207f7248
9 changed files with 1 additions and 38 deletions

View File

@@ -48,7 +48,6 @@ class WiimoteScannerAndroid final : public WiimoteScannerBackend
public:
WiimoteScannerAndroid() = default;
~WiimoteScannerAndroid() override = default;
bool IsReady() const override { return true; }
FindResults FindAttachedWiimotes() override;

View File

@@ -12,7 +12,6 @@ class WiimoteScannerDummy final : public WiimoteScannerBackend
public:
WiimoteScannerDummy() = default;
~WiimoteScannerDummy() override = default;
bool IsReady() const override { return false; }
void Update() override {}
void RequestStopSearching() override {}
};

View File

@@ -41,8 +41,6 @@ public:
WiimoteScannerLinux();
~WiimoteScannerLinux() override;
bool IsReady() const override;
// FYI: This backend only supports connecting remotes just found via Bluetooth inquiry.
FindResults FindNewWiimotes() override;
@@ -52,6 +50,7 @@ public:
private:
bool Open();
void Close();
bool IsReady() const;
int m_device_id{-1};
int m_device_sock{-1};

View File

@@ -754,14 +754,4 @@ auto WiimoteScannerWindows::FindAttachedWiimotes() -> FindResults
return FindWiimoteHIDDevices();
}
bool WiimoteScannerWindows::IsReady() const
{
bool found_radio = false;
EnumerateRadios([&](auto) {
found_radio = true;
return EnumerationControl::Stop;
});
return found_radio;
}
} // namespace WiimoteReal

View File

@@ -62,7 +62,6 @@ public:
};
WiimoteScannerWindows();
bool IsReady() const override;
FindResults FindNewWiimotes() override;
FindResults FindAttachedWiimotes() override;

View File

@@ -103,11 +103,6 @@ WiimoteScannerHidapi::~WiimoteScannerHidapi()
ERROR_LOG_FMT(WIIMOTE, "Failed to clean up hidapi.");
}
bool WiimoteScannerHidapi::IsReady() const
{
return true;
}
auto WiimoteScannerHidapi::FindAttachedWiimotes() -> FindResults
{
FindResults results;

View File

@@ -35,7 +35,6 @@ class WiimoteScannerHidapi final : public WiimoteScannerBackend
public:
WiimoteScannerHidapi();
~WiimoteScannerHidapi() override;
bool IsReady() const override;
FindResults FindAttachedWiimotes() override;

View File

@@ -127,11 +127,6 @@ void ProcessWiimotePool()
}
}
bool IsScannerReady()
{
return s_wiimote_scanner.IsReady();
}
void AddWiimoteToPool(std::unique_ptr<Wiimote> wiimote)
{
// Our real wiimote class requires an index.
@@ -592,12 +587,6 @@ void WiimoteScanner::SetScanMode(WiimoteScanMode scan_mode)
m_scan_mode_changed_or_population_event.Set();
}
bool WiimoteScanner::IsReady() const
{
std::lock_guard lg(m_backends_mutex);
return std::ranges::any_of(m_backends, &WiimoteScannerBackend::IsReady);
}
static void CheckForDisconnectedWiimotes()
{
std::lock_guard lk(g_wiimotes_mutex);

View File

@@ -181,9 +181,6 @@ class WiimoteScannerBackend
public:
virtual ~WiimoteScannerBackend() = default;
// Note: Invoked from UI thread.
virtual bool IsReady() const = 0;
// function called when not looking for more Wiimotes
virtual void Update() = 0;
// requests the backend to stop scanning if FindWiimotes is blocking
@@ -220,8 +217,6 @@ public:
void SetScanMode(WiimoteScanMode scan_mode);
void PopulateDevices();
bool IsReady() const;
private:
void ThreadFunc();
void PoolThreadFunc();
@@ -259,5 +254,4 @@ void InitAdapterClass();
void HandleWiimotesInControllerInterfaceSettingChange();
void PopulateDevices();
void ProcessWiimotePool();
bool IsScannerReady();
} // namespace WiimoteReal