BluetoothClassicMedium::GetRemoteDevice and BluetoothClassicSocket::Close implmentations

PiperOrigin-RevId: 390691122
This commit is contained in:
jfcarroll
2021-08-13 14:16:01 -07:00
committed by Copybara-Service
parent 628255ac59
commit 913a639a5d
4 changed files with 15 additions and 12 deletions
@@ -45,8 +45,16 @@ OutputStream& BluetoothSocket::GetOutputStream() {
// Closes both input and output streams, marks Socket as closed.
// After this call object should be treated as not connected.
// Returns Exception::kIo on error, Exception::kSuccess otherwise.
// TODO(b/184975123): replace with real implementation.
Exception BluetoothSocket::Close() { return Exception(); }
Exception BluetoothSocket::Close() {
// The Close method aborts any pending operations and releases all unmanaged
// resources associated with the StreamSocket object, including the Input and
// Output streams
windows_socket_.Close();
windows_socket_ = nullptr;
input_stream_ = nullptr;
output_stream_ = nullptr;
return {Exception::kSuccess};
}
// https://developer.android.com/reference/android/bluetooth/BluetoothSocket.html#getRemoteDevice()
// Returns valid BluetoothDevice pointer if there is a connection, and