Skip to content

NearbyInteraction watchOS xcode14.0 beta1

TJ Lambert edited this page Sep 1, 2022 · 3 revisions

#NearbyInteraction.framework https://github.com/xamarin/xamarin-macios/pull/15840

diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIAlgorithmConvergenceStatusReason.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIAlgorithmConvergenceStatusReason.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIAlgorithmConvergenceStatusReason.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIAlgorithmConvergenceStatusReason.h	2022-05-31 15:04:07.000000000 -0400
@@ -0,0 +1,46 @@
+//
+//  NIAlgorithmConvergenceStatusReason.h
+//  NearbyInteraction
+//
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <NearbyInteraction/NIExport.h>
+
+NS_ASSUME_NONNULL_BEGIN
+/**
+ Reasons for the convergence state.
+ @discussion Multiple reasons may be present simultaenously.
+ */
+API_AVAILABLE_BEGIN(ios(16.0), watchos(9.0))
+
+typedef NSString * NIAlgorithmConvergenceStatusReason NS_TYPED_ENUM NS_SWIFT_NAME(NIAlgorithmConvergenceStatus.Reason)
+API_UNAVAILABLE(macos, tvos);
+
+/** Tell user to sweep device horizontally from side to side. */
+NI_EXPORT NIAlgorithmConvergenceStatusReason const NIAlgorithmConvergenceStatusReasonInsufficientHorizontalSweep
+API_UNAVAILABLE(macos, tvos);
+
+/** Tell user to sweep device verically up and down. */
+NI_EXPORT NIAlgorithmConvergenceStatusReason const NIAlgorithmConvergenceStatusReasonInsufficientVerticalSweep
+API_UNAVAILABLE(macos, tvos);
+
+/** Tell user to move around. */
+NI_EXPORT NIAlgorithmConvergenceStatusReason const NIAlgorithmConvergenceStatusReasonInsufficientMovement
+API_UNAVAILABLE(macos, tvos);
+
+/** Tell user to turn on the light. */
+NI_EXPORT NIAlgorithmConvergenceStatusReason const NIAlgorithmConvergenceStatusReasonInsufficientLighting
+API_UNAVAILABLE(macos, tvos);
+
+__BEGIN_DECLS
+/** Helper methods for getting the localized description of the convergence reason*/
+NI_EXPORT
+NSString * NIAlgorithmConvergenceStatusReasonDescription(const NIAlgorithmConvergenceStatusReason reason)
+NS_SWIFT_UNAVAILABLE("Use NIAlgorithmConvergenceStatus.Reason.localizedDescription")
+API_UNAVAILABLE(macos, tvos);
+__END_DECLS
+
+API_AVAILABLE_END
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIConfiguration.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIConfiguration.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIConfiguration.h	2022-02-23 07:15:58.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIConfiguration.h	2022-05-31 15:02:20.000000000 -0400
@@ -45,7 +45,7 @@
 @interface NINearbyPeerConfiguration : NIConfiguration
 
 /**
- The discovery token identifiying the peer device for this session configuration.
+ The discovery token identifying the peer device for this session configuration.
 */
 @property (nonatomic, copy, readonly) NIDiscoveryToken *peerDiscoveryToken;
 
@@ -55,6 +55,16 @@
  */
 - (instancetype)initWithPeerToken:(NIDiscoveryToken *)peerToken;
 
+/**
+ Enables camera assistance during the NISession run with this configuration
+ @discussion:
+ If true, optionally call setARSession: on the NISession before calling runWithConfiguration:
+ If true and setARSession: is not called, an ARSession will automatically be created
+ If true and the platform does not support camera assistance, the NISession will generate an error when runWithConfiguration: is called
+ @note: Check supportsCameraAssistance property in NIDeviceCapability returned from deviceCapabilities properties on NISession
+ */
+@property (nonatomic, assign, getter=isCameraAssistanceEnabled) BOOL cameraAssistanceEnabled API_AVAILABLE(ios(16.0)) API_UNAVAILABLE(watchos);
+
 /** Unavailable */
 - (instancetype)init NS_UNAVAILABLE;
 + (instancetype)new NS_UNAVAILABLE;
@@ -75,6 +85,16 @@
 @property (nonatomic, copy, readonly) NIDiscoveryToken *accessoryDiscoveryToken;
 
 /**
+ Enables camera assistance during the NISession run with this configuration
+ @discussion:
+ If YES, optionally call -setARSession: on the NISession before calling -runWithConfiguration:
+ If YES and setARSession: is not called, an ARSession will automatically be created
+ If YES  and the platform does not support camera assistance, the NISession will generate an error when runWithConfiguration: is called
+ @note: Check supportsCameraAssistance property in NIDeviceCapability returned from deviceCapabilities properties on NISession
+ */
+@property (nonatomic, assign, getter=isCameraAssistanceEnabled) BOOL cameraAssistanceEnabled API_AVAILABLE(ios(16.0)) API_UNAVAILABLE(watchos);
+
+/**
 Create a new nearby accessory configuration using data received from the accessory.
 
 @param data Configuration data received from the accessory.
@@ -82,6 +102,19 @@
 */
 - (nullable instancetype)initWithData:(NSData *)data error:(NSError **)error;
 
+/**
+ Create a new nearby accessory configuration for an accessory that is also a paired Bluetooth device
+
+ @param accessoryData Configuration data received from the accessory
+ @param bluetoothPeerIdentifier The accessory's Bluetooth identifier
+ @param error An optional out error parameter that will be populated with an error if the provided inputs are invalid or unsupported.
+
+ @discussion The accessory must be a Bluetooth LE peripheral that is paired, actively connected, and implements the Nearby Interaction Service and Accessory Configuration Characteristic.
+ */
+- (nullable instancetype)initWithAccessoryData:(NSData *)accessoryData
+                       bluetoothPeerIdentifier:(NSUUID *)identifier
+                                         error:(NSError **)error API_AVAILABLE(ios(16.0)) API_UNAVAILABLE(watchos, tvos, macos);
+
 /** Unavailable */
 - (instancetype)init NS_UNAVAILABLE;
 + (instancetype)new NS_UNAVAILABLE;
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIDeviceCapability.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIDeviceCapability.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIDeviceCapability.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIDeviceCapability.h	2022-05-31 15:04:07.000000000 -0400
@@ -0,0 +1,34 @@
+//
+//  NIDeviceCapability.h
+//  NearbyInteraction
+//
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <NearbyInteraction/NIExport.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT
+@protocol NIDeviceCapability
+
+/**
+ Whether or not this device is capable of participating in a nearby interaction session with precise ranging
+ */
+@property (nonatomic, readonly) BOOL supportsPreciseDistanceMeasurement;
+
+/**
+ Whether or not this device is capable of participating in a nearby interaction session with instantaneous direction
+ */
+@property (nonatomic, readonly) BOOL supportsDirectionMeasurement;
+
+/**
+ Whether or not this device is capable of participating in a nearby interaction session with camera assistance
+ */
+@property (nonatomic, readonly) BOOL supportsCameraAssistance;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIError.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIError.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIError.h	2022-02-23 07:15:58.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NIError.h	2022-05-31 15:04:07.000000000 -0400
@@ -35,6 +35,12 @@
     
     /** The user did not authorize the session */
     NIErrorCodeUserDidNotAllow = -5884,
+
+    /** ARSession Configuration provided is not compatible or the platform does not support camera assistance. */
+    NIErrorCodeInvalidARConfiguration API_AVAILABLE(ios(16.0)) API_UNAVAILABLE(watchos, tvos, macos) = -5883 ,
+
+    /** A Nearby Accessory session has been associated with a peer device (such as a Bluetooth peer) that is not available */
+    NIErrorCodeAccessoryPeerDeviceUnavailable API_AVAILABLE(ios(16.0)) API_UNAVAILABLE(watchos, tvos, macos) = -5882
 };
 
 
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NINearbyObject.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NINearbyObject.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NINearbyObject.h	2022-02-23 07:15:58.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NINearbyObject.h	2022-05-31 15:04:07.000000000 -0400
@@ -21,6 +21,27 @@
 API_AVAILABLE(ios(14.0), watchos(7.3)) API_UNAVAILABLE(macos, tvos)
 NI_EXPORT simd_float3 NINearbyObjectDirectionNotAvailable NS_SWIFT_UNAVAILABLE("Use optional value semantics");
 
+/** A sentinel value indicating that an angle could not be produced */
+API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT float NINearbyObjectAngleNotAvailable NS_SWIFT_UNAVAILABLE("Use optional value semantics");
+
+API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(macos, tvos)
+typedef NS_ENUM(NSInteger, NINearbyObjectVerticalDirectionEstimate) {
+    NINearbyObjectVerticalDirectionEstimateUnknown = 0,
+
+    /** Represents the nearby object is approximately equal */
+    NINearbyObjectVerticalDirectionEstimateSame = 1,
+
+    /** Represents the nearby object is above the current device */
+    NINearbyObjectVerticalDirectionEstimateAbove = 2,
+
+    /** Represents the nearby object  is below the current device */
+    NINearbyObjectVerticalDirectionEstimateBelow = 3,
+
+    /** Represents the nearby object  is above or below the current device - i.e. not the same level */
+    NINearbyObjectVerticalDirectionEstimateAboveOrBelow = 4,
+} NS_SWIFT_NAME(NINearbyObject.VerticalDirectionEstimate);
+
 /**
  A nearby object with distance and direction measurements.
 */
@@ -46,6 +67,18 @@
 */
 @property (nonatomic, readonly) simd_float3 direction NS_REFINED_FOR_SWIFT;
 
+/**
+An indication of the positional relationship to the nearby object in the vertical dimension.
+*/
+@property (nonatomic, readonly) NINearbyObjectVerticalDirectionEstimate verticalDirectionEstimate API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(macos, tvos);
+
+/**
+An angle in radians indicating the azimuthal direction to the nearby object.
+@discussion when unavailable, the value will be set to `NINearbyObjectAngleNotAvailable`.
+*/
+@property (nonatomic, readonly) float horizontalAngle NS_REFINED_FOR_SWIFT API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(macos, tvos);
+
+
 /** Unavailable */
 - (instancetype)init NS_UNAVAILABLE;
 + (instancetype)new NS_UNAVAILABLE;
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NISession.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NISession.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NISession.h	2022-02-23 07:59:13.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NISession.h	2022-05-31 14:51:58.000000000 -0400
@@ -6,15 +6,23 @@
 //
 
 #import <Foundation/Foundation.h>
+#import <NearbyInteraction/NIAlgorithmConvergenceStatusReason.h>
 #import <NearbyInteraction/NIConfiguration.h>
+#import <NearbyInteraction/NIDeviceCapability.h>
 #import <NearbyInteraction/NIExport.h>
+#import <simd/simd.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
 @class NINearbyObject;
+@class ARSession;
 
 @protocol NISessionDelegate;
 
+/** A sentinel value indicating that the nearby world transform is unavailable */
+API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT simd_float4x4 NINearbyObjectWorldTransformNotAvailable NS_SWIFT_UNAVAILABLE("Use optional value semantics");
+
 /**
  Nearby interaction session.
  */
@@ -25,7 +33,13 @@
 /**
  Whether or not this device is capable of participating in a nearby interaction session.
  */
-@property (class, nonatomic, readonly, getter=isSupported) BOOL supported;
+@property (class, nonatomic, readonly, getter=isSupported) BOOL supported API_DEPRECATED_WITH_REPLACEMENT("Use deviceCapabilities property and check the supportsPreciseDistanceMeasurement property", ios(14.0, 16.0), watchos(7.3, 9.0)) API_UNAVAILABLE(macos, tvos);
+
+/**
+ Get the protocol that describes nearby interaction capabilities on this device.
+ @discussion Detailed description on the capability protocol is in NIDeviceCapability.h.
+ */
+@property (class, nonatomic, readonly) id<NIDeviceCapability> deviceCapabilities API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(macos, tvos);
 
 /**
  A delegate for receiving NISession updates.
@@ -71,6 +85,23 @@
 */
 - (void)invalidate;
 
+/**
+ Provide an ARSession object for use with the NISession
+ @param session The ARSession to use for camera assistance
+ @discussion If not provided, an ARSession will be created automatically if the cameraAssistanceEnabled property on the configuration is YES
+ @discussion The developer is responsible for running the ARSession if provided.
+ @discussion If the ARConfiguration used to run the session is not compatible with the NISession, the NISession will invalidate with error
+ @discussion If the platform does not support camera assistance or an ARSession is provided without enabling cameraAssistanceEnabled property in the NIConfiguration, the NISession will invalidate with error (see NIError.h)
+ */
+- (void)setARSession:(ARSession*)session NS_SWIFT_NAME(setARSession(_:)) API_AVAILABLE(ios(16.0));
+
+/**
+ Compute a transform in ARKit's world coordinate system for a given nearby object.
+ @param object The nearby object for which to compute the world transform.
+ @return The transformation matrix in ARKit world coordinates.
+ @discussion When not available returns NINearbyObjectWorldTransformNotAvailable.
+ */
+- (simd_float4x4)worldTransformForObject:(NINearbyObject *)object API_AVAILABLE(ios(16.0)) NS_REFINED_FOR_SWIFT;
 @end
 
 /**
@@ -87,6 +118,29 @@
     NINearbyObjectRemovalReasonPeerEnded,
 } NS_SWIFT_NAME(NINearbyObject.RemovalReason);
 
+/** Expose algorithm state to make it possible for apps to coach users. */
+API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(macos, tvos)
+typedef NS_ENUM(NSInteger, NIAlgorithmConvergenceStatus) {
+    /** Algorithm convergence status is unknown. */
+    NIAlgorithmConvergenceStatusUnknown,
+    /** Algorithm is not converged. */
+    NIAlgorithmConvergenceStatusNotConverged,
+    /** Algorithm is converged. */
+    NIAlgorithmConvergenceStatusConverged,
+} NS_REFINED_FOR_SWIFT;
+
+API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(macos, tvos)
+NI_EXPORT
+@interface NIAlgorithmConvergence : NSObject <NSCopying, NSSecureCoding>
+@property (nonatomic, readonly) NIAlgorithmConvergenceStatus status NS_REFINED_FOR_SWIFT;
+@property (nonatomic, readonly) NSArray<NIAlgorithmConvergenceStatusReason>* reasons NS_SWIFT_UNAVAILABLE("use associated value in .notConverged case of NIAlgorithmConvergenceStatus");
+
+/** Unavailable */
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+@end
+
+
 /**
  Delegate for nearby interaction session updates.
  */
@@ -145,6 +199,29 @@
 */
 - (void)session:(NISession *)session didGenerateShareableConfigurationData:(NSData *)shareableConfigurationData forObject:(NINearbyObject *)object API_AVAILABLE(ios(15.0), watchos(8.0)) API_UNAVAILABLE(tvos, macos);
 
+/**
+ Called when the algorithm state is updated for a specific nearby object.
+ @param session the session interacting with this object.
+ @param convergence the algoriothm convergence context of the estimator for the session or nearby object
+ @param object which nearby object this state was updated, if null, applies to the entire session
+ */
+- (void)session:(NISession *)session didUpdateAlgorithmConvergence:(NIAlgorithmConvergence *)convergence forObject:(NINearbyObject * _Nullable)object API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(tvos, macos) NS_SWIFT_NAME(session(_:didUpdateAlgorithmConvergence:for:));
+
+
+/**
+ The delegate may implement this method to be informed that the session started running.
+
+ @param session The session which started running
+
+ @discussion a call to -runWithConfiguration: will result in one of the following outcomes:
+ 1. The session successfully starts running. This delegate callback will be subsequently invoked.
+ 2. Resources are not ready, and the session is immediately suspended. This delegate callback will not be invoked.
+ 3. An error is encountered, and the session is immediately invalidated. This delegate callback will not be invoked.
+
+ This delegate method provides a way to monitor #1.
+ Note that #2 and #3 can be monitored by other delegate methods such as -sessionWasSuspended: and -session:didInvalidateWithError:
+ */
+- (void)sessionDidStartRunning:(NISession *)session API_AVAILABLE(ios(16.0), watchos(9.0)) API_UNAVAILABLE(tvos, macos);
 @end
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NearbyInteraction.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NearbyInteraction.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NearbyInteraction.h	2022-02-12 10:45:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/NearbyInteraction.framework/Headers/NearbyInteraction.h	2022-05-21 06:16:42.000000000 -0400
@@ -7,7 +7,9 @@
 
 #import <NearbyInteraction/NIError.h>
 
+#import <NearbyInteraction/NIAlgorithmConvergenceStatusReason.h>
 #import <NearbyInteraction/NIConfiguration.h>
+#import <NearbyInteraction/NIDeviceCapability.h>
 #import <NearbyInteraction/NINearbyObject.h>
 #import <NearbyInteraction/NISession.h>
 
Clone this wiki locally