Result Format

The results with a numerical data type are returned as a tuple. The number and type of the elements in the tuple correspond to the MVApp results output as produced by the execution of the MERLIC Vision App referenced in the recipe. The resulting tuple elements contain single (scalar) result values. The results themselves are sorted with respect to their data types.

The following table shows the order in which results are returned by MERLIC RTE. Additionally, the corresponding data types of the API for the communication plug-ins are shown:

MERLIC RTE Plug-in API
BOOL Bool
BYTE UInt8
WORD UInt16
DWORD UInt32
LWORD UInt64
SINT Int8
USINT UInt8
INT Int16
UINT UInt16
DINT Int32
UDINT UInt32
LINT Int64
ULINT UInt64
REAL Float
LREAL Double
TIME UInt32
TIME_OF_DAY UInt32
LTIME UInt64
DATE UInt32
DATE_AND_TIME UInt32
STRING_80 String

MERLIC RTE also returns image results, that is, images that have been specified as an "MVApp result" in MERLIC Creator. However, they are returned separately from the results of other data types. For more information, see Getting Image Results.

Example

The following tables shows examples of MVApp results returned by the MVApp with the respective data types:

Result MERLIC RTE Plug-in API
true BOOL BOOL
11 LINT Int64
8 LINT Int64
2020 LINT Int64
3141 REAL Float

When using MERLIC RTE with your plug-ins, the results are sent to your plug-ins via the ResultReady event as a tuple.

Unpacking the Contents of the Results

The following code snippet demonstrates how to use the API functions in mv_value.h and mv_tuple.h to unpack the result contents such that the "assert`s" hold:

MVTuple_t result;
MVValue_t value;
bool a_bool;
int64_t an_int;
float a_float;
MV_Event_Tuple_GetParameter(event, MV_PARAM_RESULT_CONTENT, &result);
assert(MV_Tuple_GetSize(result) == 5);
MV_Tuple_Get(result, 0, &value);
assert(MV_Value_GetType(value) == eMVValueType_Scalar);
assert(MV_Value_GetDataType(value) == eMVDataType_Bool);
MV_Value_Scalar_GetBool(value, &a_bool);
MV_Value_Clear(&value);
assert(a_bool == true);
MV_Tuple_Get(result, 2, &value);
assert(MV_Value_GetType(value) == eMVValueType_Scalar);
assert(MV_Value_GetDataType(value) == eMVDataType_Int64);
MV_Value_Scalar_GetInt64(value, &an_int);
MV_Value_Clear(&value);
assert(an_int == 8);
MV_Tuple_Get(result, 4, &value);
assert(MV_Value_GetType(value) == eMVValueType_Scalar);
assert(MV_Value_GetDataType(value) == eMVDataType_Float);
MV_Value_Scalar_GetFloat(value, &a_float);
MV_Value_Clear(&value);
assert(abs(a_float - 3.141) < 1e-7);