CloudSpatialAnchorSession Class
- java.
lang. Object - java.
lang. AutoCloseable - com.
microsoft. azure. spatialanchors. CloudSpatialAnchorSession
- com.
- java.
public class CloudSpatialAnchorSession
Use this class to create, locate and manage spatial anchors.
Constructor Summary
Constructor | Description |
---|---|
CloudSpatialAnchorSession() |
Initializes a new instance with a default configuration. |
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
addAnchorLocatedListener(AnchorLocatedListener listener)
Adds the specified listener to receive AnchorLocated events. Occurs when an anchor's location is determined. |
void |
addErrorListener(SessionErrorListener listener)
Adds the specified listener to receive Error events. Occurs when the session is unable to continue processing. |
void |
addLocateAnchorsCompletedListener(LocateAnchorsCompletedListener listener)
Adds the specified listener to receive LocateAnchorsCompleted events. Occurs when all the results from a watcher that is locating anchors are processed. |
void |
addOnLogDebugListener(OnLogDebugListener listener)
Adds the specified listener to receive OnLogDebug events. Occurs when a debug log message is generated. |
void |
addSessionUpdatedListener(SessionUpdatedListener listener)
Adds the specified listener to receive SessionUpdated events. Occurs when all the session state is updated. |
void |
addTokenRequiredListener(TokenRequiredListener listener)
Adds the specified listener to receive TokenRequired events. Occurs when the session requires an updated access token or authentication token. |
void |
addUpdatedSensorFingerprintRequiredListener(UpdatedSensorFingerprintRequiredListener listener)
Adds the specified listener to receive UpdatedSensorFingerprintRequired events. Occurs when the session requests an updated sensor fingerprint from the application. |
void |
close()
Closes this resource. |
Future |
createAnchorAsync(final CloudSpatialAnchor anchor)
Creates a new persisted spatial anchor from the specified local anchor and string properties. The local anchor passed into this method must have a valid transform. Note some platforms supported by Azure Spatial Anchors such as iOS allow transforms with scale component != 1.0. Azure Spatial Anchors SDK does not support such transforms and it will fail to create the spatial anchor with error code InvalidAnchorTransformRigidity. Any scale handling for anchors must be done at the app level. |
Cloud |
createWatcher(AnchorLocateCriteria criteria)
Creates a new object that watches for anchors that meet the specified criteria. |
Future |
deleteAnchorAsync(final CloudSpatialAnchor anchor)
Deletes a persisted spatial anchor. |
void |
finalize()
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
Future<String> |
getAccessTokenWithAccountKeyAsync(final String accountKey)
Gets the Azure Spatial Anchors access token from account key. |
Future<String> |
getAccessTokenWithAuthenticationTokenAsync(final String authenticationToken)
Gets the Azure Spatial Anchors access token from authentication token. |
List<Cloud |
getActiveWatchers()
Gets a list of active watchers. |
Future<Cloud |
getAnchorPropertiesAsync(final String identifier)
Gets a cloud spatial anchor for the given identifier, even if it hasn't been located yet. |
Session |
getConfiguration()
Gets the configuration information for the session. Configuration settings take effect when the session is started. |
Cloud |
getDiagnostics()
Gets the diagnostics settings for the session, which can be used to collect and submit data for troubleshooting and improvements. |
Platform |
getLocationProvider()
Location provider used to create and locate anchors using [Coarse Relocalization](https://aka.ms/CoarseRelocalization). |
Session |
getLogLevel()
Logging level for the session log events. |
Future<List<String>> |
getNearbyAnchorIdsAsync(final NearDeviceCriteria criteria)
Gets a list of all nearby cloud spatial anchor ids corresponding to a given criteria. |
Session |
getSession()
Gets the tracking session used to help locate anchors. This property is not available on the HoloLens platform. |
String |
getSessionId()
Gets the unique identifier for the session. |
Future<Session |
getSessionStatusAsync()
Gets an object describing the status of the session. |
boolean | getTelemetryEnabled() |
void |
processFrame(Frame frame)
Applications must call this method on platforms where per-frame processing is required. This method is not available on the HoloLens platform. |
Future |
refreshAnchorPropertiesAsync(final CloudSpatialAnchor anchor)
Refreshes properties for the specified spatial anchor. |
void |
removeAnchorLocatedListener(AnchorLocatedListener listener)
Removes the specified listener to receive AnchorLocated events. Occurs when an anchor's location is determined. |
void |
removeErrorListener(SessionErrorListener listener)
Removes the specified listener to receive Error events. Occurs when the session is unable to continue processing. |
void |
removeLocateAnchorsCompletedListener(LocateAnchorsCompletedListener listener)
Removes the specified listener to receive LocateAnchorsCompleted events. Occurs when all the results from a watcher that is locating anchors are processed. |
void |
removeOnLogDebugListener(OnLogDebugListener listener)
Removes the specified listener to receive OnLogDebug events. Occurs when a debug log message is generated. |
void |
removeSessionUpdatedListener(SessionUpdatedListener listener)
Removes the specified listener to receive SessionUpdated events. Occurs when all the session state is updated. |
void |
removeTokenRequiredListener(TokenRequiredListener listener)
Removes the specified listener to receive TokenRequired events. Occurs when the session requires an updated access token or authentication token. |
void |
removeUpdatedSensorFingerprintRequiredListener(UpdatedSensorFingerprintRequiredListener listener)
Removes the specified listener to receive UpdatedSensorFingerprintRequired events. Occurs when the session requests an updated sensor fingerprint from the application. |
void |
reset()
Resets environment data that has been captured in this session; applications must call this method when tracking is lost. On any platform, calling the method will clean all internal cached state. |
void |
setLocationProvider(PlatformLocationProvider value)
Location provider used to create and locate anchors using [Coarse Relocalization](https://aka.ms/CoarseRelocalization). |
void |
setLogLevel(SessionLogLevel value)
Logging level for the session log events. |
void |
setSession(Session value)
Sets the tracking session used to help locate anchors. This property is not available on the HoloLens platform. |
void | setTelemetryEnabled(boolean value) |
void |
start()
Begins capturing environment data for the session. |
void |
stop()
Stops capturing environment data for the session and cancels any outstanding locate operations. Environment data is maintained. |
Future |
updateAnchorPropertiesAsync(final CloudSpatialAnchor anchor)
Updates the specified spatial anchor. |
Constructor Details
CloudSpatialAnchorSession
public CloudSpatialAnchorSession()
Initializes a new instance with a default configuration.
Method Details
addAnchorLocatedListener
public void addAnchorLocatedListener(AnchorLocatedListener listener)
Adds the specified listener to receive AnchorLocated events. Occurs when an anchor's location is determined.
Parameters:
addErrorListener
public void addErrorListener(SessionErrorListener listener)
Adds the specified listener to receive Error events. Occurs when the session is unable to continue processing.
Parameters:
addLocateAnchorsCompletedListener
public void addLocateAnchorsCompletedListener(LocateAnchorsCompletedListener listener)
Adds the specified listener to receive LocateAnchorsCompleted events. Occurs when all the results from a watcher that is locating anchors are processed.
Parameters:
addOnLogDebugListener
public void addOnLogDebugListener(OnLogDebugListener listener)
Adds the specified listener to receive OnLogDebug events. Occurs when a debug log message is generated.
Parameters:
addSessionUpdatedListener
public void addSessionUpdatedListener(SessionUpdatedListener listener)
Adds the specified listener to receive SessionUpdated events. Occurs when all the session state is updated.
Parameters:
addTokenRequiredListener
public void addTokenRequiredListener(TokenRequiredListener listener)
Adds the specified listener to receive TokenRequired events. Occurs when the session requires an updated access token or authentication token.
Parameters:
addUpdatedSensorFingerprintRequiredListener
public void addUpdatedSensorFingerprintRequiredListener(UpdatedSensorFingerprintRequiredListener listener)
Adds the specified listener to receive UpdatedSensorFingerprintRequired events. Occurs when the session requests an updated sensor fingerprint from the application.
Parameters:
close
public void close()
Closes this resource.
createAnchorAsync
public Future createAnchorAsync(final CloudSpatialAnchor anchor)
Creates a new persisted spatial anchor from the specified local anchor and string properties. The local anchor passed into this method must have a valid transform. Note some platforms supported by Azure Spatial Anchors such as iOS allow transforms with scale component != 1.0. Azure Spatial Anchors SDK does not support such transforms and it will fail to create the spatial anchor with error code InvalidAnchorTransformRigidity. Any scale handling for anchors must be done at the app level.
Parameters:
createWatcher
public CloudSpatialAnchorWatcher createWatcher(AnchorLocateCriteria criteria)
Creates a new object that watches for anchors that meet the specified criteria.
Parameters:
deleteAnchorAsync
public Future deleteAnchorAsync(final CloudSpatialAnchor anchor)
Deletes a persisted spatial anchor.
Parameters:
finalize
protected void finalize()
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
getAccessTokenWithAccountKeyAsync
public Future
Gets the Azure Spatial Anchors access token from account key.
Parameters:
getAccessTokenWithAuthenticationTokenAsync
public Future
Gets the Azure Spatial Anchors access token from authentication token.
Parameters:
getActiveWatchers
public List
Gets a list of active watchers.
getAnchorPropertiesAsync
public Future
Gets a cloud spatial anchor for the given identifier, even if it hasn't been located yet.
Parameters:
getConfiguration
public SessionConfiguration getConfiguration()
Gets the configuration information for the session. Configuration settings take effect when the session is started.
getDiagnostics
public CloudSpatialAnchorSessionDiagnostics getDiagnostics()
Gets the diagnostics settings for the session, which can be used to collect and submit data for troubleshooting and improvements.
getLocationProvider
public PlatformLocationProvider getLocationProvider()
Location provider used to create and locate anchors using [Coarse Relocalization](https://aka.ms/CoarseRelocalization).
getLogLevel
public SessionLogLevel getLogLevel()
Logging level for the session log events.
getNearbyAnchorIdsAsync
public Future> getNearbyAnchorIdsAsync(final NearDeviceCriteria criteria)
Gets a list of all nearby cloud spatial anchor ids corresponding to a given criteria.
Parameters:
getSession
public Session getSession()
Gets the tracking session used to help locate anchors. This property is not available on the HoloLens platform.
getSessionId
public String getSessionId()
Gets the unique identifier for the session.
getSessionStatusAsync
public Future
Gets an object describing the status of the session.
getTelemetryEnabled
public boolean getTelemetryEnabled()
processFrame
public void processFrame(Frame frame)
Applications must call this method on platforms where per-frame processing is required. This method is not available on the HoloLens platform.
Parameters:
refreshAnchorPropertiesAsync
public Future refreshAnchorPropertiesAsync(final CloudSpatialAnchor anchor)
Refreshes properties for the specified spatial anchor.
Parameters:
removeAnchorLocatedListener
public void removeAnchorLocatedListener(AnchorLocatedListener listener)
Removes the specified listener to receive AnchorLocated events. Occurs when an anchor's location is determined.
Parameters:
removeErrorListener
public void removeErrorListener(SessionErrorListener listener)
Removes the specified listener to receive Error events. Occurs when the session is unable to continue processing.
Parameters:
removeLocateAnchorsCompletedListener
public void removeLocateAnchorsCompletedListener(LocateAnchorsCompletedListener listener)
Removes the specified listener to receive LocateAnchorsCompleted events. Occurs when all the results from a watcher that is locating anchors are processed.
Parameters:
removeOnLogDebugListener
public void removeOnLogDebugListener(OnLogDebugListener listener)
Removes the specified listener to receive OnLogDebug events. Occurs when a debug log message is generated.
Parameters:
removeSessionUpdatedListener
public void removeSessionUpdatedListener(SessionUpdatedListener listener)
Removes the specified listener to receive SessionUpdated events. Occurs when all the session state is updated.
Parameters:
removeTokenRequiredListener
public void removeTokenRequiredListener(TokenRequiredListener listener)
Removes the specified listener to receive TokenRequired events. Occurs when the session requires an updated access token or authentication token.
Parameters:
removeUpdatedSensorFingerprintRequiredListener
public void removeUpdatedSensorFingerprintRequiredListener(UpdatedSensorFingerprintRequiredListener listener)
Removes the specified listener to receive UpdatedSensorFingerprintRequired events. Occurs when the session requests an updated sensor fingerprint from the application.
Parameters:
reset
public void reset()
Resets environment data that has been captured in this session; applications must call this method when tracking is lost. On any platform, calling the method will clean all internal cached state.
setLocationProvider
public void setLocationProvider(PlatformLocationProvider value)
Location provider used to create and locate anchors using [Coarse Relocalization](https://aka.ms/CoarseRelocalization).
Parameters:
setLogLevel
public void setLogLevel(SessionLogLevel value)
Logging level for the session log events.
Parameters:
setSession
public void setSession(Session value)
Sets the tracking session used to help locate anchors. This property is not available on the HoloLens platform.
Parameters:
setTelemetryEnabled
public void setTelemetryEnabled(boolean value)
Parameters:
start
public void start()
Begins capturing environment data for the session.
stop
public void stop()
Stops capturing environment data for the session and cancels any outstanding locate operations. Environment data is maintained.
updateAnchorPropertiesAsync
public Future updateAnchorPropertiesAsync(final CloudSpatialAnchor anchor)
Updates the specified spatial anchor.
Parameters: