Package apple.nearbyinteraction.protocol
Interface NISessionDelegate
-
public interface NISessionDelegateDelegate for nearby interaction session updates. API-Since: 14.0
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidsessionDidGenerateShareableConfigurationDataForObject(@NotNull NISession session, @NotNull NSData shareableConfigurationData, @NotNull NINearbyObject object)Provides configuration data that needs to be shared with the accessory.default voidsessionDidInvalidateWithError(@NotNull NISession session, @NotNull NSError error)This is called when a session is invalidated.default voidsessionDidRemoveNearbyObjectsWithReason(@NotNull NISession session, @NotNull NSArray<? extends NINearbyObject> nearbyObjects, long reason)This is called when the system is no longer attempting to interact with some nearby objects.default voidsessionDidStartRunning(@NotNull NISession session)The delegate may implement this method to be informed that the session started running.default voidsessionDidUpdateAlgorithmConvergenceForObject(@NotNull NISession session, @NotNull NIAlgorithmConvergence convergence, @Nullable NINearbyObject object)Called when the algorithm state is updated for a specific nearby object.default voidsessionDidUpdateNearbyObjects(@NotNull NISession session, @NotNull NSArray<? extends NINearbyObject> nearbyObjects)This is called when new updates about nearby objects are available.default voidsessionSuspensionEnded(@NotNull NISession session)This is called when a session may be resumed.default voidsessionWasSuspended(@NotNull NISession session)This is called when a session is suspended.
-
-
-
Method Detail
-
sessionDidGenerateShareableConfigurationDataForObject
default void sessionDidGenerateShareableConfigurationDataForObject(@NotNull @NotNull NISession session, @NotNull @NotNull NSData shareableConfigurationData, @NotNull @NotNull NINearbyObject object)Provides configuration data that needs to be shared with the accessory. [@note] Shareable configuration data is only provided when running an NINearbyAccessoryConfiguration. After invoking this callback, the session will go into a special preparedness state for a limited amount of time. The interaction on the accessory must start within this time window. If activity is not detected from the accessory, the session will call the -[session:didRemoveNearbyObjects:reason:] delegate callback. To restart the session, coordinate with the accessory and call -[runWithConfiguration] again.- Parameters:
session- The session which produced the configuration data.shareableConfigurationData- The configuration data that needs to be shared with the accessory.object- A representation of the accessory as a NINearbyObject. The discoveryToken property will be equal to the one in the configuration used to run the session. API-Since: 15.0
-
sessionDidInvalidateWithError
default void sessionDidInvalidateWithError(@NotNull @NotNull NISession session, @NotNull @NotNull NSError error)This is called when a session is invalidated.- Parameters:
session- The session that has become invalid. Your app should discard any references it has to this session.error- The error indicating the reason for invalidation of the session (see NIError.h).
-
sessionDidRemoveNearbyObjectsWithReason
default void sessionDidRemoveNearbyObjectsWithReason(@NotNull @NotNull NISession session, @NotNull @NotNull NSArray<? extends NINearbyObject> nearbyObjects, long reason)This is called when the system is no longer attempting to interact with some nearby objects. The system was unable to interact with a peer device for some time, or the peer device signaled that it is leaving the session. After this callback is received, the session with the peer is no longer active. To retry interacting with the peer, issue a new call to -runWithConfiguration:.- Parameters:
session- The nearby interaction session that removed the nearby object(s).nearbyObjects- The nearby objects that were removed.reason- The reason the nearby object(s) were removed. All objects in nearbyObjects are removed for the same reason. If multiple nearby objects are removed for different reasons, -didRemoveNearbyObjects:reason: will be called multiple times.
-
sessionDidUpdateNearbyObjects
default void sessionDidUpdateNearbyObjects(@NotNull @NotNull NISession session, @NotNull @NotNull NSArray<? extends NINearbyObject> nearbyObjects)This is called when new updates about nearby objects are available.- Parameters:
session- The nearby interaction session being run.nearbyObjects- The nearby objects that have been updated.
-
sessionSuspensionEnded
default void sessionSuspensionEnded(@NotNull @NotNull NISession session)This is called when a session may be resumed.- Parameters:
session- The nearby interaction session that was suspended.
-
sessionWasSuspended
default void sessionWasSuspended(@NotNull @NotNull NISession session)This is called when a session is suspended. A session will be suspended in various app and system scenarios. A suspended session may be run again only after -sessionSuspensionEnded: has been called. Restart a session by issuing a new call to -runWithConfiguration:.- Parameters:
session- The nearby interaction session that was suspended.
-
sessionDidUpdateAlgorithmConvergenceForObject
default void sessionDidUpdateAlgorithmConvergenceForObject(@NotNull @NotNull NISession session, @NotNull @NotNull NIAlgorithmConvergence convergence, @Nullable @Nullable NINearbyObject object)Called when the algorithm state is updated for a specific nearby object.- Parameters:
session- the session interacting with this object.convergence- the algoriothm convergence context of the estimator for the session or nearby objectobject- which nearby object this state was updated, if null, applies to the entire session API-Since: 16.0
-
sessionDidStartRunning
default void sessionDidStartRunning(@NotNull @NotNull NISession session)The delegate may implement this method to be informed that the session started running. 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: API-Since: 16.0- Parameters:
session- The session which started running
-
-