ARSessionObserver

Trait ARSessionObserver 

Source
pub unsafe trait ARSessionObserver: NSObjectProtocol {
    // Provided methods
    unsafe fn session_didFailWithError(
        &self,
        session: &ARSession,
        error: &NSError,
    )
       where Self: Sized + Message { ... }
    unsafe fn session_cameraDidChangeTrackingState(
        &self,
        session: &ARSession,
        camera: &ARCamera,
    )
       where Self: Sized + Message { ... }
    unsafe fn sessionWasInterrupted(&self, session: &ARSession)
       where Self: Sized + Message { ... }
    unsafe fn sessionInterruptionEnded(&self, session: &ARSession)
       where Self: Sized + Message { ... }
    unsafe fn sessionShouldAttemptRelocalization(
        &self,
        session: &ARSession,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn session_didOutputAudioSampleBuffer(
        &self,
        session: &ARSession,
        audio_sample_buffer: &CMSampleBuffer,
    )
       where Self: Sized + Message { ... }
    unsafe fn session_didOutputCollaborationData(
        &self,
        session: &ARSession,
        data: &ARCollaborationData,
    )
       where Self: Sized + Message { ... }
    unsafe fn session_didChangeGeoTrackingStatus(
        &self,
        session: &ARSession,
        geo_tracking_status: &ARGeoTrackingStatus,
    )
       where Self: Sized + Message { ... }
}
Available on crate features ARSession and objc2 only.
Expand description

Provided Methods§

Source

unsafe fn session_didFailWithError(&self, session: &ARSession, error: &NSError)
where Self: Sized + Message,

Available on crate feature objc2-foundation only.

This is called when a session fails.

On failure the session will be paused.

Parameter session: The session that failed.

Parameter error: The error being reported (see ARError.h).

Source

unsafe fn session_cameraDidChangeTrackingState( &self, session: &ARSession, camera: &ARCamera, )
where Self: Sized + Message,

Available on crate feature ARCamera only.

This is called when the camera’s tracking state has changed.

Parameter session: The session being run.

Parameter camera: The camera that changed tracking states.

Source

unsafe fn sessionWasInterrupted(&self, session: &ARSession)
where Self: Sized + Message,

This is called when a session is interrupted.

A session will be interrupted and no longer able to track when it fails to receive required sensor data. This happens when video capture is interrupted, for example when the application is sent to the background or when there are multiple foreground applications (see AVCaptureSessionInterruptionReason). No additional frame updates will be delivered until the interruption has ended.

Parameter session: The session that was interrupted.

Source

unsafe fn sessionInterruptionEnded(&self, session: &ARSession)
where Self: Sized + Message,

This is called when a session interruption has ended.

A session will continue running from the last known state once the interruption has ended. If the device has moved, anchors will be misaligned. To avoid this, some applications may want to reset tracking (see ARSessionRunOptions) or attempt to relocalize (see -[ARSessionObserver sessionShouldAttemptRelocalization:]).

Parameter session: The session that was interrupted.

Source

unsafe fn sessionShouldAttemptRelocalization(&self, session: &ARSession) -> bool
where Self: Sized + Message,

This is called after a session resumes from a pause or interruption to determine whether or not the session should attempt to relocalize.

To avoid misaligned anchors, apps may wish to attempt a relocalization after a session pause or interruption. If YES is returned: the session will begin relocalizing and tracking state will switch to limited with reason relocalizing. If successful, the session’s tracking state will return to normal. Because relocalization depends on the user’s location, it can run indefinitely. Apps that wish to give up on relocalization may call run with ARSessionRunOptionResetTracking at any time.

Parameter session: The session to relocalize.

Returns: Return YES to begin relocalizing.

Source

unsafe fn session_didOutputAudioSampleBuffer( &self, session: &ARSession, audio_sample_buffer: &CMSampleBuffer, )
where Self: Sized + Message,

Available on crate feature objc2-core-media only.

This is called when the session outputs a new audio sample buffer.

Parameter session: The session being run.

Parameter audioSampleBuffer: The captured audio sample buffer.

Source

unsafe fn session_didOutputCollaborationData( &self, session: &ARSession, data: &ARCollaborationData, )
where Self: Sized + Message,

Available on crate feature ARCollaborationData only.

This is called when the session generated new collaboration data.

This data should be sent to all participants.

Parameter session: The session that produced world tracking collaboration data.

Parameter data: Collaboration data to be sent to participants.

See: ARCollaborationData

Source

unsafe fn session_didChangeGeoTrackingStatus( &self, session: &ARSession, geo_tracking_status: &ARGeoTrackingStatus, )
where Self: Sized + Message,

Available on crate feature ARGeoTrackingTypes only.

This is called when geo tracking status changes.

Parameter session: The session being run.

Parameter geoTrackingStatus: Latest geo tracking status.

Trait Implementations§

Source§

impl ProtocolType for dyn ARSessionObserver

Source§

const NAME: &'static str = "ARSessionObserver"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn ARSessionObserver

Implementations on Foreign Types§

Source§

impl<T> ARSessionObserver for ProtocolObject<T>

Implementors§