From f36b2ae7b83d45208cb05e2009bde8ebd034af7e Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Tue, 21 Jul 2020 13:12:51 -0400 Subject: [PATCH] [sensorkit] Update for Xcode 12 beta 2 (#9142) --- src/Constants.iOS.cs.in | 1 + src/SensorKit/SRAbsoluteTime.cs | 25 + src/SensorKit/SRAmbientLightChromaticity.cs | 16 + src/SensorKit/SRSensor.cs | 21 + src/foundation.cs | 18 + src/frameworks.sources | 10 + src/sensorkit.cs | 785 ++++++++++++++++++ tests/introspection/iOS/iOSApiProtocolTest.cs | 20 + tests/xtro-sharpie/iOS-SensorKit.todo | 201 ----- tools/common/Frameworks.cs | 1 + tools/mtouch/Makefile | 1 + 11 files changed, 898 insertions(+), 201 deletions(-) create mode 100644 src/SensorKit/SRAbsoluteTime.cs create mode 100644 src/SensorKit/SRAmbientLightChromaticity.cs create mode 100644 src/SensorKit/SRSensor.cs create mode 100644 src/sensorkit.cs delete mode 100644 tests/xtro-sharpie/iOS-SensorKit.todo diff --git a/src/Constants.iOS.cs.in b/src/Constants.iOS.cs.in index b3ba34d14d..a3e4512852 100644 --- a/src/Constants.iOS.cs.in +++ b/src/Constants.iOS.cs.in @@ -148,6 +148,7 @@ namespace ObjCRuntime { public const string AccessibilityLibrary = "/System/Library/Frameworks/Accessibility.framework/Accessibility"; public const string AppClipLibrary = "/System/Library/Frameworks/AppClip.framework/AppClip"; public const string MediaSetupLibrary = "/System/Library/Frameworks/MediaSetup.framework/MediaSetup"; + public const string SensorKitLibrary = "/System/Library/Frameworks/SensorKit.framework/SensorKit"; public const string UniformTypeIdentifiersLibrary = "/System/Library/Frameworks/UniformTypeIdentifiers.framework/UniformTypeIdentifiers"; } } diff --git a/src/SensorKit/SRAbsoluteTime.cs b/src/SensorKit/SRAbsoluteTime.cs new file mode 100644 index 0000000000..4c3e9610c5 --- /dev/null +++ b/src/SensorKit/SRAbsoluteTime.cs @@ -0,0 +1,25 @@ +using System; +using System.Runtime.InteropServices; +using ObjCRuntime; + +#nullable enable + +namespace SensorKit { + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + public static class SRAbsoluteTime { + + [DllImport (Constants.SensorKitLibrary, EntryPoint = "SRAbsoluteTimeGetCurrent")] + public static extern /* SRAbsoluteTime */ double GetCurrent (); + + [DllImport (Constants.SensorKitLibrary, EntryPoint = "SRAbsoluteTimeFromCFAbsoluteTime")] + public static extern /* SRAbsoluteTime */ double FromCFAbsoluteTime (/* CFAbsoluteTime */ double cfAbsoluteTime); + + [DllImport (Constants.SensorKitLibrary, EntryPoint = "SRAbsoluteTimeToCFAbsoluteTime")] + public static extern /* CFAbsoluteTime */ double ToCFAbsoluteTime (double srAbsoluteTime); + + [DllImport (Constants.SensorKitLibrary, EntryPoint = "SRAbsoluteTimeFromContinuousTime")] + public static extern /* SRAbsoluteTime */ double FromContinuousTime (ulong continuousTime); + } +} diff --git a/src/SensorKit/SRAmbientLightChromaticity.cs b/src/SensorKit/SRAmbientLightChromaticity.cs new file mode 100644 index 0000000000..4a90c4516a --- /dev/null +++ b/src/SensorKit/SRAmbientLightChromaticity.cs @@ -0,0 +1,16 @@ +using System; +using System.Runtime.InteropServices; +using ObjCRuntime; + +#nullable enable + +namespace SensorKit { + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [StructLayout (LayoutKind.Sequential)] + public struct SRAmbientLightChromaticity { + public float X; + public float Y; + } +} diff --git a/src/SensorKit/SRSensor.cs b/src/SensorKit/SRSensor.cs new file mode 100644 index 0000000000..82f62f67d0 --- /dev/null +++ b/src/SensorKit/SRSensor.cs @@ -0,0 +1,21 @@ +using System; +using System.Runtime.InteropServices; +using ObjCRuntime; + +#nullable enable + +namespace SensorKit { + + public partial class SRSensorExtensions { + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + public static SRSensor GetSensorForDeletionRecords (this SRSensor self) + { + var constant = self.GetConstant (); + if (constant == null) + return SRSensor.Invalid; + return GetValue (constant._GetSensorForDeletionRecordsFromSensor ()); + } + } +} diff --git a/src/foundation.cs b/src/foundation.cs index dc964e5592..a09c965972 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -3746,6 +3746,24 @@ namespace Foundation [Export ("isEqualToDate:")] bool IsEqualToDate (NSDate other); + + // NSDate_SensorKit + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Static] + [Export ("dateWithSRAbsoluteTime:")] + NSDate CreateFromSRAbsoluteTime (double time); + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Export ("initWithSRAbsoluteTime:")] + IntPtr Constructor (double srAbsoluteTime); + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Export ("srAbsoluteTime")] + double SrAbsoluteTime { get; } } [BaseType (typeof (NSObject))] diff --git a/src/frameworks.sources b/src/frameworks.sources index ace3ff1dd9..9d178a5f1d 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -1430,6 +1430,15 @@ SECURITY_SOURCES = \ Security/SslConnection.cs \ Security/SslContext.cs \ +# SensorKit + +SENSORKIT_CORE_SOURCES = \ + SensorKit/SRAmbientLightChromaticity.cs \ + +SENSORKIT_SOURCES = \ + SensorKit/SRAbsoluteTime.cs \ + SensorKit/SRSensor.cs \ + # Social SOCIAL_CORE_SOURCES = \ @@ -1973,6 +1982,7 @@ IOS_FRAMEWORKS = \ ReplayKit \ SafariServices \ Security \ + SensorKit \ Social \ Speech \ SystemConfiguration \ diff --git a/src/sensorkit.cs b/src/sensorkit.cs new file mode 100644 index 0000000000..e5dbf21190 --- /dev/null +++ b/src/sensorkit.cs @@ -0,0 +1,785 @@ +using System; +using System.Runtime.InteropServices; + +using Foundation; +using ObjCRuntime; + +namespace SensorKit { + + // helpers for code generation + interface NSUnitDuration : NSUnit { } + interface NSUnitIlluminance : NSUnit { } + interface NSUnitLength : NSUnit { } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Native] + enum SRAmbientLightSensorPlacement : long { + Unknown, + FrontTop, + FrontBottom, + FrontRight, + FrontLeft, + FrontTopRight, + FrontTopLeft, + FrontBottomRight, + FrontBottomLeft, + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Native] + enum SRCrownOrientation : long + { + Left, + Right, + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Native] + enum SRDeletionReason : long + { + UserInitiated, + LowDiskSpace, + AgeLimit, + NoInterestedClients, + SystemInitiated, + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Native] + [ErrorDomain ("SRErrorDomain")] + enum SRErrorCode : long + { + InvalidEntitlement, + NoAuthorization, + DataInaccessible, + FetchRequestInvalid, + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Native] + enum SRLocationCategory : long + { + Unknown, + Home, + Work, + School, + Gym, + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Native] + enum SRNotificationEvent : long + { + Unknown, + Received, + DefaultAction, + SupplementaryAction, + Clear, + NotificationCenterClearAll, + Removed, + Hide, + LongLook, + Silence, + AppLaunch, + Expired, + BannerPulldown, + TapCoalesce, + Deduped, + DeviceActivated, + DeviceUnlocked, + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Native] + enum SRWristLocation : long + { + Left, + Right, + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + enum SRDeviceUsageCategory { + [Field ("SRDeviceUsageCategoryGames")] + Games, + + [Field ("SRDeviceUsageCategoryBusiness")] + Business, + + [Field ("SRDeviceUsageCategoryWeather")] + Weather, + + [Field ("SRDeviceUsageCategoryUtilities")] + Utilities, + + [Field ("SRDeviceUsageCategoryTravel")] + Travel, + + [Field ("SRDeviceUsageCategorySports")] + Sports, + + [Field ("SRDeviceUsageCategorySocialNetworking")] + SocialNetworking, + + [Field ("SRDeviceUsageCategoryReference")] + Reference, + + [Field ("SRDeviceUsageCategoryProductivity")] + Productivity, + + [Field ("SRDeviceUsageCategoryPhotoAndVideo")] + PhotoAndVideo, + + [Field ("SRDeviceUsageCategoryNews")] + News, + + [Field ("SRDeviceUsageCategoryNavigation")] + Navigation, + + [Field ("SRDeviceUsageCategoryMusic")] + Music, + + [Field ("SRDeviceUsageCategoryLifestyle")] + Lifestyle, + + [Field ("SRDeviceUsageCategoryHealthAndFitness")] + HealthAndFitness, + + [Field ("SRDeviceUsageCategoryFinance")] + Finance, + + [Field ("SRDeviceUsageCategoryEntertainment")] + Entertainment, + + [Field ("SRDeviceUsageCategoryEducation")] + Education, + + [Field ("SRDeviceUsageCategoryBooks")] + Books, + + [Field ("SRDeviceUsageCategoryMedical")] + Medical, + + [Field ("SRDeviceUsageCategoryNewsstand")] + Newsstand, + + [Field ("SRDeviceUsageCategoryCatalogs")] + Catalogs, + + [Field ("SRDeviceUsageCategoryKids")] + Kids, + + [Field ("SRDeviceUsageCategoryMiscellaneous")] + Miscellaneous, + + [Field ("SRDeviceUsageCategoryFoodAndDrink")] + FoodAndDrink, + + [Field ("SRDeviceUsageCategoryDeveloperTools")] + DeveloperTools, + + [Field ("SRDeviceUsageCategoryGraphicsAndDesign")] + GraphicsAndDesign, + + [Field ("SRDeviceUsageCategoryShopping")] + Shopping, + + [Field ("SRDeviceUsageCategoryStickers")] + Stickers, + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRAmbientLightSample { + + [Export ("placement")] + SRAmbientLightSensorPlacement Placement { get; } + + [Export ("chromaticity")] + SRAmbientLightChromaticity Chromaticity { get; } + + [Export ("lux", ArgumentSemantic.Copy)] + NSMeasurement Lux { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRApplicationUsage { + + [NullAllowed, Export ("bundleIdentifier")] + string BundleIdentifier { get; } + + [Export ("usageTime")] + double /* NSTimeInterval */ UsageTime { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRDeletionRecord : NSSecureCoding { + + [Export ("startTime")] + double /* SRAbsoluteTime */ StartTime { get; } + + [Export ("endTime")] + double /* SRAbsoluteTime */ EndTime { get; } + + [Export ("reason")] + SRDeletionReason Reason { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRDevice : NSSecureCoding, NSCopying { + [Static] + [Export ("currentDevice")] + SRDevice CurrentDevice { get; } + + [Export ("name")] + string Name { get; } + + [Export ("model")] + string Model { get; } + + [Export ("systemName")] + string SystemName { get; } + + [Export ("systemVersion")] + string SystemVersion { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRDeviceUsageReport { + + [Export ("duration")] + double /* NSTimeInterval */ Duration { get; } + + [Export ("applicationUsageByCategory", ArgumentSemantic.Copy)] + NSDictionary> ApplicationUsageByCategory { get; } + + [Export ("notificationUsageByCategory", ArgumentSemantic.Copy)] + NSDictionary> NotificationUsageByCategory { get; } + + [Export ("webUsageByCategory", ArgumentSemantic.Copy)] + NSDictionary> WebUsageByCategory { get; } + + [Export ("totalScreenWakes")] + nint TotalScreenWakes { get; } + + [Export ("totalUnlocks")] + nint TotalUnlocks { get; } + + [Export ("totalUnlockDuration")] + double /* NSTimeInterval */ TotalUnlockDuration { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + interface SRFetchRequest { + + [Export ("from")] + double /* SRAbsoluteTime */ From { get; set; } + + [Export ("to")] + double /* SRAbsoluteTime */ To { get; set; } + + [Export ("device", ArgumentSemantic.Strong)] + SRDevice Device { get; set; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRFetchResult : NSCopying where SampleType : NSObject { + + [Export ("sample", ArgumentSemantic.Copy)] + SampleType Sample { get; } + + [Export ("timestamp")] + double /* SRAbsoluteTime */ Timestamp { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRKeyboardProbabilityMetric where UnitType : NSUnit { + [Export ("distributionSampleValues", ArgumentSemantic.Copy)] + NSMeasurement[] DistributionSampleValues { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRKeyboardMetrics { + + [Export ("duration")] + double /* NSTimeInterval */ Duration { get; } + + [Export ("keyboardIdentifier")] + string KeyboardIdentifier { get; } + + [Export ("version")] + string Version { get; } + + [Export ("width")] + NSMeasurement Width { get; } + + [Export ("height")] + NSMeasurement Height { get; } + + // SRKeyboardMetrics_ScalarMetrics + + [Export ("totalWords")] + nint TotalWords { get; } + + [Export ("totalAlteredWords")] + nint TotalAlteredWords { get; } + + [Export ("totalTaps")] + nint TotalTaps { get; } + + [Export ("totalDrags")] + nint TotalDrags { get; } + + [Export ("totalDeletes")] + nint TotalDeletes { get; } + + [Export ("totalEmojis")] + nint TotalEmojis { get; } + + [Export ("totalPaths")] + nint TotalPaths { get; } + + [Export ("totalPathTime")] + double TotalPathTime { get; } + + [Export ("totalPathLength")] + NSMeasurement TotalPathLength { get; } + + [Export ("totalAutoCorrections")] + nint TotalAutoCorrections { get; } + + [Export ("totalSpaceCorrections")] + nint TotalSpaceCorrections { get; } + + [Export ("totalRetroCorrections")] + nint TotalRetroCorrections { get; } + + [Export ("totalTranspositionCorrections")] + nint TotalTranspositionCorrections { get; } + + [Export ("totalInsertKeyCorrections")] + nint TotalInsertKeyCorrections { get; } + + [Export ("totalSkipTouchCorrections")] + nint TotalSkipTouchCorrections { get; } + + [Export ("totalNearKeyCorrections")] + nint TotalNearKeyCorrections { get; } + + [Export ("totalSubstitutionCorrections")] + nint TotalSubstitutionCorrections { get; } + + [Export ("totalHitTestCorrections")] + nint TotalHitTestCorrections { get; } + + [Export ("totalTypingDuration")] + double TotalTypingDuration { get; } + + // SRKeyboardMetrics_ProbabilityMetrics + + [Export ("upErrorDistance", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric UpErrorDistance { get; } + + [Export ("downErrorDistance", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric DownErrorDistance { get; } + + [Export ("spaceUpErrorDistance", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric SpaceUpErrorDistance { get; } + + [Export ("spaceDownErrorDistance", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric SpaceDownErrorDistance { get; } + + [Export ("deleteUpErrorDistance", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric DeleteUpErrorDistance { get; } + + [Export ("deleteDownErrorDistance", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric DeleteDownErrorDistance { get; } + + [Export ("shortWordCharKeyUpErrorDistance", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric ShortWordCharKeyUpErrorDistance { get; } + + [Export ("shortWordCharKeyDownErrorDistance", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric ShortWordCharKeyDownErrorDistance { get; } + + [Export ("touchDownUp", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric TouchDownUp { get; } + + [Export ("spaceTouchDownUp", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric SpaceTouchDownUp { get; } + + [Export ("deleteTouchDownUp", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric DeleteTouchDownUp { get; } + + [Export ("shortWordCharKeyTouchDownUp", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric ShortWordCharKeyTouchDownUp { get; } + + [Export ("touchDownDown", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric TouchDownDown { get; } + + [Export ("charKeyToPrediction", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric CharKeyToPrediction { get; } + + [Export ("shortWordCharKeyToCharKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric ShortWordCharKeyToCharKey { get; } + + [Export ("charKeyToAnyTapKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric CharKeyToAnyTapKey { get; } + + [Export ("anyTapToCharKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric AnyTapToCharKey { get; } + + [Export ("spaceToCharKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric SpaceToCharKey { get; } + + [Export ("charKeyToSpaceKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric CharKeyToSpaceKey { get; } + + [Export ("spaceToDeleteKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric SpaceToDeleteKey { get; } + + [Export ("deleteToSpaceKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric DeleteToSpaceKey { get; } + + [Export ("spaceToSpaceKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric SpaceToSpaceKey { get; } + + [Export ("spaceToShiftKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric SpaceToShiftKey { get; } + + [Export ("spaceToPlaneChangeKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric SpaceToPlaneChangeKey { get; } + + [Export ("spaceToPredictionKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric SpaceToPredictionKey { get; } + + [Export ("deleteToCharKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric DeleteToCharKey { get; } + + [Export ("charKeyToDelete", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric CharKeyToDelete { get; } + + [Export ("deleteToDelete", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric DeleteToDelete { get; } + + [Export ("deleteToShiftKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric DeleteToShiftKey { get; } + + [Export ("deleteToPlaneChangeKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric DeleteToPlaneChangeKey { get; } + + [Export ("anyTapToPlaneChangeKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric AnyTapToPlaneChangeKey { get; } + + [Export ("planeChangeToAnyTap", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric PlaneChangeToAnyTap { get; } + + [Export ("charKeyToPlaneChangeKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric CharKeyToPlaneChangeKey { get; } + + [Export ("planeChangeKeyToCharKey", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric PlaneChangeKeyToCharKey { get; } + + [Export ("pathErrorDistanceRatio", ArgumentSemantic.Strong)] + NSNumber[] PathErrorDistanceRatio { get; } + + [Export ("deleteToPath", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric DeleteToPath { get; } + + [Export ("pathToDelete", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric PathToDelete { get; } + + [Export ("spaceToPath", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric SpaceToPath { get; } + + [Export ("pathToSpace", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric PathToSpace { get; } + + [Export ("pathToPath", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric PathToPath { get; } + + // SRKeyboardMetrics_PositionalMetrics + + [Export ("longWordUpErrorDistance", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric[] LongWordUpErrorDistance { get; } + + [Export ("longWordDownErrorDistance", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric[] LongWordDownErrorDistance { get; } + + [Export ("longWordTouchDownUp", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric[] LongWordTouchDownUp { get; } + + [Export ("longWordTouchDownDown", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric[] LongWordTouchDownDown { get; } + + [Export ("deleteToDeletes", ArgumentSemantic.Strong)] + SRKeyboardProbabilityMetric[] DeleteToDeletes { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRMessagesUsageReport { + + [Export ("duration")] + double /* NSTimeInterval */ Duration { get; } + + [Export ("totalOutgoingMessages")] + nint TotalOutgoingMessages { get; } + + [Export ("totalIncomingMessages")] + nint TotalIncomingMessages { get; } + + [Export ("totalUniqueContacts")] + nint TotalUniqueContacts { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRNotificationUsage { + + [NullAllowed, Export ("bundleIdentifier")] + string BundleIdentifier { get; } + + [Export ("event")] + SRNotificationEvent Event { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRPhoneUsageReport { + + [Export ("duration")] + double /* NSTimeInterval */ Duration { get; } + + [Export ("totalOutgoingCalls")] + nint TotalOutgoingCalls { get; } + + [Export ("totalIncomingCalls")] + nint TotalIncomingCalls { get; } + + [Export ("totalUniqueContacts")] + nint TotalUniqueContacts { get; } + + [Export ("totalPhoneCallDuration")] + double /* NSTimeInterval */ TotalPhoneCallDuration { get; } + } + + interface ISRSensorReaderDelegate {} + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Protocol, Model (AutoGeneratedName = true)] + [BaseType (typeof (NSObject))] + interface SRSensorReaderDelegate { + + [Export ("sensorReader:fetchingRequest:didFetchResult:")] + bool DidFetchResult (SRSensorReader reader, SRFetchRequest fetchRequest, SRFetchResult result); + + [Export ("sensorReader:didCompleteFetch:")] + void DidCompleteFetch (SRSensorReader reader, SRFetchRequest fetchRequest); + + [Export ("sensorReader:fetchingRequest:failedWithError:")] + void FetchingRequestFailed (SRSensorReader reader, SRFetchRequest fetchRequest, NSError error); + + [Export ("sensorReader:didChangeAuthorizationStatus:")] + void DidChangeAuthorizationStatus (SRSensorReader reader, bool authorized); + + [Export ("sensorReaderWillStartRecording:")] + void WillStartRecording (SRSensorReader reader); + + [Export ("sensorReader:startRecordingFailedWithError:")] + void StartRecordingFailed (SRSensorReader reader, NSError error); + + [Export ("sensorReaderDidStopRecording:")] + void DidStopRecording (SRSensorReader reader); + + [Export ("sensorReader:stopRecordingFailedWithError:")] + void StopRecordingFailed (SRSensorReader reader, NSError error); + + [Export ("sensorReader:didFetchDevices:")] + void DidFetchDevices (SRSensorReader reader, SRDevice[] devices); + + [Export ("sensorReader:fetchDevicesDidFailWithError:")] + void FetchDevicesFailed (SRSensorReader reader, NSError error); + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + enum SRSensor { + [Field (null)] + Invalid = -1, + + [Field ("SRSensorAmbientLightSensor")] + AmbientLightSensor, + + [Field ("SRSensorAccelerometer")] + Accelerometer, + + [Field ("SRSensorGyroscope")] + Gyroscope, + + [Field ("SRSensorVisits")] + Visits, + + [Field ("SRSensorPedometerData")] + PedometerData, + + [Field ("SRSensorDeviceUsageReport")] + DeviceUsageReport, + + [Field ("SRSensorMessagesUsageReport")] + MessagesUsageReport, + + [Field ("SRSensorPhoneUsageReport")] + PhoneUsageReport, + + [Field ("SRSensorOnWristState")] + OnWristState, + + [Field ("SRSensorKeyboardMetrics")] + KeyboardMetrics, + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRSensorReader { + + [Export ("initWithSensor:")] + IntPtr Constructor (NSString sensor); + + [Wrap ("this (sensor.GetConstant ()!)")] + IntPtr Constructor (SRSensor sensor); + + [Export ("startRecording")] + void StartRecording (); + + [Export ("stopRecording")] + void StopRecording (); + + [Export ("fetchDevices")] + void FetchDevices (); + + [Export ("fetch:")] + void Fetch (SRFetchRequest request); + + [Export ("authorized")] + bool Authorized { [Bind ("isAuthorized")] get; } + + [Export ("sensor")] + NSString WeakSensor { get; } + + SRSensor Sensor { + [Wrap ("SRSensorExtensions.GetValue (WeakSensor)")] + get; + } + + [Wrap ("WeakDelegate")] + [NullAllowed] + ISRSensorReaderDelegate Delegate { get; set; } + + [NullAllowed, Export ("delegate", ArgumentSemantic.Weak)] + NSObject WeakDelegate { get; set; } + + [Static] + [Export ("requestAuthorizationForSensors:")] + void RequestAuthorization (NSSet sensors); + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRVisit { + + [Export ("distanceFromHome")] + double /* CLLocationDistance */DistanceFromHome { get; } + + [Export ("arrivalDateInterval", ArgumentSemantic.Strong)] + NSDateInterval ArrivalDateInterval { get; } + + [Export ("departureDateInterval", ArgumentSemantic.Strong)] + NSDateInterval DepartureDateInterval { get; } + + [Export ("locationCategory")] + SRLocationCategory LocationCategory { get; } + + [Export ("identifier", ArgumentSemantic.Strong)] + NSUuid Identifier { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRWebUsage { + + [Export ("totalUsageTime")] + double /* NSTimeInterval */ TotalUsageTime { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SRWristDetection { + + [Export ("onWrist")] + bool OnWrist { get; } + + [Export ("wristLocation")] + SRWristLocation WristLocation { get; } + + [Export ("crownOrientation")] + SRCrownOrientation CrownOrientation { get; } + } + + [NoWatch, NoTV, NoMac] + [iOS (14,0)] + [Category] + [BaseType (typeof (NSString))] + [Internal] // exposed thru SRSensor + interface NSString_SRDeletionRecord { + [return: NullAllowed] + [Export ("sr_sensorForDeletionRecordsFromSensor")] + NSString _GetSensorForDeletionRecordsFromSensor (); + } +} diff --git a/tests/introspection/iOS/iOSApiProtocolTest.cs b/tests/introspection/iOS/iOSApiProtocolTest.cs index 59c02d0d19..7b5e8a055c 100644 --- a/tests/introspection/iOS/iOSApiProtocolTest.cs +++ b/tests/introspection/iOS/iOSApiProtocolTest.cs @@ -388,6 +388,16 @@ namespace Introspection { #endif // Xcode 12 beta 2 case "MSServiceAccount": + case "SRAmbientLightSample": + case "SRApplicationUsage": + case "SRDeviceUsageReport": + case "SRKeyboardMetrics": + case "SRKeyboardProbabilityMetric`1": + case "SRMessagesUsageReport": + case "SRNotificationUsage": + case "SRPhoneUsageReport": + case "SRVisit": + case "SRWebUsage": return true; } break; @@ -619,6 +629,16 @@ namespace Introspection { #endif // Xcode 12 beta 2 case "MSServiceAccount": + case "SRAmbientLightSample": + case "SRApplicationUsage": + case "SRDeviceUsageReport": + case "SRKeyboardMetrics": + case "SRKeyboardProbabilityMetric`1": + case "SRMessagesUsageReport": + case "SRNotificationUsage": + case "SRPhoneUsageReport": + case "SRVisit": + case "SRWebUsage": return true; } break; diff --git a/tests/xtro-sharpie/iOS-SensorKit.todo b/tests/xtro-sharpie/iOS-SensorKit.todo deleted file mode 100644 index 2d5b93e2b5..0000000000 --- a/tests/xtro-sharpie/iOS-SensorKit.todo +++ /dev/null @@ -1,201 +0,0 @@ -!missing-enum! SRAmbientLightSensorPlacement not bound -!missing-enum! SRCrownOrientation not bound -!missing-enum! SRDeletionReason not bound -!missing-enum! SRErrorCode not bound -!missing-enum! SRLocationCategory not bound -!missing-enum! SRWristLocation not bound -!missing-field! SRErrorDomain not bound -!missing-field! SRSensorAccelerometer not bound -!missing-field! SRSensorAmbientLightSensor not bound -!missing-field! SRSensorGyroscope not bound -!missing-field! SRSensorOnWristState not bound -!missing-field! SRSensorPedometerData not bound -!missing-field! SRSensorVisits not bound -!missing-pinvoke! SRAbsoluteTimeFromCFAbsoluteTime is not bound -!missing-pinvoke! SRAbsoluteTimeFromContinuousTime is not bound -!missing-pinvoke! SRAbsoluteTimeGetCurrent is not bound -!missing-pinvoke! SRAbsoluteTimeToCFAbsoluteTime is not bound -!missing-protocol! SRSensorReaderDelegate not bound -!missing-selector! +NSDate::dateWithSRAbsoluteTime: not bound -!missing-selector! +SRDevice::currentDevice not bound -!missing-selector! +SRSensorReader::requestAuthorizationForSensors: not bound -!missing-selector! NSDate::initWithSRAbsoluteTime: not bound -!missing-selector! NSDate::srAbsoluteTime not bound -!missing-selector! NSString::sr_sensorForDeletionRecordsFromSensor not bound -!missing-selector! SRAmbientLightSample::chromaticity not bound -!missing-selector! SRAmbientLightSample::lux not bound -!missing-selector! SRAmbientLightSample::placement not bound -!missing-selector! SRDeletionRecord::endTime not bound -!missing-selector! SRDeletionRecord::reason not bound -!missing-selector! SRDeletionRecord::startTime not bound -!missing-selector! SRDevice::model not bound -!missing-selector! SRDevice::name not bound -!missing-selector! SRDevice::systemName not bound -!missing-selector! SRDevice::systemVersion not bound -!missing-selector! SRFetchRequest::device not bound -!missing-selector! SRFetchRequest::from not bound -!missing-selector! SRFetchRequest::setDevice: not bound -!missing-selector! SRFetchRequest::setFrom: not bound -!missing-selector! SRFetchRequest::setTo: not bound -!missing-selector! SRFetchRequest::to not bound -!missing-selector! SRFetchResult::sample not bound -!missing-selector! SRFetchResult::timestamp not bound -!missing-selector! SRSensorReader::delegate not bound -!missing-selector! SRSensorReader::fetch: not bound -!missing-selector! SRSensorReader::fetchDevices not bound -!missing-selector! SRSensorReader::initWithSensor: not bound -!missing-selector! SRSensorReader::isAuthorized not bound -!missing-selector! SRSensorReader::sensor not bound -!missing-selector! SRSensorReader::setDelegate: not bound -!missing-selector! SRSensorReader::startRecording not bound -!missing-selector! SRSensorReader::stopRecording not bound -!missing-selector! SRVisit::arrivalDateInterval not bound -!missing-selector! SRVisit::departureDateInterval not bound -!missing-selector! SRVisit::distanceFromHome not bound -!missing-selector! SRVisit::identifier not bound -!missing-selector! SRVisit::locationCategory not bound -!missing-selector! SRWristDetection::crownOrientation not bound -!missing-selector! SRWristDetection::onWrist not bound -!missing-selector! SRWristDetection::wristLocation not bound -!missing-type! SRAmbientLightSample not bound -!missing-type! SRDeletionRecord not bound -!missing-type! SRDevice not bound -!missing-type! SRFetchRequest not bound -!missing-type! SRFetchResult not bound -!missing-type! SRSensorReader not bound -!missing-type! SRVisit not bound -!missing-type! SRWristDetection not bound -## appended from unclassified file -!missing-enum! SRNotificationEvent not bound -!missing-field! SRDeviceUsageCategoryBooks not bound -!missing-field! SRDeviceUsageCategoryBusiness not bound -!missing-field! SRDeviceUsageCategoryCatalogs not bound -!missing-field! SRDeviceUsageCategoryDeveloperTools not bound -!missing-field! SRDeviceUsageCategoryEducation not bound -!missing-field! SRDeviceUsageCategoryEntertainment not bound -!missing-field! SRDeviceUsageCategoryFinance not bound -!missing-field! SRDeviceUsageCategoryFoodAndDrink not bound -!missing-field! SRDeviceUsageCategoryGames not bound -!missing-field! SRDeviceUsageCategoryGraphicsAndDesign not bound -!missing-field! SRDeviceUsageCategoryHealthAndFitness not bound -!missing-field! SRDeviceUsageCategoryKids not bound -!missing-field! SRDeviceUsageCategoryLifestyle not bound -!missing-field! SRDeviceUsageCategoryMedical not bound -!missing-field! SRDeviceUsageCategoryMiscellaneous not bound -!missing-field! SRDeviceUsageCategoryMusic not bound -!missing-field! SRDeviceUsageCategoryNavigation not bound -!missing-field! SRDeviceUsageCategoryNews not bound -!missing-field! SRDeviceUsageCategoryNewsstand not bound -!missing-field! SRDeviceUsageCategoryPhotoAndVideo not bound -!missing-field! SRDeviceUsageCategoryProductivity not bound -!missing-field! SRDeviceUsageCategoryReference not bound -!missing-field! SRDeviceUsageCategoryShopping not bound -!missing-field! SRDeviceUsageCategorySocialNetworking not bound -!missing-field! SRDeviceUsageCategorySports not bound -!missing-field! SRDeviceUsageCategoryStickers not bound -!missing-field! SRDeviceUsageCategoryTravel not bound -!missing-field! SRDeviceUsageCategoryUtilities not bound -!missing-field! SRDeviceUsageCategoryWeather not bound -!missing-field! SRSensorDeviceUsageReport not bound -!missing-field! SRSensorKeyboardMetrics not bound -!missing-field! SRSensorMessagesUsageReport not bound -!missing-field! SRSensorPhoneUsageReport not bound -!missing-selector! SRApplicationUsage::bundleIdentifier not bound -!missing-selector! SRApplicationUsage::usageTime not bound -!missing-selector! SRDeviceUsageReport::applicationUsageByCategory not bound -!missing-selector! SRDeviceUsageReport::duration not bound -!missing-selector! SRDeviceUsageReport::notificationUsageByCategory not bound -!missing-selector! SRDeviceUsageReport::totalScreenWakes not bound -!missing-selector! SRDeviceUsageReport::totalUnlockDuration not bound -!missing-selector! SRDeviceUsageReport::totalUnlocks not bound -!missing-selector! SRDeviceUsageReport::webUsageByCategory not bound -!missing-selector! SRKeyboardMetrics::anyTapToCharKey not bound -!missing-selector! SRKeyboardMetrics::anyTapToPlaneChangeKey not bound -!missing-selector! SRKeyboardMetrics::charKeyToAnyTapKey not bound -!missing-selector! SRKeyboardMetrics::charKeyToDelete not bound -!missing-selector! SRKeyboardMetrics::charKeyToPlaneChangeKey not bound -!missing-selector! SRKeyboardMetrics::charKeyToPrediction not bound -!missing-selector! SRKeyboardMetrics::charKeyToSpaceKey not bound -!missing-selector! SRKeyboardMetrics::deleteDownErrorDistance not bound -!missing-selector! SRKeyboardMetrics::deleteToCharKey not bound -!missing-selector! SRKeyboardMetrics::deleteToDelete not bound -!missing-selector! SRKeyboardMetrics::deleteToDeletes not bound -!missing-selector! SRKeyboardMetrics::deleteToPath not bound -!missing-selector! SRKeyboardMetrics::deleteToPlaneChangeKey not bound -!missing-selector! SRKeyboardMetrics::deleteToShiftKey not bound -!missing-selector! SRKeyboardMetrics::deleteToSpaceKey not bound -!missing-selector! SRKeyboardMetrics::deleteTouchDownUp not bound -!missing-selector! SRKeyboardMetrics::deleteUpErrorDistance not bound -!missing-selector! SRKeyboardMetrics::downErrorDistance not bound -!missing-selector! SRKeyboardMetrics::duration not bound -!missing-selector! SRKeyboardMetrics::height not bound -!missing-selector! SRKeyboardMetrics::keyboardIdentifier not bound -!missing-selector! SRKeyboardMetrics::longWordDownErrorDistance not bound -!missing-selector! SRKeyboardMetrics::longWordTouchDownDown not bound -!missing-selector! SRKeyboardMetrics::longWordTouchDownUp not bound -!missing-selector! SRKeyboardMetrics::longWordUpErrorDistance not bound -!missing-selector! SRKeyboardMetrics::pathErrorDistanceRatio not bound -!missing-selector! SRKeyboardMetrics::pathToDelete not bound -!missing-selector! SRKeyboardMetrics::pathToPath not bound -!missing-selector! SRKeyboardMetrics::pathToSpace not bound -!missing-selector! SRKeyboardMetrics::planeChangeKeyToCharKey not bound -!missing-selector! SRKeyboardMetrics::planeChangeToAnyTap not bound -!missing-selector! SRKeyboardMetrics::shortWordCharKeyDownErrorDistance not bound -!missing-selector! SRKeyboardMetrics::shortWordCharKeyToCharKey not bound -!missing-selector! SRKeyboardMetrics::shortWordCharKeyTouchDownUp not bound -!missing-selector! SRKeyboardMetrics::shortWordCharKeyUpErrorDistance not bound -!missing-selector! SRKeyboardMetrics::spaceDownErrorDistance not bound -!missing-selector! SRKeyboardMetrics::spaceToCharKey not bound -!missing-selector! SRKeyboardMetrics::spaceToDeleteKey not bound -!missing-selector! SRKeyboardMetrics::spaceToPath not bound -!missing-selector! SRKeyboardMetrics::spaceToPlaneChangeKey not bound -!missing-selector! SRKeyboardMetrics::spaceToPredictionKey not bound -!missing-selector! SRKeyboardMetrics::spaceToShiftKey not bound -!missing-selector! SRKeyboardMetrics::spaceToSpaceKey not bound -!missing-selector! SRKeyboardMetrics::spaceTouchDownUp not bound -!missing-selector! SRKeyboardMetrics::spaceUpErrorDistance not bound -!missing-selector! SRKeyboardMetrics::totalAlteredWords not bound -!missing-selector! SRKeyboardMetrics::totalAutoCorrections not bound -!missing-selector! SRKeyboardMetrics::totalDeletes not bound -!missing-selector! SRKeyboardMetrics::totalDrags not bound -!missing-selector! SRKeyboardMetrics::totalEmojis not bound -!missing-selector! SRKeyboardMetrics::totalHitTestCorrections not bound -!missing-selector! SRKeyboardMetrics::totalInsertKeyCorrections not bound -!missing-selector! SRKeyboardMetrics::totalNearKeyCorrections not bound -!missing-selector! SRKeyboardMetrics::totalPathLength not bound -!missing-selector! SRKeyboardMetrics::totalPaths not bound -!missing-selector! SRKeyboardMetrics::totalPathTime not bound -!missing-selector! SRKeyboardMetrics::totalRetroCorrections not bound -!missing-selector! SRKeyboardMetrics::totalSkipTouchCorrections not bound -!missing-selector! SRKeyboardMetrics::totalSpaceCorrections not bound -!missing-selector! SRKeyboardMetrics::totalSubstitutionCorrections not bound -!missing-selector! SRKeyboardMetrics::totalTaps not bound -!missing-selector! SRKeyboardMetrics::totalTranspositionCorrections not bound -!missing-selector! SRKeyboardMetrics::totalTypingDuration not bound -!missing-selector! SRKeyboardMetrics::totalWords not bound -!missing-selector! SRKeyboardMetrics::touchDownDown not bound -!missing-selector! SRKeyboardMetrics::touchDownUp not bound -!missing-selector! SRKeyboardMetrics::upErrorDistance not bound -!missing-selector! SRKeyboardMetrics::version not bound -!missing-selector! SRKeyboardMetrics::width not bound -!missing-selector! SRKeyboardProbabilityMetric::distributionSampleValues not bound -!missing-selector! SRMessagesUsageReport::duration not bound -!missing-selector! SRMessagesUsageReport::totalIncomingMessages not bound -!missing-selector! SRMessagesUsageReport::totalOutgoingMessages not bound -!missing-selector! SRMessagesUsageReport::totalUniqueContacts not bound -!missing-selector! SRNotificationUsage::bundleIdentifier not bound -!missing-selector! SRNotificationUsage::event not bound -!missing-selector! SRPhoneUsageReport::duration not bound -!missing-selector! SRPhoneUsageReport::totalIncomingCalls not bound -!missing-selector! SRPhoneUsageReport::totalOutgoingCalls not bound -!missing-selector! SRPhoneUsageReport::totalPhoneCallDuration not bound -!missing-selector! SRPhoneUsageReport::totalUniqueContacts not bound -!missing-selector! SRWebUsage::totalUsageTime not bound -!missing-type! SRApplicationUsage not bound -!missing-type! SRDeviceUsageReport not bound -!missing-type! SRKeyboardMetrics not bound -!missing-type! SRKeyboardProbabilityMetric not bound -!missing-type! SRMessagesUsageReport not bound -!missing-type! SRNotificationUsage not bound -!missing-type! SRPhoneUsageReport not bound -!missing-type! SRWebUsage not bound diff --git a/tools/common/Frameworks.cs b/tools/common/Frameworks.cs index 2d6b922700..425f05215b 100644 --- a/tools/common/Frameworks.cs +++ b/tools/common/Frameworks.cs @@ -338,6 +338,7 @@ public class Frameworks : Dictionary { "AppClip", "AppClip", 14,0 }, { "MediaSetup", "MediaSetup", new Version (14, 0), NotAvailableInSimulator /* no headers in beta 2 */ }, + { "SensorKit", "SensorKit", 14,0 }, { "UniformTypeIdentifiers", "UniformTypeIdentifiers", 14,0 }, { "Accessibility", "Accessibility", 14,0 }, diff --git a/tools/mtouch/Makefile b/tools/mtouch/Makefile index d15c1f78b7..be25d3abd4 100644 --- a/tools/mtouch/Makefile +++ b/tools/mtouch/Makefile @@ -163,6 +163,7 @@ SIMLAUNCHER_FRAMEWORKS = \ \ -weak_framework AppClip \ -weak_framework Accessibility \ + -weak_framework SensorKit \ # keep the above list of weak_framework # 1. grouped by iOS versions;