Commit 2a3e6c9d authored by Jan Wilken Doerrie's avatar Jan Wilken Doerrie Committed by Commit Bot

[Bluetooth][WinRT] Add RemoteGattDescriptor Skeletons

Similarly to r568056 and 573161 this change adds skeletons required for
the implementation and testing of GATT Descriptor discovery on WinRT. No
functionality is added, this will follow in a future CL.

Bug: 821766
Change-Id: Ib6cb238c97899c94f54fcf5146a5e36ede69b909
Reviewed-on: https://chromium-review.googlesource.com/1155119Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579348}
parent e700f073
......@@ -303,6 +303,10 @@ test("device_unittests") {
"bluetooth/test/fake_gatt_characteristic_winrt.h",
"bluetooth/test/fake_gatt_characteristics_result_winrt.cc",
"bluetooth/test/fake_gatt_characteristics_result_winrt.h",
"bluetooth/test/fake_gatt_descriptor_winrt.cc",
"bluetooth/test/fake_gatt_descriptor_winrt.h",
"bluetooth/test/fake_gatt_descriptors_result_winrt.cc",
"bluetooth/test/fake_gatt_descriptors_result_winrt.h",
"bluetooth/test/fake_gatt_device_service_winrt.cc",
"bluetooth/test/fake_gatt_device_service_winrt.h",
"bluetooth/test/fake_gatt_device_services_result_winrt.cc",
......
......@@ -248,6 +248,8 @@ component("bluetooth") {
"bluetooth_gatt_discoverer_winrt.h",
"bluetooth_remote_gatt_characteristic_winrt.cc",
"bluetooth_remote_gatt_characteristic_winrt.h",
"bluetooth_remote_gatt_descriptor_winrt.cc",
"bluetooth_remote_gatt_descriptor_winrt.h",
"bluetooth_remote_gatt_service_winrt.cc",
"bluetooth_remote_gatt_service_winrt.h",
"event_utils_winrt.h",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.h"
#include "base/logging.h"
#include "device/bluetooth/bluetooth_uuid.h"
namespace device {
BluetoothRemoteGattDescriptorWinrt::BluetoothRemoteGattDescriptorWinrt() =
default;
BluetoothRemoteGattDescriptorWinrt::~BluetoothRemoteGattDescriptorWinrt() =
default;
std::string BluetoothRemoteGattDescriptorWinrt::GetIdentifier() const {
NOTIMPLEMENTED();
return std::string();
}
BluetoothUUID BluetoothRemoteGattDescriptorWinrt::GetUUID() const {
NOTIMPLEMENTED();
return BluetoothUUID();
}
BluetoothGattCharacteristic::Permissions
BluetoothRemoteGattDescriptorWinrt::GetPermissions() const {
NOTIMPLEMENTED();
return BluetoothGattCharacteristic::Permissions();
}
const std::vector<uint8_t>& BluetoothRemoteGattDescriptorWinrt::GetValue()
const {
return value_;
}
BluetoothRemoteGattCharacteristic*
BluetoothRemoteGattDescriptorWinrt::GetCharacteristic() const {
NOTIMPLEMENTED();
return nullptr;
}
void BluetoothRemoteGattDescriptorWinrt::ReadRemoteDescriptor(
const ValueCallback& callback,
const ErrorCallback& error_callback) {
NOTIMPLEMENTED();
}
void BluetoothRemoteGattDescriptorWinrt::WriteRemoteDescriptor(
const std::vector<uint8_t>& value,
const base::Closure& callback,
const ErrorCallback& error_callback) {
NOTIMPLEMENTED();
}
} // namespace device
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_WINRT_H_
#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_WINRT_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "base/callback_forward.h"
#include "base/macros.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
#include "device/bluetooth/bluetooth_remote_gatt_descriptor.h"
namespace device {
class BluetoothUUID;
class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattDescriptorWinrt
: public BluetoothRemoteGattDescriptor {
public:
BluetoothRemoteGattDescriptorWinrt();
~BluetoothRemoteGattDescriptorWinrt() override;
// BluetoothGattDescriptor:
std::string GetIdentifier() const override;
BluetoothUUID GetUUID() const override;
BluetoothGattCharacteristic::Permissions GetPermissions() const override;
// BluetoothRemoteGattDescriptor:
const std::vector<uint8_t>& GetValue() const override;
BluetoothRemoteGattCharacteristic* GetCharacteristic() const override;
void ReadRemoteDescriptor(const ValueCallback& callback,
const ErrorCallback& error_callback) override;
void WriteRemoteDescriptor(const std::vector<uint8_t>& value,
const base::Closure& callback,
const ErrorCallback& error_callback) override;
private:
std::vector<uint8_t> value_;
DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorWinrt);
};
} // namespace device
#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_WINRT_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "device/bluetooth/test/fake_gatt_descriptor_winrt.h"
namespace device {
namespace {
using ABI::Windows::Devices::Bluetooth::BluetoothCacheMode;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattCommunicationStatus;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattProtectionLevel;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattWriteResult;
using ABI::Windows::Foundation::IAsyncOperation;
using ABI::Windows::Storage::Streams::IBuffer;
} // namespace
FakeGattDescriptorWinrt::FakeGattDescriptorWinrt() = default;
FakeGattDescriptorWinrt::~FakeGattDescriptorWinrt() = default;
HRESULT FakeGattDescriptorWinrt::get_ProtectionLevel(
GattProtectionLevel* value) {
return E_NOTIMPL;
}
HRESULT FakeGattDescriptorWinrt::put_ProtectionLevel(
GattProtectionLevel value) {
return E_NOTIMPL;
}
HRESULT FakeGattDescriptorWinrt::get_Uuid(GUID* value) {
return E_NOTIMPL;
}
HRESULT FakeGattDescriptorWinrt::get_AttributeHandle(uint16_t* value) {
return E_NOTIMPL;
}
HRESULT FakeGattDescriptorWinrt::ReadValueAsync(
IAsyncOperation<GattReadResult*>** value) {
return E_NOTIMPL;
}
HRESULT FakeGattDescriptorWinrt::ReadValueWithCacheModeAsync(
BluetoothCacheMode cache_mode,
IAsyncOperation<GattReadResult*>** value) {
return E_NOTIMPL;
}
HRESULT FakeGattDescriptorWinrt::WriteValueAsync(
IBuffer* value,
IAsyncOperation<GattCommunicationStatus>** async_op) {
return E_NOTIMPL;
}
HRESULT FakeGattDescriptorWinrt::WriteValueWithResultAsync(
IBuffer* value,
IAsyncOperation<GattWriteResult*>** operation) {
return E_NOTIMPL;
}
} // namespace device
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DEVICE_BLUETOOTH_TEST_FAKE_GATT_DESCRIPTOR_WINRT_H_
#define DEVICE_BLUETOOTH_TEST_FAKE_GATT_DESCRIPTOR_WINRT_H_
#include <windows.devices.bluetooth.genericattributeprofile.h>
#include <wrl/implements.h>
#include <stdint.h>
#include "base/macros.h"
namespace device {
class FakeGattDescriptorWinrt
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<
Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>,
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
IGattDescriptor,
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
IGattDescriptor2> {
public:
FakeGattDescriptorWinrt();
~FakeGattDescriptorWinrt() override;
// IGattDescriptor:
IFACEMETHODIMP get_ProtectionLevel(
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattProtectionLevel* value) override;
IFACEMETHODIMP put_ProtectionLevel(
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattProtectionLevel value) override;
IFACEMETHODIMP get_Uuid(GUID* value) override;
IFACEMETHODIMP get_AttributeHandle(uint16_t* value) override;
IFACEMETHODIMP ReadValueAsync(
ABI::Windows::Foundation::IAsyncOperation<
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattReadResult*>** value) override;
IFACEMETHODIMP ReadValueWithCacheModeAsync(
ABI::Windows::Devices::Bluetooth::BluetoothCacheMode cache_mode,
ABI::Windows::Foundation::IAsyncOperation<
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattReadResult*>** value) override;
IFACEMETHODIMP WriteValueAsync(
ABI::Windows::Storage::Streams::IBuffer* value,
ABI::Windows::Foundation::IAsyncOperation<
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattCommunicationStatus>** action) override;
// IGattDescriptor2:
IFACEMETHODIMP WriteValueWithResultAsync(
ABI::Windows::Storage::Streams::IBuffer* value,
ABI::Windows::Foundation::IAsyncOperation<
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattWriteResult*>** operation) override;
private:
DISALLOW_COPY_AND_ASSIGN(FakeGattDescriptorWinrt);
};
} // namespace device
#endif // DEVICE_BLUETOOTH_TEST_FAKE_GATT_DESCRIPTOR_WINRT_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "device/bluetooth/test/fake_gatt_descriptors_result_winrt.h"
namespace device {
namespace {
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattCommunicationStatus;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor;
using ABI::Windows::Foundation::Collections::IVectorView;
using ABI::Windows::Foundation::IReference;
} // namespace
FakeGattDescriptorsResultWinrt::FakeGattDescriptorsResultWinrt() = default;
FakeGattDescriptorsResultWinrt::~FakeGattDescriptorsResultWinrt() = default;
HRESULT FakeGattDescriptorsResultWinrt::get_Status(
GattCommunicationStatus* value) {
return E_NOTIMPL;
}
HRESULT FakeGattDescriptorsResultWinrt::get_ProtocolError(
IReference<uint8_t>** value) {
return E_NOTIMPL;
}
HRESULT FakeGattDescriptorsResultWinrt::get_Descriptors(
IVectorView<GattDescriptor*>** value) {
return E_NOTIMPL;
}
} // namespace device
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DEVICE_BLUETOOTH_TEST_FAKE_GATT_DESCRIPTORS_RESULT_WINRT_H_
#define DEVICE_BLUETOOTH_TEST_FAKE_GATT_DESCRIPTORS_RESULT_WINRT_H_
#include <windows.devices.bluetooth.genericattributeprofile.h>
#include <windows.foundation.collections.h>
#include <windows.foundation.h>
#include <wrl/implements.h>
#include <stdint.h>
#include "base/macros.h"
namespace device {
class FakeGattDescriptorsResultWinrt
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<
Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>,
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
IGattDescriptorsResult> {
public:
FakeGattDescriptorsResultWinrt();
~FakeGattDescriptorsResultWinrt() override;
// IGattDescriptorsResult:
IFACEMETHODIMP get_Status(
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattCommunicationStatus* value) override;
IFACEMETHODIMP get_ProtocolError(
ABI::Windows::Foundation::IReference<uint8_t>** value) override;
IFACEMETHODIMP get_Descriptors(
ABI::Windows::Foundation::Collections::IVectorView<
ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattDescriptor*>** value) override;
private:
DISALLOW_COPY_AND_ASSIGN(FakeGattDescriptorsResultWinrt);
};
} // namespace device
#endif // DEVICE_BLUETOOTH_TEST_FAKE_GATT_DESCRIPTORS_RESULT_WINRT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment