MultiSetCallback
Overview
MultiSetCallback is the protocol your app implements to receive SDK events: authentication, localization, object tracking, and mesh loading. The instance is passed to MultiSet.shared.initialize(config:callback:) and is held weakly by the SDK.
class MultiSetSDKDelegate: MultiSetCallback {
func onSDKReady() { }
func onAuthenticationSuccess() { }
func onAuthenticationFailure(error: String) { }
func onLocalizationSuccess(result: LocalizationResult) { }
func onLocalizationFailure(error: String) { }
func onTrackingStateChanged(state: TrackingState) { }
}Only the six methods above are required. Every other method has a default no-op implementation, so existing integrations keep compiling when new callbacks are added.
Required Methods
onSDKReady()
Called synchronously from initialize(config:callback:), before authentication starts.
This is not an authentication signal. Wait for onAuthenticationSuccess() before calling localize(). Attaching an ARSession here is safe, because the SDK applies it once authenticated.
onAuthenticationSuccess()
Authentication with the MultiSet servers succeeded. The SDK is ready to localize.
onAuthenticationFailure(error: String)
Authentication failed.
error
String
Description of the failure
onLocalizationSuccess(result: LocalizationResult)
A pose was returned and accepted. The gizmo has moved and, if meshVisualization is enabled, the mesh is loading.
onLocalizationFailure(error: String)
The localization request failed, or no pose was found.
error
String
Description of the failure
When firstLocalizationUntilSuccess is enabled, failures before the first success are retried silently and do not reach this callback.
onTrackingStateChanged(state: TrackingState)
ARKit tracking state changed.
state
TrackingState
.tracking, .paused or .stopped
Optional Methods
Each of these has a default empty implementation.
onLocalizationFalsePositive(info: FalsePositiveInfo)
The server returned a pose, but it contradicts the device's own AR trajectory, so the SDK discarded it. This fires instead of onLocalizationSuccess, and only when poseConsistencyCheck is enabled.
The request itself succeeded. The answer was wrong, most likely because the query image matched a visually similar part of the space. The AR scene is left untouched: the gizmo and mesh keep the last accepted pose.
info
FalsePositiveInfo
Details of the discarded response, see below
There is no automatic fast retry after a false positive, because a retry from the same spot tends to produce the same wrong match. Prompt the user to move to a more distinctive viewpoint and localize again. If they insist the rejections are wrong, call MultiSet.shared.resetPoseConsistencyReference(), which makes the next result trusted and adopted as the new reference.
onMeshLoaded(mapCode: String)
A map mesh finished downloading and rendering.
mapCode
String
Code of the map whose mesh was loaded
onMeshLoadError(error: String)
Mesh download or rendering failed. Localization itself is unaffected.
onObjectTrackingSuccess(objectCode: String, confidence: Double)
A tracked object was located and its outline mesh placed.
objectCode
String
Code of the detected object
confidence
Double
Detection confidence (0.0 to 1.0)
onObjectTrackingFailure(error: String)
Object tracking failed or no object was matched.
onObjectMeshLoaded(objectCode: String)
An object mesh was loaded and rendered with the outline shader.
FalsePositiveInfo
Details of a localization response that the pose consistency check discarded.
jumpMeters
Float
How far the discarded response placed the map from where the last accepted fix placed it
thresholdMeters
Float
The tolerance that was in force, from poseConsistencyThreshold
consecutiveCount
Int
Consecutive false positives since the last accepted fix. 1 on the first one
mapCodes
[String]
Map codes the server reported for the discarded response
confidence
Float?
Server confidence of the discarded response, when reported
reason
String
Short machine-readable explanation, for logs
summary
String
One-line description of all of the above, ready to log
A high confidence on a discarded response is normal and is the point of the check. The server was sure about a match that the device's own motion rules out.
Related
Last updated
Was this helpful?

