Purpose

Converts a numerical value to a text string using an enumeration or range text type scaling. Format

mcTypeStatus mcDoubleToText(
mcTypeTaskRef ECURefNum,
u32 ObjectType,
cstr ObjectName,
double Value,
u32 SizeOfTextValue,
str TextValue);

Input

ECURefNum

ECURefNum is the task reference which links to the selected ECU. This reference is originally returned from mcECUSelectEx.

ObjectType

Indicates the type of the object named in ObjectName. Valid values are:

1 Measurement Name
2 Characteristic Name

ObjectName

Indicates the object (measurement or characteristic) for which the COMPU_VTAB scaling is performed. If no COMPU_VTAB scaling is available for the object, TextValue is just a string representation of the value specified in Value.

Value

The numerical value to be converted. For example, this could have been returned from mcCharacteristicRead or mcMeasurementRead.

SizeOfTextValue

Must contain the number of bytes in the buffer passed to TextValue. Note that there is no way of requesting the necessary size of this buffer. If you do not know up front how long your text could become, specify a buffer of 256 bytes. This is the maximum the ASAM standard allows. Output

TextValue

The buffer for the resulting converted text string. If the Value specified is listed in a COMPU_VTAB scaling for the characteristic or measurement specified in ObjectName, the respective text is returned. If no such value is available, a string representation of the double value is returned.

Return Value

The return value indicates the status of the function call as a signed 32-bit integer. Zero means the function executed successfully. A negative value specifies an error, which means the function did not perform the expected behavior. A positive value specifies a warning, which means the function performed as expected, but a condition arose that may require attention.

Use the function of the ECU M&C API to obtain a descriptive string for the return value.

Description

mcDoubleToText performs text conversion for measurement or characteristic values. Especially if the measurement or characteristic has an associated COMPU_VTAB type scaling, the textual representation of the value is returned. If no such value is present, either because the object does not have a text scaling or the value does not have a textual representation in the table, a string representation of the double value is returned.