From 364001db6fca752eca298c478aea2e1e5c803a7c Mon Sep 17 00:00:00 2001 From: Israel Soto Date: Fri, 23 Sep 2022 15:00:18 -0500 Subject: [PATCH 1/3] [CoreMotion] Added support for Xcode 14.1 b1 --- src/coremotion.cs | 114 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/src/coremotion.cs b/src/coremotion.cs index e5b36154f5c9..c374172524ed 100644 --- a/src/coremotion.cs +++ b/src/coremotion.cs @@ -859,4 +859,118 @@ interface CMRecordedPressureData { NSDate StartDate { get; } } + [NoMac, NoiOS, NoMacCatalyst, Watch (9,0), NoTV] + [Native] + public enum CMWaterSubmersionState : long + { + Unknown = 0, + NotSubmerged, + Submerged + } + + [NoMac, NoiOS, NoMacCatalyst, Watch (9,0), NoTV] + [Native] + public enum CMWaterSubmersionDepthState : long + { + Unknown = 0, + NotSubmerged = 100, + SubmergedShallow = 200, + SubmergedDeep = 300, + ApproachingMaxDepth = 400, + PastMaxDepth = 500, + SensorDepthError = 600 + } + + [NoMac, NoiOS, NoMacCatalyst, Watch (9,0), NoTV] + [BaseType (typeof (NSObject))] + interface CMWaterSubmersionEvent : NSSecureCoding, NSCopying + { + [Export ("date")] + NSDate Date { get; } + + [Export ("state")] + CMWaterSubmersionState State { get; } + } + + [NoMac, NoiOS, NoMacCatalyst, Watch (9,0), NoTV] + [BaseType (typeof (NSObject))] + interface CMWaterSubmersionMeasurement : NSSecureCoding, NSCopying + { + [Export ("date")] + NSDate Date { get; } + + [NullAllowed, Export ("depth")] + NSMeasurement Depth { get; } + + [NullAllowed, Export ("pressure")] + NSMeasurement Pressure { get; } + + [Export ("surfacePressure")] + NSMeasurement SurfacePressure { get; } + + [Export ("submersionState")] + CMWaterSubmersionDepthState SubmersionState { get; } + } + + [NoMac, NoiOS, NoMacCatalyst, Watch (9,0), NoTV] + [BaseType (typeof (NSObject))] + interface CMWaterTemperature : NSSecureCoding, NSCopying + { + [Export ("date")] + NSDate Date { get; } + + [Export ("temperature")] + NSMeasurement Temperature { get; } + + [Export ("temperatureUncertainty")] + NSMeasurement TemperatureUncertainty { get; } + } + + interface ICMWaterSubmersionManagerDelegate { } + + [NoMac, NoiOS, NoMacCatalyst, Watch (9,0), NoTV] +#if NET + [Protocol, Model] +#else + [Protocol, Model (AutoGeneratedName = true)] +#endif + [BaseType (typeof (NSObject))] + interface CMWaterSubmersionManagerDelegate + { + [Abstract] + [Export ("manager:didUpdateEvent:")] + void DidUpdateEvent (CMWaterSubmersionManager manager, CMWaterSubmersionEvent @event); + + [Abstract] + [Export ("manager:didUpdateMeasurement:")] + void DidUpdateMeasurement (CMWaterSubmersionManager manager, CMWaterSubmersionMeasurement measurement); + + [Abstract] + [Export ("manager:didUpdateTemperature:")] + void DidUpdateTemperature (CMWaterSubmersionManager manager, CMWaterTemperature measurement); + + [Abstract] + [Export ("manager:errorOccurred:")] + void ErrorOccurred (CMWaterSubmersionManager manager, NSError error); + } + + [NoMac, NoiOS, NoMacCatalyst, Watch (9,0), NoTV] + [BaseType (typeof (NSObject))] + interface CMWaterSubmersionManager + { + [Wrap ("WeakDelegate")] + [NullAllowed] + ICMWaterSubmersionManagerDelegate Delegate { get; set; } + + [NullAllowed, Export ("delegate", ArgumentSemantic.Weak)] + NSObject WeakDelegate { get; set; } + + [Static] + [Export ("waterSubmersionAvailable")] + bool IsWaterSubmersionAvailable { get; } + + [Static] + [Export ("authorizationStatus")] + CMAuthorizationStatus AuthorizationStatus { get; } + } } From 719fd80b2868ccb9023751a260ce1a222a679fd1 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Mon, 3 Oct 2022 12:07:09 -0400 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com> --- src/coremotion.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coremotion.cs b/src/coremotion.cs index c374172524ed..7631c8a76387 100644 --- a/src/coremotion.cs +++ b/src/coremotion.cs @@ -865,7 +865,7 @@ public enum CMWaterSubmersionState : long { Unknown = 0, NotSubmerged, - Submerged + Submerged, } [NoMac, NoiOS, NoMacCatalyst, Watch (9,0), NoTV] @@ -878,7 +878,7 @@ public enum CMWaterSubmersionDepthState : long SubmergedDeep = 300, ApproachingMaxDepth = 400, PastMaxDepth = 500, - SensorDepthError = 600 + SensorDepthError = 600, } [NoMac, NoiOS, NoMacCatalyst, Watch (9,0), NoTV] From d4c1d829dfcbb9a4bc3114e18d47cc5fbf7c4e84 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 6 Oct 2022 16:03:16 -0400 Subject: [PATCH 3/3] Fix compilation and xtro. --- src/coremotion.cs | 1 + tests/xtro-sharpie/watchOS-CoreMotion.todo | 21 --------------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/coremotion.cs b/src/coremotion.cs index 7631c8a76387..1922c72c2025 100644 --- a/src/coremotion.cs +++ b/src/coremotion.cs @@ -834,6 +834,7 @@ interface CMAbsoluteAltitudeData // Just to please the generator that at this point does not know the hierarchy interface NSUnitPressure : NSUnit { } interface NSUnitTemperature : NSUnit { } + interface NSUnitLength : NSUnit { } [Watch (8,5), NoTV, NoMac, iOS (15,4), MacCatalyst (15,4)] [BaseType (typeof (CMLogItem))] diff --git a/tests/xtro-sharpie/watchOS-CoreMotion.todo b/tests/xtro-sharpie/watchOS-CoreMotion.todo index 3b2cef6f3e91..6305f910cab5 100644 --- a/tests/xtro-sharpie/watchOS-CoreMotion.todo +++ b/tests/xtro-sharpie/watchOS-CoreMotion.todo @@ -1,22 +1 @@ !missing-selector! +CMMovementDisorderManager::version not bound -!missing-enum! CMWaterSubmersionDepthState not bound -!missing-enum! CMWaterSubmersionState not bound -!missing-protocol! CMWaterSubmersionManagerDelegate not bound -!missing-selector! +CMWaterSubmersionManager::authorizationStatus not bound -!missing-selector! +CMWaterSubmersionManager::waterSubmersionAvailable not bound -!missing-selector! CMWaterSubmersionEvent::date not bound -!missing-selector! CMWaterSubmersionEvent::state not bound -!missing-selector! CMWaterSubmersionManager::delegate not bound -!missing-selector! CMWaterSubmersionManager::setDelegate: not bound -!missing-selector! CMWaterSubmersionMeasurement::date not bound -!missing-selector! CMWaterSubmersionMeasurement::depth not bound -!missing-selector! CMWaterSubmersionMeasurement::pressure not bound -!missing-selector! CMWaterSubmersionMeasurement::submersionState not bound -!missing-selector! CMWaterSubmersionMeasurement::surfacePressure not bound -!missing-selector! CMWaterTemperature::date not bound -!missing-selector! CMWaterTemperature::temperature not bound -!missing-selector! CMWaterTemperature::temperatureUncertainty not bound -!missing-type! CMWaterSubmersionEvent not bound -!missing-type! CMWaterSubmersionManager not bound -!missing-type! CMWaterSubmersionMeasurement not bound -!missing-type! CMWaterTemperature not bound