The VLWorker is a wrapper for an Worker object. The Worker object manages the tracking thread. More...
Inherits IDisposable.
Public Member Functions | |
delegate void | BoolCallback (bool data, IntPtr clientData) |
delegate void | StringCallback ([MarshalAs(UnmanagedType.LPStr)] string message, IntPtr clientData) |
delegate void | JsonStringCallback ([MarshalAs(UnmanagedType.LPStr)] string errorJson, [MarshalAs(UnmanagedType.LPStr)] string dataJson, IntPtr clientData) |
delegate void | JsonStringAndBinaryCallback ([MarshalAs(UnmanagedType.LPStr)] string description, IntPtr data, System.UInt32 dataSize, IntPtr clientData) |
delegate void | ImageWrapperCallback (IntPtr handle, IntPtr clientData) |
delegate void | ExtrinsicDataWrapperCallback (IntPtr handle, IntPtr clientData) |
delegate void | IntrinsicDataWrapperCallback (IntPtr handle, IntPtr clientData) |
VLWorker (VLAbstractApplicationWrapper aap, bool syncWorker=false) | |
Constructor of VLWorker. More... | |
bool | GetDisposed () |
void | Dispose () |
Explicitly releases references to unmanaged resources. More... | |
bool | Start () |
Starts the tracking thread. More... | |
bool | Stop () |
Stops the tracking thread. More... | |
bool | RunOnceSync () |
Processes the enqueued commands and the tracking once. More... | |
VLImageWrapper | GetImageSync () |
Returns a pointer to the camera image. More... | |
bool | IsRunning () |
Returns whether the thread is currently running or not. More... | |
bool | PushCommand (string name, string parameter, BoolCallback callback, IntPtr clientData) |
Enqueues a command for the tracking thread as string. More... | |
bool | PushJsonCommand (string jsonString, JsonStringCallback callback, IntPtr clientData) |
Enqueues a command for the tracking thread using a JSON string. More... | |
bool | PushCommand (VLWorkerCommands.CommandBase cmd, JsonStringCallback callback, IntPtr clientData) |
Enqueues a command for the tracking thread. More... | |
bool | ProcessCallbacks () |
Executes all enqueued callbacks. More... | |
bool | AddImageListener (ImageWrapperCallback listener, IntPtr clientData) |
Registers a listener for image events. More... | |
bool | RemoveImageListener (ImageWrapperCallback listener, IntPtr clientData) |
Unregisters a listener from image events. More... | |
bool | AddExtrinsicDataListener (ExtrinsicDataWrapperCallback listener, IntPtr clientData) |
Registers a listener for extrinsic data events. More... | |
bool | RemoveExtrinsicDataListener (ExtrinsicDataWrapperCallback listener, IntPtr clientData) |
Unregisters a listener from extrinsic data events. More... | |
bool | AddIntrinsicDataListener (IntrinsicDataWrapperCallback listener, IntPtr clientData) |
Registers a listener for intrinsic data events. More... | |
bool | RemoveIntrinsicDataListener (IntrinsicDataWrapperCallback listener, IntPtr clientData) |
Unregisters a listener from intrinsic data events. More... | |
bool | AddTrackingStateListener (StringCallback listener, IntPtr clientData) |
Registers a listener for tracking state events. More... | |
bool | RemoveTrackingStateListener (StringCallback listener, IntPtr clientData) |
Unregisters a listener from tracking state events. More... | |
bool | AddPerformanceInfoListener (StringCallback listener, IntPtr clientData) |
Registers a listener for performance information events. More... | |
bool | RemovePerformanceInfoListener (StringCallback listener, IntPtr clientData) |
Unregisters a listener from performance info events. More... | |
bool | AddNamedImageListener (string key, ImageWrapperCallback listener, IntPtr clientData) |
Registers a listener for named image events. More... | |
bool | RemoveNamedImageListener (string key, ImageWrapperCallback listener, IntPtr clientData) |
Unregisters a listener from named image events. More... | |
bool | AddNamedExtrinsicDataListener (string key, ExtrinsicDataWrapperCallback listener, IntPtr clientData) |
Registers a listener for named extrinsic data events. More... | |
bool | RemoveNamedExtrinsicDataListener (string key, ExtrinsicDataWrapperCallback listener, IntPtr clientData) |
Unregisters a listener from named extrinsic data events. More... | |
bool | AddNamedIntrinsicDataListener (string key, IntrinsicDataWrapperCallback listener, IntPtr clientData) |
Registers a listener for named intrinsic data events. More... | |
bool | RemoveNamedIntrinsicDataListener (string key, IntrinsicDataWrapperCallback listener, IntPtr clientData) |
Unregisters a listener from named intrinsic data events. More... | |
bool | AddAnchorToWorldTransformListener (string anchorName, ExtrinsicDataWrapperCallback listener, IntPtr clientData) |
Registers a listener for anchor to world transform events. More... | |
bool | RemoveAnchorToWorldTransformListener (string anchorName, ExtrinsicDataWrapperCallback listener, IntPtr clientData) |
Unregisters a listener from anchor to world transform events. More... | |
bool | PollEvents () |
Calls the registered listeners for the enqueued events. More... | |
bool | WaitEvents (uint timeout) |
Waits for enqueued events and calls the registered listeners. More... | |
bool | PushJsonAndBinaryCommand (string jsonString, IntPtr binaryDataPtr, UInt32 binaryDataSize, JsonStringAndBinaryCallback callback, IntPtr clientData) |
Enqueues a command for the tracking thread using a JSON string and binary data - THIS FUNCTION IS CONSIDERED AS BETA AND MAY BE MATTER OF CHANGE. More... | |
bool | SetNodeImageSync (VLImageWrapper image, string node, string key) |
VLImageWrapper | GetNodeImageSync (string node, string key) |
bool | SetNodeIntrinsicDataSync (VLIntrinsicDataWrapper intrinsicData, string node, string key) |
VLIntrinsicDataWrapper | GetNodeIntrinsicDataSync (string node, string key) |
bool | SetNodeExtrinsicDataSync (VLExtrinsicDataWrapper extrinsicData, string node, string key) |
VLExtrinsicDataWrapper | GetNodeExtrinsicDataSync (string node, string key) |
VLTrackingState | GetNodeTrackingStateSync (string node) |
The VLWorker is a wrapper for an Worker object. The Worker object manages the tracking thread.
|
inline |
Constructor of VLWorker.
|
inline |
Registers a listener for anchor to world transform events.
anchorName | Name of the anchor which the listener should be getting the extrinsic from. |
listener | Listener which will be notified during the event processing, if an extrinsic data event occurred. |
clientData | The listener function will be called with the given pointer value as parameter. |
true
, if the listener was registered successfully; false
otherwise.
|
inline |
Registers a listener for extrinsic data events.
listener | Listener which will be notified during the event processing, if an extrinsic data event occurred. |
clientData | The listener function will be called with the given pointer value as parameter. |
true
, if the listener was registered successfully; false
otherwise.
|
inline |
Registers a listener for image events.
listener | Listener which will be notified during the event processing, if an image event occurred. |
clientData | The listener function will be called with the given pointer value as parameter. |
true
, if the listener was registered successfully; false
otherwise.
|
inline |
Registers a listener for intrinsic data events.
listener | Listener which will be notified during the event processing, if an intrinsic data event occurred. |
clientData | The listener function will be called with the given pointer value as argument. |
true
, if the listener was registered successfully; false
otherwise.
|
inline |
Registers a listener for named extrinsic data events.
key | Key of the requested extrinsic data. |
listener | Listener which will be notified during the event processing, if a named extrinsic data event occurred. |
clientData | The listener function will be called with the given pointer value as parameter. |
true
, if the listener was registered successfully; false
otherwise.
|
inline |
Registers a listener for named image events.
key | Key of the requested image. |
listener | Listener which will be notified during the event processing, if a named image event occurred. |
clientData | The listener function will be called with the given pointer value as parameter. |
true
, if the listener was registered successfully; false
otherwise.
|
inline |
Registers a listener for named intrinsic data events.
key | Key of the requested intrinsic data. |
listener | Listener which will be notified during the event processing, if a named intrinsic data event occurred. |
clientData | The listener function will be called with the given pointer value as parameter. |
true
, if the listener was registered successfully; false
otherwise.
|
inline |
Registers a listener for performance information events.
listener | Listener which will be notified during the event processing, if a performance info state event occurred. |
clientData | The listener function will be called with the given pointer value as parameter. |
true
, if the listener was registered successfully; false
otherwise.
|
inline |
Registers a listener for tracking state events.
listener | Listener which will be notified during the event processing, if an tracking state event occurred. |
clientData | The listener function will be called with the given pointer value as parameter. |
true
, if the listener was registered successfully; false
otherwise. delegate void VLWorker.BoolCallback | ( | bool | data, |
IntPtr | clientData | ||
) |
|
inline |
Explicitly releases references to unmanaged resources.
Call Dispose when you are finished using the VLWorker. The Dispose method leaves the VLWorker in an unusable state. After calling Dispose, you must release all references to the VLWorker so the garbage collector can reclaim the memory that the VLWorker was occupying.
delegate void VLWorker.ExtrinsicDataWrapperCallback | ( | IntPtr | handle, |
IntPtr | clientData | ||
) |
|
inline |
|
inline |
Returns a pointer to the camera image.
This function only works, if the Worker was created as synchronous instance.
NOTICE: This functions is experimental and might get removed in future.
VLImageWrapper
, on success; null
, otherwise.
|
inline |
|
inline |
|
inline |
|
inline |
delegate void VLWorker.ImageWrapperCallback | ( | IntPtr | handle, |
IntPtr | clientData | ||
) |
delegate void VLWorker.IntrinsicDataWrapperCallback | ( | IntPtr | handle, |
IntPtr | clientData | ||
) |
|
inline |
Returns whether the thread is currently running or not.
true
, if the thread is running; false
otherwise. delegate void VLWorker.JsonStringAndBinaryCallback | ( | [MarshalAs(UnmanagedType.LPStr)] string | description, |
IntPtr | data, | ||
System.UInt32 | dataSize, | ||
IntPtr | clientData | ||
) |
delegate void VLWorker.JsonStringCallback | ( | [MarshalAs(UnmanagedType.LPStr)] string | errorJson, |
[MarshalAs(UnmanagedType.LPStr)] string | dataJson, | ||
IntPtr | clientData | ||
) |
|
inline |
Calls the registered listeners for the enqueued events.
Listeners aren't called immediately from the tracking thread in order to avoid synchronisation problems. Instead this method should be called regularly from the main thread.
true
, if the events where processed successfully; false
otherwise.
|
inline |
Executes all enqueued callbacks.
Callbacks aren't called immediately from the tracking thread in order to avoid synchronisation problems. Instead this method should be called regularly from the main thread.
true
, if the command was enqueue successfully; false
otherwise.
|
inline |
Enqueues a command for the tracking thread as string.
The command gets processed asynchronously by the tracking thread and a callback will called once after the processing has finished.
The following tracking independent commands exist:
The following commands exist for the line tracker:
NOTICE: Calling PushCommand with a name and parameter string is obsolete. Use one of the other Push(Json)Command functions instead.
name | Name of the command. |
parameter | Parameter for the command. Value will be ignored, if no parameters are expected by the command. |
callback | Callback, which will be called inside ProcessCallbacks after the command was processed. |
clientData | The callback function will be called with the given pointer value as parameter. |
true
, if the command was enqueue successfully; false
otherwise.
|
inline |
Enqueues a command for the tracking thread.
A callback will called once after the processing has finished.
The different commands are defined inside the VLWorkerCommands namespace.
cmd | The command object. |
callback | Callback, which will be called inside ProcessCallbacks after the command was processed. |
clientData | The callback function will be called with the given pointer value. |
true
, if the command was enqueue successfully; false
otherwise.
|
inline |
Enqueues a command for the tracking thread using a JSON string and binary data - THIS FUNCTION IS CONSIDERED AS BETA AND MAY BE MATTER OF CHANGE.
The command gets processed asynchronously by the tracking thread and a callback will called once after the processing has finished. Since the memory is pinned until the callback is called in order to prevent multiple copies, the static FreeBinaryMemory() function should be called from the callback, in order to free allocated memory, which has eventually beeing passed to the function.
jsonString | The command with all necessary data as JSON string. The JSON string should describe the data |
binaryDataPtr | Binary data ptr, which is a pinned gcHandle memory pointer, which should be given to the vlSDK |
binaryDataSize | The size of the Binary data. |
callback | Callback, which will be called inside ProcessCallbacks after the command was processed. |
clientData | The callback function will be called with the given pointer value. |
true
, if the command was enqueue successfully; false
otherwise (usually some JSON syntax error).
|
inline |
Enqueues a command for the tracking thread using a JSON string.
The command gets processed asynchronously by the tracking thread and a callback will called once after the processing has finished.
You need to make sure, that the JSON string has the expected format. Therefore you might want to use the VLWorker.PushCommand functions instead. This function will ensure that the command will be pushed as expected.
jsonString | The command with all necessary data as JSON string. |
callback | Callback, which will be called inside ProcessCallbacks after the command was processed. |
clientData | The callback function will be called with the given pointer value. |
true
, if the command was enqueue successfully; false
otherwise (usually some JSON syntax error).
|
inline |
Unregisters a listener from anchor to world transform events.
anchorName | Name of the anchor from which the listener should be removed. |
listener | Listener which should be unregistered. |
clientData | Pointer value used as parameter during the registration of the listener. |
true
, if the listener was unregistered successfully; false
otherwise.
|
inline |
Unregisters a listener from extrinsic data events.
listener | Listener which should be unregistered. |
clientData | Pointer value used as parameter during the registration of the listener. |
true
, if the listener was unregistered successfully; false
otherwise.
|
inline |
Unregisters a listener from image events.
listener | Listener which should be unregistered. |
clientData | Pointer value used as parameter during the registration of the listener. |
true
, if the listener was unregistered successfully; false
otherwise.
|
inline |
Unregisters a listener from intrinsic data events.
listener | Listener which should be unregistered. |
clientData | Pointer value used as parameter during the registration of the listener. |
true
, if the listener was unregistered successfully; false
otherwise.
|
inline |
Unregisters a listener from named extrinsic data events.
key | Key of the requested extrinsic data. |
listener | Listener which should be unregistered. |
clientData | Pointer value used as parameter during the registration of the listener. |
true
, if the listener was unregistered successfully; false
otherwise.
|
inline |
Unregisters a listener from named image events.
key | Key of the requested image. |
listener | Listener which should be unregistered. |
clientData | Pointer value used as parameter during the registration of the listener. |
true
, if the listener was unregistered successfully; false
otherwise.
|
inline |
Unregisters a listener from named intrinsic data events.
key | Key of the requested intrinsic data. |
listener | Listener which should be unregistered. |
clientData | Pointer value used as parameter during the registration of the listener. |
true
, if the listener was unregistered successfully; false
otherwise.
|
inline |
Unregisters a listener from performance info events.
listener | Listener which should be unregistered. |
clientData | Pointer value used as parameter during the registration of the listener. |
true
, if the listener was unregistered successfully; false
otherwise.
|
inline |
Unregisters a listener from tracking state events.
listener | Listener which should be unregistered. |
clientData | Pointer value used as parameter during the registration of the listener. |
true
, if the listener was unregistered successfully; false
otherwise.
|
inline |
Processes the enqueued commands and the tracking once.
This function only works, if the Worker was created as synchronous instance. The target number of FPS will get ignored. After calling this function you should call VLWorker.ProcessCallbacks and VLWorker.PollEvents to invoke callbacks and registered listeners.
true
, on success; false
otherwise.
|
inline |
|
inline |
|
inline |
|
inline |
Starts the tracking thread.
true
, if the thread was started successfully; false
otherwise.
|
inline |
Stops the tracking thread.
true
, if the thread was stopped successfully; false
otherwise. delegate void VLWorker.StringCallback | ( | [MarshalAs(UnmanagedType.LPStr)] string | message, |
IntPtr | clientData | ||
) |
|
inline |
Waits for enqueued events and calls the registered listeners.
Listeners aren't called immediately from the tracking thread in order to avoid synchronisation problems. Instead this method should be called regularly from the main thread.
timeout | Number of milliseconds before stopping to wait. Under normal circumstances this shouldn't happen, but in case something went wrong, we don't want to wait indefinitely. |
true
, on success or false
, if there was an error while waiting for events. false
is also returned, if the tracking is enabled, but the timeout elapsed without an event arriving.