ArVpsAvailabilityFuture

An asynchronous operation checking VPS availability.

Summary

The availability of VPS in a given location helps to improve the quality of Geospatial localization and tracking accuracy. See ArSession_checkVpsAvailabilityAsync for more details.

Enumerations

ArFutureState{
  AR_FUTURE_STATE_PENDING = 0,
  AR_FUTURE_STATE_CANCELLED = 1,
  AR_FUTURE_STATE_DONE = 2
}
enum
The state of an asynchronous operation.
ArVpsAvailability{
  AR_VPS_AVAILABILITY_UNKNOWN = 0,
  AR_VPS_AVAILABILITY_AVAILABLE = 1,
  AR_VPS_AVAILABILITY_UNAVAILABLE = 2,
  AR_VPS_AVAILABILITY_ERROR_INTERNAL = -1,
  AR_VPS_AVAILABILITY_ERROR_NETWORK_CONNECTION = -2,
  AR_VPS_AVAILABILITY_ERROR_NOT_AUTHORIZED = -3,
  AR_VPS_AVAILABILITY_ERROR_RESOURCE_EXHAUSTED = -4
}
enum

Typedefs

ArCheckVpsAvailabilityCallback)(void *context, ArVpsAvailability availability) typedef
void(*
Callback definition for ArSession_checkVpsAvailabilityAsync.
ArVpsAvailabilityFuture typedef
struct ArVpsAvailabilityFuture_
Handle to an asynchronous operation launched by ArSession_checkVpsAvailabilityAsync.

Functions

ArVpsAvailabilityFuture_cancel(const ArSession *session, ArVpsAvailabilityFuture *future, int32_t *out_was_cancelled)
void
Tries to cancel execution of this operation.
ArVpsAvailabilityFuture_getResult(const ArSession *session, const ArVpsAvailabilityFuture *future, ArVpsAvailability *out_result_availability)
void
Returns the result of an asynchronous operation.
ArVpsAvailabilityFuture_getState(const ArSession *session, const ArVpsAvailabilityFuture *future, ArFutureState *out_state)
void
Gets the state of an asynchronous operation.
ArVpsAvailabilityFuture_release(ArVpsAvailabilityFuture *future)
void
Releases a reference to a future.

Enumerations

ArFutureState

 ArFutureState

The state of an asynchronous operation.

Properties
AR_FUTURE_STATE_CANCELLED

The operation has been cancelled.

Any associated callback will never be invoked.

AR_FUTURE_STATE_DONE

The operation is complete and the result is available.

If a callback was associated with this future, it will soon be invoked with the result on the main thread, if it hasn't been invoked already.

AR_FUTURE_STATE_PENDING

The operation is still pending.

The result of the operation isn't available yet and any associated callback hasn't yet been dispatched or invoked.

Do not use this to check if the operation can be cancelled as the state can change from another thread between the call to ArVpsAvailabilityFuture_getState and ArVpsAvailabilityFuture_cancel.

ArVpsAvailability

 ArVpsAvailability

The result of ArSession_checkVpsAvailabilityAsync, obtained by ArVpsAvailabilityFuture_getResult or from an invocation of an ArCheckVpsAvailabilityCallback.

Properties
AR_VPS_AVAILABILITY_AVAILABLE

VPS is available at the requested location.

AR_VPS_AVAILABILITY_ERROR_INTERNAL

An internal error occurred while determining availability.

AR_VPS_AVAILABILITY_ERROR_NETWORK_CONNECTION

The external service could not be reached due to a network connection error.

AR_VPS_AVAILABILITY_ERROR_NOT_AUTHORIZED

An authorization error occurred when communicating with the Google Cloud ARCore API.

See Enable the Geospatial API for troubleshooting steps.

AR_VPS_AVAILABILITY_ERROR_RESOURCE_EXHAUSTED

Too many requests were sent.

AR_VPS_AVAILABILITY_UNAVAILABLE

VPS is not available at the requested location.

AR_VPS_AVAILABILITY_UNKNOWN

The request to the remote service is not yet completed, so the availability is not yet known.

Typedefs

ArCheckVpsAvailabilityCallback

void(* ArCheckVpsAvailabilityCallback)(void *context, ArVpsAvailability availability)

Callback definition for ArSession_checkVpsAvailabilityAsync.

The context argument will be the same as that passed to ArSession_checkVpsAvailabilityAsync. The availability argument will be the same as the result obtained from the future returned by ArSession_checkVpsAvailabilityAsync.

It is a best practice to free context memory provided to ArSession_checkVpsAvailabilityAsync at the end of the callback implementation.

ArVpsAvailabilityFuture

struct ArVpsAvailabilityFuture_ ArVpsAvailabilityFuture

Handle to an asynchronous operation launched by ArSession_checkVpsAvailabilityAsync.

Release with ArVpsAvailabilityFuture_release. (reference type, long-lived).

Functions

ArVpsAvailabilityFuture_cancel

void ArVpsAvailabilityFuture_cancel(
  const ArSession *session,
  ArVpsAvailabilityFuture *future,
  int32_t *out_was_cancelled
)

Tries to cancel execution of this operation.

out_was_cancelled will be set to 1 if the operation was cancelled by this invocation, and in that case it is a best practice to free context memory provided to ArSession_checkVpsAvailabilityAsync.

Details
Parameters
session
The ARCore session.
future
The handle for the asynchronous operation.
out_was_cancelled
Set to 1 if this invocation successfully cancelled the operation, 0 otherwise. This may be null.

ArVpsAvailabilityFuture_getResult

void ArVpsAvailabilityFuture_getResult(
  const ArSession *session,
  const ArVpsAvailabilityFuture *future,
  ArVpsAvailability *out_result_availability
)

Returns the result of an asynchronous operation.

The returned result is only valid when ArVpsAvailabilityFuture_getState returns AR_FUTURE_STATE_DONE.

Details
Parameters
session
The ARCore session.
future
The handle for the asynchronous operation.
out_result_availability
The result of the operation, if the Future's state is AR_FUTURE_STATE_DONE.

ArVpsAvailabilityFuture_getState

void ArVpsAvailabilityFuture_getState(
  const ArSession *session,
  const ArVpsAvailabilityFuture *future,
  ArFutureState *out_state
)

Gets the state of an asynchronous operation.

Details
Parameters
session
The ARCore session.
future
The handle for the asynchronous operation.
out_state
The state of the operation.

ArVpsAvailabilityFuture_release

void ArVpsAvailabilityFuture_release(
  ArVpsAvailabilityFuture *future
)

Releases a reference to a future.

This does not mean that the operation will be terminated - see ArVpsAvailabilityFuture_cancel.

This function may safely be called with NULL - it will do nothing.