For controlling the behaviour of VisionLib during runtime, we provide a variety of different commands. Some commands can be used in every pipeline, others depend on the used tracker. The commands are expressed in json
and have the following structure:
To send such a command one has to call the vlWorker_PushJsonCommand function. Apart from the command string, this function receives a worker object and optionally a callback function and a pointer to client data. This callback function will be called after the command has been processed. The client data will be propagated to this callback together with a possible result or error string (see vlCallbackJsonString).
Commands are usually not executed immediately after calling the vlWorker_PushJsonCommand
function since they interact with a background thread. They will be executed after the processing of the current image has been finished. To trigger the callbacks one has to call the vlWorker_ProcessCallbacks function. This way, executing the callbacks will be done in the same thread that calls vlWorker_ProcessCallbacks
and thus there should be no need for thread save implementations.
If a command fails, the callback will called with an error
string. The error string has the following form:
The name
is the command name given in the command json string. The errorCode
has a value from Initialization Issues. Depending on this errorCode
the meaning of the info
string may differ. Additional details in english may be provided via the message
string.
The following commands can be executed in every pipeline:
CommandName | Parameter | Result |
---|---|---|
createTracker | {
"uri": string
}
| {
"trackerType": string,
"deviceType": string,
"warnings":
{
"issues": Issue[]
}
}
|
The | ||
createTrackerFromString | {
"str": string,
"fakeFilename": string
}
| {
"trackerType": string,
"deviceType": string,
"warnings":
{
"issues": Issue[]
}
}
|
The | ||
setTargetFPS | {
"targetFPS": int
}
| None |
The | ||
setDeviceOrientation | {
"mode": int(0-3)
}
| None |
The
| ||
runTracking | None | None |
The | ||
runTrackingOnce | None | None |
The | ||
pauseTracking | None | None |
The | ||
getAttribute | {
"att": string
}
| {
"value": string,
"param": string,
}
|
The | ||
setAttribute | {
"att": string,
"value": string
}
| None |
The |
Some commands are only available with specific trackers:
In addition to the commands which are only based on json strings, there are some commands, which consume or return binary data in addition to a json string. The json part of the command has the same structure as the Json commands.
To send such a command one has to call the vlWorker_PushJsonAndBinaryCommand function. Apart from the command string, this function receives a worker object, a const char*
containing the binary data, the size of the data and optionally a callback function and a pointer to client data. For some commands, the binary data is expected to be 0
. The purpose of these commands is to return binary data in the callback. This callback function will be called after the command has been processed. The client data will be propagated to this callback together with a possible result or error string and binary return data together with the size of the data (see vlCallbackJsonAndBinaryString).
As for json commands, these commands are also not executed immediately after calling the vlWorker_PushJsonAndBinaryCommand
function since they interact with a background thread.
There are no general jsonAndBinary commands, which can be executed without a pipeline. They require a loaded tracking configuration of a specific type. Currently only the setGlobalCoordinateSystem
can be performed in every pipeline but only on HoloLens if the camera is used.
CommandName | Parameter | BinaryData | Result |
---|---|---|---|
setGlobalCoordinateSystem | None | Windows::Perception::Spatial::ISpatialCoordinateSystem^ | None |
The setGlobalCoordinateSystem command sets the spatial coordinate system of the HoloLens inside VisionLib. It requires a Windows::Perception::Spatial::ISpatialCoordinateSystem^ . This command can only be performed on HoloLens. |
Additionally, only the ModelTracker (and the MultiModelTracker which propagates these commands to its anchors) have JsonAndBinary commands: