mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 07:36:10 -04:00
Implemented BluetoothClassicMedium::ConnectToService
PiperOrigin-RevId: 389007196
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "platform/impl/windows/bluetooth_classic_socket.h"
|
||||
|
||||
#include "platform/impl/windows/generated/winrt/Windows.Networking.Sockets.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
@@ -25,6 +27,8 @@ BluetoothSocket::~BluetoothSocket() {}
|
||||
// returned by BluetoothClassicMedium::ConnectToService() for client side or
|
||||
// BluetoothServerSocket::Accept() for server side of connection.
|
||||
|
||||
BluetoothSocket::BluetoothSocket() { windows_socket_ = StreamSocket(); }
|
||||
|
||||
// Returns the InputStream of this connected BluetoothSocket.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
InputStream& BluetoothSocket::GetInputStream() {
|
||||
@@ -49,6 +53,16 @@ Exception BluetoothSocket::Close() { return Exception(); }
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
api::BluetoothDevice* BluetoothSocket::GetRemoteDevice() { return nullptr; }
|
||||
|
||||
// Starts an asynchronous operation on a StreamSocket object to connect to a
|
||||
// remote network destination specified by a remote hostname and a remote
|
||||
// service name.
|
||||
winrt::Windows::Foundation::IAsyncAction BluetoothSocket::ConnectAsync(
|
||||
HostName connectionHostName, winrt::hstring connectionServiceName) {
|
||||
// https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.streamsocket.connectasync?view=winrt-20348
|
||||
return windows_socket_.ConnectAsync(connectionHostName,
|
||||
connectionServiceName);
|
||||
}
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
Reference in New Issue
Block a user