Implemented BluetoothClassicMedium::ConnectToService

PiperOrigin-RevId: 389007196
This commit is contained in:
hai007
2021-08-05 13:15:57 -07:00
committed by Copybara-Service
parent cb169f5897
commit 7a02eaad37
12 changed files with 410 additions and 43 deletions
@@ -21,6 +21,7 @@
#include "platform/base/exception.h"
#include "platform/base/input_stream.h"
#include "platform/base/output_stream.h"
#include "platform/impl/windows/generated/winrt/Windows.Devices.Bluetooth.h"
#include "platform/impl/windows/generated/winrt/Windows.Devices.Enumeration.h"
#include "platform/impl/windows/generated/winrt/base.h"
@@ -29,6 +30,24 @@ namespace location {
namespace nearby {
namespace windows {
// Represents an asynchronous operation, which returns a result upon completion.
// https://docs.microsoft.com/en-us/uwp/api/windows.foundation.iasyncoperation-1?view=winrt-20348
using winrt::Windows::Foundation::IAsyncOperation;
// The result of an Rfcomm device service request.
// https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.rfcomm.rfcommdeviceservicesresult?view=winrt-20348
using winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommDeviceServicesResult;
// Represents an RFCOMM service ID.
// https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.rfcomm.rfcommserviceid?view=winrt-20348
using winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceId;
// Indicates whether applicable Bluetooth API methods should operate on values
// cached in the system, or whether they should retrieve those values from the
// Bluetooth device.
// https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.bluetoothcachemode?view=winrt-20348
using winrt::Windows::Devices::Bluetooth::BluetoothCacheMode;
// https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html.
class BluetoothDevice : public api::BluetoothDevice {
public:
@@ -49,6 +68,12 @@ class BluetoothDevice : public api::BluetoothDevice {
std::string GetId() { return id_; }
winrt::Windows::Foundation::IAsyncOperation<
winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommDeviceServicesResult>
GetRfcommServicesForIdAsync(
const winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceId
serviceId);
private:
// https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.bluetoothdevice?view=winrt-20348
winrt::Windows::Devices::Bluetooth::BluetoothDevice windows_bluetooth_device_;