Minor refactoring.

This commit is contained in:
Vibhav Pant
2023-08-30 01:53:54 +05:30
parent 86cffae21f
commit cb83656eab
26 changed files with 392 additions and 305 deletions
@@ -22,28 +22,27 @@
namespace nearby {
namespace linux {
class BluetoothServerSocket : public api::BluetoothServerSocket {
class BluetoothServerSocket final : public api::BluetoothServerSocket {
public:
BluetoothServerSocket(ProfileManager &profile_manager,
absl::string_view service_uuid)
: profile_manager_(profile_manager), service_uuid_(service_uuid) {}
~BluetoothServerSocket() = default;
BluetoothServerSocket(ProfileManager &profile_manager,
absl::string_view service_uuid)
: profile_manager_(profile_manager), service_uuid_(service_uuid) {}
// https://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html#accept()
//
// Blocks until either:
// - at least one incoming connection request is available, or
// - ServerSocket is closed.
// On success, returns connected socket, ready to exchange data.
// Returns nullptr on error.
// Once error is reported, it is permanent, and ServerSocket has to be
// closed.
std::unique_ptr<api::BluetoothSocket> Accept() override;
// https://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html#accept()
//
// Blocks until either:
// - at least one incoming connection request is available, or
// - ServerSocket is closed.
// On success, returns connected socket, ready to exchange data.
// Returns nullptr on error.
// Once error is reported, it is permanent, and ServerSocket has to be
// closed.
std::unique_ptr<api::BluetoothSocket> Accept() override;
// https://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html#close()
//
// Returns Exception::kIo on error, Exception::kSuccess otherwise.
Exception Close() override;
// https://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html#close()
//
// Returns Exception::kIo on error, Exception::kSuccess otherwise.
Exception Close() override;
private:
ProfileManager &profile_manager_;