Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HomeKit] Added support to Xcode 14.1 b1-b3 #16069

Merged
merged 11 commits into from
Oct 13, 2022
84 changes: 17 additions & 67 deletions src/homekit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ partial interface HMHomeManager {
[Protocolize]
HMHomeManagerDelegate Delegate { get; set; }

[Deprecated (PlatformName.MacOSX, 13,0, message: "No longer supported.")]
[Deprecated (PlatformName.iOS, 16,1, message: "No longer supported.")]
[Deprecated (PlatformName.MacCatalyst, 16,1, message: "No longer supported.")]
[Deprecated (PlatformName.WatchOS, 9,1, message: "No longer supported.")]
[Deprecated (PlatformName.TvOS, 16,1, message: "No longer supported.")]
[NullAllowed, Export ("primaryHome", ArgumentSemantic.Retain)]
HMHome PrimaryHome { get; }

Expand All @@ -47,6 +52,9 @@ partial interface HMHomeManager {

[NoTV]
[NoWatch]
[Deprecated (PlatformName.MacOSX, 13, 0, message: "No longer supported.")]
[Deprecated (PlatformName.iOS, 16,1, message: "No longer supported.")]
[Deprecated (PlatformName.MacCatalyst, 16,1, message: "No longer supported.")]
[Async]
[Export ("updatePrimaryHome:completionHandler:")]
void UpdatePrimaryHome (HMHome home, Action<NSError> completion);
Expand Down Expand Up @@ -166,6 +174,10 @@ partial interface HMAccessory {
[NullAllowed, Export ("firmwareVersion")]
string FirmwareVersion { get; }

[Mac (13,0), iOS (16,1), MacCatalyst (16,1), Watch (9,1), TV (16,1)]
[Export ("matterNodeID", ArgumentSemantic.Copy)]
NSNumber MatterNodeId { get; }

[NoTV]
[NoWatch]
[Async]
Expand Down Expand Up @@ -537,7 +549,6 @@ partial interface HMCharacteristicWriteAction {

[NoTV]
[NoWatch]
[DesignatedInitializer]
[Export ("initWithCharacteristic:targetValue:")]
#if XAMCORE_3_0
NativeHandle Constructor (HMCharacteristic characteristic, INSCopying targetValue);
Expand Down Expand Up @@ -1921,75 +1932,14 @@ interface HMAccessControl {

}

[iOS (15,2), Watch (8,3), TV (15,2), MacCatalyst (15,2)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface HMMatterHome : NSCopying, NSSecureCoding
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it intentional to remove these types?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, since it won't compile without them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this addressed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nevermind! I see that's what those added classes are there for!

{
[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);
}

delegate void HMFetchRoomHandler (HMMatterRoom [] rooms, NSError error);

[iOS (15,2), Watch (8,3), TV (15,2), MacCatalyst (15,2)]
[iOS (15,2), NoWatch, NoTV, NoMacCatalyst]
[BaseType (typeof (NSObject))]
interface HMMatterRequestHandler : NSExtensionRequestHandling
interface HMAccessorySetupManager
{
[Async]
[Export ("fetchRoomsInHome:completion:")]
void FetchRooms (HMMatterHome home, HMFetchRoomHandler completion);

[Async]
[Export ("pairAccessoryInHome:onboardingPayload:completion:")]
void PairAccessory (HMMatterHome home, string onboardingPayload, Action<NSError> completion);

[Async]
[Export ("configureAccessoryWithName:room:completion:")]
void ConfigureAccessory (string accessoryName, HMMatterRoom accessoryRoom, Action<NSError> completion);
}

[iOS (15,2), Watch (8,3), TV (15,2), MacCatalyst (15,2)]
[BaseType (typeof (NSObject))]
[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);
}

[iOS (15,2), Watch (8,3), TV (15,2), MacCatalyst (15,2)]
[BaseType (typeof (NSObject))]
[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; }
[iOS (15,4)]
[Export ("performAccessorySetupUsingRequest:completionHandler:")]
void PerformAccessorySetup (HMAccessorySetupRequest request, Action<HMAccessorySetupResult, NSError> completion);
}

[NoWatch, NoTV, NoMacCatalyst, NoMac, iOS (15,4)]
Expand Down