CloudRecognizerBaseBehaviour Class

Inherits: DeviceUserAbstractBehaviour

Description

CloudRecognizerBaseBehaviour is the component to control CloudRecognizer in the AR scene.

When it is Bind to a DeviceAbstractBehaviour, it will automatically connect to the server and if the connection fails, an auto reconnection will be triggered.

CloudRecognizer works on its own thread. You can call StartDetect/StopDetect to control the recognition.

Before using a CloudRecognizer, an ImageTracker must be setup and prepared. Any target returned from cloud should be manually put into the ImageTracker if it need to be tracked. Then the target can be used as same as a local target after loaded into the tracker. When a target is recognized, you can get it from CloudUpdate event, and you should use target uid to distinguish different targets. The target id is dynamically created and cannot be used as unique identifier in the cloud condition.

Public Types

enum Status{Success, Reconnecting, Fail}

Public Fields

string Server
string Key
string Secret

Public Functions

bool StartDetect()
bool StopDetect()

Public Events

event Action<CloudRecognizerBaseBehaviour, CloudRecognizer.Status, List<ImageTarget>> CloudUpdate

Overwritten MonoBahaviour Functions

protected virtual void OnDestroy()
protected virtual void Start()
protected virtual void Update()

enum Status

Constant

Value

Description

Success

0

recognition success

Reconnecting

1

connection fail or disconnected, reconnection is ongoing

Fail

2

recognition fail

string Server

Server address, usually has the format of xxx.easyar.com:port, without http://.

string Key

Key.

string Secret

Secret.

bool StartTrack()

Starts the recognize.

bool StopTrack()

Stops the recognize.

event Action<CloudRecognizerBaseBehaviour, CloudRecognizer.Status, List<ImageTarget>> CloudUpdate

The event when recognition returns a result or connection fail (will auto reconnect).