Skip to main content
Open topic with navigation CAPL Functions » MOST » mostParamSet

mostParamSet

Valid for: CANoe DE

Function Syntax

long mostParamSet(mostAmsMessage msg, char paramAdr[], double value); // form 1
long mostParamSet(mostAmsMessage msg, char paramAdr[], long arrayIndex, double value); // form 2

Description

Setting of a parameter value in an AMS message using the parameter name from the XML function catalog. Suitable for parameter types ‘Number’, ‘Enum’, ‘BitField’ and ‘Bool’. For parameters of the ‘Enum’ type, the numeric value can be specified. The mostParamSetString function can be used to set the symbolic value. Note: For arrays and sequences the size (number of elements) of the parameter is set. The array size cannot be set, if the parameter ‘Pos’ selects only one array element. Example:
mostAmsMessage AudioDiskPlayer.MediaInfo.Status msg;
mostParamSet(msg, "Pos", 0x0200); // second array element selected
mostParamSet(msg, "Data", 6); // Returns an error code at runtime! Array size can only be set if Pos selects all array elements.
Note: The message data must contain a parameter with the given parameter address. Since the compiler is not able to validate this, errors are detected at runtime of the CAPL program only. If the parameter is not part of the message or not the expected type, an error text is displayed in the Write Window and the measurement stops. The function mostParamIsAvailable can be applied to assure parameter availability. When using function mostParamSet to build a message dump, the parameters must be populated in the order specified by the MOST Function Catalog, particularly for messages with StreamCases.

Parameters

  • msg: Message in which the parameter value should be described.
  • paramAdr: Identification of parameters (see Symbolic Identification of Parameters).
  • arrayIndex: Parameter index in arrays or sequences. This declaration overwrites the indexing in the brackets of <paramAdr>.
  • value: Value of the parameter with whole-number parameter types, decimal places are truncated. A raw value is expected i.e. no conversion formula is applied.

Return Values

See error codes.

Example

mostParamIsAvailablemostParamGetmostParamGetDatamostParamGetStringmostParamSetDatamostParamSetStringGeneral Tips on XML Function Catalog Support in CAPLSymbolic Identification of Parameters