public final class

VDARRemoteController

extends Observable
java.lang.Object
   ↳ java.util.Observable
     ↳ com.vidinoti.android.vdarsdk.VDARRemoteController

Class Overview

Class used to retrieve and synchronize contexts with the PixLive Maker platform. Note that all actions can be observed by passing a specific Observer instance as argument. Each call to the update method of the observer will include an VDARRemoteController.ObserverUpdateInfo object describing the current status of the action.

Summary

Nested Classes
interface VDARRemoteController.Callback<T>  
class VDARRemoteController.ObserverUpdateInfo Describe the status of a current action  
Fields
public boolean useLocationInBuildRequest
Public Methods
void addProgressListener(VDARRemoteControllerListener listener)
Add the given listener to the listener list.
void fetchRemoteModelAsynchronously(String remoteID, Observer observer)
Fetch the context corresponding to the remoteID and insert it into the local AR DB.
final static VDARRemoteController getInstance()
Return the singleton instance of the Remote Controller
float getProgress()
Return the global progress of all remote controller tasks (between 0 and 100).
boolean isUsingRemoteTestServer()
Returns true if the current used servers are the test one (corresponding to https://ar-test.vidinoti.com ), or the production ones ( corresponding to https://ar.vidinoti.com ).
void removeProgressListener(VDARRemoteControllerListener listener)
Remove the given listener from the listener list.
void setCustomRemoteApiServerEndpoint(String url)
Sets a custom remote api server endpoint.
void setUseRemoteTestServer(boolean useTestServer)
Switch the remote controller to use to Vidinoti test server for the current app session (will be reset at false on App restart).
void sycnRemoteModelsAsynchronouslyWithPriors(ArrayList<VDARPrior> priors, Observer observer)
This method is deprecated. Use syncRemoteContextsAsynchronouslyWithPriors(List, Observer) instead
boolean syncRemoteContextsAsynchronouslyWithPriors(List<VDARPrior> priors, Observer observer)
Synchronize the local AR DB with the remote ARManager for the given set of priors.
void syncTagContexts(List<String> tagNames, Callback<Void> callback)
Downloads and stores the mapping between the given tag names and the contexts currently present on the device.
[Expand]
Inherited Methods
From class java.util.Observable
From class java.lang.Object

Fields

public boolean useLocationInBuildRequest

Public Methods

public void addProgressListener (VDARRemoteControllerListener listener)

Add the given listener to the listener list. The listener is not added a second time if already present in the list.

Parameters
listener The listener to add

public void fetchRemoteModelAsynchronously (String remoteID, Observer observer)

Fetch the context corresponding to the remoteID and insert it into the local AR DB. If the context already exists, it is replaced by the newly downloaded one.

Parameters
remoteID The remote ID of the context to downloaded
observer The observer which will receive progress event. Can be null.

public static final VDARRemoteController getInstance ()

Return the singleton instance of the Remote Controller

Returns
  • the singleton instance of the Remote Controller

public float getProgress ()

Return the global progress of all remote controller tasks (between 0 and 100).

Note that the progress can fluctuate as new tasks can be added while others are progressing. Therefore the progress will not necessarily linearly grow.

Returns
  • the global progress of all remote controller tasks

public boolean isUsingRemoteTestServer ()

Returns true if the current used servers are the test one (corresponding to https://ar-test.vidinoti.com ), or the production ones ( corresponding to https://ar.vidinoti.com ).

Returns
  • true if the current used servers are the test one (corresponding to https://ar-test.vidinoti.com ), or the production ones ( corresponding to https://ar.vidinoti.com )

public void removeProgressListener (VDARRemoteControllerListener listener)

Remove the given listener from the listener list. The provided listener will not receive anymore calls.

Parameters
listener The listener to remove

public void setCustomRemoteApiServerEndpoint (String url)

Sets a custom remote api server endpoint. The default value is "https://ar.vidinoti.com/api/api.php"

Parameters
url the API URL

public void setUseRemoteTestServer (boolean useTestServer)

Switch the remote controller to use to Vidinoti test server for the current app session (will be reset at false on App restart). Default: Using production server.

This setting is saved and persist accross application launched

Parameters
useTestServer Whether or not to use Vidinoti test server

public void sycnRemoteModelsAsynchronouslyWithPriors (ArrayList<VDARPrior> priors, Observer observer)

This method is deprecated.
Use syncRemoteContextsAsynchronouslyWithPriors(List, Observer) instead

Synchronize the local AR DB with the remote ARManager for the given set of priors.

The following actions will be performed:

  1. The contexts IDs corresponding to the priors or selected in PixLive Maker are retrieved from the server.
  2. Based on the local AR DB, a list of new contexts and contexts which has to be upgraded are computed.
  3. The contexts in the computed list are downloaded and inserted into the local AR DB.
  4. The contexts which have been previously downloaded by this method with the same prior and which have not been returned by the server are deleted.

Warning: Synchronization should be started only once at a time. Doing so will ensure a proper behaviour of the program.

Parameters
priors The array of priors to synchronize with. Pass null for the default application selected contexts
observer The observer to be called when the synchronization is done and in progress

public boolean syncRemoteContextsAsynchronouslyWithPriors (List<VDARPrior> priors, Observer observer)

Synchronize the local AR DB with the remote ARManager for the given set of priors.

The following actions will be performed:

  1. The contexts IDs corresponding to the priors or selected in PixLive Maker are retrieved from the server.
  2. Based on the local AR DB, a list of new contexts and contexts which has to be upgraded are computed.
  3. The contexts in the computed list are downloaded and inserted into the local AR DB.
  4. The contexts which have been previously downloaded by this method with the same prior and which have not been returned by the server are deleted.

Warning: Synchronization should be started only once at a time. Doing so will ensure a proper behaviour of the program.

Parameters
priors The list of priors to synchronize with. Pass null for the default application selected contexts
observer The observer to be called when the synchronization is done and in progress
Returns
  • false if a synchronization is already in progress, true otherwise.

public void syncTagContexts (List<String> tagNames, Callback<Void> callback)

Downloads and stores the mapping between the given tag names and the contexts currently present on the device. This method must be called after a model synchronization and before calling enableContextsWithTags(List)

Parameters
tagNames a list of tag names
callback the callback called once the operation is over. No data is returned and an error is present if an error happened.