-- v2: windows.devices.bluetooth: Add stubs for BluetoothLEDeviceStatics. windows.devices.bluetooth/tests: Add tests for BluetoothLEDeviceStatics. include: Add definitions for IBluetoothLEDevice.
From: Vibhav Pant vibhavp@gmail.com
--- include/windows.devices.bluetooth.idl | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
diff --git a/include/windows.devices.bluetooth.idl b/include/windows.devices.bluetooth.idl index cba007010ae..31896dfc7a9 100644 --- a/include/windows.devices.bluetooth.idl +++ b/include/windows.devices.bluetooth.idl @@ -40,6 +40,7 @@ namespace Windows.Devices.Bluetooth { typedef enum BluetoothMajorClass BluetoothMajorClass; typedef enum BluetoothMinorClass BluetoothMinorClass; typedef enum BluetoothServiceCapabilities BluetoothServiceCapabilities; + typedef enum BluetoothError BluetoothError;
interface IBluetoothAdapter; interface IBluetoothAdapter2; @@ -54,10 +55,13 @@ namespace Windows.Devices.Bluetooth { interface IBluetoothDevice5; interface IBluetoothDeviceStatics; interface IBluetoothDeviceStatics2; + interface IBluetoothDeviceId; + interface IBluetoothDeviceIdStatics;
runtimeclass BluetoothAdapter; runtimeclass BluetoothClassOfDevice; runtimeclass BluetoothDevice; + runtimeclass BluetoothDeviceId;
namespace Rfcomm { runtimeclass RfcommDeviceService; @@ -204,6 +208,26 @@ namespace Windows.Devices.Bluetooth { InformationService = 0x400, };
+ [ + contract(Windows.Foundation.UniversalApiContract, 1.0) + ] + enum BluetoothError + { + Success = 0, + RadioNotAvailable = 1, + ResourceInUse = 2, + DeviceNotConnected = 3, + OtherError = 4, + DisabledByPolicy = 5, + NotSupported = 6, + [contract(Windows.Foundation.UniversalApiContract, 2.0)] + DisabledByUser = 7, + [contract(Windows.Foundation.UniversalApiContract, 3.0)] + ConsentRequired = 8, + [contract(Windows.Foundation.UniversalApiContract, 4.0)] + TransportNotSupported = 9, + }; + [ contract(Windows.Foundation.UniversalApiContract, 4.0), exclusiveto(Windows.Devices.Bluetooth.BluetoothAdapter), @@ -341,4 +365,38 @@ namespace Windows.Devices.Bluetooth { [contract(Windows.Foundation.UniversalApiContract, 6.0)] interface Windows.Devices.Bluetooth.IBluetoothDevice5; interface Windows.Foundation.IClosable; } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.BluetoothDeviceId), + uuid(c17949af-57c1-4642-bcce-e6c06b20ae76) + ] + interface IBluetoothDeviceId : IInspectable + { + [propget] HRESULT Id([out, retval] HSTRING *value); + [propget] HRESULT IsClassicDevice([out, retval] boolean *value); + [propget] HRESULT IsLowEnergyDevice([out, retval] boolean *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 5.0), + exclusiveto(Windows.Devices.Bluetooth.BluetoothDeviceId), + uuid(a7884e67-3efb-4f31-bbc2-810e09977404) + ] + interface IBluetoothDeviceIdStatics : IInspectable + { + HRESULT FromId([in] HSTRING id, [out, retval] Windows.Devices.Bluetooth.BluetoothDeviceId **result); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile), + static(Windows.Devices.Bluetooth.IBluetoothDeviceIdStatics, Windows.Foundation.UniversalApiContract, 5.0), + threading(both) + ] + runtimeclass BluetoothDeviceId + { + [default] interface Windows.Devices.Bluetooth.IBluetoothDeviceId; + } + }
From: Vibhav Pant vibhavp@gmail.com
--- include/Makefile.in | 1 + ...ices.bluetooth.genericattributeprofile.idl | 749 ++++++++++++++++++ 2 files changed, 750 insertions(+) create mode 100644 include/windows.devices.bluetooth.genericattributeprofile.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 25c87c5e183..1df6b2f0ecd 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -859,6 +859,7 @@ SOURCES = \ windows.data.json.idl \ windows.data.xml.dom.idl \ windows.devices.bluetooth.idl \ + windows.devices.bluetooth.genericattributeprofile.idl \ windows.devices.bluetooth.rfcomm.idl \ windows.devices.enumeration.idl \ windows.devices.geolocation.idl \ diff --git a/include/windows.devices.bluetooth.genericattributeprofile.idl b/include/windows.devices.bluetooth.genericattributeprofile.idl new file mode 100644 index 00000000000..0eab9a951ae --- /dev/null +++ b/include/windows.devices.bluetooth.genericattributeprofile.idl @@ -0,0 +1,749 @@ +/* + * Copyright 2025 Vibhav Pant + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +#ifndef DO_NO_IMPORTS +import "inspectable.idl"; +import "asyncinfo.idl"; +import "eventtoken.idl"; +import "windowscontracts.idl"; +import "windows.foundation.idl"; +import "windows.storage.streams.idl"; +import "windows.devices.bluetooth.idl"; +import "windows.devices.enumeration.idl"; +#endif + +namespace Windows.Devices.Bluetooth { + typedef enum BluetoothCacheMode BluetoothCacheMode; + typedef enum BluetoothError BluetoothError; + + runtimeclass BluetoothDeviceId; +} + +namespace Windows.Devices.Bluetooth.GenericAttributeProfile { + typedef enum GattCommunicationStatus GattCommunicationStatus; + typedef enum GattCharacteristicProperties GattCharacteristicProperties; + typedef enum GattProtectionLevel GattProtectionLevel; + typedef enum GattWriteOption GattWriteOption; + typedef enum GattClientCharacteristicConfigurationDescriptorValue GattClientCharacteristicConfigurationDescriptorValue; + typedef enum GattSharingMode GattSharingMode; + typedef enum GattOpenStatus GattOpenStatus; + typedef enum GattSessionStatus GattSessionStatus; + + interface IGattDeviceService; + interface IGattDeviceService2; + interface IGattDeviceService3; + interface IGattDeviceServiceStatics; + interface IGattDeviceServiceStatics2; + interface IGattDeviceServicesResult; + interface IGattSession; + interface IGattSessionStatusChangedEventArgs; + interface IGattSessionStatics; + interface IGattCharacteristic; + interface IGattCharacteristic2; + interface IGattCharacteristic3; + interface IGattCharacteristicStatics; + interface IGattDescriptorsResult; + interface IGattDescriptor; + interface IGattDescriptor2; + interface IGattDescriptorStatics; + interface IGattValueChangedEventArgs; + interface IGattReadResult; + interface IGattReadResult2; + interface IGattWriteResult; + interface IGattReadClientCharacteristicConfigurationDescriptorResult; + interface IGattReadClientCharacteristicConfigurationDescriptorResult2; + interface IGattPresentationFormat; + interface IGattPresentationFormatStatics; + interface IGattPresentationFormatStatics2; + + runtimeclass GattDeviceService; + runtimeclass GattDeviceServicesResult; + runtimeclass GattSession; + runtimeclass GattSessionStatusChangedEventArgs; + runtimeclass GattCharacteristic; + runtimeclass GattDescriptorsResult; + runtimeclass GattDescriptor; + runtimeclass GattPresentationFormat; + runtimeclass GattValueChangedEventArgs; + runtimeclass GattWriteResult; + runtimeclass GattReadResult; + runtimeclass GattReadClientCharacteristicConfigurationDescriptorResult; + runtimeclass GattReadClientCharacteristicConfigurationDescriptorResult; + runtimeclass GattPresentationFormat; + runtimeclass GattCharacteristicsResult; + + declare { + interface Windows.Foundation.Collections.IIterator<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic *>; + interface Windows.Foundation.Collections.IIterable<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic *>; + interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic *>; + interface Windows.Foundation.Collections.IIterator<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptor *>; + interface Windows.Foundation.Collections.IIterable<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptor *>; + interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptor *>; + interface Windows.Foundation.Collections.IIterator<Windows.Devices.Bluetooth.GenericAttributeProfile.GattPresentationFormat *>; + interface Windows.Foundation.Collections.IIterable<Windows.Devices.Bluetooth.GenericAttributeProfile.GattPresentationFormat *>; + interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattPresentationFormat *>; + interface Windows.Foundation.Collections.IIterator<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *>; + interface Windows.Foundation.Collections.IIterable<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *>; + interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadResult *>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadResult *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteResult*>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteResult*>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadClientCharacteristicConfigurationDescriptorResult *>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadClientCharacteristicConfigurationDescriptorResult *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Enumeration.DeviceAccessStatus>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Enumeration.DeviceAccessStatus>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattOpenStatus>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattOpenStatus>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristicsResult *>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristicsResult *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceServicesResult *>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceServicesResult *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattSession *>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattSession *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptorsResult *>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptorsResult *>; + interface Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic *, Windows.Devices.Bluetooth.GenericAttributeProfile.GattValueChangedEventArgs *>; + interface Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattSession *, Windows.Devices.Bluetooth.GenericAttributeProfile.GattSessionStatusChangedEventArgs *>; + interface Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattSession *, IInspectable *>; + interface Windows.Foundation.IReference<BYTE>; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0) + ] + enum GattCommunicationStatus + { + Success = 0, + Unreachable = 1, + [contract(Windows.Foundation.UniversalApiContract, 4.0)] + ProtocolError = 2, + [contract(Windows.Foundation.UniversalApiContract, 4.0)] + AccessDenied = 3, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + flags + ] + enum GattCharacteristicProperties + { + None = 0x0000, + Broadcast = 0x0001, + Read = 0x0002, + WriteWithoutResponse = 0x0004, + Write = 0x0008, + Notify = 0x0010, + Indicate = 0x0020, + AuthenticatedSignedWrites = 0x0040, + ExtendedProperties = 0x0080, + ReliableWrites = 0x0100, + WritableAuxiliaries = 0x0200, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0) + ] + enum GattProtectionLevel + { + Plain = 0, + AuthenticationRequired = 1, + EncryptionRequired = 2, + EncryptionAndAuthenticationRequired = 3, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0) + ] + enum GattWriteOption + { + WriteWithResponse = 0, + WriteWithoutResponse = 1, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0) + ] + enum GattClientCharacteristicConfigurationDescriptorValue + { + None = 0, + Notify = 1, + Indicate = 2, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0) + ] + enum GattSharingMode + { + Unspecified = 0, + Exclusive = 1, + SharedReadOnly = 2, + SharedReadAndWrite = 3, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0) + ] + enum GattOpenStatus + { + Unspecified = 0, + Success = 1, + AlreadyOpened = 2, + NotFound = 3, + SharingViolation = 4, + AccessDenied = 5, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0) + ] + enum GattSessionStatus + { + Closed = 0, + Active = 1, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService), + uuid(ac7b7c05-b33c-47cf-990f-6b8f5577df71) + ] + interface IGattDeviceService : IInspectable requires Windows.Foundation.IClosable + { + HRESULT GetCharacteristics([in] GUID uuid, + [out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic *> **value); + HRESULT GetIncludedServices([in] GUID uuid, + [out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *> **value); + [propget] HRESULT DeviceId([out, retval] HSTRING *value); + [propget] HRESULT Uuid([out, retval] GUID *value); + [propget] HRESULT AttributeHandle([out, retval] UINT16 *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService), + uuid(b293a950-0c53-437c-a9b3-5c3210c6e569), + ] + interface IGattDeviceService3 : IInspectable + { + [propget] HRESULT DeviceAccessInformation([out, retval] Windows.Devices.Enumeration.DeviceAccessInformation **value); + [propget] HRESULT Session([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattSession **value); + [propget] HRESULT SharingMode([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattSharingMode *value); + HRESULT RequestAccessAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Enumeration.DeviceAccessStatus> **async); + HRESULT OpenAsync([in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattSharingMode mode, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattOpenStatus> **async); + [overload("GetCharacteristicsAsync")] + HRESULT GetCharacteristicsAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristicsResult *> **async); + [overload("GetCharacteristicsAsync")] + HRESULT GetCharacteristicsWithCacheModeAsync([in] Windows.Devices.Bluetooth.BluetoothCacheMode mode, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristicsResult *> **async); + [overload("GetCharacteristicsForUuidAsync")] + HRESULT GetCharacteristicsForUuidAsync([in] GUID uuid, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristicsResult *> **async); + [overload("GetCharacteristicsForUuidAsync")] + HRESULT GetCharacteristicsForUuidWithCacheModeAsync([in] GUID uuid, + [in] Windows.Devices.Bluetooth.BluetoothCacheMode mode, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristicsResult *> **async); + [overload("GetIncludedServicesAsync")] + HRESULT GetIncludedServicesAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceServicesResult *> **async); + [overload("GetIncludedServicesAsync")] + HRESULT GetIncludedServicesWithCacheModeAsync([in] Windows.Devices.Bluetooth.BluetoothCacheMode mode, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceServicesResult *> **async); + [overload("GetIncludedServicesForUuidAsync")] + HRESULT GetIncludedServicesForUuidAsync([in] GUID uuid, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceServicesResult *> **async); + [overload("GetIncludedServicesForUuidAsync")] + HRESULT GetIncludedServicesForUuidWithCacheModeAsync([in] GUID uuid, + [in] Windows.Devices.Bluetooth.BluetoothCacheMode mode, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceServicesResult *> **async); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService), + uuid(196d0022-faad-45dc-ae5b-2ac3184e84db) + ] + interface IGattDeviceServiceStatics : IInspectable + { + [overload("FromIdAsync")] + HRESULT FromIdAsync([in] HSTRING id, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *> **async); + HRESULT GetDeviceSelectorFromUuid([in] GUID uuid, [out, retval] HSTRING *selector); + HRESULT GetDeviceSelectorFromShortId([in] UINT16 id, [out, retval] HSTRING *selector); + HRESULT ConvertShortIdToUuid([in] UINT16 id, [out, retval] GUID *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService), + uuid(0604186e-24a6-4b0d-a2f2-30cc01545d25) + ] + interface IGattDeviceServiceStatics2 : IInspectable + { + [overload("FromIdAsync")] + HRESULT FromIdWithSharingModeAsync([in] HSTRING id, + [in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattSharingMode mode, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *> **async); + [overload("GetDeviceSelectorForBluetoothDeviceId")] + HRESULT GetDeviceSelectorForBluetoothDeviceId([in] Windows.Devices.Bluetooth.BluetoothDeviceId *id, + [out, retval] HSTRING *selector); + [overload("GetDeviceSelectorForBluetoothDeviceId")] + HRESULT GetDeviceSelectorForBluetoothDeviceIdWithCacheMode([in] Windows.Devices.Bluetooth.BluetoothDeviceId *id, + [in] Windows.Devices.Bluetooth.BluetoothCacheMode mode, + [out, retval] HSTRING *selector); + [overload("GetDeviceSelectorForBluetoothDeviceIdAndUuid")] + HRESULT GetDeviceSelectorForBluetoothDeviceIdAndUuid([in] Windows.Devices.Bluetooth.BluetoothDeviceId *id, + [in] GUID uuid, + [out, retval] HSTRING *selector); + [overload("GetDeviceSelectorForBluetoothDeviceIdAndUuid")] + HRESULT GetDeviceSelectorForBluetoothDeviceIdAndUuidWithCacheMode([in] Windows.Devices.Bluetooth.BluetoothDeviceId *id, + [in] GUID uuid, + [in] Windows.Devices.Bluetooth.BluetoothCacheMode mode, + [out, retval] HSTRING *selector); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + static(Windows.Devices.Bluetooth.GenericAttributeProfile.IGattDeviceServiceStatics, Windows.Foundation.UniversalApiContract, 1.0), + static(Windows.Devices.Bluetooth.GenericAttributeProfile.IGattDeviceServiceStatics2, Windows.Foundation.UniversalApiContract, 4.0), + threading(both) + ] + runtimeclass GattDeviceService + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattDeviceService; + interface Windows.Foundation.IClosable; + [contract(Windows.Foundation.UniversalApiContract, 1.0)] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattDeviceService2; + [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattDeviceService3; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceServicesResult), + uuid(171dd3ee-016d-419d-838a-576cf475a3d8) + ] + interface IGattDeviceServicesResult : IInspectable + { + [propget] HRESULT Status([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus *value); + [propget] HRESULT ProtocolError([out, retval] Windows.Foundation.IReference<BYTE> **value); + [propget] HRESULT Services([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *> **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass GattDeviceServicesResult + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattDeviceServicesResult; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattSession), + uuid(d23b5143-e04e-4c24-999c-9c256f9856b1) + ] + interface IGattSession : IInspectable + { + [propget] HRESULT DeviceId([out, retval] Windows.Devices.Bluetooth.BluetoothDeviceId **value); + [propget] HRESULT CanMaintainConnection([out, retval] boolean *value); + [propput] HRESULT MaintainConnection([in] boolean value); + [propget] HRESULT MaintainConnection([out, retval] boolean *value); + [propget] HRESULT MaxPduSize([out, retval] UINT16 * value); + [propget] HRESULT SessionStatus([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattSessionStatus *value); + [eventadd] HRESULT MaxPduSizeChanged([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattSession *, IInspectable *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT MaxPduSizeChanged([in] EventRegistrationToken token); + [eventadd] HRESULT SessionStatusChanged([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattSession *, Windows.Devices.Bluetooth.GenericAttributeProfile.GattSessionStatusChangedEventArgs *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT SessionStatusChanged([in] EventRegistrationToken token); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattSession), + uuid(2e65b95c-539f-4db7-82a8-73bdbbf73ebf) + ] + interface IGattSessionStatics : IInspectable + { + HRESULT FromDeviceIdAsync([in] Windows.Devices.Bluetooth.BluetoothDeviceId *id, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattSession *> **async); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile), + static(Windows.Devices.Bluetooth.GenericAttributeProfile.IGattSessionStatics, Windows.Foundation.UniversalApiContract, 4.0), + threading(both) + ] + runtimeclass GattSession + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattSession; + interface Windows.Foundation.IClosable; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattSessionStatusChangedEventArgs), + uuid(7605b72e-837f-404c-ab34-3163f39ddf32) + ] + interface IGattSessionStatusChangedEventArgs : IInspectable + { + [propget] HRESULT Error([out, retval] Windows.Devices.Bluetooth.BluetoothError *value); + [propget] HRESULT Status([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattSessionStatus *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass GattSessionStatusChangedEventArgs + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattSessionStatusChangedEventArgs; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic), + uuid(59cb50c1-5934-4f68-a198-eb864fa44e6b), + ] + interface IGattCharacteristic : IInspectable + { + HRESULT GetDescriptors([in] GUID descriptorUuid, + [out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptor *> **value); + [propget] HRESULT CharacteristicProperties([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristicProperties *value); + [propget] HRESULT ProtectionLevel([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattProtectionLevel *value); + [propput] HRESULT ProtectionLevel([in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattProtectionLevel value); + [propget] HRESULT UserDescription([out, retval] HSTRING *value); + [propget] HRESULT Uuid([out, retval] GUID *value); + [propget] HRESULT AttributeHandle([out, retval] UINT16 *value); + [propget] HRESULT PresentationFormats([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattPresentationFormat *> **value); + [overload("ReadValueAsync")] + HRESULT ReadValueAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadResult *> **value); + [overload("ReadValueAsync")] + HRESULT ReadValueWithCacheModeAsync([in] Windows.Devices.Bluetooth.BluetoothCacheMode mode, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadResult *> **value); + [overload("WriteValueAsync")] + HRESULT WriteValueAsync([in] Windows.Storage.Streams.IBuffer *value, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus> **async); + [overload("WriteValueAsync")] + HRESULT WriteValueWithOptionAsync([in] Windows.Storage.Streams.IBuffer *value, + [in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteOption opt, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus> **async); + HRESULT ReadClientCharacteristicConfigurationDescriptorAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadClientCharacteristicConfigurationDescriptorResult *> **async); + HRESULT WriteClientCharacteristicConfigurationDescriptorAsync([in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattClientCharacteristicConfigurationDescriptorValue value, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus> **async); + [eventadd] HRESULT ValueChanged([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic *, Windows.Devices.Bluetooth.GenericAttributeProfile.GattValueChangedEventArgs *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT ValueChanged([in] EventRegistrationToken token); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic), + uuid(ae1ab578-ec06-4764-b780-9835a1d35d6e) + ] + interface IGattCharacteristic2 : IInspectable requires Windows.Devices.Bluetooth.GenericAttributeProfile.IGattCharacteristic + { + [propget] HRESULT Service([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService **value); + HRESULT GetAllDescriptors([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptor *> **descriptors); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic), + uuid(3f3c663e-93d4-406b-b817-db81f8ed53b3) + ] + interface IGattCharacteristic3 : IInspectable + { + [overload("GetDescriptorsAsync")] + HRESULT GetDescriptorsAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptorsResult *> **async); + [overload("GetDescriptorsAsync")] + HRESULT GetDescriptorsWithCacheModeAsync([in] Windows.Devices.Bluetooth.BluetoothCacheMode mode, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptorsResult *> **async); + [overload("GetDescriptorsForUuidAsync")] + HRESULT GetDescriptorsForUuidAsync([in] GUID uuid, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptorsResult *> **async); + [overload("GetDescriptorsForUuidAsync")] + HRESULT GetDescriptorsForUuidWithCacheModeAsync([in] GUID uuid, + [in] Windows.Devices.Bluetooth.BluetoothCacheMode mode, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptorsResult *> **async); + [overload("WriteValueWithResultAsync")] + HRESULT WriteValueWithResultAsync([in] Windows.Storage.Streams.IBuffer *value, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteResult *> **async); + [overload("WriteValueWithResultAsync")] + HRESULT WriteValueWithResultAndOptionAsync([in] Windows.Storage.Streams.IBuffer *value, + [in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteOption option, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteResult *> **async); + HRESULT WriteClientCharacteristicConfigurationDescriptorWithResultAsync([in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattClientCharacteristicConfigurationDescriptorValue value, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteResult *> **async); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic), + uuid(59cb50c3-5934-4f68-a198-eb864fa44e6b) + ] + interface IGattCharacteristicStatics : IInspectable + { + HRESULT ConvertShortIdToUuid([in] UINT16 id, [out, retval] GUID *uuid); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + static(Windows.Devices.Bluetooth.GenericAttributeProfile.IGattCharacteristicStatics, Windows.Foundation.UniversalApiContract, 1.0), + threading(both) + ] + runtimeclass GattCharacteristic + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattCharacteristic; + [contract(Windows.Foundation.UniversalApiContract, 1.0)] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattCharacteristic2; + [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattCharacteristic3; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristicsResult), + uuid(1194945C-B257-4F3E-9DB7-F68BC9A9AEF2) + ] + interface IGattCharacteristicsResult : IInspectable + { + [propget] HRESULT Status([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus *value); + [propget] HRESULT ProtocolError([out, retval] Windows.Foundation.IReference<BYTE> **value); + [propget] HRESULT Characteristics([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic *> **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass GattCharacteristicsResult + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattCharacteristicsResult; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptor), + uuid(92055f2b-8084-4344-b4c2-284de19a8506) + ] + interface IGattDescriptor : IInspectable + { + [propget] HRESULT ProtectionLevel([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattProtectionLevel *value); + [propput] HRESULT ProtectionLevel([in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattProtectionLevel value); + [propget] HRESULT Uuid([out, retval] GUID *value); + [propget] HRESULT AttributeHandle([out, retval] UINT16 *value); + [overload("ReadValueAsync")] + HRESULT ReadValueAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadResult *> **async); + [overload("ReadValueAsync")] + HRESULT ReadValueWithCacheModeAsync([in] Windows.Devices.Bluetooth.BluetoothCacheMode cacheMode, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadResult *> **async); + HRESULT WriteValueAsync([in] Windows.Storage.Streams.IBuffer *value, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus> **async); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptor), + uuid(8f563d39-d630-406c-ba11-10cdd16b0e5e) + ] + interface IGattDescriptor2 : IInspectable + { + HRESULT WriteValueWithResultAsync([in] Windows.Storage.Streams.IBuffer *value, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteResult *> **async); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptor), + uuid(92055f2d-8084-4344-b4c2-284de19a8506), + ] + interface IGattDescriptorStatics : IInspectable + { + HRESULT ConvertShortIdToUuid([in] UINT16 id, [out, retval] GUID *uuid); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + static(Windows.Devices.Bluetooth.GenericAttributeProfile.IGattDescriptorStatics, Windows.Foundation.UniversalApiContract, 1.0), + threading(both), + ] + runtimeclass GattDescriptor + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattDescriptor; + [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattDescriptor2; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptorsResult), + uuid(9bc091f3-95e7-4489-8d25-ff81955a57b9) + ] + interface IGattDescriptorsResult : IInspectable + { + [propget] HRESULT Status([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus *value); + [propget] HRESULT ProtocolError([out, retval] Windows.Foundation.IReference<BYTE> **value); + [propget] HRESULT Descriptors([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptor *> **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile), + threading(both), + ] + runtimeclass GattDescriptorsResult + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattDescriptorsResult; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattValueChangedEventArgs), + uuid(d21bdb54-06e3-4ed8-a263-acfac8ba7313) + ] + interface IGattValueChangedEventArgs : IInspectable + { + [propget] HRESULT CharacteristicValue([out, retval] Windows.Storage.Streams.IBuffer **value); + [propget] HRESULT Timestamp([out, retval] Windows.Foundation.DateTime *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass GattValueChangedEventArgs + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattValueChangedEventArgs; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadResult), + uuid(63a66f08-1aea-4c4c-a50f-97bae474b348) + ] + interface IGattReadResult : IInspectable + { + [propget] HRESULT Status([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus *value); + [propget] HRESULT Value([out, retval] Windows.Storage.Streams.IBuffer **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass GattReadResult + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattReadResult; + [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattReadResult2; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteResult), + uuid(4991ddb1-cb2b-44f7-99fc-d29a2871dc9b) + ] + interface IGattWriteResult : IInspectable + { + [propget] HRESULT Status([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus* value); + [propget] HRESULT ProtocolError([out, retval] Windows.Foundation.IReference<BYTE>** value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass GattWriteResult + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattWriteResult; + } + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadClientCharacteristicConfigurationDescriptorResult), + uuid(63a66f09-1aea-4c4c-a50f-97bae474b348) + ] + + interface IGattReadClientCharacteristicConfigurationDescriptorResult : IInspectable + { + [propget] HRESULT Status([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus *value); + [propget] HRESULT ClientCharacteristicConfigurationDescriptor([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattClientCharacteristicConfigurationDescriptorValue *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadClientCharacteristicConfigurationDescriptorResult), + uuid(1bf1a59d-ba4d-4622-8651-f4ee150d0a5d) + ] + interface IGattReadClientCharacteristicConfigurationDescriptorResult2 : IInspectable + { + [propget] HRESULT ProtocolError([out, retval] Windows.Foundation.IReference<BYTE>** value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass GattReadClientCharacteristicConfigurationDescriptorResult + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattReadClientCharacteristicConfigurationDescriptorResult; + [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattReadClientCharacteristicConfigurationDescriptorResult2; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattPresentationFormat), + uuid(196d0021-faad-45dc-ae5b-2ac3184e84db) + ] + interface IGattPresentationFormat : IInspectable + { + [propget] HRESULT FormatType([out, retval] BYTE *value); + [propget] HRESULT Exponent([out, retval] INT32 *value); + [propget] HRESULT Unit([out, retval] UINT16 *value); + [propget] HRESULT Namespace([out, retval] BYTE *value); + [propget] HRESULT Description([out, retval] UINT16 *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + static(Windows.Devices.Bluetooth.GenericAttributeProfile.IGattPresentationFormatStatics, Windows.Foundation.UniversalApiContract, 1.0), + static(Windows.Devices.Bluetooth.GenericAttributeProfile.IGattPresentationFormatStatics2, Windows.Foundation.UniversalApiContract, 4.0), + threading(both) + ] + runtimeclass GattPresentationFormat + { + [default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattPresentationFormat; + } +}
From: Vibhav Pant vibhavp@gmail.com
--- dlls/windows.devices.bluetooth/classes.idl | 1 + include/windows.devices.bluetooth.idl | 76 +++++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/dlls/windows.devices.bluetooth/classes.idl b/dlls/windows.devices.bluetooth/classes.idl index 4ed8641d5f6..ae2b58ffa2d 100644 --- a/dlls/windows.devices.bluetooth/classes.idl +++ b/dlls/windows.devices.bluetooth/classes.idl @@ -36,5 +36,6 @@ import "windows.networking.sockets.idl"; import "windows.storage.streams.idl";
#define DO_NO_IMPORTS +#include "windows.devices.bluetooth.genericattributeprofile.idl" #include "windows.devices.bluetooth.rfcomm.idl" #include "windows.devices.bluetooth.idl" diff --git a/include/windows.devices.bluetooth.idl b/include/windows.devices.bluetooth.idl index 31896dfc7a9..ef14b25ba8c 100644 --- a/include/windows.devices.bluetooth.idl +++ b/include/windows.devices.bluetooth.idl @@ -26,7 +26,7 @@ import "asyncinfo.idl"; import "eventtoken.idl"; import "windowscontracts.idl"; import "windows.foundation.idl"; -/* import "windows.devices.bluetooth.genericattributeprofile.idl"; */ +import "windows.devices.bluetooth.genericattributeprofile.idl"; import "windows.devices.bluetooth.rfcomm.idl"; import "windows.devices.enumeration.idl"; import "windows.devices.radios.idl"; @@ -57,24 +57,41 @@ namespace Windows.Devices.Bluetooth { interface IBluetoothDeviceStatics2; interface IBluetoothDeviceId; interface IBluetoothDeviceIdStatics; + interface IBluetoothLEDevice; + interface IBluetoothLEDevice2; + interface IBluetoothLEDevice3; + interface IBluetoothLEDevice4; + interface IBluetoothLEDevice5; + interface IBluetoothLEDevice6; + interface IBluetoothLEDeviceStatics; + interface IBluetoothLEDeviceStatics2;
runtimeclass BluetoothAdapter; runtimeclass BluetoothClassOfDevice; runtimeclass BluetoothDevice; runtimeclass BluetoothDeviceId; + runtimeclass BluetoothLEDevice;
namespace Rfcomm { runtimeclass RfcommDeviceService; }
+ namespace GenericAttributeProfile { + runtimeclass GattDeviceService; + } + declare { interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.BluetoothAdapter *>; interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.BluetoothAdapter *>; interface Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.BluetoothDevice *, IInspectable *>; interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.BluetoothDevice *>; interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.BluetoothDevice *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Bluetooth.BluetoothLEDevice *>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.BluetoothLEDevice *>; + interface Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.BluetoothLEDevice *, IInspectable *>; interface Windows.Foundation.Collections.IVectorView<Windows.Storage.Streams.IBuffer *>; interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.Rfcomm.RfcommDeviceService *>; + interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *>; }
[ @@ -399,4 +416,61 @@ namespace Windows.Devices.Bluetooth { [default] interface Windows.Devices.Bluetooth.IBluetoothDeviceId; }
+ [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.BluetoothLEDevice), + uuid(b5ee2f7b-4ad8-4642-ac48-80a0b500e887) + ] + interface IBluetoothLEDevice : IInspectable + { + [propget] HRESULT DeviceId([out, retval] HSTRING *value); + [propget] HRESULT Name([out, retval] HSTRING *value); + [propget] HRESULT GattServices([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService *> **value); + [propget] HRESULT ConnectionStatus([out, retval] Windows.Devices.Bluetooth.BluetoothConnectionStatus *value); + [propget] HRESULT BluetoothAddress([out, retval] UINT64 *value); + HRESULT GetGattService([in] GUID uuid, + [out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService **service); + [eventadd] HRESULT NameChanged([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.BluetoothLEDevice *, IInspectable *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT NameChanged([in] EventRegistrationToken token); + [eventadd] HRESULT GattServicesChanged([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.BluetoothLEDevice *, IInspectable *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT GattServicesChanged([in] EventRegistrationToken token); + [eventadd] HRESULT ConnectionStatusChanged([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Bluetooth.BluetoothLEDevice *, IInspectable *> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT ConnectionStatusChanged([in] EventRegistrationToken token); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Bluetooth.BluetoothLEDevice), + uuid(c8cf1a19-f0b6-4bf0-8689-41303de2d9f4) + ] + interface IBluetoothLEDeviceStatics : IInspectable + { + HRESULT FromIdAsync([in] HSTRING id, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.BluetoothLEDevice *> **async); + [overload("FromBluetoothAddressAsync")] + HRESULT FromBluetoothAddressAsync([in] UINT64 addr, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.BluetoothLEDevice *> **async); + HRESULT GetDeviceSelector([out, retval] HSTRING *result); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + static(Windows.Devices.Bluetooth.IBluetoothLEDeviceStatics, Windows.Foundation.UniversalApiContract, 1.0), + static(Windows.Devices.Bluetooth.IBluetoothLEDeviceStatics2, Windows.Foundation.UniversalApiContract, 2.0), + threading(both) + ] + runtimeclass BluetoothLEDevice + { + [default] interface Windows.Devices.Bluetooth.IBluetoothLEDevice; + [contract(Windows.Foundation.UniversalApiContract, 2.0)] interface Windows.Devices.Bluetooth.IBluetoothLEDevice2; + [contract(Windows.Foundation.UniversalApiContract, 4.0)] interface Windows.Devices.Bluetooth.IBluetoothLEDevice3; + [contract(Windows.Foundation.UniversalApiContract, 5.0)] interface Windows.Devices.Bluetooth.IBluetoothLEDevice4; + [contract(Windows.Foundation.UniversalApiContract, 6.0)] interface Windows.Devices.Bluetooth.IBluetoothLEDevice5; + [contract(Windows.Foundation.UniversalApiContract, 13.0)] interface Windows.Devices.Bluetooth.IBluetoothLEDevice6; + interface Windows.Foundation.IClosable; + } }
From: Vibhav Pant vibhavp@gmail.com
--- .../tests/bluetooth.c | 205 ++++++++++++++++++ 1 file changed, 205 insertions(+)
diff --git a/dlls/windows.devices.bluetooth/tests/bluetooth.c b/dlls/windows.devices.bluetooth/tests/bluetooth.c index 1d2ef394842..03e6dbda30a 100644 --- a/dlls/windows.devices.bluetooth/tests/bluetooth.c +++ b/dlls/windows.devices.bluetooth/tests/bluetooth.c @@ -50,6 +50,157 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) IUnknown_Release( unk ); }
+struct inspectable_async_handler +{ + IAsyncOperationCompletedHandler_IInspectable iface; + const GUID *iid; + IAsyncOperation_IInspectable *async; + AsyncStatus status; + BOOL invoked; + HANDLE event; + LONG ref; +}; + +static inline struct inspectable_async_handler *impl_from_IAsyncOperationCompletedHandler_IInspectable( IAsyncOperationCompletedHandler_IInspectable *iface ) +{ + return CONTAINING_RECORD( iface, struct inspectable_async_handler, iface ); +} + +static HRESULT WINAPI inspectable_async_handler_QueryInterface( IAsyncOperationCompletedHandler_IInspectable *iface, REFIID iid, void **out ) +{ + struct inspectable_async_handler *impl = impl_from_IAsyncOperationCompletedHandler_IInspectable( iface ); + if (IsEqualGUID( iid, &IID_IUnknown ) || IsEqualGUID( iid, &IID_IAgileObject ) || IsEqualGUID( iid, impl->iid )) + { + IUnknown_AddRef( iface ); + *out = iface; + return S_OK; + } + + if (winetest_debug > 1) + trace( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI inspectable_async_handler_AddRef( IAsyncOperationCompletedHandler_IInspectable *iface ) +{ + struct inspectable_async_handler *impl = impl_from_IAsyncOperationCompletedHandler_IInspectable( iface ); + return InterlockedIncrement( &impl->ref ); +} + +static ULONG WINAPI inspectable_async_handler_Release( IAsyncOperationCompletedHandler_IInspectable *iface ) +{ + struct inspectable_async_handler *impl = impl_from_IAsyncOperationCompletedHandler_IInspectable( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + if (!ref) free( impl ); + return ref; +} + +static HRESULT WINAPI inspectable_async_handler_Invoke( IAsyncOperationCompletedHandler_IInspectable *iface, IAsyncOperation_IInspectable *async, + AsyncStatus status ) +{ + struct inspectable_async_handler *impl = impl_from_IAsyncOperationCompletedHandler_IInspectable( iface ); + ok( !impl->invoked, "invoked twice\n" ); + impl->async = async; + impl->status = status; + if (impl->event) SetEvent( impl->event ); + return S_OK; +} + +static const IAsyncOperationCompletedHandler_IInspectableVtbl inspectable_async_handler_vtbl = +{ + /* IUnknown */ + inspectable_async_handler_QueryInterface, + inspectable_async_handler_AddRef, + inspectable_async_handler_Release, + /* IAsyncOperationCompletedHandler<IInspectable> */ + inspectable_async_handler_Invoke +}; + +static WINAPI IAsyncOperationCompletedHandler_IInspectable *inspectable_async_handler_create( HANDLE event, const GUID *iid ) +{ + struct inspectable_async_handler *impl; + + if (!(impl = calloc( 1, sizeof(*impl) ))) return NULL; + impl->iface.lpVtbl = &inspectable_async_handler_vtbl; + impl->iid = iid; + impl->event = event; + impl->ref = 1; + return &impl->iface; +} + +static void await_bluetoothledevice( int line, IAsyncOperation_BluetoothLEDevice *async ) +{ + IAsyncOperationCompletedHandler_IInspectable *handler; + HANDLE event; + HRESULT hr; + DWORD ret; + + event = CreateEventW( NULL, FALSE, FALSE, NULL ); + ok_(__FILE__, line)( !!event, "CreateEventW failed, error %lu\n", GetLastError() ); + + handler = inspectable_async_handler_create( event, &IID_IAsyncOperationCompletedHandler_BluetoothLEDevice ); + ok_( __FILE__, line )( !!handler, "inspectable_async_handler_create failed\n" ); + hr = IAsyncOperation_BluetoothLEDevice_put_Completed( async, (IAsyncOperationCompletedHandler_BluetoothLEDevice *)handler ); + ok_(__FILE__, line)( hr == S_OK, "put_Completed returned %#lx\n", hr ); + IAsyncOperationCompletedHandler_IInspectable_Release( handler ); + + ret = WaitForSingleObject( event, 5000 ); + ok_(__FILE__, line)( !ret, "WaitForSingleObject returned %#lx\n", ret ); + ret = CloseHandle( event ); + ok_(__FILE__, line)( ret, "CloseHandle failed, error %lu\n", GetLastError() ); +} + +static void check_bluetoothledevice_async( int line, IAsyncOperation_BluetoothLEDevice *async, + UINT32 expect_id, AsyncStatus expect_status, + HRESULT expect_hr, IBluetoothLEDevice **result ) +{ + AsyncStatus async_status; + IAsyncInfo *async_info; + HRESULT hr, async_hr; + UINT32 async_id; + + hr = IAsyncOperation_BluetoothLEDevice_QueryInterface( async, &IID_IAsyncInfo, (void **)&async_info ); + ok_(__FILE__, line)( hr == S_OK, "QueryInterface returned %#lx\n", hr ); + + async_id = 0xdeadbeef; + hr = IAsyncInfo_get_Id( async_info, &async_id ); + if (expect_status < 4) ok_(__FILE__, line)( hr == S_OK, "get_Id returned %#lx\n", hr ); + else ok_(__FILE__, line)( hr == E_ILLEGAL_METHOD_CALL, "get_Id returned %#lx\n", hr ); + ok_(__FILE__, line)( async_id == expect_id, "got id %u\n", async_id ); + + async_status = 0xdeadbeef; + hr = IAsyncInfo_get_Status( async_info, &async_status ); + if (expect_status < 4) ok_(__FILE__, line)( hr == S_OK, "get_Status returned %#lx\n", hr ); + else ok_(__FILE__, line)( hr == E_ILLEGAL_METHOD_CALL, "get_Status returned %#lx\n", hr ); + ok_(__FILE__, line)( async_status == expect_status, "got status %u\n", async_status ); + + async_hr = 0xdeadbeef; + hr = IAsyncInfo_get_ErrorCode( async_info, &async_hr ); + if (expect_status < 4) ok_(__FILE__, line)( hr == S_OK, "get_ErrorCode returned %#lx\n", hr ); + else ok_(__FILE__, line)( hr == E_ILLEGAL_METHOD_CALL, "get_ErrorCode returned %#lx\n", hr ); + if (expect_status < 4) todo_wine_if( FAILED(expect_hr)) + ok_(__FILE__, line)( async_hr == expect_hr, "got error %#lx\n", async_hr ); + else ok_(__FILE__, line)( async_hr == E_ILLEGAL_METHOD_CALL, "got error %#lx\n", async_hr ); + + IAsyncInfo_Release( async_info ); + + hr = IAsyncOperation_BluetoothLEDevice_GetResults( async, result ); + switch (expect_status) + { + case Completed: + case Error: + todo_wine_if( FAILED(expect_hr)) + ok_(__FILE__, line)( hr == expect_hr, "GetResults returned %#lx\n", hr ); + break; + case Canceled: + case Started: + default: + ok_(__FILE__, line)( hr == E_ILLEGAL_METHOD_CALL, "GetResults returned %#lx\n", hr ); + break; + } +} + static void test_BluetoothAdapterStatics(void) { static const WCHAR *default_res = L"System.Devices.InterfaceClassGuid:="{92383B0E-F90E-4AC9-8D44-8C2D0D0EBDA2}" " @@ -138,6 +289,59 @@ static void test_BluetoothDeviceStatics( void ) IBluetoothDeviceStatics_Release( statics ); }
+static void test_BluetoothLEDeviceStatics( void ) +{ + static const WCHAR *class_name = RuntimeClass_Windows_Devices_Bluetooth_BluetoothLEDevice; + IAsyncOperation_BluetoothLEDevice *async_op; + IBluetoothLEDeviceStatics *statics; + IActivationFactory *factory; + IBluetoothLEDevice *device = NULL; + HSTRING str; + HRESULT hr; + + WindowsCreateString( class_name, wcslen( class_name ), &str ); + hr = RoGetActivationFactory( str, &IID_IActivationFactory, (void *)&factory ); + WindowsDeleteString( str ); + todo_wine ok( hr == S_OK || broken( hr == REGDB_E_CLASSNOTREG ), "got hr %#lx.\n", hr ); + if (hr == REGDB_E_CLASSNOTREG) + { + todo_wine win_skip( "%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w( class_name ) ); + return; + } + check_interface( factory, &IID_IUnknown ); + check_interface( factory, &IID_IInspectable ); + check_interface( factory, &IID_IAgileObject ); + + hr = IActivationFactory_QueryInterface( factory, &IID_IBluetoothLEDeviceStatics, (void **)&statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + IActivationFactory_Release( factory ); + if (FAILED( hr )) + { + skip( "BluetoothLEDeviceStatics not available.\n" ); + return; + } + + str = NULL; + hr = IBluetoothLEDeviceStatics_GetDeviceSelector( statics, &str ); + todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + todo_wine ok( !WindowsIsStringEmpty( str ), "got empty device selector string.\n" ); + WindowsDeleteString( str ); + + /* Use an invalid Bluetooth address. */ + hr = IBluetoothLEDeviceStatics_FromBluetoothAddressAsync( statics, 0, &async_op ); + todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + + if (hr == S_OK) + { + await_bluetoothledevice( __LINE__, async_op ); + check_bluetoothledevice_async( __LINE__, async_op, 1, Completed, S_OK, &device ); + ok( !device, "got device %p != NULL\n", device ); + if (device) IBluetoothLEDevice_Release( device ); + } + + IBluetoothLEDeviceStatics_Release( statics ); +} + START_TEST(bluetooth) { HRESULT hr; @@ -147,6 +351,7 @@ START_TEST(bluetooth)
test_BluetoothAdapterStatics(); test_BluetoothDeviceStatics(); + test_BluetoothLEDeviceStatics();
RoUninitialize(); }
From: Vibhav Pant vibhavp@gmail.com
--- .../bluetoothdevice.c | 46 ++++++++++++++++++- dlls/windows.devices.bluetooth/main.c | 3 +- .../tests/bluetooth.c | 4 +- 3 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/dlls/windows.devices.bluetooth/bluetoothdevice.c b/dlls/windows.devices.bluetooth/bluetoothdevice.c index 6eff705c352..e0b32575d19 100644 --- a/dlls/windows.devices.bluetooth/bluetoothdevice.c +++ b/dlls/windows.devices.bluetooth/bluetoothdevice.c @@ -1,4 +1,4 @@ -/* BluetoothDevice Implementation +/* BluetoothDevice, BluetoothLEDevice Implementation * * Copyright 2025 Vibhav Pant * @@ -26,6 +26,7 @@ struct bluetoothdevice_statics { IActivationFactory IActivationFactory_iface; IBluetoothDeviceStatics IBluetoothDeviceStatics_iface; + IBluetoothLEDeviceStatics IBluetoothLEDeviceStatics_iface; LONG ref; };
@@ -53,6 +54,11 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID IBluetoothDeviceStatics_AddRef(( *out = &impl->IBluetoothDeviceStatics_iface )); return S_OK; } + if (IsEqualGUID( iid, &IID_IBluetoothLEDeviceStatics )) + { + IBluetoothLEDeviceStatics_AddRef(( *out = &impl->IBluetoothLEDeviceStatics_iface )); + return S_OK; + } *out = NULL; FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); return E_NOINTERFACE; @@ -155,10 +161,48 @@ static const IBluetoothDeviceStaticsVtbl bluetoothdevice_statics_vtbl = bluetoothdevice_statics_GetDeviceSelector, };
+DEFINE_IINSPECTABLE( bluetoothledevice_statics, IBluetoothLEDeviceStatics, struct bluetoothdevice_statics, IActivationFactory_iface ); + +static HRESULT WINAPI bluetoothledevice_statics_FromIdAsync( IBluetoothLEDeviceStatics *iface, HSTRING id, IAsyncOperation_BluetoothLEDevice **async_op ) +{ + FIXME( "(%p, %s, %p): stub!\n", iface, debugstr_hstring( id ), async_op ); + return E_NOTIMPL; +} + +static HRESULT WINAPI bluetoothledevice_statics_FromBluetoothAddressAsync( IBluetoothLEDeviceStatics *iface, UINT64 addr, IAsyncOperation_BluetoothLEDevice **async_op ) +{ + FIXME( "(%p, %#I64x, %p): stub!\n", iface, addr, async_op ); + return E_NOTIMPL; +} + +static HRESULT WINAPI bluetoothledevice_statics_GetDeviceSelector( IBluetoothLEDeviceStatics *iface, HSTRING *result ) +{ + FIXME( "(%p, %p): stub!\n", iface, result ); + return E_NOTIMPL; +} + +static const IBluetoothLEDeviceStaticsVtbl bluetoothledevice_statics_vtbl = +{ + /* IUnknown */ + bluetoothledevice_statics_QueryInterface, + bluetoothledevice_statics_AddRef, + bluetoothledevice_statics_Release, + /* IInspectable */ + bluetoothledevice_statics_GetIids, + bluetoothledevice_statics_GetRuntimeClassName, + bluetoothledevice_statics_GetTrustLevel, + /* IBluetoothLEDeviceStatics */ + bluetoothledevice_statics_FromIdAsync, + bluetoothledevice_statics_FromBluetoothAddressAsync, + bluetoothledevice_statics_GetDeviceSelector +}; + + static struct bluetoothdevice_statics bluetoothdevice_statics = { {&factory_vtbl}, {&bluetoothdevice_statics_vtbl}, + {&bluetoothledevice_statics_vtbl}, 1 };
diff --git a/dlls/windows.devices.bluetooth/main.c b/dlls/windows.devices.bluetooth/main.c index b94599103a8..1d89f77eb97 100644 --- a/dlls/windows.devices.bluetooth/main.c +++ b/dlls/windows.devices.bluetooth/main.c @@ -40,7 +40,8 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING classid, IActivationFactory **fa
if (!wcscmp( buffer, RuntimeClass_Windows_Devices_Bluetooth_BluetoothAdapter )) IActivationFactory_QueryInterface( bluetoothadapter_factory, &IID_IActivationFactory, (void **)factory ); - if (!wcscmp( buffer, RuntimeClass_Windows_Devices_Bluetooth_BluetoothDevice )) + if (!wcscmp( buffer, RuntimeClass_Windows_Devices_Bluetooth_BluetoothDevice ) + || !wcscmp( buffer, RuntimeClass_Windows_Devices_Bluetooth_BluetoothLEDevice )) IActivationFactory_QueryInterface( bluetoothdevice_statics_factory, &IID_IActivationFactory, (void **)factory );
if (*factory) return S_OK; diff --git a/dlls/windows.devices.bluetooth/tests/bluetooth.c b/dlls/windows.devices.bluetooth/tests/bluetooth.c index 03e6dbda30a..f8c75250271 100644 --- a/dlls/windows.devices.bluetooth/tests/bluetooth.c +++ b/dlls/windows.devices.bluetooth/tests/bluetooth.c @@ -302,10 +302,10 @@ static void test_BluetoothLEDeviceStatics( void ) WindowsCreateString( class_name, wcslen( class_name ), &str ); hr = RoGetActivationFactory( str, &IID_IActivationFactory, (void *)&factory ); WindowsDeleteString( str ); - todo_wine ok( hr == S_OK || broken( hr == REGDB_E_CLASSNOTREG ), "got hr %#lx.\n", hr ); + ok( hr == S_OK || broken( hr == REGDB_E_CLASSNOTREG ), "got hr %#lx.\n", hr ); if (hr == REGDB_E_CLASSNOTREG) { - todo_wine win_skip( "%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w( class_name ) ); + win_skip( "%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w( class_name ) ); return; } check_interface( factory, &IID_IUnknown );
Rémi Bernon (@rbernon) commented about include/windows.devices.bluetooth.genericattributeprofile.idl:
+import "eventtoken.idl"; +import "windowscontracts.idl"; +import "windows.foundation.idl"; +import "windows.storage.streams.idl"; +import "windows.devices.bluetooth.idl"; +import "windows.devices.enumeration.idl"; +#endif
+namespace Windows.Devices.Bluetooth {
- typedef enum BluetoothCacheMode BluetoothCacheMode;
- typedef enum BluetoothError BluetoothError;
- runtimeclass BluetoothDeviceId;
+}
+namespace Windows.Devices.Bluetooth.GenericAttributeProfile {
Do we really need all of these? Fwiw it would be better to add them to the headers on an as-needed basis for the implementation, and to implement only what applications require.
On Tue Jun 17 15:44:08 2025 +0000, Rémi Bernon wrote:
Do we really need all of these? Fwiw it would be better to add them to the headers on an as-needed basis for the implementation, and to implement only what applications require.
Unfortunately, yeah. GATT is how BLE devices communicate and send data. The latest winebth.sys MR (https://gitlab.winehq.org/wine/wine/-/merge_requests/8174, also contains a brief explanation of what GATT is and how it's structured) adds support for GATT services, which I ultimately will use to implement these interfaces.
Rémi Bernon (@rbernon) commented about include/windows.devices.bluetooth.genericattributeprofile.idl:
marshaling_behavior(agile),
threading(both)
- ]
- runtimeclass GattSessionStatusChangedEventArgs
- {
[default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattSessionStatusChangedEventArgs;
- }
- [
contract(Windows.Foundation.UniversalApiContract, 1.0),
exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic),
uuid(59cb50c1-5934-4f68-a198-eb864fa44e6b),
- ]
- interface IGattCharacteristic : IInspectable
- {
HRESULT GetDescriptors([in] GUID descriptorUuid,
```suggestion:-0+0 HRESULT GetDescriptors([in] GUID uuid, ```
Rémi Bernon (@rbernon) commented about include/windows.devices.bluetooth.genericattributeprofile.idl:
- [
contract(Windows.Foundation.UniversalApiContract, 1.0),
exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDescriptor),
uuid(92055f2b-8084-4344-b4c2-284de19a8506)
- ]
- interface IGattDescriptor : IInspectable
- {
[propget] HRESULT ProtectionLevel([out, retval] Windows.Devices.Bluetooth.GenericAttributeProfile.GattProtectionLevel *value);
[propput] HRESULT ProtectionLevel([in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattProtectionLevel value);
[propget] HRESULT Uuid([out, retval] GUID *value);
[propget] HRESULT AttributeHandle([out, retval] UINT16 *value);
[overload("ReadValueAsync")]
HRESULT ReadValueAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadResult *> **async);
[overload("ReadValueAsync")]
HRESULT ReadValueWithCacheModeAsync([in] Windows.Devices.Bluetooth.BluetoothCacheMode cacheMode,
```suggestion:-0+0 HRESULT ReadValueWithCacheModeAsync([in] Windows.Devices.Bluetooth.BluetoothCacheMode mode, ```
Rémi Bernon (@rbernon) commented about include/windows.devices.bluetooth.genericattributeprofile.idl:
contract(Windows.Foundation.UniversalApiContract, 1.0),
marshaling_behavior(agile),
threading(both)
- ]
- runtimeclass GattWriteResult
- {
[default] interface Windows.Devices.Bluetooth.GenericAttributeProfile.IGattWriteResult;
- }
- [
contract(Windows.Foundation.UniversalApiContract, 1.0),
exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadClientCharacteristicConfigurationDescriptorResult),
uuid(63a66f09-1aea-4c4c-a50f-97bae474b348)
- ]
- interface IGattReadClientCharacteristicConfigurationDescriptorResult : IInspectable
- {
```suggestion:-7+0
[ contract(Windows.Foundation.UniversalApiContract, 1.0), exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadClientCharacteristicConfigurationDescriptorResult), uuid(63a66f09-1aea-4c4c-a50f-97bae474b348) ] interface IGattReadClientCharacteristicConfigurationDescriptorResult : IInspectable { ```
Rémi Bernon (@rbernon) commented about include/windows.devices.bluetooth.genericattributeprofile.idl:
HRESULT WriteValueWithResultAndOptionAsync([in] Windows.Storage.Streams.IBuffer *value,
[in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteOption option,
[out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteResult *> **async);
HRESULT WriteClientCharacteristicConfigurationDescriptorWithResultAsync([in] Windows.Devices.Bluetooth.GenericAttributeProfile.GattClientCharacteristicConfigurationDescriptorValue value,
[out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteResult *> **async);
- }
- [
contract(Windows.Foundation.UniversalApiContract, 1.0),
exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic),
uuid(59cb50c3-5934-4f68-a198-eb864fa44e6b)
- ]
- interface IGattCharacteristicStatics : IInspectable
- {
HRESULT ConvertShortIdToUuid([in] UINT16 id, [out, retval] GUID *uuid);
- }
Any reason to include the definition for this one which only has deprecated methods, but not for `IGattDeviceService2` which I assumed you skipped for the same reason (versus `IGattDeviceService3` which has non-deprecated methods for instance)?
I've reviewed the whole thing and except for minor details above it looks alright, and probably okay to merge at once to avoid the burden of splitting the changes, but again, forward declarations are sufficient in most cases, and it's probably better to only add the interfaces we need to implement, right before implementing them, to avoid writing, reviewing, and committing unnecessary cruft. The WinRT surface and verbosity makes it even more relevant (or we need a better way to do this than rewriting every IDL).
Rémi Bernon (@rbernon) commented about dlls/windows.devices.bluetooth/bluetoothdevice.c:
IBluetoothDeviceStatics_AddRef(( *out = &impl->IBluetoothDeviceStatics_iface )); return S_OK; }
- if (IsEqualGUID( iid, &IID_IBluetoothLEDeviceStatics ))
- {
IBluetoothLEDeviceStatics_AddRef(( *out = &impl->IBluetoothLEDeviceStatics_iface ));
return S_OK;
- }
It's maybe not a huge problem for this static factory, but unless the object are really supposed to implement both interfaces, which tests should attest, I think it'd be better to keep them separate objects. The same is true for the devices for which I assume you want to share the implementation.
You could have an internal abstraction for bluetooth devices, or implement one on top of the other, or optional vtable pointers with each kind of devices created with one or the other iface, as long as it doesn't leak such implementation details to the application.
Rémi Bernon (@rbernon) commented about dlls/windows.devices.bluetooth/tests/bluetooth.c:
- {
todo_wine win_skip( "%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w( class_name ) );
return;
- }
- check_interface( factory, &IID_IUnknown );
- check_interface( factory, &IID_IInspectable );
- check_interface( factory, &IID_IAgileObject );
- hr = IActivationFactory_QueryInterface( factory, &IID_IBluetoothLEDeviceStatics, (void **)&statics );
- ok( hr == S_OK, "got hr %#lx.\n", hr );
- IActivationFactory_Release( factory );
- if (FAILED( hr ))
- {
skip( "BluetoothLEDeviceStatics not available.\n" );
return;
- }
This doesn't seem necessary? The test right before it would fail if the call failed.
On Tue Jun 17 17:42:32 2025 +0000, Rémi Bernon wrote:
This doesn't seem necessary? The test right before it would fail if the call failed.
Hm, doesn't the previous test check for `IID_IActivationFactory`, and not `IID_IBluetoothLEDeviceStatics`?
On Tue Jun 17 17:42:08 2025 +0000, Rémi Bernon wrote:
It's maybe not a huge problem for this static factory, but unless the object are really supposed to implement both interfaces, which tests should attest, I think it'd be better to keep them separate objects. The same is true for the devices for which I assume you want to share the implementation. You could have an internal abstraction for bluetooth devices, or implement one on top of the other, or optional vtable pointers with each kind of devices created with one or the other iface, as long as it doesn't leak such implementation details to the application.
Makes sense. I have separated the two implementations.
On Tue Jun 17 17:40:44 2025 +0000, Rémi Bernon wrote:
HRESULT GetDescriptors([in] GUID uuid,
Fixed, thanks.
On Tue Jun 17 17:40:44 2025 +0000, Rémi Bernon wrote:
HRESULT ReadValueWithCacheModeAsync([in] Windows.Devices.Bluetooth.BluetoothCacheMode mode,
Fixed, thanks.
On Tue Jun 17 17:40:44 2025 +0000, Rémi Bernon wrote:
[ contract(Windows.Foundation.UniversalApiContract, 1.0), exclusiveto(Windows.Devices.Bluetooth.GenericAttributeProfile.GattReadClientCharacteristicConfigurationDescriptorResult), uuid(63a66f09-1aea-4c4c-a50f-97bae474b348) ] interface IGattReadClientCharacteristicConfigurationDescriptorResult : IInspectable {
Fixed.
On Tue Jun 17 20:21:43 2025 +0000, Vibhav Pant wrote:
Hm, doesn't the previous test check for `IID_IActivationFactory`, and not `IID_IBluetoothLEDeviceStatics`?
You have `ok( hr == S_OK, "got hr %#lx.\n", hr );` just above, it's not allowed to fail.
On Tue Jun 17 17:40:44 2025 +0000, Rémi Bernon wrote:
Any reason to include the definition for this one which only has deprecated methods, but not for `IGattDeviceService2` which I assumed you skipped for the same reason (versus `IGattDeviceService3` which has non-deprecated methods for instance)? I've reviewed the whole thing and except for minor details above it looks alright, and probably okay to merge at once to avoid the burden of splitting the changes, but again, forward declarations are sufficient in most cases, and it's probably better to only add the interfaces we need to implement, right before implementing them, to avoid writing, reviewing, and committing unnecessary cruft. The WinRT surface and verbosity makes it even more relevant (or we need a better way to do this than rewriting every IDL).
Ah, I skipped the `IGattDeviceService2` commit, as the interface relied on `BluetoothLEDevice *`, requiring a separate commit after the latter was added. Added in the latest revision, thanks.