diff --git a/impl/ocean/devices/arkit/AKDevice.h b/impl/ocean/devices/arkit/AKDevice.h index 16313099..956827ac 100644 --- a/impl/ocean/devices/arkit/AKDevice.h +++ b/impl/ocean/devices/arkit/AKDevice.h @@ -19,7 +19,7 @@ #include -@interface AKTracker6DOFDelegate : NSObject +@interface AKTracker6DOFDelegate : NSObject @end namespace Ocean @@ -192,6 +192,13 @@ class OCEAN_DEVICES_ARKIT_EXPORT AKDevice : virtual public Device */ bool parameter(const std::string& parameter, Value& value) override; + /** + * Translates the value of an ARTrackingState to a readable string. + * @param state The state to translate + * @return The readable string + */ + static std::string translateTrackingState(const ARTrackingState& state); + /** * Translates the value of an ARGeoTrackingState to a readable string. * @param state The state to translate diff --git a/impl/ocean/devices/arkit/AKDevice.mm b/impl/ocean/devices/arkit/AKDevice.mm index b5c2b8cc..6a97e1ba 100644 --- a/impl/ocean/devices/arkit/AKDevice.mm +++ b/impl/ocean/devices/arkit/AKDevice.mm @@ -736,6 +736,28 @@ - (void)session:(ARSession *)session didRemoveAnchors:(NSArray<__kindof ARAnchor } } +- (void)session:(ARSession*)session cameraDidChangeTrackingState:(ARCamera*)camera +{ + Log::debug() << "ARKit camera tracking state changed: " << AKDevice::translateTrackingState(camera.trackingState); +} + +- (void)sessionWasInterrupted:(ARSession*)session +{ + Log::warning() << "ARKit session was interrupted"; +} + +- (void)sessionInterruptionEnded:(ARSession*)session +{ + Log::debug() << "ARKit session interruption ended"; +} + +- (BOOL)sessionShouldAttemptRelocalization:(ARSession*)session +{ + Log::debug() << "ARKit session should attempt relocalization"; + + return YES; +} + + (ARVideoFormat*)determinePreferredVideoFormat:(NSArray*)supportedVideoFormats withWidth:(unsigned int)preferredWidth withHeight:(unsigned int)preferredHeight withFps:(float)preferredFps withHDR:(int)preferredHDR { #ifdef OCEAN_DEBUG @@ -1025,6 +1047,24 @@ + (ARVideoFormat*)determinePreferredVideoFormat:(NSArray*)suppor return true; } +std::string AKDevice::translateTrackingState(const ARTrackingState& state) +{ + switch (state) + { + case ARTrackingStateNotAvailable: + return std::string("ARTrackingStateNotAvailable"); + + case ARTrackingStateLimited: + return std::string("ARTrackingStateLimited"); + + case ARTrackingStateNormal: + return std::string("ARTrackingStateNormal"); + } + + ocean_assert(false && "Unknown"); + return std::string("Unknown"); +} + API_AVAILABLE(ios(14.0)) std::string AKDevice::translateGeoTrackingState(const ARGeoTrackingState& state) {