From 5e2a39f65f1b921309abd06fac80eac8fab68c63 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Mon, 19 Sep 2022 14:20:48 -0500 Subject: [PATCH 01/10] [xcode14] Fix selectors from submission tests These selectors failed the most recent submission test: UIFocusDebugger checkFocusGroupTreeForEnvironment: HMMatterRequestHandler configureAccessoryWithName:room:completion: fetchRoomsInHome:completion: pairAccessoryInHome:onboardingPayload:completion: HMMatterTopology initWithHomes: HMMatterHome/HMMatterRoom initWithUUID:name: HMAccessorySetupManager performMatterEcosystemAccessorySetupUsingRequest:topology:completionHandler: ChipDeviceController pairDevice:address:port:discriminator:setupPINCode:error: setListenPort: sharedController ChipLowPower sleep: ChipTestCluster test: toggle: ChipGeneralCommissioning commissioningComplete: --- src/Chip/ChipCompat.cs | 347 +++++++++++++++++++++++ src/HomeKit/HMCompat.cs | 27 +- src/ObjCRuntime/ObsoleteConstants.cs | 3 + src/chip.cs | 403 --------------------------- src/homekit.cs | 28 +- src/uikit.cs | 2 + 6 files changed, 383 insertions(+), 427 deletions(-) diff --git a/src/Chip/ChipCompat.cs b/src/Chip/ChipCompat.cs index 5f41e9aad246..ebff1760b3c0 100644 --- a/src/Chip/ChipCompat.cs +++ b/src/Chip/ChipCompat.cs @@ -8,6 +8,7 @@ // using System; +using System.ComponentModel; using System.Threading.Tasks; using Foundation; using CoreFoundation; @@ -138,5 +139,351 @@ public virtual Task GoToTiltValueAsync (ushort tiltValu #endif } + + [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] + public delegate void ChipDeviceConnectionCallback (ChipDevice device, NSError error); + + [Register("CHIPDeviceController", true)] + public partial class ChipDeviceController : NSObject { + public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } + + protected ChipDeviceController (NSObjectFlag t) : base (t) => throw new InvalidOperationException (Constants.RemovedFromChip); + + protected internal ChipDeviceController (IntPtr handle) : base (handle) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual bool GetConnectedDevice (ulong deviceID, global::CoreFoundation.DispatchQueue queue,ChipDeviceConnectionCallback completionHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task GetConnectedDeviceAsync (ulong deviceID, global::CoreFoundation.DispatchQueue queue) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task GetConnectedDeviceAsync (ulong deviceID, global::CoreFoundation.DispatchQueue queue, out bool result) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual ChipDevice? GetPairedDevice (ulong deviceId, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual bool IsDevicePaired (ulong deviceID, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); + + [Obsolete ("This method is removed.", false)] + [Unavailable (PlatformName.MacOSX, ObjCRuntime.PlatformArchitecture.All)] + public virtual bool PairDevice (ulong deviceId, ushort discriminator, uint setupPinCode, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); + + [Unavailable (PlatformName.MacOSX, ObjCRuntime.PlatformArchitecture.All)] + public virtual bool PairDevice (ulong deviceID, ushort discriminator, uint setupPINCode, NSData? csrNonce, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual bool PairDevice (ulong deviceId, string address, ushort port, ushort discriminator, uint setupPinCode, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual bool PairDevice (ulong deviceId, string onboardingPayload, ChipOnboardingPayloadType onboardingPayloadType, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual bool PairDeviceWithoutSecurity (ulong deviceId, string address, ushort port, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void SetListenPort (ushort port) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void SetPairingDelegate (IChipDevicePairingDelegate @delegate, global::CoreFoundation.DispatchQueue queue) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual bool Shutdown () => throw new InvalidOperationException (Constants.RemovedFromChip); + + [Obsolete ("This method is removed.", false)] + public virtual bool Startup (IChipPersistentStorageDelegate? storageDelegate) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual bool Startup (IChipPersistentStorageDelegate? storageDelegate, ushort vendorId, IChipKeypair? nocSigner) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual bool StopDevicePairing (ulong deviceId, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual bool UnpairDevice (ulong deviceId, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void UpdateDevice (ulong deviceId, ulong fabricId) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual NSNumber ControllerNodeId => throw new InvalidOperationException (Constants.RemovedFromChip); + public virtual bool IsRunning => throw new InvalidOperationException (Constants.RemovedFromChip); + public static ChipDeviceController SharedController => throw new InvalidOperationException (Constants.RemovedFromChip); + } + + [Register("CHIPLowPower", true)] + public partial class ChipLowPower : ChipCluster { + public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } + + protected ChipLowPower (NSObjectFlag t) : base (t) => throw new InvalidOperationException (Constants.RemovedFromChip); + + protected internal ChipLowPower (IntPtr handle) : base (handle) => throw new InvalidOperationException (Constants.RemovedFromChip); + + [DesignatedInitializer] + public ChipLowPower (ChipDevice device, ushort endpoint, global::CoreFoundation.DispatchQueue queue) + : base (NSObjectFlag.Empty) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public ChipLowPower (ChipDevice device, byte endpoint, global::CoreFoundation.DispatchQueue queue) + : this (device, (ushort) endpoint, queue) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeClusterRevision (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeClusterRevisionAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void Sleep (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + public virtual Task SleepAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + } + + [Register("CHIPTestCluster", true)] + public partial class ChipTestCluster : ChipCluster { + public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } + + protected ChipTestCluster (NSObjectFlag t) : base (t) => throw new InvalidOperationException (Constants.RemovedFromChip); + + protected internal ChipTestCluster (IntPtr handle) : base (handle) => throw new InvalidOperationException (Constants.RemovedFromChip); + + [DesignatedInitializer] + public ChipTestCluster (ChipDevice device, ushort endpoint, global::CoreFoundation.DispatchQueue queue) + : base (NSObjectFlag.Empty) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public ChipTestCluster (ChipDevice device, byte endpoint, global::CoreFoundation.DispatchQueue queue) + : this (device, (ushort) endpoint, queue) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeBitmap16 (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeBitmap16Async () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeBitmap32 (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeBitmap32Async () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeBitmap64 (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeBitmap64Async () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeBitmap8 (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeBitmap8Async () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeBoolean (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeBooleanAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeCharString (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeCharStringAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeClusterRevision (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeClusterRevisionAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeEnum16 (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeEnum16Async () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeEnum8 (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeEnum8Async () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeInt16s (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeInt16sAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeInt16u (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeInt16uAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeInt32s (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeInt32sAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeInt32u (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeInt32uAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeInt64s (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeInt64sAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeInt64u (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeInt64uAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeInt8s (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeInt8sAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeInt8u (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeInt8uAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeListInt8u (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeListInt8uAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeListOctetString (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeListOctetStringAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeListStructOctetString (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeListStructOctetStringAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeLongCharString (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeLongCharStringAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeLongOctetString (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeLongOctetStringAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeOctetString (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeOctetStringAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeUnsupported (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeUnsupportedAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void Test (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task TestAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void TestAddArguments (byte arg1, byte arg2, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task TestAddArgumentsAsync (byte arg1, byte arg2) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void TestNotHandled (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task TestNotHandledAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void TestSpecific (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task TestSpecificAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void TestUnknownCommand (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task TestUnknownCommandAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeBitmap16 (ushort value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeBitmap16Async (ushort value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeBitmap32 (uint value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeBitmap32Async (uint value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeBitmap64 (ulong value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeBitmap64Async (ulong value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeBitmap8 (byte value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeBitmap8Async (byte value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeBoolean (byte value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeBooleanAsync (byte value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeBoolean (bool boolValue, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeBooleanAsync (bool boolValue) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeCharString (string value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeCharStringAsync (string value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeEnum16 (ushort value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeEnum16Async (ushort value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeEnum8 (byte value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeEnum8Async (byte value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeInt16s (short value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeInt16sAsync (short value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeInt16u (ushort value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeInt16uAsync (ushort value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeInt32s (int value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeInt32sAsync (int value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeInt32u (uint value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeInt32uAsync (uint value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeInt64s (long value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeInt64sAsync (long value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeInt64u (ulong value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeInt64uAsync (ulong value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeInt8s (sbyte value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeInt8sAsync (sbyte value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeInt8u (byte value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeInt8uAsync (byte value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeLongCharString (string value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeLongCharStringAsync (string value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeLongOctetString (NSData value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeLongOctetStringAsync (NSData value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeOctetString (NSData value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeOctetStringAsync (NSData value) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeUnsupported (bool boolValue, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeUnsupportedAsync (bool boolValue) => throw new InvalidOperationException (Constants.RemovedFromChip); + } + + [Register("CHIPGeneralCommissioning", true)] + public partial class ChipGeneralCommissioning : ChipCluster { + public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } + + protected ChipGeneralCommissioning (NSObjectFlag t) : base (t) => throw new InvalidOperationException (Constants.RemovedFromChip); + + protected internal ChipGeneralCommissioning (IntPtr handle) : base (handle) => throw new InvalidOperationException (Constants.RemovedFromChip); + + [DesignatedInitializer] + public ChipGeneralCommissioning (ChipDevice device, ushort endpoint, global::CoreFoundation.DispatchQueue queue) + : base (NSObjectFlag.Empty) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public ChipGeneralCommissioning (ChipDevice device, byte endpoint, global::CoreFoundation.DispatchQueue queue) + : this (device, (ushort) endpoint, queue) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ArmFailSafe (ushort expiryLengthSeconds, ulong breadcrumb, uint timeoutMs, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ArmFailSafeAsync (ushort expiryLengthSeconds, ulong breadcrumb, uint timeoutMs) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void CommissioningComplete (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task CommissioningCompleteAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeBasicCommissioningInfoList (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeBasicCommissioningInfoListAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeBreadcrumb (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeBreadcrumbAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void ReadAttributeClusterRevision (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task ReadAttributeClusterRevisionAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + [Obsolete ("This method is removed.", false)] + public virtual void ReadAttributeFabricId (ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + [Obsolete ("This method is removed.", false)] + public virtual Task ReadAttributeFabricIdAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void SetRegulatoryConfig (byte location, string countryCode, ulong breadcrumb, uint timeoutMs, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task SetRegulatoryConfigAsync (byte location, string countryCode, ulong breadcrumb, uint timeoutMs) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual void WriteAttributeBreadcrumb (ulong value, ChipResponseHandler responseHandler) => throw new InvalidOperationException (Constants.RemovedFromChip); + + public virtual Task WriteAttributeBreadcrumbAsync (ulong value) + => throw new InvalidOperationException (Constants.RemovedFromChip); + } } #endif // !NET diff --git a/src/HomeKit/HMCompat.cs b/src/HomeKit/HMCompat.cs index 6b6872336b78..8ec7e535ca9e 100644 --- a/src/HomeKit/HMCompat.cs +++ b/src/HomeKit/HMCompat.cs @@ -11,11 +11,15 @@ using System.Threading.Tasks; using Foundation; using CoreFoundation; +using ObjCRuntime; #if !NET +using NativeHandle = System.IntPtr; +#endif + #nullable enable namespace HomeKit { - +#if !NET [Obsolete ("Use 'HMFetchRoomHandler' instead.")] public delegate void FetchRoomHandler (NSArray rooms, NSError error); @@ -102,8 +106,23 @@ public partial class HMAccessorySetupManager { public virtual void AddAndSetUpAccessories (HMChipServiceTopology topology, HMErrorHandler completion) => throw new InvalidOperationException (); public virtual Task AddAndSetUpAccessoriesAsync (HMChipServiceTopology topology) => throw new InvalidOperationException (); #pragma warning restore CS0618 // HMChipServiceTopology and HMErrorHandler is obsolete + } +#endif // !NET - } /* class HMAccessorySetupManager */ - +#if __IOS__ && !__MACCATALYST__ + public unsafe partial class HMAccessorySetupManager : NSObject { + public override NativeHandle ClassHandle => throw new InvalidOperationException (); + + public HMAccessorySetupManager () : base (NSObjectFlag.Empty) => throw new InvalidOperationException (); + protected HMAccessorySetupManager (NSObjectFlag t) : base (t) => throw new InvalidOperationException (); + protected internal HMAccessorySetupManager (NativeHandle handle) : base (handle) => throw new InvalidOperationException (); + + public virtual void AddAndSetUpAccessories (HMMatterTopology topology, Action completion) => throw new InvalidOperationException (); + public virtual Task AddAndSetUpAccessoriesAsync (HMMatterTopology topology) => throw new InvalidOperationException (); + public virtual void PerformAccessorySetup (HMAccessorySetupRequest request, Action completion) => throw new InvalidOperationException (); + public virtual Task PerformAccessorySetupAsync (HMAccessorySetupRequest request) => throw new InvalidOperationException (); + public virtual void PerformMatterEcosystemAccessorySetup (HMAccessorySetupRequest request, HMMatterTopology topology, Action completion) => throw new InvalidOperationException (); + public virtual Task PerformMatterEcosystemAccessorySetupAsync (HMAccessorySetupRequest request, HMMatterTopology topology) => throw new InvalidOperationException (); + } +#endif } -#endif // !NET diff --git a/src/ObjCRuntime/ObsoleteConstants.cs b/src/ObjCRuntime/ObsoleteConstants.cs index 9af119ff7172..68f65e6ce190 100644 --- a/src/ObjCRuntime/ObsoleteConstants.cs +++ b/src/ObjCRuntime/ObsoleteConstants.cs @@ -28,6 +28,9 @@ partial class Constants { internal const string RemovedFromChip = "This API has been removed from the 'CHIP' framework."; internal const string BrokenBinding = "This API was incorrectly bound and does not work correctly. Use the new version indicated in the associated Obsolete attribute."; + + internal const string RemovedFromHomeKit = "This API has been removed from the 'HomeKit' framework."; + internal const string ApiRemovedGeneral = "This API has been removed from the framework."; } } diff --git a/src/chip.cs b/src/chip.cs index 8714a8b50121..959a3d261b26 100644 --- a/src/chip.cs +++ b/src/chip.cs @@ -1011,62 +1011,6 @@ interface ChipDoorLock void ReadAttributeClusterRevision (ChipResponseHandler responseHandler); } - [Mac (12,0), Watch (8,0), TV (15,0), iOS (15,0), MacCatalyst (15,0)] - [BaseType (typeof (ChipCluster), Name="CHIPGeneralCommissioning")] - [DisableDefaultCtor] - interface ChipGeneralCommissioning - { - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Export ("initWithDevice:endpoint:queue:")] - [DesignatedInitializer] - NativeHandle Constructor (ChipDevice device, ushort endpoint, DispatchQueue queue); - -#if !NET - [Deprecated (PlatformName.iOS, 15, 2)] - [Deprecated (PlatformName.TvOS, 15, 2)] - [Deprecated (PlatformName.WatchOS, 8, 3)] - [Deprecated (PlatformName.MacOSX, 12, 1)] - [Deprecated (PlatformName.MacCatalyst, 15, 2)] - [Wrap ("this (device, (ushort) endpoint, queue)")] - NativeHandle Constructor (ChipDevice device, byte endpoint, DispatchQueue queue); -#endif - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("armFailSafe:breadcrumb:timeoutMs:responseHandler:")] - void ArmFailSafe (ushort expiryLengthSeconds, ulong breadcrumb, uint timeoutMs, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("commissioningComplete:")] - void CommissioningComplete (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("setRegulatoryConfig:countryCode:breadcrumb:timeoutMs:responseHandler:")] - void SetRegulatoryConfig (byte location, string countryCode, ulong breadcrumb, uint timeoutMs, ChipResponseHandler responseHandler); - -#if !NET - [Obsolete ("This method is removed.")] - [Wrap ("throw new InvalidOperationException (Constants.RemovedFromChip)", IsVirtual = true)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - void ReadAttributeFabricId (ChipResponseHandler responseHandler); -#endif - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeBreadcrumbWithResponseHandler:")] - void ReadAttributeBreadcrumb (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeBreadcrumbWithValue:responseHandler:")] - void WriteAttributeBreadcrumb (ulong value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeBasicCommissioningInfoListWithResponseHandler:")] - void ReadAttributeBasicCommissioningInfoList (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeClusterRevisionWithResponseHandler:")] - void ReadAttributeClusterRevision (ChipResponseHandler responseHandler); - } - [Mac (12,0), Watch (8,0), TV (15,0), iOS (15,0), MacCatalyst (15,0)] [BaseType (typeof (ChipCluster), Name="CHIPGroupKeyManagement")] [DisableDefaultCtor] @@ -1263,35 +1207,6 @@ interface ChipLevelControl void ReadAttributeClusterRevision (ChipResponseHandler responseHandler); } - [Mac (12,0), Watch (8,0), TV (15,0), iOS (15,0), MacCatalyst (15,0)] - [BaseType (typeof (ChipCluster), Name="CHIPLowPower")] - [DisableDefaultCtor] - interface ChipLowPower - { - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Export ("initWithDevice:endpoint:queue:")] - [DesignatedInitializer] - NativeHandle Constructor (ChipDevice device, ushort endpoint, DispatchQueue queue); - -#if !NET - [Deprecated (PlatformName.iOS, 15, 2)] - [Deprecated (PlatformName.TvOS, 15, 2)] - [Deprecated (PlatformName.WatchOS, 8, 3)] - [Deprecated (PlatformName.MacOSX, 12, 1)] - [Deprecated (PlatformName.MacCatalyst, 15, 2)] - [Wrap ("this (device, (ushort) endpoint, queue)")] - NativeHandle Constructor (ChipDevice device, byte endpoint, DispatchQueue queue); -#endif - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("sleep:")] - void Sleep (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeClusterRevisionWithResponseHandler:")] - void ReadAttributeClusterRevision (ChipResponseHandler responseHandler); - } - [Mac (12,0), Watch (8,0), TV (15,0), iOS (15,0), MacCatalyst (15,0)] [BaseType (typeof (ChipCluster), Name="CHIPNetworkCommissioning")] [DisableDefaultCtor] @@ -1920,244 +1835,6 @@ interface ChipTemperatureMeasurement void ReadAttributeClusterRevision (ChipResponseHandler responseHandler); } - [Mac (12,0), Watch (8,0), TV (15,0), iOS (15,0), MacCatalyst (15,0)] - [BaseType (typeof (ChipCluster), Name="CHIPTestCluster")] - [DisableDefaultCtor] - interface ChipTestCluster - { - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Export ("initWithDevice:endpoint:queue:")] - [DesignatedInitializer] - NativeHandle Constructor (ChipDevice device, ushort endpoint, DispatchQueue queue); - -#if !NET - [Deprecated (PlatformName.iOS, 15, 2)] - [Deprecated (PlatformName.TvOS, 15, 2)] - [Deprecated (PlatformName.WatchOS, 8, 3)] - [Deprecated (PlatformName.MacOSX, 12, 1)] - [Deprecated (PlatformName.MacCatalyst, 15, 2)] - [Wrap ("this (device, (ushort) endpoint, queue)")] - NativeHandle Constructor (ChipDevice device, byte endpoint, DispatchQueue queue); -#endif - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("test:")] - void Test (ChipResponseHandler responseHandler); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("testAddArguments:arg2:responseHandler:")] - void TestAddArguments (byte arg1, byte arg2, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("testNotHandled:")] - void TestNotHandled (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("testSpecific:")] - void TestSpecific (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("testUnknownCommand:")] - void TestUnknownCommand (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeBooleanWithResponseHandler:")] - void ReadAttributeBoolean (ChipResponseHandler responseHandler); - -#if !NET - [Deprecated (PlatformName.iOS, 15, 2)] - [Deprecated (PlatformName.TvOS, 15, 2)] - [Deprecated (PlatformName.WatchOS, 8, 3)] - [Deprecated (PlatformName.MacOSX, 12, 1)] - [Deprecated (PlatformName.MacCatalyst, 15, 2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Wrap ("WriteAttributeBoolean (Convert.ToBoolean(value), responseHandler)", IsVirtual = true)] - void WriteAttributeBoolean (byte value, ChipResponseHandler responseHandler); -#endif - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeBooleanWithValue:responseHandler:")] - void WriteAttributeBoolean (bool boolValue, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeBitmap8WithResponseHandler:")] - void ReadAttributeBitmap8 (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeBitmap8WithValue:responseHandler:")] - void WriteAttributeBitmap8 (byte value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeBitmap16WithResponseHandler:")] - void ReadAttributeBitmap16 (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeBitmap16WithValue:responseHandler:")] - void WriteAttributeBitmap16 (ushort value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeBitmap32WithResponseHandler:")] - void ReadAttributeBitmap32 (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeBitmap32WithValue:responseHandler:")] - void WriteAttributeBitmap32 (uint value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeBitmap64WithResponseHandler:")] - void ReadAttributeBitmap64 (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeBitmap64WithValue:responseHandler:")] - void WriteAttributeBitmap64 (ulong value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeInt8uWithResponseHandler:")] - void ReadAttributeInt8u (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeInt8uWithValue:responseHandler:")] - void WriteAttributeInt8u (byte value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeInt16uWithResponseHandler:")] - void ReadAttributeInt16u (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeInt16uWithValue:responseHandler:")] - void WriteAttributeInt16u (ushort value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeInt32uWithResponseHandler:")] - void ReadAttributeInt32u (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeInt32uWithValue:responseHandler:")] - void WriteAttributeInt32u (uint value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeInt64uWithResponseHandler:")] - void ReadAttributeInt64u (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeInt64uWithValue:responseHandler:")] - void WriteAttributeInt64u (ulong value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeInt8sWithResponseHandler:")] - void ReadAttributeInt8s (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeInt8sWithValue:responseHandler:")] - void WriteAttributeInt8s (sbyte value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeInt16sWithResponseHandler:")] - void ReadAttributeInt16s (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeInt16sWithValue:responseHandler:")] - void WriteAttributeInt16s (short value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeInt32sWithResponseHandler:")] - void ReadAttributeInt32s (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeInt32sWithValue:responseHandler:")] - void WriteAttributeInt32s (int value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeInt64sWithResponseHandler:")] - void ReadAttributeInt64s (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeInt64sWithValue:responseHandler:")] - void WriteAttributeInt64s (long value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeEnum8WithResponseHandler:")] - void ReadAttributeEnum8 (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeEnum8WithValue:responseHandler:")] - void WriteAttributeEnum8 (byte value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeEnum16WithResponseHandler:")] - void ReadAttributeEnum16 (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeEnum16WithValue:responseHandler:")] - void WriteAttributeEnum16 (ushort value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeOctetStringWithResponseHandler:")] - void ReadAttributeOctetString (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeOctetStringWithValue:responseHandler:")] - void WriteAttributeOctetString (NSData value, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeListInt8uWithResponseHandler:")] - void ReadAttributeListInt8u (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeListOctetStringWithResponseHandler:")] - void ReadAttributeListOctetString (ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeListStructOctetStringWithResponseHandler:")] - void ReadAttributeListStructOctetString (ChipResponseHandler responseHandler); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeLongOctetStringWithResponseHandler:")] - void ReadAttributeLongOctetString (ChipResponseHandler responseHandler); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeLongOctetStringWithValue:responseHandler:")] - void WriteAttributeLongOctetString (NSData value, ChipResponseHandler responseHandler); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeCharStringWithResponseHandler:")] - void ReadAttributeCharString (ChipResponseHandler responseHandler); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeCharStringWithValue:responseHandler:")] - void WriteAttributeCharString (string value, ChipResponseHandler responseHandler); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeLongCharStringWithResponseHandler:")] - void ReadAttributeLongCharString (ChipResponseHandler responseHandler); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeLongCharStringWithValue:responseHandler:")] - void WriteAttributeLongCharString(string value, ChipResponseHandler responseHandler); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeUnsupportedWithResponseHandler:")] - void ReadAttributeUnsupported (ChipResponseHandler responseHandler); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("writeAttributeUnsupportedWithValue:responseHandler:")] - void WriteAttributeUnsupported (bool boolValue, ChipResponseHandler responseHandler); - - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("readAttributeClusterRevisionWithResponseHandler:")] - void ReadAttributeClusterRevision (ChipResponseHandler responseHandler); - } - [Mac (12,0), Watch (8,0), TV (15,0), iOS (15,0), MacCatalyst (15,0)] [BaseType (typeof (ChipCluster), Name="CHIPThermostat")] [DisableDefaultCtor] @@ -2362,86 +2039,6 @@ interface ChipDevicePairingDelegate void OnAddressUpdated ([NullAllowed] NSError error); } - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - delegate void ChipDeviceConnectionCallback ([NullAllowed] ChipDevice device, [NullAllowed] NSError error); - - [Mac (12,0), Watch (8,0), TV (15,0), iOS (15,0), MacCatalyst (15,0)] - [BaseType (typeof (NSObject), Name="CHIPDeviceController")] - [DisableDefaultCtor] - interface ChipDeviceController - { - [Export ("isRunning")] - bool IsRunning { get; } - -#if !NET - [Obsolete ("This method is removed.")] - [Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromChip) : false", IsVirtual = true)] - [NoMac] // fails on macOS 12 beta 6 - bool PairDevice (ulong deviceId, ushort discriminator, uint setupPinCode, [NullAllowed] out NSError error); -#endif - - [NoMac, Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Export ("pairDevice:discriminator:setupPINCode:csrNonce:error:")] - bool PairDevice (ulong deviceID, ushort discriminator, uint setupPINCode, [NullAllowed] NSData csrNonce, [NullAllowed] out NSError error); - - [Export ("pairDevice:address:port:discriminator:setupPINCode:error:")] - bool PairDevice (ulong deviceId, string address, ushort port, ushort discriminator, uint setupPinCode, [NullAllowed] out NSError error); - - [Export ("pairDeviceWithoutSecurity:address:port:error:")] - bool PairDeviceWithoutSecurity (ulong deviceId, string address, ushort port, [NullAllowed] out NSError error); - - [Export ("pairDevice:onboardingPayload:onboardingPayloadType:error:")] - bool PairDevice (ulong deviceId, string onboardingPayload, ChipOnboardingPayloadType onboardingPayloadType, [NullAllowed] out NSError error); - - [Export ("setListenPort:")] - void SetListenPort (ushort port); - - [Export ("unpairDevice:error:")] - bool UnpairDevice (ulong deviceId, [NullAllowed] out NSError error); - - [Export ("stopDevicePairing:error:")] - bool StopDevicePairing (ulong deviceId, [NullAllowed] out NSError error); - - [Export ("updateDevice:fabricId:")] - void UpdateDevice (ulong deviceId, ulong fabricId); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Export ("isDevicePaired:error:")] - bool IsDevicePaired (ulong deviceID, [NullAllowed] out NSError error); - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Async (ResultTypeName = "ChipReadAttributeResult")] - [Export ("getConnectedDevice:queue:completionHandler:")] - bool GetConnectedDevice (ulong deviceID, DispatchQueue queue, ChipDeviceConnectionCallback completionHandler); - - [Export ("getPairedDevice:error:")] - [return: NullAllowed] - ChipDevice GetPairedDevice (ulong deviceId, [NullAllowed] out NSError error); - - [Static] - [Export ("sharedController")] - ChipDeviceController SharedController { get; } - - [Export ("getControllerNodeId")] - NSNumber ControllerNodeId { get; } - - [Export ("setPairingDelegate:queue:")] - void SetPairingDelegate (IChipDevicePairingDelegate @delegate, DispatchQueue queue); - -#if !NET - [Obsolete ("This method is removed.")] - [Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromChip) : false", IsVirtual = true)] - bool Startup ([NullAllowed] IChipPersistentStorageDelegate storageDelegate); -#endif - - [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] - [Export ("startup:vendorId:nocSigner:")] - bool Startup ([NullAllowed] IChipPersistentStorageDelegate storageDelegate, ushort vendorId, [NullAllowed] IChipKeypair nocSigner); - - [Export ("shutdown")] - bool Shutdown (); - } - interface IChipKeypair {} [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] diff --git a/src/homekit.cs b/src/homekit.cs index fbdc39eb2a8f..464270a5a10c 100644 --- a/src/homekit.cs +++ b/src/homekit.cs @@ -1921,37 +1921,20 @@ interface HMAccessControl { } - [iOS (15,2), NoWatch, NoTV, NoMacCatalyst] - [BaseType (typeof (NSObject))] - interface HMAccessorySetupManager - { - [Async] - [iOS (15,4)] - [Export ("performAccessorySetupUsingRequest:completionHandler:")] - void PerformAccessorySetup (HMAccessorySetupRequest request, Action completion); - - [Async] - [iOS (15,4)] - [Export ("performMatterEcosystemAccessorySetupUsingRequest:topology:completionHandler:")] - void PerformMatterEcosystemAccessorySetup (HMAccessorySetupRequest request, HMMatterTopology topology, Action completion); - - [Deprecated (PlatformName.iOS, 15, 4, message: "Use 'PerformAccessorySetup' instead.")] - [Async] - [Export ("addAndSetUpAccessoriesForTopology:completionHandler:")] - void AddAndSetUpAccessories (HMMatterTopology topology, Action completion); - } - [iOS (15,2), Watch (8,3), TV (15,2), MacCatalyst (15,2)] [BaseType (typeof (NSObject))] [DisableDefaultCtor] interface HMMatterHome : NSCopying, NSSecureCoding { + [Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)] [Export ("uuid", ArgumentSemantic.Strong)] NSUuid Uuid { get; } + [Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)] [Export ("name", ArgumentSemantic.Strong)] string Name { get; } + [Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)] [Export ("initWithUUID:name:")] [DesignatedInitializer] NativeHandle Constructor (NSUuid uuid, string name); @@ -1981,12 +1964,15 @@ interface HMMatterRequestHandler : NSExtensionRequestHandling [DisableDefaultCtor] interface HMMatterRoom : NSCopying, NSSecureCoding { + [Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)] [Export ("uuid", ArgumentSemantic.Strong)] NSUuid Uuid { get; } + [Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)] [Export ("name", ArgumentSemantic.Strong)] string Name { get; } + [Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)] [Export ("initWithUUID:name:")] [DesignatedInitializer] NativeHandle Constructor (NSUuid uuid, string name); @@ -1997,9 +1983,11 @@ interface HMMatterRoom : NSCopying, NSSecureCoding [DisableDefaultCtor] interface HMMatterTopology : NSCopying, NSSecureCoding { + [Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)] [Export ("initWithHomes:")] NativeHandle Constructor (HMMatterHome [] homes); + [Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)] [Export ("homes", ArgumentSemantic.Copy)] HMMatterHome [] Homes { get; } } diff --git a/src/uikit.cs b/src/uikit.cs index f5b05d16f769..a338ba72ee7f 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -18785,6 +18785,8 @@ interface UIFocusDebugger { [Export ("simulateFocusUpdateRequestFromEnvironment:")] IUIFocusDebuggerOutput SimulateFocusUpdateRequest (IUIFocusEnvironment environment); + // Removed from headers in Xcode 14 + [Wrap ("true ? throw new InvalidOperationException (Constants.ApiRemovedGeneral) : false", IsVirtual = true)] [TV (15,0), NoWatch, iOS (15,0), MacCatalyst (15,0)] [Static] [Export ("checkFocusGroupTreeForEnvironment:")] From c6cc110fc8e7c612fadcd08805dfbef1136acba2 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Tue, 20 Sep 2022 11:21:39 -0500 Subject: [PATCH 02/10] Add homekit obsolete constant to compat shim --- src/HomeKit/HMCompat.cs | 102 ++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/src/HomeKit/HMCompat.cs b/src/HomeKit/HMCompat.cs index 8ec7e535ca9e..fc62ee20ca4c 100644 --- a/src/HomeKit/HMCompat.cs +++ b/src/HomeKit/HMCompat.cs @@ -30,19 +30,19 @@ namespace HomeKit { [Register ("HMCHIPServiceRequestHandler", SkipRegistration = true)] public class HMChipServiceRequestHandler : NSObject, INSExtensionRequestHandling { - public override IntPtr ClassHandle => throw new InvalidOperationException (); + public override IntPtr ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit); - public HMChipServiceRequestHandler () => throw new InvalidOperationException (); - protected HMChipServiceRequestHandler (NSObjectFlag t) => throw new InvalidOperationException (); - protected HMChipServiceRequestHandler (IntPtr handle) => throw new InvalidOperationException (); + public HMChipServiceRequestHandler () => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + protected HMChipServiceRequestHandler (NSObjectFlag t) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + protected HMChipServiceRequestHandler (IntPtr handle) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); - public virtual void BeginRequestWithExtensionContext (NSExtensionContext context) => throw new InvalidOperationException (); - public virtual void ConfigureAccessory (string accessoryName, HMChipServiceRoom accessoryRoom, Action completion) => throw new InvalidOperationException (); - public virtual Task ConfigureAccessoryAsync (string accessoryName, HMChipServiceRoom accessoryRoom) => throw new InvalidOperationException (); - public virtual void FetchRooms (HMChipServiceHome home, FetchRoomHandler completion) => throw new InvalidOperationException (); - public virtual Task> FetchRoomsAsync (HMChipServiceHome home) => throw new InvalidOperationException (); - public virtual void PairAccessory (HMChipServiceHome home, string onboardingPayload, Action completion) => throw new InvalidOperationException (); - public virtual Task PairAccessoryAsync (HMChipServiceHome home, string onboardingPayload) => throw new InvalidOperationException (); + public virtual void BeginRequestWithExtensionContext (NSExtensionContext context) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual void ConfigureAccessory (string accessoryName, HMChipServiceRoom accessoryRoom, Action completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual Task ConfigureAccessoryAsync (string accessoryName, HMChipServiceRoom accessoryRoom) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual void FetchRooms (HMChipServiceHome home, FetchRoomHandler completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual Task> FetchRoomsAsync (HMChipServiceHome home) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual void PairAccessory (HMChipServiceHome home, string onboardingPayload, Action completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual Task PairAccessoryAsync (HMChipServiceHome home, string onboardingPayload) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); } /* class HMChipServiceRequestHandler */ @@ -50,16 +50,16 @@ public class HMChipServiceRequestHandler : NSObject, INSExtensionRequestHandling [Register ("HMCHIPServiceTopology", SkipRegistration = true)] public class HMChipServiceTopology : NSObject, INSCoding, INSCopying, INSSecureCoding { - public override IntPtr ClassHandle => throw new InvalidOperationException (); + public override IntPtr ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit); - protected HMChipServiceTopology (IntPtr handle) => throw new InvalidOperationException (); - public HMChipServiceTopology (NSCoder coder) => throw new InvalidOperationException (); - protected HMChipServiceTopology (NSObjectFlag t) => throw new InvalidOperationException (); - public HMChipServiceTopology (HMChipServiceHome[] homes) => throw new InvalidOperationException (); + protected HMChipServiceTopology (IntPtr handle) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public HMChipServiceTopology (NSCoder coder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + protected HMChipServiceTopology (NSObjectFlag t) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public HMChipServiceTopology (HMChipServiceHome[] homes) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); - public virtual NSObject Copy (NSZone? zone) => throw new InvalidOperationException (); - public virtual void EncodeTo (NSCoder encoder) => throw new InvalidOperationException (); - public virtual HMChipServiceHome[] Homes => throw new InvalidOperationException (); + public virtual NSObject Copy (NSZone? zone) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual void EncodeTo (NSCoder encoder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual HMChipServiceHome[] Homes => throw new InvalidOperationException (Constants.RemovedFromHomeKit); } /* class HMChipServiceTopology */ @@ -67,17 +67,17 @@ public class HMChipServiceTopology : NSObject, INSCoding, INSCopying, INSSecureC [Register("HMCHIPServiceRoom", SkipRegistration = true)] public class HMChipServiceRoom : NSObject, INSCoding, INSCopying, INSSecureCoding { - public override IntPtr ClassHandle => throw new InvalidOperationException (); + public override IntPtr ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit); - protected HMChipServiceRoom (IntPtr handle) => throw new InvalidOperationException (); - public HMChipServiceRoom (NSCoder coder) => throw new InvalidOperationException (); - protected HMChipServiceRoom (NSObjectFlag t) => throw new InvalidOperationException (); - public HMChipServiceRoom (NSUuid uuid, string name) => throw new InvalidOperationException (); + protected HMChipServiceRoom (IntPtr handle) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public HMChipServiceRoom (NSCoder coder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + protected HMChipServiceRoom (NSObjectFlag t) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public HMChipServiceRoom (NSUuid uuid, string name) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); - public virtual NSObject Copy (NSZone? zone)=> throw new InvalidOperationException (); - public virtual void EncodeTo (NSCoder encoder) => throw new InvalidOperationException (); - public virtual string Name => throw new InvalidOperationException (); - public virtual NSUuid Uuid => throw new InvalidOperationException (); + public virtual NSObject Copy (NSZone? zone)=> throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual void EncodeTo (NSCoder encoder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual string Name => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual NSUuid Uuid => throw new InvalidOperationException (Constants.RemovedFromHomeKit); } /* class HMChipServiceRoom */ @@ -85,44 +85,44 @@ public class HMChipServiceRoom : NSObject, INSCoding, INSCopying, INSSecureCodin [Register("HMCHIPServiceHome", SkipRegistration = true)] public partial class HMChipServiceHome : NSObject, INSCoding, INSCopying, INSSecureCoding { - public override IntPtr ClassHandle => throw new InvalidOperationException (); + public override IntPtr ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit); - protected HMChipServiceHome (IntPtr handle) => throw new InvalidOperationException (); - public HMChipServiceHome (NSCoder coder) => throw new InvalidOperationException (); - protected HMChipServiceHome (NSObjectFlag t) => throw new InvalidOperationException (); + protected HMChipServiceHome (IntPtr handle) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public HMChipServiceHome (NSCoder coder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + protected HMChipServiceHome (NSObjectFlag t) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); - public HMChipServiceHome (NSUuid uuid, string name) => throw new InvalidOperationException (); - public virtual NSObject Copy (NSZone? zone) => throw new InvalidOperationException (); + public HMChipServiceHome (NSUuid uuid, string name) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual NSObject Copy (NSZone? zone) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); - public virtual void EncodeTo (NSCoder encoder) => throw new InvalidOperationException (); - public virtual string Name => throw new InvalidOperationException (); - public virtual NSUuid Uuid => throw new InvalidOperationException (); + public virtual void EncodeTo (NSCoder encoder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual string Name => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual NSUuid Uuid => throw new InvalidOperationException (Constants.RemovedFromHomeKit); } /* class HMChipServiceHome */ public partial class HMAccessorySetupManager { #pragma warning disable CS0618 // HMChipServiceTopology and HMErrorHandler is obsolete - public virtual void AddAndSetUpAccessories (HMChipServiceTopology topology, HMErrorHandler completion) => throw new InvalidOperationException (); - public virtual Task AddAndSetUpAccessoriesAsync (HMChipServiceTopology topology) => throw new InvalidOperationException (); + public virtual void AddAndSetUpAccessories (HMChipServiceTopology topology, HMErrorHandler completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual Task AddAndSetUpAccessoriesAsync (HMChipServiceTopology topology) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); #pragma warning restore CS0618 // HMChipServiceTopology and HMErrorHandler is obsolete } #endif // !NET #if __IOS__ && !__MACCATALYST__ public unsafe partial class HMAccessorySetupManager : NSObject { - public override NativeHandle ClassHandle => throw new InvalidOperationException (); - - public HMAccessorySetupManager () : base (NSObjectFlag.Empty) => throw new InvalidOperationException (); - protected HMAccessorySetupManager (NSObjectFlag t) : base (t) => throw new InvalidOperationException (); - protected internal HMAccessorySetupManager (NativeHandle handle) : base (handle) => throw new InvalidOperationException (); - - public virtual void AddAndSetUpAccessories (HMMatterTopology topology, Action completion) => throw new InvalidOperationException (); - public virtual Task AddAndSetUpAccessoriesAsync (HMMatterTopology topology) => throw new InvalidOperationException (); - public virtual void PerformAccessorySetup (HMAccessorySetupRequest request, Action completion) => throw new InvalidOperationException (); - public virtual Task PerformAccessorySetupAsync (HMAccessorySetupRequest request) => throw new InvalidOperationException (); - public virtual void PerformMatterEcosystemAccessorySetup (HMAccessorySetupRequest request, HMMatterTopology topology, Action completion) => throw new InvalidOperationException (); - public virtual Task PerformMatterEcosystemAccessorySetupAsync (HMAccessorySetupRequest request, HMMatterTopology topology) => throw new InvalidOperationException (); + public override NativeHandle ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + + public HMAccessorySetupManager () : base (NSObjectFlag.Empty) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + protected HMAccessorySetupManager (NSObjectFlag t) : base (t) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + protected internal HMAccessorySetupManager (NativeHandle handle) : base (handle) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + + public virtual void AddAndSetUpAccessories (HMMatterTopology topology, Action completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual Task AddAndSetUpAccessoriesAsync (HMMatterTopology topology) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual void PerformAccessorySetup (HMAccessorySetupRequest request, Action completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual Task PerformAccessorySetupAsync (HMAccessorySetupRequest request) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual void PerformMatterEcosystemAccessorySetup (HMAccessorySetupRequest request, HMMatterTopology topology, Action completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); + public virtual Task PerformMatterEcosystemAccessorySetupAsync (HMAccessorySetupRequest request, HMMatterTopology topology) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); } #endif } From 7400663f4864195ee1821922a249b28245249892 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Wed, 21 Sep 2022 10:40:18 -0500 Subject: [PATCH 03/10] [tests] Fix introspection/xtro test failures from selector removal --- tests/introspection/iOS/iOSApiCtorInitTest.cs | 3 +++ .../xtro-sharpie/api-annotations-dotnet/iOS-HomeKit.ignore | 5 +++++ tests/xtro-sharpie/iOS-HomeKit.ignore | 6 ++++++ 3 files changed, 14 insertions(+) create mode 100644 tests/xtro-sharpie/api-annotations-dotnet/iOS-HomeKit.ignore diff --git a/tests/introspection/iOS/iOSApiCtorInitTest.cs b/tests/introspection/iOS/iOSApiCtorInitTest.cs index 7a2c4905de30..eefe38a0685c 100644 --- a/tests/introspection/iOS/iOSApiCtorInitTest.cs +++ b/tests/introspection/iOS/iOSApiCtorInitTest.cs @@ -249,6 +249,9 @@ protected override bool Skip (Type type) return true; break; #endif + case "HMAccessorySetupManager": + // Selector fails submission test in Xcode 14.0 timeframe + return true; } return base.Skip (type); } diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-HomeKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-HomeKit.ignore new file mode 100644 index 000000000000..658616c9dd72 --- /dev/null +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-HomeKit.ignore @@ -0,0 +1,5 @@ +# These performMatterEcosystemAccessorySetupUsingRequest:topology:completionHandler: now fails submission tests +# And the type was stubbed away as it was not usable +!missing-selector! HMAccessorySetupManager::performAccessorySetupUsingRequest:completionHandler: not bound +!missing-selector! HMAccessorySetupManager::performMatterEcosystemAccessorySetupUsingRequest:topology:completionHandler: not bound +!missing-type! HMAccessorySetupManager not bound \ No newline at end of file diff --git a/tests/xtro-sharpie/iOS-HomeKit.ignore b/tests/xtro-sharpie/iOS-HomeKit.ignore index 5c2849efd525..e3fbd323b695 100644 --- a/tests/xtro-sharpie/iOS-HomeKit.ignore +++ b/tests/xtro-sharpie/iOS-HomeKit.ignore @@ -1,2 +1,8 @@ # This is deprecated in Xcode 13.3 and its companion member is deprecated on 15.4 !deprecated-attribute-wrong! HMHome::addAndSetupAccessoriesWithPayload:completionHandler: has 15.4 not 15.0 on [Deprecated] attribute + +# These performMatterEcosystemAccessorySetupUsingRequest:topology:completionHandler: now fails submission tests +# And the type was stubbed away as it was not usable +!missing-selector! HMAccessorySetupManager::performAccessorySetupUsingRequest:completionHandler: not bound +!missing-selector! HMAccessorySetupManager::performMatterEcosystemAccessorySetupUsingRequest:topology:completionHandler: not bound +!missing-type! HMAccessorySetupManager not bound \ No newline at end of file From aabb84cb9733996afeccf411746647523d0f4017 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Wed, 21 Sep 2022 11:56:19 -0500 Subject: [PATCH 04/10] Add [Obsolete] attributes to homekit/chip stubs --- src/Chip/ChipCompat.cs | 4 ++++ src/HomeKit/HMCompat.cs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/Chip/ChipCompat.cs b/src/Chip/ChipCompat.cs index ebff1760b3c0..ab2d059b7d76 100644 --- a/src/Chip/ChipCompat.cs +++ b/src/Chip/ChipCompat.cs @@ -143,6 +143,7 @@ public virtual Task GoToTiltValueAsync (ushort tiltValu [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] public delegate void ChipDeviceConnectionCallback (ChipDevice device, NSError error); + [Obsolete ("This class is removed.")] [Register("CHIPDeviceController", true)] public partial class ChipDeviceController : NSObject { public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } @@ -196,6 +197,7 @@ public partial class ChipDeviceController : NSObject { public static ChipDeviceController SharedController => throw new InvalidOperationException (Constants.RemovedFromChip); } + [Obsolete ("This class is removed.")] [Register("CHIPLowPower", true)] public partial class ChipLowPower : ChipCluster { public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } @@ -219,6 +221,7 @@ public ChipLowPower (ChipDevice device, byte endpoint, global::CoreFoundation.Di public virtual Task SleepAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); } + [Obsolete ("This class is removed.")] [Register("CHIPTestCluster", true)] public partial class ChipTestCluster : ChipCluster { public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } @@ -435,6 +438,7 @@ public ChipTestCluster (ChipDevice device, byte endpoint, global::CoreFoundation public virtual Task WriteAttributeUnsupportedAsync (bool boolValue) => throw new InvalidOperationException (Constants.RemovedFromChip); } + [Obsolete ("This class is removed.")] [Register("CHIPGeneralCommissioning", true)] public partial class ChipGeneralCommissioning : ChipCluster { public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } diff --git a/src/HomeKit/HMCompat.cs b/src/HomeKit/HMCompat.cs index fc62ee20ca4c..f2738ff98b93 100644 --- a/src/HomeKit/HMCompat.cs +++ b/src/HomeKit/HMCompat.cs @@ -100,6 +100,7 @@ public partial class HMChipServiceHome : NSObject, INSCoding, INSCopying, INSSec } /* class HMChipServiceHome */ + [Obsolete ("This class is removed.")] public partial class HMAccessorySetupManager { #pragma warning disable CS0618 // HMChipServiceTopology and HMErrorHandler is obsolete @@ -110,6 +111,7 @@ public partial class HMAccessorySetupManager { #endif // !NET #if __IOS__ && !__MACCATALYST__ + [Obsolete ("This class is removed.")] public unsafe partial class HMAccessorySetupManager : NSObject { public override NativeHandle ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit); From 3eb43b4813f9518f9823ac5f2c0d6fc5c78b6e87 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 22 Sep 2022 09:31:52 -0500 Subject: [PATCH 05/10] [xtro] Ignore CHIPDeviceController --- tests/xtro-sharpie/common-CHIP.ignore | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/xtro-sharpie/common-CHIP.ignore b/tests/xtro-sharpie/common-CHIP.ignore index 70239e064663..1a41da07a2c5 100644 --- a/tests/xtro-sharpie/common-CHIP.ignore +++ b/tests/xtro-sharpie/common-CHIP.ignore @@ -4,3 +4,19 @@ !missing-field! CHIPSizeThreadMasterKey not bound !missing-field! CHIPSizeThreadNetworkName not bound !missing-field! CHIPSizeThreadPSKc not bound + +# These ChipDeviceController sharedController now fails submission tests +# And the type was stubbed away as it was not usable +!missing-selector! +CHIPDeviceController::sharedController not bound +!missing-selector! CHIPDeviceController::getConnectedDevice:queue:completionHandler: not bound +!missing-selector! CHIPDeviceController::getControllerNodeId not bound +!missing-selector! CHIPDeviceController::isDevicePaired:error: not bound +!missing-selector! CHIPDeviceController::isRunning not bound +!missing-selector! CHIPDeviceController::pairDevice:address:port:discriminator:setupPINCode:error: not bound +!missing-selector! CHIPDeviceController::setListenPort: not bound +!missing-selector! CHIPDeviceController::setPairingDelegate:queue: not bound +!missing-selector! CHIPDeviceController::shutdown not bound +!missing-selector! CHIPDeviceController::startup:vendorId:nocSigner: not bound +!missing-selector! CHIPDeviceController::stopDevicePairing:error: not bound +!missing-selector! CHIPDeviceController::unpairDevice:error: not bound +!missing-selector! CHIPDeviceController::updateDevice:fabricId: not bound \ No newline at end of file From 692ee8e90ad51d8e7671341b3f29fc58e369354a Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 23 Sep 2022 08:01:32 +0200 Subject: [PATCH 06/10] Fix duplicate Obsolete attribute. --- src/HomeKit/HMCompat.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/HomeKit/HMCompat.cs b/src/HomeKit/HMCompat.cs index f2738ff98b93..1d8769b06026 100644 --- a/src/HomeKit/HMCompat.cs +++ b/src/HomeKit/HMCompat.cs @@ -111,7 +111,9 @@ public partial class HMAccessorySetupManager { #endif // !NET #if __IOS__ && !__MACCATALYST__ +#if NET [Obsolete ("This class is removed.")] +#endif public unsafe partial class HMAccessorySetupManager : NSObject { public override NativeHandle ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit); From d31fdcfc3db3298eb844520a606fb70db81be1f6 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 23 Sep 2022 14:27:26 +0200 Subject: [PATCH 07/10] Don't add compat API. --- src/Chip/ChipCompat.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Chip/ChipCompat.cs b/src/Chip/ChipCompat.cs index ab2d059b7d76..3b2225dd36d5 100644 --- a/src/Chip/ChipCompat.cs +++ b/src/Chip/ChipCompat.cs @@ -162,12 +162,14 @@ public partial class ChipDeviceController : NSObject { public virtual bool IsDevicePaired (ulong deviceID, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); +#if !NET && !__MACOS__ [Obsolete ("This method is removed.", false)] - [Unavailable (PlatformName.MacOSX, ObjCRuntime.PlatformArchitecture.All)] public virtual bool PairDevice (ulong deviceId, ushort discriminator, uint setupPinCode, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); +#endif - [Unavailable (PlatformName.MacOSX, ObjCRuntime.PlatformArchitecture.All)] +#if !__MACOS__ public virtual bool PairDevice (ulong deviceID, ushort discriminator, uint setupPINCode, NSData? csrNonce, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); +#endif public virtual bool PairDevice (ulong deviceId, string address, ushort port, ushort discriminator, uint setupPinCode, out NSError? error) => throw new InvalidOperationException (Constants.RemovedFromChip); From d97c3d02cd21c3a938d4225f212e0082f0ad6ba2 Mon Sep 17 00:00:00 2001 From: GitHub Actions Autoformatter Date: Fri, 23 Sep 2022 12:55:25 +0000 Subject: [PATCH 08/10] Auto-format source code --- tools/common/StringUtils.cs | 23 +++++++++++------------ tools/xibuild/Main.cs | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tools/common/StringUtils.cs b/tools/common/StringUtils.cs index df6fd1961f64..54a3a849888f 100644 --- a/tools/common/StringUtils.cs +++ b/tools/common/StringUtils.cs @@ -3,24 +3,24 @@ using System.Linq; using System.Text; -#nullable enable +#nullable enable namespace Xamarin.Utils { internal class StringUtils { static StringUtils () { PlatformID pid = Environment.OSVersion.Platform; - if (((int)pid != 128 && pid != PlatformID.Unix && pid != PlatformID.MacOSX)) + if (((int) pid != 128 && pid != PlatformID.Unix && pid != PlatformID.MacOSX)) shellQuoteChar = '"'; // Windows else shellQuoteChar = '\''; // !Windows } static char shellQuoteChar; - static char[] mustQuoteCharacters = new char [] { ' ', '\'', ',', '$', '\\' }; + static char [] mustQuoteCharacters = new char [] { ' ', '\'', ',', '$', '\\' }; static char [] mustQuoteCharactersProcess = { ' ', '\\', '"', '\'' }; - public static string[]? Quote (params string[] array) + public static string []? Quote (params string [] array) { if (array is null || array.Length == 0) return array; @@ -53,14 +53,14 @@ public static string Quote (string f) return s.ToString (); } - public static string[]? QuoteForProcess (IList arguments) + public static string []? QuoteForProcess (IList arguments) { if (arguments is null) return Array.Empty (); return QuoteForProcess (arguments.ToArray ()); } - public static string[]? QuoteForProcess (params string [] array) + public static string []? QuoteForProcess (params string [] array) { if (array is null || array.Length == 0) return array; @@ -184,7 +184,7 @@ public static bool TryParseArguments (string quotedArguments, out string []? arg } else if (qchar == '\0' && (c == '\'' || c == '"')) { string sofar = builder.ToString (); - if (GetArgument (builder, buf, i, out endIndex, out ex) is string embedded ) { + if (GetArgument (builder, buf, i, out endIndex, out ex) is string embedded) { i = endIndex; builder.Clear (); builder.Append (sofar); @@ -212,7 +212,7 @@ public static bool TryParseArguments (string quotedArguments, out string []? arg return builder.ToString (); } - + // Version.Parse requires, minimally, both major and minor parts. // However we want to accept `11` as `11.0` public static Version ParseVersion (string v) @@ -224,20 +224,19 @@ public static Version ParseVersion (string v) } } - static class StringExtensions - { + static class StringExtensions { internal static string [] SplitLines (this string s) => s.Split (new [] { Environment.NewLine }, StringSplitOptions.None); // Adds an element to an array and returns a new array with the added element. // The original array is not modified. // If the original array is null, a new array is also created, with just the new value. - internal static T [] CopyAndAdd(this T[] array, T value) + internal static T [] CopyAndAdd (this T [] array, T value) { if (array is null || array.Length == 0) return new T [] { value }; var tmpArray = array; Array.Resize (ref array, array.Length + 1); - tmpArray[tmpArray.Length - 1] = value; + tmpArray [tmpArray.Length - 1] = value; return tmpArray; } } diff --git a/tools/xibuild/Main.cs b/tools/xibuild/Main.cs index 0e100e1199c7..f83c51972980 100644 --- a/tools/xibuild/Main.cs +++ b/tools/xibuild/Main.cs @@ -236,7 +236,7 @@ void SetToolsetProperty (string name, string value) return; // MSBuild property names are case insensitive - var valueAttribute = toolsets.SelectSingleNode ($"property[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')='{name.ToLowerInvariant()}']/@value"); + var valueAttribute = toolsets.SelectSingleNode ($"property[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')='{name.ToLowerInvariant ()}']/@value"); if (valueAttribute != null) { valueAttribute.Value = value; } else { From bc7538aa729ab315bbeb1cdf4a758ccc21069fd7 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 23 Sep 2022 15:02:43 +0200 Subject: [PATCH 09/10] Revert "Auto-format source code" This reverts commit d97c3d02cd21c3a938d4225f212e0082f0ad6ba2. --- tools/common/StringUtils.cs | 23 ++++++++++++----------- tools/xibuild/Main.cs | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tools/common/StringUtils.cs b/tools/common/StringUtils.cs index 54a3a849888f..df6fd1961f64 100644 --- a/tools/common/StringUtils.cs +++ b/tools/common/StringUtils.cs @@ -3,24 +3,24 @@ using System.Linq; using System.Text; -#nullable enable +#nullable enable namespace Xamarin.Utils { internal class StringUtils { static StringUtils () { PlatformID pid = Environment.OSVersion.Platform; - if (((int) pid != 128 && pid != PlatformID.Unix && pid != PlatformID.MacOSX)) + if (((int)pid != 128 && pid != PlatformID.Unix && pid != PlatformID.MacOSX)) shellQuoteChar = '"'; // Windows else shellQuoteChar = '\''; // !Windows } static char shellQuoteChar; - static char [] mustQuoteCharacters = new char [] { ' ', '\'', ',', '$', '\\' }; + static char[] mustQuoteCharacters = new char [] { ' ', '\'', ',', '$', '\\' }; static char [] mustQuoteCharactersProcess = { ' ', '\\', '"', '\'' }; - public static string []? Quote (params string [] array) + public static string[]? Quote (params string[] array) { if (array is null || array.Length == 0) return array; @@ -53,14 +53,14 @@ public static string Quote (string f) return s.ToString (); } - public static string []? QuoteForProcess (IList arguments) + public static string[]? QuoteForProcess (IList arguments) { if (arguments is null) return Array.Empty (); return QuoteForProcess (arguments.ToArray ()); } - public static string []? QuoteForProcess (params string [] array) + public static string[]? QuoteForProcess (params string [] array) { if (array is null || array.Length == 0) return array; @@ -184,7 +184,7 @@ public static bool TryParseArguments (string quotedArguments, out string []? arg } else if (qchar == '\0' && (c == '\'' || c == '"')) { string sofar = builder.ToString (); - if (GetArgument (builder, buf, i, out endIndex, out ex) is string embedded) { + if (GetArgument (builder, buf, i, out endIndex, out ex) is string embedded ) { i = endIndex; builder.Clear (); builder.Append (sofar); @@ -212,7 +212,7 @@ public static bool TryParseArguments (string quotedArguments, out string []? arg return builder.ToString (); } - + // Version.Parse requires, minimally, both major and minor parts. // However we want to accept `11` as `11.0` public static Version ParseVersion (string v) @@ -224,19 +224,20 @@ public static Version ParseVersion (string v) } } - static class StringExtensions { + static class StringExtensions + { internal static string [] SplitLines (this string s) => s.Split (new [] { Environment.NewLine }, StringSplitOptions.None); // Adds an element to an array and returns a new array with the added element. // The original array is not modified. // If the original array is null, a new array is also created, with just the new value. - internal static T [] CopyAndAdd (this T [] array, T value) + internal static T [] CopyAndAdd(this T[] array, T value) { if (array is null || array.Length == 0) return new T [] { value }; var tmpArray = array; Array.Resize (ref array, array.Length + 1); - tmpArray [tmpArray.Length - 1] = value; + tmpArray[tmpArray.Length - 1] = value; return tmpArray; } } diff --git a/tools/xibuild/Main.cs b/tools/xibuild/Main.cs index f83c51972980..0e100e1199c7 100644 --- a/tools/xibuild/Main.cs +++ b/tools/xibuild/Main.cs @@ -236,7 +236,7 @@ void SetToolsetProperty (string name, string value) return; // MSBuild property names are case insensitive - var valueAttribute = toolsets.SelectSingleNode ($"property[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')='{name.ToLowerInvariant ()}']/@value"); + var valueAttribute = toolsets.SelectSingleNode ($"property[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')='{name.ToLowerInvariant()}']/@value"); if (valueAttribute != null) { valueAttribute.Value = value; } else { From 82423bb734a85fc6e30e71f0ceb6ad1ca72258d6 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Mon, 26 Sep 2022 12:09:40 -0500 Subject: [PATCH 10/10] Fix test, and also wrap in XAMCORE_5_0 --- src/HomeKit/HMCompat.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/HomeKit/HMCompat.cs b/src/HomeKit/HMCompat.cs index 1d8769b06026..afdb4dfb27de 100644 --- a/src/HomeKit/HMCompat.cs +++ b/src/HomeKit/HMCompat.cs @@ -8,6 +8,7 @@ // using System; +using System.ComponentModel; using System.Threading.Tasks; using Foundation; using CoreFoundation; @@ -110,8 +111,10 @@ public partial class HMAccessorySetupManager { } #endif // !NET +#if !XAMCORE_5_0 #if __IOS__ && !__MACCATALYST__ #if NET + [EditorBrowsable (EditorBrowsableState.Never)] [Obsolete ("This class is removed.")] #endif public unsafe partial class HMAccessorySetupManager : NSObject { @@ -129,4 +132,5 @@ public unsafe partial class HMAccessorySetupManager : NSObject { public virtual Task PerformMatterEcosystemAccessorySetupAsync (HMAccessorySetupRequest request, HMMatterTopology topology) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); } #endif +#endif }