Professional Documents
Culture Documents
CANoe CAPLFunctionsManual PDF 240301 105658
CANoe CAPLFunctionsManual PDF 240301 105658
CAPL Functions
Version 1.1
Englisch
Imprint
The information and data given in this user manual can be changed without prior notice. No part of this manual may be reproduced in
any form or by any means without the written permission of the publisher, regardless of which method or which instruments, electronic
or mechanical, are used. All technical information, drafts, etc. are liable to law of copyright protection.
© Copyright 2012, Vector Informatik GmbH
All rights reserved.
User Manual
Topic: Technical Reference: CAPL Functions
General
The CAPL language allows you to write programs for individual applications. For example, in the
development of network nodes, the problem often arises that the remaining bus nodes are not available
yet for tests. The system environment can be emulated with the help of CAPL, e.g. the data traffic of all
remaining stations can be emulated.
With CAPL you can also write programs to analyze data traffic which are adapted to your problem, or
programs for a gateway — a connection element between two buses — so that data can be exchanged
between different buses.
The emphasis in modeling lies in the description of the node‘s bus behavior, for which the language
capabilities of CAPL are normally sufficient.
CAPL is a procedural language in which the execution of program blocks is controlled by events. These
program blocks are referred to as event procedures. Within an event procedure there may be reactions to
the following events:
The program code that you define in event procedures is executed when the event occurs. For example,
you could send a message onto the bus in response to a key press (on key), track the occurrence of
messages on the bus (on message), or else execute cyclically defined actions (on timer).
Example
Example:
on preStop
{
write ("stop");
deferStop (5000);
}
If the test module is inactive, the on preStart() write is displayed, on preStop will not be
executed.
| LIN Event Procedures | MOST Event Procedures | FlexRay Event Procedures | Unconditional (Boxed) Event Procedures |
Event Procedure: on *
CAPL Function Overview » General Event Procedures » on *
If you add a CAPL program in measurement setup, it will initially act as a filter, as only messages/frames
called explicitly in the CAPL program will be allowed through.
on * enables all messages/frames not executed in the context of a previous procedure to be forwarded in
all bus systems.
You can add the event procedure in the Browser Tree with the All Frames shortcut menu item New.
Example
All messages except the CAN message with the ID 500 are forwarded.
// blocking CAN ID 500
on message 500 {
}
on * {
output(this);
}
In the event procedure, the keyword this can only be used for a call in the output function and to read
out the time stamp.
Example
// counting and viewing all frames (after a filter)
on * {
write("Received frame nr. %d, time %d", ++gFrameCount, this.time);
output(this);
}
The event procedure type on envVar is provided to react to value changes of environment variables in
CANoe's network node models. In contrast to messages, environment variables are not blocked by CAPL
nodes in a data flow branch of the measurement configuration. Therefore, when there are two CAPL nodes
in series, both react to the same environment variable with the event procedure on envVar. With the
functions getValue and putValue you can query or set the active environment variable value in the
simulation configuration. But please note that you cannot call the function putValue() from the
measurement configuration window.
In the procedure on envVar X { ... } there is a reaction to the event Change of Environment Variable
X. The environment variable can be accessed by the key word this within the event procedure, e.g. to
determine the value of the variable with the function getvalue.
Example
In the following example there is a reaction to a change in the environment variable Switch, and
the value is assigned to the signal Stop of the message Controller:
on envvar Switch {
// Declare a CAN message to be transmitteed
message Controller msg;
Info
Starting with CANoe version 7.1 SP4, you can also define handlers for several environment
variables. For this, use the syntax "on envVar (envVar1 | envVar2 | ...)", e.g. "on envVar
(envSwitch1 | envSwitch2)". The handler is called whenever one of the environment
variables changes. The keyword this can only be used in such a handler if all variables have the
same data type. CAPL programs which contain such handlers can not be used with CANoe
versions < 7.1 SP4.
Since version 7.2, you can retrieve the name of the environment variable as a string constant
with this.name.
This event procedure is called when an error state (Error frame) occurs on the bus.
Use this procedure, for example, to analyze bus errors (frequency, activities during the time frame of the
event, etc.) in a CAPL node in the evaluation branch.
Within this procedure timestamp, channel number and ECC register are available via the this variable.
Example
In the following example it shall be checked if the error frame is a transmission or a reception
error.
This information is set in the 5th bit of the ECC register. A transmission error is indicated by 0, a
reception by 1. To get the 5th bit you have to mask the ECC register with 0x20.
on errorFrame
{
switch (this.ecc & 0x20)
{
case (0x20): // in case of reception error
write ("%d Ch %d RxErr", this.time, this.can);
return;
case (0): // in case of transmission error
write ("%d Ch %d TxErr", this.time, this.can);
return;
};
}
With on key procedure you can execute defined actions with a key press.
E.g. write
message 100 msg;
...
on key 'a' {
output(msg);
}
to transmit message 100 on the bus with every kepress on key 'a'. The code for a key press can be
entered either as a character, a number or a predefined identifier for a function keys. The event
procedure on key * reacts to all key presses.
In on key procedures the key word this serves to determine the active key code. For example, if you wish
to incorporate the handling of keyboard entries in an event procedure you could write it as the following
code:
on key * {
switch(this) {
case 'a' : ... break;
case F10: ... break;
...
}
Info
If for example a CAPL program contains the on key procedures on key 'a' and on key *, the
procedure on key 'a' will be called up, when key 'a' is used. With all other keys the procedure
on key * will be called up.
The keys <ESC>, <F7>, <F8> and <F9> are not supported of on key procedures.
<End> End
<Home> Home
<Insert> InsertKey
<Delete> DeleteKey
<Ctrl>+< >,
←>,<Ctrl>+<
<Ctrl>+<→>, ctrlCursorLeft, ctrlCursorRight, ctrlCursorUp,
↓>
ctrlCursorDown
Examples
To react to activation of character keys you would write the particular character, enclosed in
single quotation marks, or enter the character code:
The event procedure type on message is available to have CAPL nodes react to the receipt of CAN
messages.
To access the control information you would use selectors. The key word this is available within an on
message procedure, to access the data of the message that has just been received.
CAPL programs are by default not transparent to bus events. This means that a CAPL node in the
evaluation branch of the measurement configuration will block the data flow to its right side. You must
explicitly program the passing of messages in CAPL nodes in the evaluation branch.
However, please note that you are programming a recursive if you are using this code in CANoe's
simulation configuration:
For each message received, the reaction is to immediately resend the same message on the bus, causing
the event procedure on message * to be called, etc.
Info
If for example a CAPL program contains the on message procedures on message 123 and on
message *, the procedure on message 123 will be called up, when a message with the
identifier 123 is received. For all other messages the procedure on message * will be called up.
In contrast to bus events, value changes of environment variables are transparent to CAPL
programs in the evaluation branch. Thus, a new environment variable is also available on the
right side of CAPL nodes, and the user does not need to program this explicitly.
Examples
Gateway example
The gateway should transmit all messages between Bus 1 and Bus 2 in both directions:
on message CAN1.*
{
message CAN2.* msg;
if(this.dir != rx) return; //important!
msg = this;
output(msg);
}
on message CAN2.*
{
message CAN1.* msg;
if(this.dir != rx) return; //important!
msg = this;
output(msg);
}
Further examples
The event procedure type on sysVar is provided to react to value changes of system variables in CANoe.
In contrast to messages, system variables are not blocked by CAPL nodes in a data flow branch of the
measurement configuration. Therefore, when there are two CAPL nodes in series, both react to the same
system variable with the event procedure on sysVar.
In the procedure on sysVar X{ ... } there is a reaction to the event change of system variable X. The
system variable can be accessed by the key word this within the event procedure, e.g. to determine the
value of the variable with the ‘@’ syntax or the function sysGetVariable.
The time stamp of the last system variable change (in nanoseconds since measurement start) can be
retrieved with "this.time_ns".
X must be the fully qualified name of the system variable, i.e. the variable name preceded by all name
space names, separated by "::". The system variable must exist at compile time. Please note that the
automatic make mechanism in CANoe currently does not trigger a compile whenever a system variable
definition changes.
The procedure on sysVar is called only when the value of the variable changes. It can also be written as
on sysVar_change. If you want to be notified of value updates to the variable which don’t change the
value, you should use on sysVar_update instead.
Example
In the following example there is a reaction to a change on the I/O input DI_0 (first input port),
and the new value of the I/O signal is assigned to the signal IOValue of a CAN message
transmitted by the node Gateway.
on sysvar IO::DI_0
{
$Gateway::IOValue = @this;
}
Info
Starting with CANoe version 7.1 SP4, you can also define handlers for several system variables.
For this, use the syntax "on sysVar (sysVar1 | sysVar2 | ...)", e.g. "on sysVar
(IO::DI_0 | IO_DI1)". The handler is called whenever one of the system variables changes (or
is updated if you use on sysvar_update). The keyword this can only be used in such a handler
if all variables have the same data type. CAPL programs which contain such handlers can not be
used with CANoe versions < 7.1 SP4.
Since version 7.2, you can retrieve the name of the system variable as a string constant with
this.name and its namespace with this.namespace.
You can define time events in CAPL. When this event occurs, i.e. when a certain period of time elapses,
the associated on timer procedure is called. You can program cyclic program sequences by resetting the
same time event within the on timer procedure.
The timer variable can be accessed with the key word this within the event procedure.
After the timer has elapsed, the associated on timer procedure is called. The maximum time is
2147483647 s (=596523.23h) for variables of the type timer and 2147483647 ms (= 2147483,647 s =
596,52h) for variables of the type msTimer. With the function cancelTimer you can stop a timer which has
already been started and thereby prevent the associated on timer procedure from being called.
Info
Example
In the following example always message 100 is transmitted on the bus 20 milliseconds after
pressing key 'a':
msTimer myTimer;
message 100 msg;
...
on key 'a' {
setTimer(myTimer,20);
}
...
on timer myTimer {
output(msg);
}
Version extensions
• Version 7.2
Since version 7.2, you can retrieve the name of the timer as a string constant with this.name.
• Version 7.5
Example
variables
{
mstimer myTimers[10];
}
You have to set each single timer but the same timer procedure will be called for all timers. For that
the procedure has to contain a parameter (dword type) that indicates the index of the just run out
timer.
Example
on start
{
dword i;
for (i = 0; i < elcount(myTimers); ++i)
myTimers[i].set(100 + 20 * i);
}
In the procedure the keyword this describes the whole array. E.g. if you want to set the just run out
timer, you have to add an index to this.
Example
write("Timer %s with index %d fired", this[index].name, index);
setTimer(this[index], 2000);
These event procedures are called when the CAN controller's state or one of it’s error counters
(errorCountRX, errorCountTX) changes. You would use this procedure to monitor the error counters (e.g.
output of a warning) or to end the measurement or simulation.
Within these procedures the error counters of the CAN controller are made available by the this variable.
They are accessed with the following syntax:
Info
Error counters are supported and thus changed by the complete XL family.
Examples
on errorPassive procedure
on errorPassive {
...
write("CAN Controller is in errorPassive state")
write(" errorCountTX = %d", this.errorCountTX);
write(" errorCountRX = %d", this.errorCountRX);
};
on busOff procedure
on busOff
{
int errRxCnt;
int errTxCnt;
int channel;
double timestamp; // [seconds]
timestamp = (double)timeNow() / (double)100000;
channel = this.can;
errRxCnt = this.errorCountRX;
errTxCnt = this.errorCountTX;
Write("Bus Off: time=%f channel=%d, errRxCnt=%d, errTxCnt=%d",
timestamp, channel, errRxCnt, errTxCnt);
resetCanEx(channel);
}
When one of the following events occurs (Message with ID 100 is received, key a is pressed, or Timer
Clock_1 elapses) then, in this example
• an on message procedure,
• an on key procedure or
• an on timer procedure is called.
In doing so, an appropriate text is always output to the Write window by the write function:
These event procedures are called before the start of measurement, at the start, and when the
measurement is ended. For example, you can initialize variables here, output a start report to the Write
window with the write function, start Timer or output statistics after the end of measurement.
The on preStart procedure is only used to initialize variables, to display messages in the write window
and to read in data from files. At the moment the on preStart procedure is executed, not all possibilities
of the system (CANoe) are available. It is not possible for example to send messages on the bus with the
output function.
The on preStop handler is called after a measurement stop has been requested. The on preStop function
can be used to carry out some final actions that must be done before the measurement stop actually takes
effect.
Note that some actions, such as setting environments, would have no effect if they were only initiated in
on StopMeasurement. If more complex pre-stop actions like sending a shutdown message to an attached
ECU and waiting for an acknowledgement message are required, a DeferStop call within the on preStop
function might be useful to further defer the measurement stop. If DeferStop is not called in the CAPL
node, all pre-stop activities are assumed to be completed after the on preStop handler is finished, i.e.
measurement immediately stops unless there are other nodes that are deferring a measurement stop.
At the measurement start it may be necessary, in the network node models, to execute the
same actions that otherwise would be performed during the measurement when environment
variables change. In particular, it may be necessary to initialize environment variables, to start
timers activated in response to changes of environment variables, or to send messages on the
bus with the start values of environment variables.
Since these functions are normally performed in the on envVar event procedures of the model,
the CAPL function CallAllOnEnvVar is provided, with which you can call all of the model‘s on
envVar event procedures. You would execute this function in the on start procedure to
initialize the environment variables of the model.
Examples
on preStart procedure
on preStart
{
write("Measurement started!");
msg_Count = 0;
}
on start procedure
on start
{
write("start Node A");
setTimer(cycTimer,20);
CallAllOnEnvVar(); // CANoe only
}
on preStop procedure
on preStop
{
message ShutdownReq m;
output(m);
DeferStop(1000);
}
on stopMeasurement procedure
on stopMeasurement
{
write("Message 0x%x received: %d", msg.id, msg_Count);
}
Example:
on preStop
{
write ("stop");
deferStop (5000);
}
If the test module is inactive, the on preStart() write is displayed, on preStop will not be
executed.
Info
The usage of "boxed" event procedures is not compatible to older versions of CANoe. They can
only be used in CAPL programs with CANoe version 7.0 and higher.
Normally, the generic event procedures (e.g. on message *) are only called if there is no more specific
event procedure in the program for the message which is received.
Example
on message 100
{
write("specific");
}
on message *
{
write("generic");
}
If the message 100 is received, the output in the Write window will be "specific" only.
If you want to implement an event procedure which is called always, regardless of other event
procedures, you can use a "boxed" event procedure signified by [*].
Example
on message 100
{
write("specific");
}
on message [*]
{
write("generic");
}
If the message 100 is received, the output in the Write window will be "generic" followed by
"specific".
The "boxed" event procedures are always called before other, possibly more specific event procedures in
the program.
Info
If you implement a "boxed" event procedure in the measurement setup, you should not call
output(this) because of the danger of transmitting the message two times, once in the
"boxed" event procedure and once in the specific event procedure. Call output(this) only in
specific event procedures and unboxed generic event procedures.
You may use a "boxed" event procedure with the following message types:
• message
• pg
• linmessage
• frSlot
| General Event Procedures | LIN Event Procedures | MOST Event Procedures | FlexRay Event Procedures |
Keyword this
CAPL Function Overview » General Event Procedures » this
Within an event procedure for receiving a CAN object or an environment variable, the data structure of
the object is designated by the key word this.
For example, you could access the first data byte of message 100 which was just received by means of the
following:
on message 100 {
byte byte_0;
byte_0 = this.byte(0);
...
}
Analogously, you could read the new value of the integer environment variable Switch which has just been
changed by means of the following:
on envVar Switch {
int val;
val = getvalue(this);
...
}
Info
You should not change the value of this within an event procedure. However, to permit the use
of this as a parameter, value changes made to this are not prohibited by the CAPL compiler.
However, please note that these types of write accesses to this are only valid locally (i.e. within
the event procedure). When compiling you will receive an appropriate warning. Thus, if you call
the function output(this) after this has been changed in an on message event procedure, the
unchanged original of this is passed, and not your change.
Info
For a signal length of more than 32 bit the read out of signal values from a message with
this.<signalName> is not yet supported. In this case the dollar notation must be used, see the
example below.
on message 101
{
float a = 0;
a = $Signal1;
}
In CAPL predefined data types are available that can be used like classes in object-oriented programming
languages such as C++.
This means that functions in the form of methods can be called on variables (objects) of these data types
(classes), and that under certain circumstances destructors can be called automatically to stop a process
and invalidate the variable.
Classes Timer, File Tcp Udp Test Test Diag Diag Associative CAN
Ms Socket Socket Check Stimulus Request Response fields
Timer
Method call
Methods are called on a variable of a class type by writing a point and the method name after the variable
name.
Example
Method call
myTimer.set(long duraton);
Function call
void settimer (timer myTimer, long duration);
Automatic destructors
If you declare the variable of a class type within a function or a test case, but not in the global variables
section, a destructor will be called on this variable as soon as the process leaves the block in which the
variable has been declared.
Example
if (someCondition)
{
File file1("C:\test.txt");
// ...
} // file1 is closed here automatically
If you declare the variable of a class type in the global variables section, the destructor will not be called
automatically. You will need to call it explicitly once the object is no longer needed. The call corresponds
to a call to a standard method.
Constructors
Most variables of class types which have destructors have to be initialized explicitly before they can be
used. The initialization functions used for this purpose are called constructors.
• simple constructors
Simple constructors can transfer the necessary parameters directly when a variable is declared:
Example
File f("C:\test.txt");
However, this is not permitted if the variable has been declared in the global variables section. In
this case, the constructor has to be called explicitly:
Example
f.open("C:\test.txt");
• constructor functions
Constructor functions are also used for initialization. Their call is class name::method name:
Example
TestCheck c = TestCheck::CreateTimeout(500);
If a constructor is called again on an object which has already been initialized, the destructor of the old
object is called first and then the variable is initialized.
In the case of constructor functions, the function is evaluated before the old object is destroyed.
Example
TestCheck c = TestCheck::CreateTimeout(500));
// Sequence:
// 1. Call CreateTimeout, i.e. build new check
// 2. destruct old check
// 3. initialize c with the new check
c = TestCheck::CreateTimeout(200);
Further information
Variables of the same class type cannot be assigned to one another. However, they can be
transferred to functions as parameters. Please bear in mind that in this case multiple variables
might stand for the same object and that calling a destructor on one variable will invalidate the
other variables.
You can also generate fields from variables of the same class type, but only in the global
variables section. Structures or associative fields cannot contain variables of a class type.
Note
The methods are linked to the description of the corresponding CAPL function.
Constructor —
Destructor —
Methods clear
containsKey
remove
size
Class: CAN
CAPL Function Overview » Classes and Objects » CAN
The CAN objects (CAN1, CAN2, ...) provide access to channel specific statistics.
Note
The methods are linked to the description of the corresponding CAPL function.
Constructor —
Destructor —
Methods BusLoad
ChipState
ErrorFrameCount
ErrorFrameRate
ExtendedFrameCount
ExtendedFrameRate
ExtendedRemoteFrameRate
ExtendedRemoteFrameCount
OverloadFrameCount
OverloadFrameRate
PeakLoad
RxChipErrorCount
StandardFrameRate
StandardFrameCount
StandardRemoteFrameRate
StandardRemoteFrameCount
TxChipErrorCount
Class: DiagRequest
CAPL Function Overview » Classes and Objects » DiagRequest
Note
The methods are linked to the description of the corresponding CAPL function.
Destructor —
Methods CheckValidNegResCode
CheckValidPrimitive
CheckValidRespPrimitive
GetComplexParameter
GetComplexParameterRaw, SetComplexParameterRaw
GetComplexRespParameter
GetComplexRespParameterRaw
GetLastResponse
GetLastResponseCode
GetObjectName
GetObjectPath
GetParameter
GetParameterName
GetParameterPath, GetRespParameterPath
GetParameterRaw, SetParameterRaw
GetParameterSize
GetParameterType, GetRespParameterType
GetParameterUnit
GetPrimitiveByte
GetPrimitiveData, SetPrimitiveData
GetPrimitiveSize
GetRespParameter
GetRespParameterRaw
GetRespPrimitiveByte
GetRespPrimitiveSize
GetSuppressResp, SetSuppressResp
IsParameterConstant, IsRespParameterConstant
IsParameterDefault
IsRaw
IsRawResp
ResetParameter
Resize | Resize
SendMarked
SendNegativeResponse
SendNetwork
SendRequest
SetComplexParameter
SetParameter
SetPrimitiveByte
SetRespPrimitiveByte
SetSuppressResp
SetTimeoutHandler
Class: DiagResponse
CAPL Function Overview » Classes and Objects » DiagResponse
Note
The methods are linked to the description of the corresponding CAPL function.
Destructor —
Methods CheckValidNegResCode
CheckValidPrimitive
GetComplexParameter
GetComplexParameterRaw, SetComplexParameterRaw
GetComplexRespParameterRaw
GetLastResponse
GetObjectName
GetObjectPath
GetParameter
GetParameterName
GetParameterPath, GetRespParameterPath
GetParameterRaw, SetParameterRaw
GetParameterSize
GetParameterType, GetRespParameterType
GetParameterUnit
GetPrimitiveByte
GetPrimitiveData, SetPrimitiveData
GetPrimitiveSize
GetResponseCode
GetSendingMode
IsNegativeResponse
IsParameterConstant
IsParameterDefault
IsPositiveResponse
IsRaw
ResetParameter
Resize | Resize
SendNegativeResponse
SendPositiveResponse
SendResponse
SetComplexParameter
SetParameter
SetPrimitiveByte
Class: File
CAPL Function Overview » Classes and Objects » File
Note
The methods are linked to the description of the corresponding CAPL function.
Constructor open
Destructor close
Methods getBinaryBlock
getString
getStringSZ
putString
rewind
writeBinaryBlock
writeString
Class: TcpSocket
CAPL Function Overview » Classes and Objects » TcpSocket
Note
The methods are linked to the description of the corresponding CAPL function.
open
Destructor close
Methods bind
connect
getLastSocketError
getLastSocketErrorAsString
listen
receive
send
setSocketOption
shutdown
| TCP/IP API |
Class: TestCheck
CAPL Function Overview » Classes and Objects » TestCheck
Checks are functions which run parallel to the defined test sequence or simulation node and continuously
check compliance with specific conditions.
Note
The methods are linked to the description of the corresponding CAPL function.
CreateAllNodesDead, StartAllNodesDead
CreateErrorFramesOccured, StartErrorFramesOccured
CreateInconsistentDLC, StartInconsistentDLC
CreateInconsistentRxDLC, StartInconsistentRxDLC
CreateInconsistentTxDLC, StartInconsistentTxDLC
CreateMostCriticalUnlock, StartMostCriticalUnlock
CreateMostErrorMessage, StartMostErrorMessage
CreateMostLightOff, StartMostLightOff
CreateMostMethodProtocolError, StartMostMethodProtocolError
CreateMostNetState, StartMostNetState
CreateMostPropertyProtocolError, StartMostPropertyProtocolError
CreateMostShortUnlock, StartMostShortUnlock
CreateMostStableLock, StartMostStableLock
CreateMsgAbsCycleTimeViolation, StartMsgAbsCycleTimeViolation
CreateMsgDistViolation, StartMsgDistViolation
CreateMsgOccurrenceCount, StartMsgOccurrenceCount
CreateMsgRelCycleTimeViolation, StartMsgRelCycleTimeViolation
CreateMsgRelOccurrenceViolation, StartMsgRelOccurrenceViolation
CreateMsgSignalValueInvalid, StartMsgSignalValueInvalid
CreateMsgSignalValueRangeViolation, StartMsgSignalValueRangeViolation
CreateNodeBabbling, StartNodeBabbling
CreateNodeDead, StartNodeDead
CreateNodeMsgsRelCycleTimeViolation, StartNodeMsgsRelCycleTimeViolation
CreateNodeMsgsRelOccurrenceViolation, StartNodeMsgsRelOccurrenceViolation
CreateSignalValueChange, StartSignalValueChange
CreateTimeout, StartTimeout
CreateUndefinedMessageReceived, StartUndefinedMessageReceived
StartLINDiagDelayTimesViolation
StartLINETFViolation
StartLINHeaderToleranceViolation
StartLINMasterBaudrateViolation
StartLINMasterInitTimeViolation
StartLINReconfRequestFormatViolation
StartLINRespErrorSignal
StartLINRespToleranceViolation
StartLINSchedTableViolation
StartLINSyncBreakTimingViolation
StartLINSyncDelTimingViolation
StartLINWakeupReqLengthViolation
StartLINWakeupRetryViolation
Destructor destroy
Methods reset
start
stop
QueryEventInterval
QueryEventMessageContents
QueryEventMessageId
QueryEventMessageName
QueryEventNodeName
QueryEventReason
QueryEventSchedSlotIndex
QueryEventSignalValue
QueryEventStatus
QueryEventStatusToLog
QueryEventStatusToWrite
QueryEventTimestamp
QueryEventTiming
QueryNumEvents
QueryNumRequests
QueryNumTimedoutRequests
QueryPrecision
QueryRequestDstAdr
QueryRequestFBlockId
QueryRequestFunctionId
QueryRequestInstId
QueryRequestOpType
QueryRequestSrcAdr
QueryRequestTimestamp
QueryStatAvResponseTime
QueryStatEventFreePeriodAvg
QueryStatEventFreePeriodMax
QueryStatEventFreePeriodMed
QueryStatEventFreePeriodMin
QueryStatMaxValidResponseTime
QueryStatMinResponseTime
QueryStatNumProbes
QueryStatProbeIntervalAvg
QueryStatProbeIntervalMax
QueryStatProbeIntervalMin
QueryValid
Class: TestStimulus
CAPL Function Overview » Classes and Objects » TestStimulus
This class can be used to generate a specific value pattern for a signal or an environment variable for
stimulating a device.
Note
The methods are linked to the description of the corresponding CAPL function.
CreateEnvVar
Destructor destroy
Methods reset
start
stop
QueryValid
Note
The methods are linked to the description of the corresponding CAPL function.
Constructor —
Destructor —
Methods set
cancel
timeToElapse
Class: UdpSocket
CAPL Function Overview » Classes and Objects » UdpSocket
Note
The methods are linked to the description of the corresponding CAPL function.
Destructor close
Methods bind
getLastSocketError
getLastSocketErrorAsString
receiveFrom
sendTo
setSocketOption
| TCP/IP API |
canSetChannelOutput Defines the response of the CAN controller to the bus traffic and sets the ACK
bit.
InterfaceStatus The callback occurs when the status of the connection to the interface
hardware is changed.
output Outputs a message or an error frame from the program block.
ResetCanEx Resets the CAN controller for one specific CAN channel.
ScanBaudratePassive Starts the scan and detects the baud rate on the given channel.
callAllOnEnvVar Calls all event procedures for environment variables (on envVar).
ClockControlReset Resets the Clock Control designed as stop watch in the Panel Designer.
ClockControlStart Starts the Clock control designed as stop watch in the Panel Designer.
ClockControlStop Stops the Clock Control designed as stop watch in the Panel Designer.
MakeRGB Calculates the color value from the three primary color components.
SetDefaultControlColors Sets the background and text color of panel elements to the default colors
defined in the Panel Designer.
SetMediaFile Replaces the media file of the Panel Designer Media Player element.
SetPictureBoxImage Replaces the image of the Panel Designer Picture Box element.
swapInt
swapLong
swapWord
CANdb Functions
setSignalStartValues Sets the values of the signals in the parameter to the start values defined in the
database.
File Functions
GetOfflineFileName Returns the complete path of the currently used offline source file.
getAbsFilePath Gets the full path name for a path defined relative to the current configuration.
getProfileArray Reads the value of the given variable from the specified section in the specified
file.
getProfileFloat
getProfileInt
getProfileString
writeProfileFloat Opens the file, searches the section and writes the variable.
writeProfileInt
writeProfileString
Flow Control
canOffline Cuts the connection between the node and the bus.
getStartdelay Determines the value of the start delay configured for this network node in the
Simulation Setup.
setStartdelay Sets the value of the Start Delay for this network node.
inspect Causes an update of the variables displayed on the Inspect side of the Write
window.
setWriteDbgLevel Sets the priority level for the writeDbgLevel CAPL function.
writeDbgLevel Outputs a message to the Write window with the specified priority.
Logging Functions
StartLogging Starts all logging blocks immediately bypassing all logging trigger settings.
StopLogging Stops all logging blocks immediately bypassing all logging trigger settings.
Other Functions
DeferStop Defers a measurement stop so that activities can be completed before the
stop takes effect.
FDXTriggerDataGroup Triggers the transmission of a data group via CANoe FDX protocol.
traceSetEventColors Sets the font, and background color for the message display in the Trace
window.
Replay Functions
Standalone Mode
StandaloneConfigOpen Opens the rtcfg file with the given name as standalone configuration.
String Functions
strncmp_off
strncpy_off
strstr_off
substr_cpy_off
strstr_regex_off
Time Management
ConvertTimestampNS
getJitterMax Determines the upper limit for the allowable deviation when Jitter is set.
getJitterMin Determines the lower limit for the allowable deviation when Jitter is set.
setJitter Sets the Jitter interval for the timers of a network node.
timeDiff Time difference between messages or between a message and the current
time in ms.
timeToElapse Returns a value indicating how much more time will elapse before an on
timer event procedure is called.
User Interactions
writeClear Clears the contents of the specified page in the Write window.
writeCreate Generates a new page in the Write window with the specified name.
writeEx Writes the text into the last line of the specified window or into a tab of the Write
window without previously creating a new line.
writeLineEX Writes the text into a new line of the specified window or into a tab of the Write
window.
writeTextBkgColor Sets the color for text background of the specified page in the Write window.
writeTextColor Sets the color for text of the specified page in the Write window.
abs
CAPL Function Overview » General » abs
2.5 — • •
Example
long x;
x = abs(15); // Result: 15
arccos
CAPL Function Overview » General » arccos
Parameters x
Value between –1 and 1 whose arccosine is to be calculated. Values outside this range
cause a CAPL runtime error.
7.5 — • •
Example
double x;
x = arccos(0); // result PI/2
x = arccos(1); // result 0
| arcsin | arctan |
arcsin
CAPL Function Overview » General » arcsin
Parameters x
Value between –1 and 1 whose arcsine is to be calculated. Values outside this range cause
a CAPL runtime error.
7.5 — • •
Example
double x;
x = arcsin(1); // result PI/2
x = arcsin(0); // result 0
| arccos | arctan |
arctan
CAPL Function Overview » General » arctan
Parameters x
7.5 — • •
Example
double x;
x = arctan(0); // result 0
x = arctan(1); // result PI/4
| arccos | arcsin |
atodbl
CAPL Function Overview » General » atodbl
Function The function converts the string s into a double number. Normally, the base is decimal
and must have the following format:
[Blank space] [Sign] [Digits] [.Digits] [ {d | D | e | E}[Sign]Digits]
If the string starts with 0x, the base used is 16. Only integer numbers can be read in.
6.0 — • •
Example
double d;
d = atodbl(" -3.7"); // -3.7
d = atodbl("0x1F"); // 31.0
d = atodbl("1.3E2"); // 130.0
| atol |
atol
CAPL Function Overview » General » atol
Function This function converts the string s to a LONG number. The number base is decimal.
Starting with string 0x, base 16 is used. Leading blanks are not been read.
All — • •
Example
...
long z1;
long z2;
z1 = atol("200");
z2 = atol("0xFF");
...
Result:
z1 = 200, z2 = 255
| ltoa |
callAllOnEnvVar
CAPL Function Overview » General » callAllOnEnvVar
Function Calls all event procedures for environment variables (on envVar). This can be necessary at
measurement start to initialize environment variables, to start timers activated in
response to changes of environment variables, or to send messages on the bus with the
start values of environment variables.
Parameters —
Return values —
All — — •
Example
on start
{
callAllOnEnvVar();
}
cancelTimer
CAPL Function Overview » General » cancelTimer
Method t.cancel();
Return values —
All — • •
Example
variables {
msTimer takt;
message 100 data = {dlc = 1, byte(0) = 0xFF, dir = Tx};
}
on Timer takt{
output(data);
setTimer(takt, 200);
}
on key F1 {
cancelTimer(takt); // cancel timer
write("canceled");
}
on key F2 {
setTimer(takt, 200); // set timer to 200ms
write("start");
}
CANdelaLibCloseChannel
CAPL Function Overview » General » CANdelaLibCloseChannel
Function Closes the communication channel to the control unit, thereby terminating the sending of
'Tester Present' on the selected diagnostics channel for the selected diagnostic
descriptions.
If necessary in the context of sending requests from the Diagnostics Console, the Fault
Memory window and diagnostics test modules which do not implement a dedicated
callback interface for the transport protocol layer, the channel can be restored
automatically.
This function can be used, for example, to ensure that a 'Tester Present' sent cyclically
does not prevent the bus switching to sleep mode in the context of network management
when the Diagnostics Console is in use.
Parameters ECUqualifier
Qualifier associated with the diagnostics description whose channel is to be closed and/or
for which no more 'Tester Present' requests are to be sent.
5.0 SP2 — • •
Example
canOffline
CAPL Function Overview » General » canOffline
Function Cuts the connection between the node and the bus. Messages send from the node are not
passed through to the bus. The function canOnline() will restore the connection.
If the node is set to offline, output instructions for sending messages in CAPL or
NodeLayer DLL are ignored (refers to a node locally only).
Regardless of the status, all messages are received in the CAPL program/NodeLayer.
In Form 2 you can choose between the CAPL-program and/or the Nodelayer-DLL.
Parameters Flags
Return values Form 2 returns the part of the node being online before the function call. Equal to the
flags.
All — — •
Example
dword var;
var = canOffline(3); // Deactivates CAPL-Program and Nodelayer-DLL.
...
canOnline(); // Activates CAPL-Program. Form 1
...
var = canOnline(2); // Activates Nodelayer-DLL
| canOnline |
canOnline
CAPL Function Overview » General » canOnline
Function Restores the connection of the node to the bus. After a call to the function canOffline()
the node can be connected to the bus with the function canOnline(). Messages send
from the node are passed through to the bus.
If the node is set to offline, output instructions for sending messages in CAPL or
NodeLayer DLL are ignored (refers to a node locally only).
Regardless of the status, all messages are received in the CAPL program/NodeLayer.
In Form 2 you can choose between the CAPL-program and/or the Nodelayer-DLL.
Parameters Flags
Return values Form 2 returns the part of the node being online before the function call. Equal to the
flags.
All — — •
Example
dword var;
var = canOffline(3); // Deactivates CAPL-Program and Nodelayer-DLL.
...
canOnline(); // Activates CAPL-Program. Form 1
...
var = canOnline(2); // Activates Nodelayer-DLL
| canOffline |
canSetChannelAcc
CAPL Function Overview » General » canSetChannelAcc
Note
This function can only be used with Vector drivers. The vcndrvms.dll must be at least
Version 4.2.40.
Function Via an acceptance filter the CAN controllers control which received messages are sent
through to CANoe.
Some controller chips, such as the SJA 1000, expect partitioning into acceptance mask
and acceptance code.
!=0: error
5.0 — • •
Example
on key 'a'
{
/*
To distinguish whether the filter is for standard or extended identifiers. For extended
identifiers the MSB of the code and mask are set.
Description:
Different ports may have different filters for a channel. If the CAN hardware cannot
implement the filter, the driver virtualises filtering.
Accept if ((id ^ code) & mask) == 0).
*/
long channel =2;
dword code=0x10;
dword mask=0x10;
canSetChannelAcc(channel,code,mask);
write("channel mask set");
}
| canSetChannelMode | canSetChannelOutput |
canSetChannelMode
CAPL Function Overview » General » canSetChannelMode
Note
This function can only be used with Vector drivers. The vcndrvms.dll must be at least
Version 4.2.40.
Function Activates/deactivates the TxReq and Tx of the CAN controller. This function does nothing
with the Ack bit.
gtx
0 tx off
1 tx on
gtxreq
0 gtxreq off
1 gtxreq on
Return values 0: ok
!=0: error
5.0 — • •
Example
on key 't'
{
long channel =2;
char gtx =1;
char gtxreq =1;
canSetChannelMode(channel,gtx,gtxreq);
Write("Mode set to tx=%d, txreq=%d",gtx,gtxreq);
}
| canSetChannelAcc | canSetChannelOutput |
canSetChannelOutput
CAPL Function Overview » General » canSetChannelOutput
Note
This function can only be used with Vector drivers. The vcndrvms.dll must be at least
Version 4.2.40.
Function Defines the response of the CAN controller to the bus traffic and sets the ACK bit.
The CAN transmitter of the channel is switched off. So CANoe does not generate an Ack
bit here, and messages can no longer be sent. It is still possible to receive messages.
silent
0 silent
1 normal
Return values 0: ok
!=0: error
5.0 — • •
Example
on key 's'
{
long channel =2;
long silent =0;
canSetChannelOutput(channel,silent);
Write("silent set to %d",silent);
}
| canSetChannelAcc | canSetChannelMode |
_ceil
CAPL Function Overview » General » _ceil
Function Calculates the ceiling of a value, i.e. the smallest integer larger or equal to the value.
Parameters x
7.2 — • •
Example
float x;
x = _ceil(3.6); // x == 4.0
| _floor | _round |
ClockControlReset
CAPL Function Overview » General » ClockControlReset
Function Resets the Clock Control designed as stop watch with the Panel Designer (setting Mode =
StopWatch).
The displayed time is reset to 00:00:00 or 00:00 depending on the Panel Designer setting
Display Seconds.
Info
The panel is accessed by its individual panel name that is entered in the Panel Designer.
Parameters panel
control
Name of the element. You can only access the control by its name. In the property dialog
of the control it's name is assigned/displayed.
If you want to use the name of a symbol (signal or environment/system variable) you have
to ensure that the control has no name instead of the individual control's name. The name
of the environment variable, system variable or signal could be specified as following.
Info
Example
"EnvVar:EnvGearLockDsp"
"Signal:SleepInd"
"Signal:easy/MotorState/EngineSpeed"
"SysVar:SysVarTester" (for a system variable defined with name
space TestSysvar in the configuration)
"ElemPanelHelp" (for Panel help)
"ElemPanelRecorder" (for Panel recorder)
"ElemCtrlBN" (for Panel control button)
Return values —
Example
// Reset the clock control designed as stop watch.
on key 'a'
{
ClockControlReset("ClockControl", "StoppWatch");
}
ClockControlStart
CAPL Function Overview » General » ClockControlStart
Function Starts the Clock Control designed as stop watch in the Panel Designer (setting Mode =
StopWatch).
The stop watch starts with 00:00:00 or 00:00 depending on the Panel Designer setting
Display Seconds. The start time cannot be changed.
Info
The panel is accessed by its individual panel name that is entered in the Panel Designer.
Parameters panel
control
Name of the element. You can only access the control by its name. In the property dialog
of the control it's name is assigned/displayed.
If you want to use the name of a symbol (signal or environment/system variable) you have
to ensure that the control has no name instead of the individual control's name. The name
of the environment variable, system variable or signal could be specified as following.
Info
Example
"EnvVar:EnvGearLockDsp"
"Signal:SleepInd"
"Signal:easy/MotorState/EngineSpeed"
"SysVar:SysVarTester" (for a system variable defined with name
space TestSysvar in the configuration)
"ElemPanelHelp" (for Panel help)
"ElemPanelRecorder" (for Panel recorder)
"ElemCtrlBN" (for Panel control button)
Return values —
Example
// Start the clock control designed as stop watch.
on key 'a'
{
ClockControlStart("ClockControl", "StoppWatch");
}
ClockControlStop
CAPL Function Overview » General » ClockControlStop
Function Stops the Clock Control designed as stop watch with the Panel Designer (setting Mode =
StopWatch).
The displayed time stays unchanged unless the user starts the stop watch again or resets
it.
If the stop watch is started again without resetting it, the start time is the current
displayed time (not zero).
The panel is accessed by its individual panel name that is entered in the Panel Designer.
Parameters panel
control
Name of the element. You can only access the control by its name. In the property dialog
of the control it's name is assigned/displayed.
If you want to use the name of a symbol (signal or environment/system variable) you have
to ensure that the control has no name instead of the individual control's name. The
name of the environment variable, system variable or signal could be specified as
following.
Info
Example
"EnvVar:EnvGearLockDsp"
"Signal:SleepInd"
"Signal:easy/MotorState/EngineSpeed"
"SysVar:SysVarTester" (for a system variable defined with name
space TestSysvar in the configuration)
"ElemPanelHelp" (for Panel help)
"ElemPanelRecorder" (for Panel recorder)
"ElemCtrlBN" (for Panel control button)
Return values —
Example
// Stop the clock control designed as stop watch.
on key 'a'
{
ClockControlStop("ClockControl", "StoppWatch");
}
closePanel
CAPL Function Overview » General » closePanel
Note
If several panels with the same name exist in the CANoe configuration this command has
an effect on all these panels.
The panel is accessed by its individual panel name that is entered in the Panel Designer /
Panel Editor.
Parameters panelName
Panel name
Return values —
5.1 — • •
Example
| openPanel |
CompleteStop
CAPL Function Overview » General » CompleteStop
Function Indicates completion of pre-stop actions carried out in a certain node after a
measurement stop has been deferred by DeferStop.
Infos
Parameters —
Return values —
7.1 SP4 — — •
Example
on preStop
{
message ShutdownReq m;
output(m);
DeferStop(1000); // measurement is stopped if ACK has not
// yet been received after one second
}
on message ShutdownAck
{
CompleteStop();
}
ConvertTimestamp, ConvertTimestampNS
CAPL Function Overview » General » ConvertTimestamp, ConvertTimestampNS
Parameters timestamp
days
hours
minutes
seconds
milliseconds
microseconds
Return values —
7.5 — • •
Example
on envVar EnvGearUp
{
dword d;
byte h, m, s;
word ms, us, ns;
convertTimestampNS(timeNowNS(), d, h, m, s, ms, us, ns);
write("Gear up at %d days, %d::%d::%d,%d.%d.%d", d, h, m, s, ms, us,
ns);
cos
CAPL Function Overview » General » cos
All — • •
Example
double x;
x = cos(PI); // result -1
or
double tangens(double x) {
return sin(x) / cos(x);
}
DeferStop
CAPL Function Overview » General » DeferStop
The function can be called in the on preStop handler or even at an earlier time instance.
Measurement is deferred until CompleteStop is called in the same node or the simulation
time has advanced by the amount given in parameter maxDeferTime since the arrival of a
stop request (and call of the on preStop handler).
DeferStop enables waiting for completion of activities that have to be carried out before
measurement stop takes effect, e.g. a reset of an attached ECU.
Infos
Parameters maxDeferTime
Indicates the time interval in milliseconds after which completion of pre-stop activities is
indicated automatically if it has not yet been done explicitly via CompleteStop.
Return values —
7.1 SP4 — — •
Example
on preStop
{
message ShutdownReq m;
output(m);
DeferStop(1000);
}
on message ShutdownAck
{
CompleteStop();
}
elCount
CAPL Function Overview » General » elCount
All — • •
Example
void bsp(int ar[]) {
int i;
for(i=0; i < elCount(ar); i++)
...
}
| runError |
enableControl
CAPL Function Overview » General » enableControl
• control elements
• control and display elements
If a control and display element is configured as a simple display, this command will have
no effect on the element in question.
The turned on or turned off state of an element remains intact at the start/end of the
measurement. Because of this, a defined state should be created for the beginning of the
measurement for the elements involved (for example in the CAPL program under System-
>Start).
Parameters panel
If an empty string is transferred, the action will affect all open panels.
control
Name of the element. You can only activate/deactivate the control with its name. In the
property dialog of the control it's name is assigned/displayed.
If you want to use the name of a symbol (signal or environment/system variable) you have
to ensure that the control has no name instead of the individual control's name. The name
of the environment variable, system variable or signal could be specified as following.
Info
Example
"EnvVar:EnvGearLockDsp"
"Signal:SleepInd"
"Signal:easy/MotorState/EngineSpeed"
"SysVar:SysVarTester" (for a system variable defined with name
space TestSysvar in the configuration)
"ElemPanelHelp" (for Panel help)
"ElemPanelRecorder" (for Panel recorder)
"ElemCtrlBN" (for Panel control button)
enable
Return values —
4.1 — • •
Example
on key 'a'
{
enableControl("gateway", "ElemPanelHelp", 1);
// Activates Panel help in the "gateway" panel.
EnvVarTimeNS
CAPL Function Overview » General » EnvVarTimeNS
Function Returns the time stamp of the environment variable envVariable in nanoseconds.
Parameters envVariable
5.1 — • •
Example
| MessageTimeNS | timeNowNS |
exp
CAPL Function Overview » General » exp
All — • •
Example
double x;
x = exp(5);
write("Exponent of 5: %l",x); // Result: 148.413159
FDXTriggerDataGroup
CAPL Function Overview » General » FDXTriggerDataGroup
Function This function triggers the transmission of a data group via CANoe FDX protocol.
Parameters groupID
7.6 — — •
Example
// CANoe FDX data exchange synchronously to FlexRay cycle
// Whenever slot 5 of the FlexRay cycle will be reached, the FDX data group
10 is transmitted one time
on frSlot 5
{
FDXTriggerDataGroup(10);
}
fileClose
CAPL Function Overview » General » fileClose
As Destructor file.close()
3.0 — • •
Example
fileGetBinaryBlock
CAPL Function Overview » General » fileGetBinaryBlock
Function The function reads characters from the specified file in binary format.
Parameters buff
Buffer
buffsize
fileHandle
3.0 — • •
Example
fileGetString
CAPL Function Overview » General » fileGetString
Function The function reads a string from the specified file. The returned string contains a new
line character. See also fileGetStringSZ.
Characters continue to be read out until the end of line is reached or the number of read-
out characters is equal to buffsize -1.
Parameters buff
buffsize
fileHandle
3.0 — • •
Example
fileGetStringSZ
CAPL Function Overview » General » fileGetStringSZ
Function The function reads a string from the specified file. Characters continue to be read out
until the end of line is reached or the number of read-out characters is equal to buffsize-
1. The new line character is not included in the string. See also fileGetString.
Parameters buff
buffsize
fileHandle
3.0 — • •
Example
fileName
CAPL Function Overview » General » fileName
Function Output of the CAPL program name in the Write window. Helpful for debugging purposes.
Parameters —
Return values —
All — • •
Example
...
fileName();
...
Result:
| elCount | runError |
filePutString
CAPL Function Overview » General » filePutString
Parameters buff
buffsize
Number of characters
fileHandle
3.0 — • •
Example
fileRewind
CAPL Function Overview » General » fileRewind
Method file.Rewind()
Function This function resets the position pointer to the beginning of the file.
3.0 — • •
7.0 SP5: — • •
method
Example
fileWriteBinaryBlock
CAPL Function Overview » General » fileWriteBinaryBlock
Parameters buff
buffersize
Number of bytes
fileHandle
3.0 — • •
Example
_floor
CAPL Function Overview » General » _floor
Function Calculates the floor of a value, i.e. the largest integer smaller or equal to the value.
Parameters x
7.2 — • •
Example
float x;
x = _floor(3.6); // x == 3.0
| _ceil | _round |
_gcvt
CAPL Function Overview » General » _gcvt
Function The number val is converted to a string s containing a decimal point and a possible sign
byte.
Parameters val
Number to be converted.
digits
String, which contains the converted number. If the string size is too small, the string
keeps unchanged.
Return values —
7.5 SP2 — • •
Example
char s[15];
Result:
val1: 3.141593: s: 3.141592654
val2: 271828.182840: s: 271828.182
val2: 271828.182840: s: 2.7183e+005
val2: 271828.182840: s: 2.7183e+005
| atol | ltoa |
getAbsFilePath
CAPL Function Overview » General » getAbsFilePath
Info
As parameter the file should be defined with the relative path to the current
configuration.
Parameters relPath
A path (with or without a file name) defined relative to the current configuration. If this
parameter is empty, then the full path of the current configuration will simply be
returned.
absPath
absPathLen
Size of the buffer [in bytes] for the full path name.
Return values On success this function returns length of the full path name, otherwise -1.
5.1 — • •
Example
on key 'x'
{
char absPath[256];
getAbsFilePath("Nodes\\Test.can", absPath, 256);
write ("absPath: %s ", absPath);
}
GetBusContext
CAPL Function Overview » General » GetBusContext
Note
The bus context plays a role in modeling gateways and in tests of control units with
several bus connections. In this case, a series of CAPL functions such as canOnline and
canOffline may have more than one meaning in terms of the bus interface (channel) to be
used. A similar type of problem occurs when identical node layer modules are used
simultaneously within a CAPL block. A distinction must be made between the instances of
the node layer, both for calls to CAPL functions that are implemented in the node layers
and for implementing callbacks.
To facilitate this distinction, a bus context is placed in the CAPL program by the runtime
environment while a callback is being executed by the node layer. This context
unambiguously identifies the node layer that is making the call. In a similar manner, the
call of a CAPL function that is implemented in a node layer is forwarded on to the
appropriate node layer, depending on the current bus context. This also applies to the
CAPL functions mentioned above, canOnline and canOffline, as well as to many wait
points of the Test Feature Set.
Parameters —
3.2 — — •
Example
on preStart
{
ibus_context = GetBusNameContext( "ibus");
motbus_context = GetBusNameContext( "motbus");
}
void apCanOn()
{
dword context;
SetBusContext( context);
| GetBusNameContext | SetBusContext |
GetBusNameContext
CAPL Function Overview » General » GetBusNameContext
Note
The bus context plays a role in modeling gateways and in tests of control units with
several bus connections. In this case, a series of CAPL functions such as canOnline and
canOffline may have more than one meaning in terms of the bus interface (channel) to be
used. A similar type of problem occurs when a node layer module is used simultaneously
on multiple busses within a CAPL block. A distinction must be made between the
instances of the node layer, both for calls to CAPL functions that are implemented in the
node layers and for implementing callbacks.
To facilitate this distinction, a bus context is placed in the CAPL program by the runtime
environment while a callback is being executed by the node layer. This context
unambiguously identifies the node layer that is making the call. In a similar manner, the
call of a CAPL function that is implemented in a node layer is forwarded on to the
appropriate node layer, depending on the current bus context. This also applies to the
CAPL functions mentioned above, canOnline and canOffline, as well as to many wait
points of the Test Feature Set.
Parameters name
Return values In the case of success, the context of the specified bus is returned.
3.2 — — •
Example
dword ibus_context = 0;
dword motbus_context = 0;
}
on preStart
{
ibus_context = GetBusNameContext( ibus);
motbus_context = GetBusNameContext( motbus);
if ( 0 == ibus_context)
{
writeex( 0, 3, "Error: Cannot determine context for bus: %s", ibus);
}
if ( 0 == motbus_context)
{
writeex( 0, 3, "Error: Cannot determine context for bus: %s", motbus);
}
}
| GetBusContext | SetBusContext |
getCardType
CAPL Function Overview » General » getCardType
Function Determines the type of CAN platform being used. Is needed e.g. to program the BTR /
OCR values.
Parameters —
All — • •
Example
...
switch(getCardType()) {
case 6: setOcr(0,0x02);
break;
case ...
default:
write("Unknown driver %d", getCardType());
break;
}
...
| getChipType | getCardTypeEx |
getCardTypeEx
CAPL Function Overview » General » getCardTypeEx
Function Determines the card type of CAN channel. Is needed e.g. to program the BTR / OCR
values.
Parameters CAN
Channel number
15 Peak CAN-Dongle
16 Vector CAN-Dongle
33 Vector VN7600
5.0 — • •
Example
| getCardType | getChipType |
getChipType
CAPL Function Overview » General » getChipType
0 both controller
1 Channel 1
2 Channel 2
5 NEC 72005
Other types may occur. DEMO versions return the result 0 or simulate one of the existing
types. If an attempt is made to access a nonexistent channel (e.g. Channel 2 for CPC/PP)
or if the driver used does not support this function, the functional result is 0.
All — • •
Example
...
switch(getChipType(0)) {
case 200: setOcr(0,0x02);
break;
case ...
default:
write("Unknown CAN-chip %d", getChipType(0));
break;
}
...
| getCardType | getCardTypeEx |
GetComputerName
CAPL Function Overview » General » GetComputerName
Parameters buffer
bufferSize
7.2 SP3 — • •
Example
char buffer[50];
GetComputerName(buffer, elcount(buffer));
write("Computer name: %s", buffer);
getDrift
CAPL Function Overview » General » getDrift
Parameters —
3.0 — — •
Example
int val;
...
// Assign to val the Drift value
val = getDrift();
...
GetEventSortingStatus
CAPL Function Overview » General » GetEventSortingStatus
int GetEventSortingStatus(beanMessage);
With active Event Sorting the return value indicates if the given event in the simulation
setup of CANoe was processed in correct time sequence.
The Event Sorting is inactive or it concerns a program internal event that will never be
sorted (e.g. environment variable).
1: sorted
The Event Sorting is active and the event was processed and sorted in the correct time
sequence.
2: unsorted
The Event Sorting is active but the event arrived too late or too soon so that the event
was processed unsorted.
6.0 — • •
Example
on message *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on linSlaveTimeout
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on linTransmError
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on linCsError
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on linReceiveError
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on linSyncError
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on pg *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on gmLanMessage *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on linMessage *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on mostMessage *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on beanMessage *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on mostRawMessage
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on mostAMSMessage *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on J1587Param *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event", (double)this.msgOrigTime/100000 );
}
}
on linBaudrateEvent
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on linDlcInfo
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on linSchedulerModeChange
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on linSleepModeEvent
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on linWakeupFrame
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on beanError
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on mostLightLockError
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on FRSlot *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on FRFrame *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
on FRStartCycle *
{
if ( GetEventSortingStatus(this)==2 ) {
Write("Unsorted Event at time %.6f", (double)this.time/100000 );
}
}
GetFirstCANdbName
CAPL Function Overview » General » GetFirstCANdbName
Parameters buffer
size
4.0 — • —
Example
on start
{
char buffer[256];
dword pos;
while ( 0 != pos)
{
write( "CANdb: %s", buffer);
pos = GetNextCANdbName( pos, buffer, elcount( buffer));
//Finds the names of other databases.
//If any other databases are found
//"pos" contains the value 2, 3, etc
//If no further databases are found
//"pos" contains 0 and the loop is exited
}
}
Example to find the third database
on key '3'
{
char buffer[256];
dword pos;
dword DbcNumber = 2; //Position number of the second database
pos = GetNextCANdbName(DbcNumber, buffer, elcount(buffer));
//Returns the name of the third database.
//Return value "pos" contains the value 3.
//If no third database is found "pos" contains 0.
| GetMessageName | GetNextCANdbName |
GetIPAddress
CAPL Function Overview » General » GetIPAddress
Parameters buffer
bufferSize
7.2 SP3 — • •
Example
char buffer[50];
GetIPAddress(buffer, elcount(buffer));
write("IP Address: %s", buffer);
getJitterMax
CAPL Function Overview » General » getJitterMax
Function Determines the upper limit for the allowable deviation when Jitter is set.
Parameters —
3.0 — — •
Example
int val;
...
// Assign to val the upper value of the Jitter
val = getJitterMax();
...
getJitterMin
CAPL Function Overview » General » getJitterMin
Function Determines the lower limit for the allowable deviation when Jitter is set.
Parameters —
3.0 — — •
Example
int val;
...
// Assign to val the lower value of the Jitter
val = getJitterMin();
...
getLocalTime
CAPL Function Overview » General » getLocalTime
Function Returns details to the current date and time in an array of type long.
The entries of the array will be filled with the following information:
1 Seconds (0 - 60)
2 Minutes (0 - 60)
3 Hours (0 - 24)
5 Month (0 - 11)
7 Day of week (0 - 7)
Return values —
All — • —
Example
...
long tm[9];
getLocalTime(tm);
// now tm contains the following entries:
// tm[0] = 3; (seconds)
// tm[1] = 51; (minutes)
// tm[2] = 16; (hours)
// tm[3] = 21; (day of month)
// tm[4] = 7; (month stating with 0)
// tm[5] = 98; (year)
// tm[6] = 5; (weekday)
// tm[7] = 232;(day of year)
// tm[8] = 1; (Summer time)
...
| getLocalTimeString |
getLocalTimeString
CAPL Function Overview » General » getLocalTimeString
Function Copies a printed representation of the current date and time into the supplied character
buffer. The format of the string is ddd mmm dd hh:mm:ss jjjj (e.g. "Fri Aug 21 15:22:24
1998").
Parameters timeBuffer
Return values —
All — • —
Example
...
char timeBuffer[64];
getLocalTimeString(timeBuffer);
// now timeBuffer contains for example. "Fri Aug 21 15:22:24 1998"
...
| getLocalTime |
getMessageAttrInt
CAPL Function Overview » General » getMessageAttrInt
Note
This function finds the value of the message attribute in the database again with each
call. If the message is already known when the CAPL program is being written, the
attribute should be found directly by its selector syntax (<Message
variable>.<Attribute name> e.g. absData.msgCycleTime).
A user-defined attribute with the name specified in the parameter, and of the Integer
type, must be defined in the database. If no such attribute is defined, the function
returns 0. If no attribute value is assigned to the message in the database, the default
value of the attribute definition is returned.
Parameters canMessage
Message variable
attributeName
Attribute name
Return values Value of the attribute (or default value) from the database.
3.1 — • •
Example
This example outputs the value of the message attribute GenMsgCycleTime in the Write
window when the message is received.
The attribute name must be written as defined in the database. You can find the
attribute name in the attribute window of the database.
on message *
{
long cycleTimeValue1;
long cycleTimeValue2;
cycleTimeValue1 = getMessageAttrInt(this, "GenMsgCycleTime");
write("CycleTime of message id %x = %d", this.id, cycleTimeValue1);
message EngineData gMsgEngineData;
cycleTimeValue2 = getMessageAttrInt(gMsgEngineData, "GenMsgCycleTime");
write("CycleTime of message id %x = %d", this.id, cycleTimeValue2);
}
GetMessageID
CAPL Function Overview » General » GetMessageID
Parameters messageName
dbName
Name of the database, needed if the message name is used in more than one database.
7.1 — • •
Example
dword id;
id = GetMessageID("LightState");
| GetMessageName |
GetMessageName
CAPL Function Overview » General » GetMessageName
Syntax dword GetMessageName( dword id, dword context, char buffer[], dword size)
Parameters id
context
CAN 1
LIN 5
MOST 6
FlexRay 7
BEAN 8
J1708 9
buffer
size
4.0 — • —
7.1 — • •
Example
variables
{
DWORD contextCAN = 0x00010000;
DWORD contextLIN = 0x00050000;
DWORD contextMOST = 0x00060000;
DWORD contextFLEXRAY = 0x00070000;
DWORD contextBEAN = 0x00080000;
DWORD contextJ1708 = 0x00090000;
}
on message *
{
char buffer[64];
if ( GetMessageName( this.ID, contextCAN | this.CAN, buffer, elcount(
buffer)))
{
write( "Message: %s", buffer);
}
}
| GetFirstCANdbName | GetNextCANdbName |
GetNextCANdbName
CAPL Function Overview » General » GetNextCANdbName
Function Finds out the names of the other assigned databases with pos.
Parameters pos
buffer
size
4.0 — • —
Example
on start
{
char buffer[256];
dword pos;
while ( 0 != pos)
{
write( "CANdb: %s", buffer);
pos = GetNextCANdbName( pos, buffer, elcount( buffer));
//Finds the names of other databases.
//If any other databases are found
//"pos" contains the value 2, 3, etc
//If no further databases are found
//"pos" contains 0 and the loop is exited
}
}
on key '3'
{
char buffer[256];
dword pos;
dword DbcNumber = 2; //Position number of the second database
pos = GetNextCANdbName(DbcNumber, buffer, elcount(buffer));
//Returns the name of the third database.
//Return value "pos" contains the value 3.
//If no third database is found "pos" contains 0.
| GetFirstCANdbName | GetMessageName |
GetOfflineFileName
CAPL Function Overview » General » GetOfflineFileName
Function Returns the complete path of the currently used offline source file.
Parameters buffer
bufferSize
7.2 — • —
Example
getProfileArray
CAPL Function Overview » General » getProfileArray
Note
Function Searches the file under section section for the variable entry. Entry is interpreted as a
list of numerical values, separated by comma, tab, space, semicolon or slash. A 0x prefix
indicates hex values.
Parameters section
entry
buff
buffsize
Size of buff: Maximum number of read in numerical values (max. 1279 characters).
filename
3.0 — • •
Example
Note
Using 256 hex values (format 0x??) and int values (format ??? plus signed) respectively as
well as separators the string length is 4 * 256 + 255 = 1279 characters.
The first 1279 characters are read from the ini entry and are converted to numerical
values.
Does the string contain figures with only one figure as well as separators (e.g.
3,1,4,1,5,9,2,6,5,3,5...), 640 numerical values can be read.
getProfileInt
CAPL Function Overview » General » getProfileInt
Note
Syntax long getProfileInt(char section[], char entry[], long def, char filename[])
Function Searches the file filename under section section for the variable entry. If its value is a
number, this number is returned as the functional result. If the file or entry is not found,
or if entry does not contain a valid number, the default value def is returned as the
functional result.
Parameters section
entry
def
filename
3.0 — • •
Example
getProfileFloat
CAPL Function Overview » General » getProfileFloat
Note
Function Searches the file filename under section section for the variable entry. If its value is a
number, this number is returned as the functional result. If the file or entry is not found,
or if entry does not contain a valid number, the default value def is returned as the
functional result.
Parameters section
entry
def
filename
3.0 — • •
Example
getProfileString
CAPL Function Overview » General » getProfileString
Note
Function Searches the file filename under section section for the variable entry. Its contents
(value) are written to the buffer buff. Its length must be passed correctly in buffsize. If
the file or entry is not found, the default value def is copied to buffer.
Parameters section
entry
def
buff
buffersize
filename
3.0 — • •
Example
getStartdelay
CAPL Function Overview » General » getStartdelay
Function Determines the value of the start delay configured for this network node in the Simulation
Setup.
Parameters —
Return values Start delay in ms. If no start delay was set the function returns the value zero.
3.0 — — •
Example
int val;
...
// Assign to val the value of the start delay
val = getStartdelay();
...
| setStartdelay |
getValue
CAPL Function Overview » General » getValue
Function Determines the value of the environment variable with identifier EnvVarName/name. The
type of the return value is based on the type of environment variable (int for discrete
(form 1), float for continuous environment variables (form 2 and 6)). For character string
environment variables (form 3 and 7) and environment variables with data bytes (form 4,
5, 8 and 9) the active value is saved to a buffer which you identify in the function call.
Info
Parameters EnvVarName
buffer
offset
Form 3, 4 and 5
All — • •
Example
int val;
float fval;
char cBuf[25];
byte bBuf[64];
long copiedBytes;
...
// Assign to val the value of the environment variable Switch
val = getValue(Switch);
// Assign to fval the value of the environment variable Temperature
val = getValue(Temperature);
// Read the value of environment variable NodeName
copiedBytes = getValue(NodeName, cBuf);
// Read the value of environment variable DiagData
copiedBytes = getValue(DiagData, bBuf);
// Read the value of environment variable DiagData starting at position 32
copiedBytes = getValue(DiagData, bBuf, 32);
...
| getValueSize | putValue |
getValueSize
CAPL Function Overview » General » getValueSize
Info
• For environment variables of type string the string length plus the
terminating null character will be returned.
• With form 2 the compiler cannot check whether name actually
designates an environment variable of the correct type. If it is not, an
error message will appear in the Write window in runtime.
Parameters EnvVarName
name
All — • •
Example
int vSize;
...
// Size of the data of an environment variable of type integer
vSize = getValueSize(switch);
// Buffersize of an environment variable of type string
// (with terminating Null character)
vSize = getValueSize(nodename);
// Size of the data byffer of an environment variable of type data
vSize = getValueSize(DiagData);
...
| getValue | putValue |
gmLanId
CAPL Function Overview » General » gmLanId
Function This function can be used to create a message ID for a GMLAN message. In addition to the
message, you must specify the transmission node or its source ID.
The message ID returned can be used, for example, to wait for a specific GMLAN message
with the TestWaitForMessage function.
Parameters aMessage
aSourceId
Source ID of the node to be coded as the transmission node in the message ID.
aTxNode
Return values If the message is a GMLAN message, a GMLAN message ID will be returned containing the
correct source address and priority. Otherwise, the message ID will be returned.
6.1 — — •
Example
dword gmID = 0;
long result = 0;
gmID = gmLanId(Comfort::Console_1, 48);
waitResult = TestWaitForMessage(gmID, 5000);
gmLanGetPID(gmLanMessage msg);
gmLanGetSourceId(gmLanMessage msg);
gmLanGetPrio(gmLanMessage msg);
Parameters msg
Message
4.1 — • •
Examples
output(msg1);
Priority and source address are copied from Battery_Voltage message to the new message
msg:
on gmlanmessage Battery_Voltage
{
gmlanmessage Battery_Voltage msg;
msg = this; // SA and PRIO are not copied
gmLanSetSourceId(msg, gmLanGetSourceId(this));
// Copy source address from Battery_Voltage to msg
gmLanSetPrio(msg, gmLanGetPrio(this));
// Copy priority from Battery_Voltage to msg
...
}
halt
CAPL Function Overview » General » halt
Function This function stops the execution of the simulation. The simulation can be continued with
<F9>. The halt instruction is ignored in Real mode.
In addition, the halt instruction causes an update of the variables displayed on the Inspect
side of the Write window.
Parameters —
Return values —
4.1 — — •
Example
on key 'h'
{
halt();
// Stops execution of the simulation in Simulation mode
}
| inspect |
inspect
CAPL Function Overview » General » inspect
Function This function causes an update of the variables displayed on the Inspect side of the Write
window.
Parameters —
Return values —
4.1 — — •
Example
on key 'i'
{
inspect();
// Update of the variables displayed on the Inspect side of the Write
window
}
| halt |
InterfaceStatus
CAPL Function Overview » General » InterfaceStatus
Function The callback can be inserted in the sections callback function or function.
The callback occurs when the status of the connection to the interface hardware is
changed (e.g. when Windows reports a lost connection to a CAN/WLAN gateway or to a
WLAN interface hardware for Car2x communication).
Parameters time
channel
status
Values:
3015: The connection is lost
Return values —
7.6 — • •
Example
void InterfaceStatus(long time, long channel, long status)
{
if(status == 3015)
{
write("Time %f s, channel %d: The connection to the interface is
lost!", ((float)time)/100000.0, channel);
}
else
{
//other status is not yet supported
}
}
isStatisticAcquisitionRunning
CAPL Function Overview » General » isStatisticAcquisitionRunning
Note
The relevant CAPL block must appear directly before the Frame Histogram window in the
evaluation branch. Otherwise a warning is output in the Write window.
In the Configuration dialog the Statistics report and histogram evaluations check box
must be activated. You open this dialog with the Configuration shortcut menu item of the
Frame Histogram window in the measurement setup.
Function This function is used to test whether an acquisition range has already been started.
Parameters —
Return values The function returns 1 if an evaluation is already running. Otherwise it returns 0.
3.0 — • —
Example
| startStatisticAcquisition | stopStatisticAcquisition |
isOfflineMode
CAPL Function Overview » General » isOfflineMode
Function This function is used to get the information if CANoe is in offline mode.
Parameters —
7.0 SP4 — • —
Example
isSimulated
CAPL Function Overview » General » isSimulated
Function This function is used to get the information if CANoe is in simulated mode.
Parameters —
5.1 — — •
Example
This example checks if CANoe is in simulated mode. Then the test is not executed.
// do not activate test when running in simulated mode
if (isSimulated())
{
Write("Test cannot run in simulated mode!");
}
isStdId, isExtId
CAPL Function Overview » General » isStdId, isExtId
Function Checks parameter for extended identifier (29 bit) or standard identifier (11 Bit).
Id part of a message
All — • •
Example
...
if(isExtId(this))
write("extended identifier");
else
write("standard identifier");
or
std = isStdId(m100.id);
isTimerActive
CAPL Function Overview » General » isTimerActive
int isTimerActive(mstimer t)
This is the case between the call to the setTimer function and the call to the on timer
event procedure.
6.0 — • •
Example
timer t;
write("Active? %d", isTimerActive(t)); // writes 0
setTimer(t, 5);
write("Active? %d", isTimerActive(t)); // writes 1
keypressed
CAPL Function Overview » General » keypressed
Function This function returns the key code of a currently pressed key. If no key is being pressed it
returns 0.. For example, pressing of a key can be queried in a timer function. The
reaction can also be to letting go of a key.
Parameters —
If the 8 lower bits do not equal 0, keypressed returns the ASCII code of the next key in
the keyboard buffer. If the 8 lower bits do not equal 0, the 8 upper bits represent the
extended key code (see IBM PC Technical Reference Manual).
All — • •
Example
variables
{
message 0x1A0 msg; // intialises a message with the
// name msg and identifier 0x1A0
msTimer myTimer; // timer with millisecond resolution
int running; // memorises the first keypress to
// bypass the key repeat
int counter; // message counter
}
on timer myTimer
{
if (keypressed()) // if key is pressed ...
{
counter++; // increment counter by 1
msg.byte(0) = counter; // write the counter reading
// into the 1. byte of the message
output(msg); // send the message to the bus
setTimer(myTimer, 100); // set a timer to 100 ms
}
else // if key is released...
{
running = 0; // wait until new keypress
}
}
on key 'r'
{
if (running == 1) return; // inhibit key repeat
_Log
CAPL Function Overview » General » _Log
7.1 SP4 — • •
Example
double x;
x = _log(1.0); // x == 0.0
_Log10
CAPL Function Overview » General » _Log10
7.1 SP4 — • •
Example
double x;
x = _log10(100.0); // x == 2.0
ltoa
CAPL Function Overview » General » ltoa
Function The number val is converted to a string s. In this case, base indicates a number base
between 2 and 36. s must be large enough to accept the converted number!
Parameters val
Number to be converted.
base
Number base.
Return values —
All — • •
Example
char s1[9];
char s2[9];
ltoa(z,s1,2);
ltoa(z,s2,10);
write("z: %d s1= %s",z, s1);
write("z: %d s2= %s",z, s2);
...
Result:
z: 255 s1= 11111111
z: 255 s2= 255
| atol |
MakeRGB
CAPL Function Overview » General » MakeRGB
Function Calculates the color value from the three primary color components.
Parameters Red
Green
Blue
4.1 — • •
Example
MakeRGB(0, 255, 149);
_max
CAPL Function Overview » General » _max
Parameters x
First operand
Second operand
7.1 — • •
Example
float result;
result = _max(1.0, _max(-3.0, 5.2)); // result == 5.2
MessageTimeNS
CAPL Function Overview » General » MessageTimeNS
The time stamp that can be polled with this function has a greater precision than the
msg.TIME time stamp, whereby the precision depends on the CAN or LIN hardware that is
being used.
Parameters message
CAN message
linmessage
LIN message
MOST message
5.1 — • •
Example
_min
CAPL Function Overview » General » _min
Parameters x
First operand
Second operand
7.1 — • •
Example
float result;
result = _min(1.0, _min(-3.0, 5.2)); // result == -3.0
mkExtId
CAPL Function Overview » General » mkExtId
Example
...
msg.id = mkExtId(this.id);
...
msgBeep
CAPL Function Overview » General » msgBeep
Note
If the specified sound type (e.g. MB_ICONHAND) cannot be played, the standard beep (PC
speaker) is used. The beep must be activated on the Windows control panel to do this!
Function The msgBeep function plays back a sound predefined by the Windows system. It replaces
the previous beep function.
Parameters soundType
0 MB_ICONASTERISK SystemAsterisk
1 MB_ICONEXCLAMATION SystemExclamation
2 MB_ICONHAND SystemHand
3 MB_ICONQUESTION SystemQuestion
4 MB_OK SystemDefault
Return values —
3.0 — • •
Example
void sound() {
// Standard signal question
msgBeep (3);
}
| write | writeToLog |
Open
CAPL Function Overview » General » Open
Note
Parameters filename
access
mode
7.0 CAN • •
Example
openFileRead
CAPL Function Overview » General » openFileRead
Note
Function This function opens the file named filename for the read access.
Parameters filename
file name
mode
Return values The return value is the file handle that must be used for read operations.
3.0 — • •
Example
openFileWrite
CAPL Function Overview » General » openFileWrite
Note
Before this function can be called the write path must be set by the function
SetWritePath. Otherwise the configuration directory will be used. A relative file name
must be passed to the function.
Function This function opens the file named filename for the write access.
mode=2 to append data at the end of the file use for ASCII mode.
mode=3 to append data at the end of the file for binary mode.
Parameters filename
file name
mode
Return values The return value is the file handle that must be used for write operations.
3.0 — • •
Example
openPanel
CAPL Function Overview » General » openPanel
Note
If several panels with the same name exist in the CANoe configuration this command has
an effect on all these panels.
The panel is accessed by its individual panel name that is entered in the Panel
Designer/Panel Editor.
Parameters panelName
Panel name
Return values —
5.1 — • •
Example
| closePanel |
output
CAPL Function Overview » General » output
void output(errorFrame);
Return values —
All CAN • •
Example
output(msg) Example
variables {
message can2.125 msg = { // define CAN-Message
dlc = 1,
byte(0) = 1
};
}
on key F1 {
output (msg); // output Message
}
output(errorFrame) Example
on key F10 {
output(errorFrame); // output error frame on CAN channel 1
}
on CAN2.errorFrame {
output (CAN3.errorFrame); // output error frame on CAN channel 3
}
Except for the first channel for all other channels the key word errorFrame has to be
qualified with the number of the CAN channel.
_pow
CAPL Function Overview » General » _pow
Parameters x – base
y – exponent
7.0 — • •
Example
double result;
result = _pow(2.0, 3.0); // result == 8.0
result = _pow(4.0, 0.5); // result == 2.0
putValue
CAPL Function Overview » General » putValue
Function Assigns the value val to the environment variable with identifier EnvVarName/name.
Integers are assigned to discrete environment variables (form 1 and 6), floating point
numbers are assigned to continuous environment variables (form 2 and 7). The contents of
a character string is assigned to character string environment variables (form 3 and 8).
For data byte environment variables (form 4, 5, 9 and 10) the bytes of the data buffer are
copied into the environment variable.
Info
Parameters EnvVarName
name
val
New value of environment variable (form 1 and 2) or buffer with new data (form 3, 4 and
5) and for form 5 the number of bytes to be copied.
Return values —
All — • •
Example
byte dataBuf[64];
...
// Assign the value 0 to environment variable Switch
putValue(Switch, 0);
// Assign the value 22.5 to environment variable Temperature
putValue(Temperature, 22.5);
// Assign the value Master to environment variable NodeName
putValue(NodeName, "Master");
// Copy 64 bytes of the data buffer into the environment variable DiagData
putValue(DiagData, dataBuf, 64);
...
| getValue | getValueSize |
putValueToControl
CAPL Function Overview » General » putValueToControl
Message Output
PG Output
1
This function requires CANoe 7.5 and higher.
Function Assigns the value val to the Multi Display Control or the CAPL Output View with the name
control. The Multi Display Control/ CAPL Output View is located on the panel with the
title panel.
Different contents are displayed with the Multi Display Control/CAPL Output View. In
addition to numbers (float and integer) and texts (char[]), in particular different
messages (CAN, LIN, ... and J1939 PGNs) can also be displayed.
Info
Parameters panel
control
val
Value to be displayed.
paragraph
Info
Parameter Description
Values
0 In this case, no new paragraph is set. The text will be append directly to
the existing output.
This is the default setting. If you want to use the default setting you do
not need to set the parameter when calling the function.
dispHex
Info
Parameter Description
Values
For signals this is the default setting. If you want to use the default
setting you do not need to set the parameter when calling the function.
For messages this is the default setting. If you want to use the default
setting you do not need to set the parameter when calling the function.
Return values —
3.2 — • •
value = getvalue(this);
switch(value)
{
case 1: putValueToControl("Gateway","DisplayControl","This is the
Automot Demo!");
break;
case 2: putValueToControl("Gateway","DisplayControl",mEngineData);
break;
case
3: putValueToControl("Gateway","DisplayControl",mEngineData.EngSpeed.phys);
break;
}
}
on key 'a'
{
//Output of a message without additional parameter settings. In this case
parameters have default settings; they are 'no new paragraph' and 'display
message in 'hexadecimal' notation'
putValueToControl("TestPanel","ControlOutput1", TestMsg);
//Output of a message, each time in a new paragraph.
putValueToControl("TestPanel","ControlOutput1", TestMsg, 1);
//Output of a message, each time with a new paragraph and the message is
displayed in decimal notation.
//putValueToControl("TestPanel","ControlOutput1", TestMsg, 1, 0);
}
on key 'b'
{
//Output of a signal (raw) without additional parameter settings.
//In this case parameters have default settings;
//they are 'no new paragraph' and display signal in 'decimal' notation.
putValueToControl("TestPanel","ControlOutput1", "\nSignal raw\n");
putValueToControl("TestPanel","ControlOutput1", TestMsg.Signal1);
on key 'c'
{
//Output of a signal (physical) without additional parameter settings.
//In this case parameters have default settings;
//they are 'no new paragraph' and display signal in 'decimal' notation.
putValueToControl("TestPanel","ControlOutput1", "\nSignal raw\n");
putValueToControl("TestPanel","ControlOutput1", TestMsg.Signal1.phys);
random
CAPL Function Overview » General » random
All — • •
Example
dword x;
// generate random number in the interval [0;100[
x = random(100);
| runError |
ReplayResume
CAPL Function Overview » General » ReplayResume
Function Starts the Replay block with the name pName after it is suspended by ReplaySuspend.
Parameters pName
4.0 — • •
Example
ReplayStart
CAPL Function Overview » General » ReplayStart
Parameters pName
4.0 — • •
Example
ReplayState
CAPL Function Overview » General » ReplayState
Function Returns the state of the Replay block with the name pName.
Parameters pName
4.0 — • •
Example
ReplayStop
CAPL Function Overview » General » ReplayStop
Parameters pName
4.0 — • •
Example
ReplaySuspend
CAPL Function Overview » General » ReplaySuspend
Parameters pName
4.0 — • •
Example
resetCan
CAPL Function Overview » General » resetCan
Function Resets the CAN controller. Can be used to reset the CAN controller after a BUSOFF or to
activate configuration changes. Since execution of the function takes some time and the
CAN controller is disconnected from the bus briefly, messages can be lost when this is
performed.
Info
With this function you can reset CAN1 and CAN2. If only one specific CAN
channel is used, resetCan stops with an error and the CAN channels keep
offline. In this case the ResetCanEx function has to be used.
The function resetCanEx can be used for all channels.
Parameters —
Return values —
All — — •
Example
on key 'r' { // Controller is reset after BUSOFF
resetCan();
}
| setOcr | setBtr |
ResetCanEx
CAPL Function Overview » General » ResetCanEx
Function Resets the CAN controller for one specific CAN channel. Can be used to reset the CAN
controller after a BUSOFF or to activate configuration changes. Since execution of the
function takes a certain amount of time and the CAN controller is disconnected from the
bus for a brief period messages may be lost.
Parameters channel
CAN channel
Return values —
4.1 — • •
Example
on key 'r' { // After BUSOFF the controller on Channel 2 is reset
resetCanEx(2);
}
| resetCan |
_round
CAPL Function Overview » General » _round
Function Rounds x to the nearest integral number. The rounding method used is symmetric
arithmetic rounding.
Parameters x
Number to be rounded
For very large numbers, you should use _round64, which returns a 64 bit integer.
7.0 — • •
Example
long result;
result = _round(2.4); // result == 2
result = _round(2.5); // result == 3
result = _round(-3.5); // result == -4
runError
CAPL Function Overview » General » runError
Function Triggers a run error. Outputs the error number to the Write window indicating the error
number and the passed number, and then terminates the measurement.
Parameters Numbers that are represented in CANoe as a references for the user.
The values under 1000 are reserved for internal purposes. The second parameter is
reserved for future expansions.
Return values —
All — • •
Example
...
if(rpm < 0) runError(1001,1);
...
| elCount |
ScanBaudrateActive
CAPL Function Overview » General » ScanBaudrateActive
Note
Use case The applied baud rate on a real network should be determined on which NO
communication exists. In this case CANoe is an active participant - Transmitter - on the
network.
Function The function determines the baud rate for the given channel. Result of the function is
written into the Write window.
The baud rate scanner checks different baud rates and tries to send a message through
the given channel. The function is finished if the message was sent successfully and the
baud rate was determined. If a wrong baud rate is present, the other power supply takers
cannot receive the message. CANoe as the transmitter does not receive an acknowledge
and sends an ErrorFrame. In this case the next baud rate of the baud rate range is
checked.
Info
Dlc:
Default value: 8
DisplayBaudrateList:
If this value is set to 0 the baudrate scanner stops after finding the first
baudrate.
If the value is non-zero the scanner checks all baudrates and displays a list of
values at the end.
Default value: 0
Parameters channel
messageID
ID of the message that the scanner will send to detect the baudrate. The DLC of the
message is always 8.
firstBaudrate / lastBaudrate
• If both values are set to zero the scanner checks the most commonly used baudrates:
33.333, 50.0, 83.333, 100.0, 125.0, 250.0, 500.0, 1000.0 [kBaud]
• If both values are the same but not zero the scanner multiplies the baudrate with a
given factor (Value range 0.25-5.0). The factor is changed with steps of 0.25.
• If both values are different, all possible baudrate values in the ranged are scanned.
The incremental step in the range is 1.5%.
timeout
Period of time [ms] the scanner waits when the message is sent.
Return values Returns 0 if the scan function was successfully started. Otherwise the return value is non-
zero.
5.1 — — •
Example
| ScanBaudratePassive |
ScanBaudratePassive
CAPL Function Overview » General » ScanBaudratePassive
Note
Use case The applied baud rate on a real network should be determined on which communication
exists. In this case CANoe is a passive participant - receiver - on the network and it is
connected about a Y cable to the network.
Function Baud rate scanner checks different baud rates and tries to receive a message on the
channel. Function starts the scan and detects the baud rate on the given channel. Result
of the function is written into the Write window.
If a wrong baudrate is present, CANoe cannot receive messages and sends an ErrorFrame,
which can be put on the bus using the parameter bAcknowledge.
Info
Dlc:
Default value: 8
DisplayBaudrateList:
If this value is set to 0 the baudrate scanner stops after finding the first
baudrate.
If the value is non-zero the scanner checks all baudrates and displays a list of
values at the end.
Default value: 0
Parameters channel
messageID
ID of the message that the scanner will receive to detect the baudrate.
If this value is 0xffff the scanner will receive all the messages on the channel.
firstBaudrate / lastBaudrate
• If both values are set to zero the scanner checks the most commonly used baudrates:
33.333, 50.0, 83.333, 100.0, 125.0, 250.0, 500.0, 1000.0 [kBaud]
• If both values are the same but not zero the scanner multiplies the baudrate with a
given factor (Value range 0.25-5.0). The factor is changed with steps of 0.25.
• If both values are different, all possible baudrate values in the ranged are scanned.
The incremental step in the range is 1.5%.
timeout
Period of time [ms] the scanner waits when the message is sent.
bAcknowledge
If a wrong baud rate is present, CANoe cannot receive messages and sends an ErrorFrame,
which can be put on the bus using the parameter bAcknowledge.
The parameter serves for the fact that CANoe - as a passive receiver - can participate
indirectly in the network communication by sending an ErrorFrame.
The parameter does not change the Acknowledge settings of the Hardware Configuration
dialog. The parameter has an effect only during runtime of the function.
Return values Returns 0 if the scan function was successfully started. Otherwise the return value is non-
zero.
5.1 — — •
Example
| ScanBaudrateActive |
setBtr
CAPL Function Overview » General » setBtr
Function Sets another baud rate. The values do not become active until the next call of the
function resetCan.
It should be noted that these values depend on the CAN controller used.
0 Both controllers
1 channel 1
2 channel 2
BTR0
BTR1
All — — •
Example
...
setBtr(0, 0x00, 0x3a); // 500 kBaud for 82C200
resetCan(); // aktivate
...
| resetCan | setOcr |
SetBusContext
CAPL Function Overview » General » SetBusContext
Note
The bus context plays a role in modeling gateways and in tests of control units with
several bus connections. In this case, a series of CAPL functions such as canOnline and
canOffline may have more than one meaning in terms of the bus interface (channel) to be
used. A similar type of problem occurs when identical node layer modules are used
simultaneously within a CAPL block. A distinction must be made between the instances of
the node layer, both for calls to CAPL functions that are implemented in the node layers
and for implementing callbacks.
To facilitate this distinction, a bus context is placed in the CAPL program by the runtime
environment while a callback is being executed by the node layer. This context
unambiguously identifies the node layer that is making the call. In a similar manner, the
call of a CAPL function that is implemented in a node layer is forwarded on to the
appropriate node layer, depending on the current bus context. This also applies to the
CAPL functions mentioned above, canOnline and canOffline, as well as to many wait
points of the Test Feature Set.
Parameters context
Return values The bus context that was valid before the call was made is returned.
3.2 — — •
Example
SetBusContext( context);
// ...and activate its CAN chip as well
CanOnline();
}
| GetBusNameContext | GetBusContext |
setCanCabsMode
CAPL Function Overview » General » setCanCabsMode
Function Various CANcabs modes may be set. Replaces the setPortBits functions.
Parameters ntype
nchannel
CAN channel
nmode
Is used for the control of the board lines via a bit pattern.
0 NORMAL
1 SLEEP
2 HIVOLTAGE
3 HISPEED
4 DUAL_WIRE
5 SINGLE_WIRE_LOW
6 SINGLE_WIRE_HIGH
7 is reserved
Example
nflags
Is used for the control of the board lines via a bit pattern.
Info
Info
Not all mode and flag values are valid for all CANcabs!
Return values 0: ok
!=0: Error
4.1 — • •
Example
on key 'n'
{
long ntype, nmode, nchannel, nflags;
ntype = 0;
nmode = 0;
nchannel = 1;
nflags = 0;
setCanCabsMode(ntype, nchannel, nmode, nflags);
write("normal mode");
}
SetClockControlTime
CAPL Function Overview » General » SetClockControlTime
Function Sets the time of the Panel Designer clock control element.
The panel is accessed by its individual panel name that is entered in the Panel Designer.
Parameters panel
control
Name of the element. You can only access the control by its name. In the property dialog
of the control it's name is assigned/displayed.
If you want to use the name of a symbol (signal or environment/system variable) you have
to ensure that the control has no name instead of the individual control's name. The name
of the environment variable, system variable or signal could be specified as following.
Info
Example
"EnvVar:EnvGearLockDsp"
"Signal:SleepInd"
"Signal:easy/MotorState/EngineSpeed"
"SysVar:SysVarTester" (for a system variable defined with name
space TestSysvar in the configuration)
"ElemPanelHelp" (for Panel help)
"ElemPanelRecorder" (for Panel recorder)
"ElemCtrlBN" (for Panel control button)
hours
minutes
seconds
time
Defines the time in seconds to be displayed in the clock control. The corresponding hours,
minutes and seconds are calculated during runtime.
Return values —
Example
// Set the time in hours, minutes, seconds. It will be displayed
'10:20:30'.
on key 'a'
{
SetClockControlTime("ClockControl1", "ClockCAPL", 10, 20, 30);
}
SetControlBackColor
CAPL Function Overview » General » SetControlBackColor
The panel is accessed by its individual panel name that is entered in the Panel Designer /
Panel Editor.
Parameters panel
control
Name of the element. You can only activate/deactivate the control with its name. In the
property dialog of the control it's name is assigned/displayed.
If you want to use the name of a symbol (signal or environment/system variable) you have
to ensure that the control has no name instead of the individual control's name. The
name of the environment variable, system variable or signal could be specified as
following.
Info
Example
"EnvVar:EnvGearLockDsp"
"Signal:SleepInd"
"Signal:easy/MotorState/EngineSpeed"
"SysVar:SysVarTester" (for a system variable defined with name
space TestSysvar in the configuration)
"ElemPanelHelp" (for Panel help)
"ElemPanelRecorder" (for Panel recorder)
"ElemCtrlBN" (for Panel control button)
When changing the background color only the following/future output — using
putValueToControl — is colored with the new one. The existing output stays
unchanged in color.
color
Return values —
4.1 — • •
Example
// Set the background color for a specific control of a panel
SetControlBackColor("motor", "PedalPos", MakeRGB(255,0,0));
// All controls of the panel are set to the same background color
SetControlBackColor("motor", "", MakeRGB(255,0,0));
// All controls of all panels are set to the same background color
SetControlBackColor("", "", MakeRGB(255,0,0));
SetControlColors
CAPL Function Overview » General » SetControlColors
The panel is accessed by its individual panel name that is entered in the Panel Designer.
Parameters panel
control
Name of the element. You can only activate/deactivate the control with its name. In the
property dialog of the control it's name is assigned/displayed.
If you want to use the name of a symbol (signal or environment/system variable) you have
to ensure that the control has no name instead of the individual control's name. The name
of the environment variable, system variable or signal could be specified as following.
Info
Example
"EnvVar:EnvGearLockDsp"
"Signal:SleepInd"
"Signal:easy/MotorState/EngineSpeed"
"SysVar:SysVarTester" (for a system variable defined with name
space TestSysvar in the configuration)
"ElemPanelHelp" (for Panel help)
"ElemPanelRecorder" (for Panel recorder)
"ElemCtrlBN" (for Panel control button)
When changing the background and text color only the following/future
output — using putValueToControl — is colored with the new one. The
existing output stays unchanged in color.
backcolor
textcolor
Return values —
7.5 — • •
Example
//Set the background and text color for a specific control of a panel
SetControlColors("motor", "PedalPos", MakeRGB(255,0,0), MakeRGB(0,0,255));
//All controls of the panel are set to the same background and text color
SetControlColors("motor", "", MakeRGB(255,0,0), MakeRGB(0,0,255));
//All controls of all panels are set to the same background and text color
SetControlColors("", "", MakeRGB(255,0,0), MakeRGB(0,0,255));
SetControlForeColor
CAPL Function Overview » General » SetControlForeColor
The panel is accessed by its individual panel name that is entered in the Panel Designer /
Panel Editor.
Parameters panel
control
Name of the element. You can only activate/deactivate the control with its name. In the
property dialog of the control it's name is assigned/displayed.
If you want to use the name of a symbol (signal or environment/system variable) you have
to ensure that the control has no name instead of the individual control's name. The
name of the environment variable, system variable or signal could be specified as
following.
Info
Example
"EnvVar:EnvGearLockDsp"
"Signal:SleepInd"
"Signal:easy/MotorState/EngineSpeed"
"SysVar:SysVarTester" (for a system variable defined with name
space TestSysvar in the configuration)
"ElemPanelHelp" (for Panel help)
"ElemPanelRecorder" (for Panel recorder)
"ElemCtrlBN" (for Panel control button)
When changing the text color only the following/future output — using
putValueToControl — is colored with the new one. The existing output stays
unchanged in color.
color
Return values —
4.1 — • •
Example
// Set the foreground color for a specific control of a panel
SetControlForeColor("motor", "PedalPos", MakeRGB(255,0,0));
// All controls of the panel are set to the same foreground color
SetControlForeColor("motor", "", MakeRGB(255,0,0));
// All controls of all panels are set to the same foreground color
SetControlForeColor("", "", MakeRGB(255,0,0));
SetControlProperty
CAPL Function Overview » General » SetControlProperty
The panel is accessed by its individual panel name that is entered in the Panel Editor.
Parameters panel
control
Name of the panel element ("" – references all elements on the panel)
property
value
Return values —
4.1 — • •
Example
SetControlProperty("Measurements", "StatusIndicator", "Caption",
"running");
SetControlProperty("Measurements", "StatusIndicator", "BackColor",
MakeRGB(0,145,255));
| SetControlBackColor | SetControlForeColor |
SetDefaultControlColors
CAPL Function Overview » General » SetDefaultControlColors
Function Sets back the background and text color of panel elements as defined in the Panel
Designer.
The panel is accessed by its individual panel name that is entered in the Panel Designer.
Parameters panel
control
Name of the element. You can only activate/deactivate the control with its name. In the
property dialog of the control it's name is assigned/displayed.
If you want to use the name of a symbol (signal or environment/system variable) you have
to ensure that the control has no name instead of the individual control's name. The
name of the environment variable, system variable or signal could be specified as
following.
Info
Example
"EnvVar:EnvGearLockDsp"
"Signal:SleepInd"
"Signal:easy/MotorState/EngineSpeed"
"SysVar:SysVarTester" (for a system variable defined with name
space TestSysvar in the configuration)
"ElemPanelHelp" (for Panel help)
"ElemPanelRecorder" (for Panel recorder)
"ElemCtrlBN" (for Panel control button)
When changing the background and text color only the following/future
output — using putValueToControl — is colored with the new one. The
existing output stays unchanged in color.
Return values —
7.5 — • •
Example
//Set the default background and text color for a specific control of a
panel.
SetDefaultControlColors("motor", "PedalPos");
//All controls of the panel are set to the default background and text
color as defined in the Panel Designer.
SetDefaultControlColors("motor", "");
//All controls of all panels are set to the default background and text
color as defined in the Panel Designer.
SetDefaultControlColors("", "");
setDrift
CAPL Function Overview » General » setDrift
Function A constant deviation can be set for the timers of a network node with this function. Inputs
for the two values may lie between –10000 and 10000 (corresponds to –100.00% to
100.00%). If the value does not lie within this range, a message is output in the Write
window.
Info
Parameters drift
Return values —
3.0 — — •
Example
...
// Sets the Drift to 35.5 percent
setDrift(3550);
...
setFilePath
CAPL Function Overview » General » setFilePath
Info
Function This function sets the read and write path to the directory. The path can be given as
absolute or relative to the currently active configuration.
Parameters Path
Return values —
4.1 — • •
Example
//set directory for reading
setFilePath("C:\\Windows\\TEMP", 0);
//set directory for writing
setFilePath("D:\\TEMP", 1);
//set directory for writing and reading
setFilePath("C:\\TEMP", 2);
on key 'i'
{
int defaultPara1;
int returnParaInt;
int counter;
double defaultPara2;
double returnParaFloat;
char buffer [256];
//define symbolic values for read/write access mode
dword FILE_PATH_R = 0;
dword FILE_PATH_W = 1;
dword FILE_PATH_RW = 2;
defaultPara1 = -1;
defaultPara2 = -1;
//set absolute file path for writing
setFilePath("C:\\TEMP" , FILE_PATH_W);
// Write different values into the section "Parameter" of the INI file
"Test.ini"
// If no file path is specified, the path from previous setFilePath command
is used
writeProfileString ("Parameter","String","TestString","Test.ini");
writeProfileFloat ("Parameter","Float", 1.7845,"Test.ini");
writeProfileInt ("Parameter", "Integer", 8, "Test.ini");
// Read different values from the Section "Parameter" of the INI file
"C:\\temp\\Test.ini"
// And display the values in the Write window
//if an absolute path is to be used, this can be coded in the parameter
<filename> directly
returnParaInt =
getProfileInt("Parameter","Integer",defaultPara1,"C:\\TEMP\\Test.ini");
returnParaFloat =
getProFileFloat("Parameter","Float",defaultPara2,"C:\\TEMP\\Test.ini");
getProFileString("Parameter","String","Default String", buffer,
elcount(buffer), "C:\\TEMP\\Test.ini");
write("Integer: %d", returnParaInt);
write("Float: %f", returnParaFloat);
write("String: %s", buffer);
}
setJitter
CAPL Function Overview » General » setJitter
Function The Jitter interval for the timers of a network node can be set with this function. The two
values may lie between –10000 and 10000 (corresponds to –100.00% to 100.00%). If one of
the two values does not lie within this range, a message is output in the Write window.
Info
Setting of a Jitter will cause any existing Drift to be reset. To utilize Jitter
and Drift simultaneously please refer to the example.
Parameters min
max
Return values —
3.0 — — •
Example
...
// Set a Jitter with +–4 percent
setJitter(-400, 400);
...
...
// Set a Jitter with +–4 percent
// and a Drift of 17 percent
setJitter(1300, 2100);
...
setLogFileName
CAPL Function Overview » General » setLogFileName
Parameters fileName
The name may be an absolute path, a single filename or a relative path. If an absolute
path or a relative path is supplied, all non existing directories of the path will be created.
The logfile will be placed in the directory of the current configuration, if a single
filename is supplied, or in the path relative to the configuration file if a relative path is
supplied. The directories of the path must be separated by a backslash ('\'). The filename
must not contain a file extension. The extension will be set automatically by the system.
Info
The new name will only be changed with a new setLogFileName call or by a
corresponding entry in the configuration dialog of the logfile.
If the logging block does not log (logging is not active) the name is changed immediately.
If the logging block logs (logging is active) the new name will be taken over with the next
trigger event or with a new measurement start.
Info
The name set with the setLogFileName function will not be saved when
saving the configuration. Only the name set in the configuration dialog of the
logfile will be taken over.
strLoggingBlockName
Return values —
All — • —
Example
...
setLogFileName("Logging1", "newlog");
...
Sets the name of the logging file to "newlog" in the directory of the
current configuration.
...
setLogFileName("Logging1", "c:\\canw\\demo\\automot\\newlog");
...
Sets the absolute path of the logging file.
...
setLogFileName("Logging1", "..\\Logging\\newlog");
...
Sets the relative path of the logging file.
SetMediaFile
CAPL Function Overview » General » SetMediaFile
Function Replaces the media file of the Panel Designer Media Player control during runtime.
The panel is accessed by its individual panel name that is entered in the Panel Designer.
Parameters panel
control
Name of the panel element ("" – references all controls on the panel)
mediafile
Return values —
Example
Setting media file using relative path. The media file is in the Videos folder and this
folder is parallel to the panel folder.
on key 'y'
{
SetMediaFile("Movie", "Media Player", "..\\Videos\\song.mpg");
}
| putValue | SetPictureBoxImage |
setOcr
CAPL Function Overview » General » setOcr
Function Sets the Output Control Register. The values do not become active until the next call of
the function resetCan().
It should be noted that these values depend on the CAN platform used.
0 all channels
OCR
0: error
All — — •
Example
...
setOcr(0, 0x02); // set
resetCan(); // activate
...
| resetCan | setBtr |
SetPictureBoxImage
CAPL Function Overview » General » SetPictureBoxImage
Function Replaces the image of the Panel Designer Picture Box control during runtime.
The panel is accessed by its individual panel name that is entered in the Panel Designer.
Parameters panel
control
Name of the panel element ("" – references all controls on the panel)
iamgefile
Return values —
Example
Setting image file using relative path. The image is in the Images folder and this folder is
parallel to the panel folder.
on key 'y'
{
SetPictureBoxImage("Movie", "Picture Box", "..\\Images\\Picture.bmp");
}
| SetMediaFile |
setPostTrigger
CAPL Function Overview » General » setPostTrigger
Function Sets the posttrigger of the logging. The posttrigger set with this function is valid until the
end of the measurement or until the next call of this function.
All — • —
Example
...
setPostTrigger(2500);
...
Set the posttrigger time of the logging to 2.5 seconds.
...
setPostTrigger(-1);
...
Set the posttrigger of the logging to infinity.
| setPreTrigger |
setPreTrigger
CAPL Function Overview » General » setPreTrigger
Function Sets the pretrigger of the logging. The pretrigger set with this function is valid until the
end of the measurement or until the next call of this function.
All — • —
Example
...
setPreTrigger(25);
...
Set the pretrigger time of the logging to 25 milliseconds.
| setPostTrigger |
setSignalStartValues
CAPL Function Overview » General » setSignalStartValues
Function Sets the values of the signals in the parameter to the start values defined in the
database.
Value to which the bytes in the frame / PDU shall be set which are not used by signals.
2: at least one signal start value didn't fit into the signal in the message
7.1 — • •
Example
message LightState msg;
setSignalStartValues(msg);
| StartLogging |
setStartdelay
CAPL Function Overview » General » setStartdelay
Function Sets the value of the Start Delay for this network node. This function can only be called in
the preStart event procedure. Afterwards the value of the Start Delay cannot be changed
any more.
Parameters delayText
Integer for the Start Delay ms. This value may lie between 0 and 99999. If the value is
greater or less than the limits of this range a warning appears in the Write window.
Return values —
3.0 — — •
Example
...
on preStart
{
// Set Start Delay to 10 seconds
setStartdelay(10000);
}
| getStartdelay |
setTimer
CAPL Function Overview » General » setTimer
Info
Parameters Timer or msTimer variable and an expression which specifies the duration of the timer.
Return values —
All — • •
Example
variables {
msTimer t;
Timer t1;
}
on key F1 {
setTimer(t, 200); // set timer t to 200 ms
}
on key F2 {
setTimer (t1, 2); // set timer t1 to 2 sec
}
on key F3 {
setTimer (t1, 0, 1250*1000 ); // set timer t1 to 1.250 milliseconds
}
setTimerCyclic
CAPL Function Overview » General » setTimerCyclic
With form 2, firstDuration is implicitly the same as period, i.e. the timer runs precisely
according to period the first time.
Parameters t
firstDuration
Time in milliseconds until the timer runs out for the first time.
period
Return values —
7.1 — • •
Example
Starting of a timer that expires the first time 10 ms after the start of measurement and
thereafter every 20 ms (10 ms, 30 ms, 50 ms, 70 ms etc.)
variables {
msTimer t;
}
on start {
setTimerCyclic(t, 10, 20)
}
setWriteDbgLevel
CAPL Function Overview » General » setWriteDbgLevel
Function This function sets the priority level for the writeDbgLevel CAPL function. The output
priority must be set for every network node.
Parameters priority
0 Only write output with a priority of 0 are shown in the write window.
Return values —
3.0 — — •
Example
int i = 10;
int j = 12;
setWriteDbgLevel(7);
writeDbgLevel (4, "This is shown: h= %lxh",j);
// Output: This is shown: h= 0ch
writeDbgLevel (9, "This is not shown: d= %ld",i);
// No output
| write | writeDbgLevel |
setWritePath
CAPL Function Overview » General » setWritePath
Note
After drive letters and also between folders you have to enter two "\" e.g.
setWritePath("E:\\testconfiguration\\exercise").
Function This function sets the write path for the functions openFileWritewriteProfileString
andwriteProfileInt ,writeProfileFloat ,. The path can be given as absolute or relative to
the currently active configuration.
Return values —
3.0 — • •
Example
SetWritePath("C:\\TEMP")– after the drive letter (e.g. "C:") you have to
enter two backslashes "\\"!
| setFilePath |
sin
CAPL Function Overview » General » sin
All — • •
Example
double x;
x = sin(PI); // Result 0
snprintf
CAPL Function Overview » General » snprintf
Function This function corresponds to the C function sprintf. Supplementally, the parameter len
indicates the maximum length of the array dest.
The format string has the same meaning as with the function write and is described there.
Info
Parameters dest
len
format
All — • •
Example
char buffer[100], str[7] = "Vector";
long i;
i = snprintf(buffer,elcount(buffer),"String: %s\n", str);
write("Output:\n%s : Character count = %d\n", buffer, i);
| write |
sqrt
CAPL Function Overview » General » sqrt
All — • •
Example
double x;
x = sqrt(4.0); // Result 2.0
StandaloneConfigOpen
CAPL Function Overview » General » StandaloneConfigOpen
Function Opens the rtcfg file with the given name as standalone configuration.
• The given standalone configuration file must have been downloaded to the device
before.
• The command is only allowed while standalone mode is activated.
• If standalone measurement is currently running the command is deferred until end of
measurement (unless overwritten by another subsequent open command).
• If standalone measurement is not running but standalone mode is activated the file is
loaded (and indicated in the Standalone Manager GUI) but measurement is not started
automatically.
• Basic behavior corresponds to changing the default standalone configuration file (see
Configuration|Standalone Mode… in Remote Files tab.
Parameters rtcfgFileName
Name of the standalone configuration file (without path) to be set as default file.
stopCurrentMeasurement
If this parameter is 1 measurement is stopped immediately (but still waiting for deferred
stop clients). If the parameter value is 0 the request to load another configuration is
queued until end of measurement.
startNewMeasurement
If this parameter is set to 1 measurement will start immediately after the new
configuration has been loaded.
returnToActiveConfig
Return values The function returns an error code with 0 representing successful operation.
Example
// "Config1.rtcfg" (master config.) contains following CAPL code:
on key F2
{
StandaloneConfigOpen("Config2.rtcfg", 1, 1, 1);
}
on key F3
{
StandaloneConfigOpen("Config3.rtcfg", 1, 0, 1);
}
| StandaloneConfigSetDefault |
StandaloneConfigSetDefault
CAPL Function Overview » General » StandaloneConfigSetDefault
Function Changes the default configuration file, i.e. the standalone configuration to be loaded
when standalone mode is activated or the runtime kernel is started after reboot. Thus, it
results in a persistent change on the VN8900.
• The given standalone configuration file must have been downloaded to the device
before.
• The command can be used while standalone mode is activated or deactivated.
• Basic behavior corresponds to changing the default standalone configuration file (see
Configuration|Standalone Mode… in Remote Files tab.
Parameters rtcfgFileName
Return values The function returns an error code with 0 representing successful operation.
Example
| StandaloneConfigOpen |
startStatisticAcquisition
CAPL Function Overview » General » startStatisticAcquisition
Note
The relevant CAPL block must appear directly before the Frame Histogram window in the
evaluation branch. Otherwise a warning is output in the Write window.
Function A new acquisition range is started with this function. If an acquisition range has already
been started, the function has no effect since it cannot influence the currently active
range.
Parameters —
Return values —
3.0 — • —
Example
| isStatisticAcquisitionRunning | stopStatisticAcquisition |
StartLogging
CAPL Function Overview » General » StartLogging
Function Starts all logging blocks immediately bypassing all logging trigger settings.
Starts a logging block with name strLoggingBlockName immediately bypassing all logging
trigger settings.
Starts a logging block with name strLoggingBlockName bypassing all logging trigger
settings.
Parameters strLoggingBlockName
preTriggerTime
Info
While using the preTriggerTime please pay attention to the fact, that the
buffer size in the trigger configuration dialog of the logging block is set
accordingly, so that all events of the given time interval can be logged.
Return values —
4.1 — • •
Example
startLogging();
// starts all logging blocks
stopLogging();
// stops all logging blocks
startLogging( "Logging 1");
// starts the logging block "Logging 1"
stopLogging( "Logging 1");
// stops the logging block "Logging 1"
startLogging( "Logging 1", 2000);
// starts the logging block "Logging 1" with pre-trigger time 2000
milliseconds.
stopLogging( "Logging 1", 1000);
// stops the logging block "Logging 1" with post-trigger time 1000
milliseconds.
| StopLogging |
StartMacroFile
CAPL Function Overview » General » StartMacroFile
Note
Note that a relative path to the configuration directory or an absolute path can be
specified for the macro file.
Just the file name of the macro can also be specified. For this option, the macro file must
be located in the same folder as the configuration.
Function Starts playing the macro with the fileName file name.
Parameters fileName
Macro file.
Return values The returned handle is required to stop the macro playback.
6.0 — — •
Example
StartReplayFile
CAPL Function Overview » General » StartReplayFile
Note
Note that a relative path to the configuration directory or an absolute path can be used
to specify the replay file.
Just the file name of the replay file can also be specified. For this option, the replay file
must be located in the same folder as the configuration.
Function Starts playing the replay file with the name fileName.
Parameters fileName
Replay file.
Return values The returned handle is required to stop the replay file.
6.0 — — •
Example
stop
CAPL Function Overview » General » stop
In offline mode this function interrupts but does not end the measurement. In offline
mode the measurement can only be ended with <ESC>.
Parameters —
Return values —
All — • •
Example
...
if( isExtId(this) )
stop();
...
| trigger |
stopStatisticAcquisition
CAPL Function Overview » General » stopStatisticAcquisition
Note
The relevant CAPL block must appear directly before the Frame Histogram window in the
evaluation branch. Otherwise a warning is output in the Write window.
Function A started acquisition range is stopped with this function. If no acquisition range has been
started yet, this function has no effect.
Parameters —
Return values —
3.0 — • —
Example
| isStatisticAcquisitionRunning | startStatisticAcquisition |
StopLogging
CAPL Function Overview » General » StopLogging
Function Stops all logging blocks immediately bypassing all logging trigger settings.
Stops a logging block with name strLoggingBlockName immediately bypassing all logging
trigger settings.
Stops a logging block with name strLoggingBlockName bypassing all logging trigger
settings.
Parameters strLoggingBlockName
postTriggerTime
Return values —
4.1 — • •
Example
startLogging();
// starts all logging blocks
stopLogging();
// stops all logging blocks
startLogging( "Logging 1");
// starts the logging block "Logging 1"
stopLogging( "Logging 1");
// stops the logging block "Logging 1"
startLogging( "Logging 1", 2000);
// starts the logging block "Logging 1" with pre-trigger time 2000
milliseconds.
stopLogging( "Logging 1", 1000);
// stops the logging block "Logging 1" with post-trigger time 1000
milliseconds.
| StartLogging |
StopMacroFile
CAPL Function Overview » General » StopMacroFile
Function Stops the macro from playing with the handle handle.
Parameters handle
The handle is returned from the StartMacroFile function when starting the macro.
Return values —
6.0 — — •
Example
StopReplayFile
CAPL Function Overview » General » StopReplayFile
Function Stops the replay file from playing with the handle handle.
Parameters handle
The handle is returned from the StartReplayFile function when starting the reply file.
Return values —
6.0 — — •
Example
strlen
CAPL Function Overview » General » strlen
Parameters string
All — • •
Example
long length;
char buffer[100] = "CANalyzer";
length = strlen(buffer);
Result:
length = 9
str_match_regex
CAPL Function Overview » General » str_match_regex
Parameters s
String to be checked.
pattern
Regular expression against which the string is matched. For the regular expression, the
same syntax is used as in the Perl programming language.
Return values 1 if the string matches the pattern, 0 if it doesn’t match the pattern.
7.5 SP2 — • •
Example
char buffer[70] = "Vector Informatik";
long res;
res = str_match_regex(buffer, "Vector [A-Za-z]*"); // 1
res = str_match_regex(buffer, "Inf[a-z]*"); // 0
strncat
CAPL Function Overview » General » strncat
Function This function appends src to dest. len indicates the maximum length of the fit string. The
function ensures that there is a terminating "\0". Thus, a maximum of len - strlen(dest) -
1 characters are copied.
Info
Parameters dest
src
Appended string.
len
Return values —
All — • •
Example
char s[20];
strncpy(s, "Vector", 10); // s is "Vector"
strncat(s, " CANoe", 19); // s is "Vector CANoe"
strncpy(s, "Vector", 10); // s is "Vector"
strncat(s, " CANoe", 11); // s is "Vector CAN"
strncmp
CAPL Function Overview » General » strncmp
Parameters s1
First string
s2
Second string
s2offset
Offset in s2
len
All: form 1 — • •
7.0: form 2 — • •
Example
on key 's'
{
char s1[7] = "Vector";
char s2[7] = "Vector";
if(strncmp(s1,s2,strlen(s1)))
write("not equal");
else
write("equal");
}
strncmp_off
CAPL Function Overview » General » strncmp_off
Syntax long strncmp_off(char s1[], long s1offset, char s2[], long s2offset, long
len);
Parameters s1
First string
s1offset
Offset in s1
s2
Second string
s2offset
Offset in s2
len
7.0 — • •
Example
char s1[18] = "Vector Informatik";
char s2[11] = "Informatik";
if (strncmp_off(s1, 7, s2, 0, strlen(s2)) == 0)
write("Equal!");
else
write("Unequal!");
strncpy
CAPL Function Overview » General » strncpy
Function This function copies src to dest. len indicates the maximum length of src and dest. The
function ensures that there is a terminating '\0'. Thus, a maximum of len-1 characters are
copied.
Parameters dest
Destination buffer
src
Source string
len
Return values —
All — • •
Example
variables {
char s1[7] = "Vector";
char s2 [32];
}
on key 'z'
{ Output to the Write-Window:
strncpy (s2,s1,elcount(s2));
write ("Result: %s",s2); Result: Vector
}
strncpy_off
CAPL Function Overview » General » strncpy_off
Syntax void strncpy_off(char dest[], long destOffset, char src[], long max);
Function This function copies src to dest. max indicates the maximum length of src and dest.
The function ensures that there is a terminating '\0'. Thus, a maximum of max-1-
destOffset characters are copied. Characters are overwritten in dest starting at
destOffset.
Parameters dest
Destination buffer
destOffset
src
Source string
max
Return values —
7.0 — • •
Example
char s[6] = "Hallo";
strncpy_off(s, 1, "e", elcount(s)); // s: He
str_replace
CAPL Function Overview » General » str_replace
Function Form 1: Replaces all occurrences of a text in a string with another string.
Parameters s
String to be modified.
searched
startoffset
replacement
length
Return values 1 if successful, 0 if the resulting string would be too long for the buffer s.
7.5 SP2 — • •
Example
char buffer[70] = "Vector Informatik";
str_replace(buffer, "Informatik", "CANoe");
write(buffer);
str_replace(buffer, 7, "CANalyzer", 10);
write(buffer);
str_replace_regex
CAPL Function Overview » General » str_replace_regex
Parameters s
String to be modified.
pattern
Regular expression which determines the parts in s which shall be replaced. For the
regular expression, the same syntax is used as in the Perl programming language.
replacement
Return values 1 if successful, 0 if the resulting string would be too long for the buffer s.
7.5 SP2 — • •
Example
char buffer[70] = "Vector Informatik";
str_replace_regex(buffer, "Inf[a-z]*", "CANoe");
write(buffer);
strstr, strstr_off
CAPL Function Overview » General » strstr, strstr_off
Parameters s1
First string
offset
s2
Second string
7.0 — • •
Example
long pos;
char s1[18] = "Vector Informatik";
char s2[11] = "Informatik";
pos = strstr(s1, s2); // pos = 7
strstr_regex, strstr_regex_off
CAPL Function Overview » General » strstr_regex, strstr_regex_off
Parameters s
String to be searched.
offset
pattern
Regular expression which is searched. For the regular expression, the same syntax is used
as in the Perl programming language.
Return values The position in s where the pattern was found, or -1 if it wasn’t found.
7.5 SP2 — • •
Example
char buffer[70] = "Vector Informatik";
long res;
res = strstr_regex(buffer, "Inf[a-z]*"); // 7
res = strstr_regex_off(buffer, res + 1, "Inf[a-z]*"); // -1
substr_cpy
CAPL Function Overview » General » substr_cpy
Syntax void substr_cpy(char dest[], char src[], long srcStart, long len, long
max);
Function This function copies a substring of src to dest. max indicates the maximum length of src
and dest.
The function ensures that there is a terminating '\0'. Thus, a maximum of max-1-
destOffset characters are copied. Characters are overwritten in dest starting at
destOffset.
Parameters dest
Destination buffer
src
Source string
srcStart
len
max
Return values —
7.0 — • •
Example
char s1[7];
char s2[18] = "Vector Informatik";
substr_cpy(s1, s2, 0, 6, elcount(s1)); // s1: Vector
| strstr |
substr_cpy_off
CAPL Function Overview » General » substr_cpy_off
Function This function copies a substring of src to dest. max indicates the maximum length of src
and dest.
The function ensures that there is a terminating ‘\0’. Thus, a maximum of max-1-
destOffset characters are copied.
Parameters dest
Destination buffer
destOffset
src
Source string
srcStart
len
max
Return values —
7.0 — • •
Example
char s1[9] = "New CAPL";
char s2[18] = "Vector Informatik";
substr_cpy_off(s2, 7, s1, 4, -1, elcount(s2)); // s2: Vector CAPL
| strstr |
Function Swaps bytes of parameters. CAPL arithmetics follows the "little-endian-format" (Intel).
The swap-functions serve for swapping bytes for the transition to and from the "big-
endian-format" (Motorola).
All — • •
Example
bigEndian = swapInt(1234); // create constant 1234 for Motorola processors
sysExec, sysExecCmd
CAPL Function Overview » General » sysExec, sysExecCmd
Function Executes an external command. Does not wait until the command has completed its
execution.
sysExec must be given an executable; sysExecCmd calls cmd.exe /K with the first
parameter, which opens a command window where the command is executed as if it was
entered directly.
Parameters cmd
The command to be executed. Either the full absolute path or a path relative to the
current working directory must be given or the command must be in the system path.
params
Parameters to the command. A parameter which contains spaces must be enclosed in " ".
directory (Form 2)
Working directory for the command. Either an absolute path or a path relative to the
current working directory must be given.
Info
Note that no return value from the command itself is given because the call
does not wait for the command to finish.
7.2 SP3 — • •
Example
char configDir[1024];
getAbsFilePath("", configDir, elcount(configDir));
sysExecCmd("dir", "/O:-D", configDir); // show files in configuration
directory, newest files first
| getAbsFilePath | TestWaitForSyscall |
sysExit
CAPL Function Overview » General » sysExit
Parameters —
Return values —
All — • —
Example
...
sysExit();
...
| sysMinimize |
sysMinimize
CAPL Function Overview » General » sysMinimize
Function The application window of CANoe will be minimized or restored. The first call of the
function minimizes the window, afterwards the window will be restored to normal size
and minimized alternaltly.
Parameters —
Return values —
All — • —
Example
...
sysMinimize();
...
| sysExit |
timeDiff
CAPL Function Overview » General » timeDiff
Function Time difference between messages or between a message and the current time in ms
(msg2 - msg1 or now - msg1). Starting with CANalyzer 2.xx this difference can be
calculated directly (Units of 10 microseconds).
All — • •
Example
diff = timeDiff(m100, now); // CANalyzer 1.x & 2.x
diff = this.time - m100.time; // CANalyzer 2.xx
| timeNow | timeNowFlaot |
timeNow
CAPL Function Overview » General » timeNow
The simulation time can be correlated with the hardware results of the interface cards
(e.g. CANcardXL).
The resolution of this time is dependent upon the hardware used (usually a millisecond or
better).
• will be the same as the message time calculated by the interface cards
(e.g., system with two CAN channels connected to one CANcardXL)
or
Parameters —
All — • •
Example
...
float x;
x = timeNow()/100000.0; //current time in seconds
...
| timeDiff | timeNowFlaot |
timeNowFloat
CAPL Function Overview » General » timeNowFloat
The simulation time can be correlated with the hardware results of the interface cards
(e.g. CANcardXL).
The resolution of this time is dependent upon the hardware used (usually a millisecond or
better).
• will be the same as the message time calculated by the interface cards
(e.g., system with two CAN channels connected to one CANcardXL)
or
Parameters —
All — • •
Example
...
float x;
x = timeNowFloat()/100000.0; //current time in seconds
...
| timeDiff | timeNow |
timeNowNS, timeNowInt64
CAPL Function Overview » General » timeNowNS, timeNowInt64
int64 timeNowInt64();
The simulation time can be correlated with the hardware results of the interface cards
(e.g. CANcardXL).
The resolution of this time is dependent upon the hardware used (usually a millisecond or
better).
• will be the same as the message time calculated by the interface cards
(e.g., system with two CAN channels connected to one CANcardXL)
or
Parameters —
5.0 — • •
Example
timeToElapse
CAPL Function Overview » General » timeToElapse
Method t.timeToElapse();
Function Returns a value indicating how much more time will elapse before an on timer event
procedure is called.
For form 1, the time value is returned in seconds; for form 2, the time value is returned
in milliseconds.
If the timer is not active, -1 is returned. This is also the case in the on timer event
procedure itself.
Return values Time to go until the timer elapses and the event procedure is called.
6.0 — • •
Example
timer t;
setTimer(t, 5);
write("Time to elapse: %d", timeToElapse(t)); // writes 5
toLower
CAPL Function Overview » General » toLower
Function Transforms a character or string to lower case. Only characters a-z and A-Z are
supported.
Parameters c
Character to be transformed.
source
String to be transformed.
dest
bufferSize
7.2 — • •
Example
char buffer[20];
toLower(buffer, "Vector", elcount(buffer)); // buffer contains "vector"
| toUpper |
toUpper
CAPL Function Overview » General » toUpper
Function Transforms a character or string to upper case. Only characters a-z and A-Z are
supported.
Parameters c
Character to be transformed.
source
String to be transformed.
dest
bufferSize
7.2 — • •
Example
char buffer[20];
toUpper(buffer, "Vector", elcount(buffer)); // buffer contains "VECTOR"
| toLower |
traceSetEventColors
CAPL Function Overview » General » traceSetEventColors
Function Sets the text and background color for displaying the message in the Trace window. The
makeRGB function can be used for the colors.
Info
• This function can only be used in measurement setup and is only applied
to the trace window.
• The setting of colors with this function has a higher priority than the
color settings for events in the trace window.
Parameters msg
font
bkgnd
Return values 0: OK
7.0 — • —
Example
on message *
{
traceSetEventColors(this, makeRGB(0x00, 0xFF, 0xFF), makeRGB(0x00, 0x00,
0x00));
output(this);
on message *
{
message * msg;
msg = this;
traceSetEventColors(msg, makeRGB(0x00, 0xFF, 0xFF), makeRGB(0x00, 0x00,
0x00));
output(msg);
}
trigger
CAPL Function Overview » General » trigger
Info
Parameters —
Return values —
All — • •
Example
on message 100 {
write("logging start");
trigger(); // start logging
setTimer(logging,1000); // for 1000 ms
}
on timer logging
{
trigger(); // Stop logging
}
| triggerEx | stop |
triggerEx
CAPL Function Overview » General » triggerEx
If you enter no block name, triggering will be activated/deactivated for all blocks.
Info
Parameters name
Return values —
4.0 — • •
Example
| trigger | stop |
valOfId
CAPL Function Overview » General » valOfId
All — • •
Example
on message *
{
long x;
x = valOfId(this);
write("Received Identifier: %d",x);
output(this);
}
write
CAPL Function Overview » General » write
Function Outputs a text message to the Write window. Write is based on the C function printf.
The compiler cannot check the format string. Illegal format entries will lead to undefined
results. Messages output with the write function will be displayed on separate lines.
e.g. %5.3f means, 5 digits in total (decimal point inclusive) and 3 digits
after the decimal point. 5 is the minimum of digits in this case.
Info
Return values —
2.5 — • •
Examples
float f=123.456;
on key 'h'
{
write("Hello World!");
write("f = %5.3f",f);
write("format is not supported for the given variable");
write("f = %7.3f",f);
write("f = %9.3f",f);
}
on key 'q'
{
qword q = 0x1234567890ABCDEFLL;
write("Decimal: %I64u", q);
write("Hexadecimal: %I64X", q);
}
on key 'd'
{
dword d = 0x1234;
write("Decimal: %u", d);
write("Hexadecimal: %X", d);
}
Forward of a 64 bit data byte message from CAN1 to CAN2. The message should be
forwarded as "qword":
variables
{
qword ringbuffer[100][14];
int a = 0;
}
on message CAN1.TestMessage
{
ringbuffer[a][1] = this.qword[0];
}
TestFunction ()
{
message OutputMessage sendMsg;
sendMsg.dlc=8;
sendMsg.qword(0) = ringbuffer[a][1];
sendMsg.CAN =2;
output(sendMsg);
//write("Output ringbuffer=%I64d",ringbuffer[a][1]);
//write("Output a from ringbuffer=%I64d",a);
}
writeClear
CAPL Function Overview » General » writeClear
Function Clears the contents of the specified page in the Write window.
You can use the following constants for the target identifier or type of message:
// write sinks
DWORD WRITE_SYSTEM = 0;
DWORD WRITE_CAPL = 1;
In addition you can use one of the target identifiers returned by the function writeCreate.
The All page can’t be cleared.
Parameters sink
Return values —
3.2 — • •
Example
writeConfigure
CAPL Function Overview » General » writeConfigure
Syntax void writeConfigure( dword sink, dword lines, dword logging, char
filename[]);
Parameters sink
lines
logging
filename
Return values —
7.6 SP3 — • •
Example
| write |
writeCreate
CAPL Function Overview » General » writeCreate
Function Generates a new page in the Write window with the specified name.
Parameters name
Return values Sink identifier that is valid for output to the new page.
3.2 — • •
Example
writeDbgLevel
CAPL Function Overview » General » writeDbgLevel
Function Outputs a message to the write window with the specified priority. This function can be
used for debugging to vary the output to the write window. This function is especially
useful if nodelayer-DLL’s are used. In this case the debug output can be controlled using a
global priority parameter.
In the simulation tree the priority level can be set for every network node using the
setWriteDbgLevel function.
Parameters priority
format
Return values —
3.0 — — •
Example
int i = 10;
int j = 12;
setWriteDbgLevel(7);
writeDbgLevel (4, "This is shown: h= %lxh",j);
// Output: This is shown: h= 0ch
writeDbgLevel (9, "This is not shown: d= %ld",i);
// No output
writeDestroy
CAPL Function Overview » General » writeDestroy
Function Removes the specified page from the Write window. Only pages that have been created
with the aid of the writeCreate function can be removed.
Parameters sink
Return values —
3.2 — • •
Example
writeEx
CAPL Function Overview » General » writeEx
Function Writes the text into the last line of the specified window, into a tab of the Write window
or into a logging file without previously creating a new line.
Parameters sink
Sink identifier of the page to which the output will take place.
Values:
-3 Trace window
-2 Output to the logging file (only in ASC format and if the CAPL node is inserted in
the measurement setup in front of the logging block)
-1 Reserved
severity
Values:
0 Success
1 Information
2 Warning
3 Error
The parameter severity has no meaning for output to the Trace window.
format
Return values —
3.2 — • •
Example
writeLineEX
CAPL Function Overview » General » writeLineEX
Function Writes the text into a new line of the specified window, into a tab of the Write window or
into a logging file.
Parameters sink
The target identifier of the page to which the output will take place.
Values:
-3 Trace window
-2 Output to the logging file (only in ASC format and if the CAPL node is inserted in
the measurement setup in front of the logging block)
-1 Reserved
severity
Values:
0 Success
1 Information
2 Warning
3 Error
The parameter severity has no meaning for output to the Trace window.
For output to a logging file, this parameter specifies whether comments should be output
(severity == 0).
If this is not desired, set severity = 1.
format
Return values —
3.2 — • •
Example
writeProfileInt
CAPL Function Overview » General » writeProfileInt
Note
Before this function can be called the write path must be set by the function
setWritePath. Otherwise the configuration directory will be used. A relative file name
must be passed to the function.
Function Opens the file filename, searches the section section and writes the variable entry with
the value value. If entry already exists the old value is overwritten.
Parameters section
entry
value
Value as a integer.
filename
3.0 — • •
Example
writeProfileFloat
CAPL Function Overview » General » writeProfileFloat
Note
Before this function can be called the write path must be set by the function
setWritePath. Otherwise the configuration directory will be used. A relative file name
must be passed to the function.
Function Opens the file filename, searches the section section and writes the variable entry with
the value value. If entry already exists the old value is overwritten.
Parameters section
entry
value
Value as a float.
filename
3.0 — • •
Example
writeProfileString
CAPL Function Overview » General » writeProfileString
Note
Before this function can be called the write path must be set by the function
setWritePath. Otherwise the configuration directory will be used. A relative file name
must be passed to the function.
Function Opens the file filename, searches the section section and writes the variable entry with
the value value. If entry already exists the old value is overwritten. The functional result
is the number of characters written or 0 in case of an error.
Parameters section
entry
value
Value as a string.
filename
3.0 — • •
Example
writeTextBkgColor
CAPL Function Overview » General » writeTextBkgColor
Function Sets the color for text background of the specified page in the Write window.
You can use the following constants for the target identifier:
// write sinks
DWORD WRITE_SYSTEM = 0;
DWORD WRITE_CAPL = 1;
In addition you can use one of the target identifiers returned by the function
writeCreate.
The color settings have also an effect on the All tab of the Write window.
Parameters sink
The target identifier of the page on which the color settings should have an effect.
red
green
blue
Return values —
5.0 — • •
Example
WriteTextColor(0,255,0,0);
WriteLineEx(0,1,"This is red text");
WriteTextBkgColor(0,0,255,0);
WriteLineEx(0,1,"This is red text with green background");
WriteTextColor(0,0,0,0);
WriteTextBkgColor(0,255,255,255);
WriteLineEx(0,1,"This is black text with white background");
writeTextColor
CAPL Function Overview » General » writeTextColor
Function Sets the color for text of the specified page in the Write window.
You can use the following constants for the target identifier:
// write sinks
DWORD WRITE_SYSTEM = 0;
DWORD WRITE_CAPL = 1;
In addition you can use one of the target identifiers returned by the function writeCreate.
The color settings have also an effect on the All tab of the Write window.
Parameters sink
The target identifier of the page on which the color settings should have an effect.
red
green
blue
Return values —
5.0 — • •
Example
WriteTextColor(0,255,0,0);
WriteLineEx(0,1,"This is red text");
WriteTextBkgColor(0,0,255,0);
WriteLineEx(0,1,"This is red text with green background");
WriteTextColor(0,0,0,0);
WriteTextBkgColor(0,255,255,255);
WriteLineEx(0,1,"This is black text with white background");
writeToLog
CAPL Function Overview » General » writeToLog
Function Writes an output string to an ASCII logging file. Write is based on the C function printf.
The compiler cannot check the format string. Illegal format entries will lead to undefined
results. Different to the writeToLogEx function, comment characters ("//") and a
timestamp at the beginning of each line will be printed.
Return values —
All — • •
Example
void MarkLogFile(int marker) {
// marks line of ASCII logging file with an integer
writeToLog("===> %d",marker);
}
writeToLogEx
CAPL Function Overview » General » writeToLogEx
Function Writes an output string to an ASCII logging file. Write is based on the C function printf.
The compiler cannot check the format string. Illegal format entries will lead to undefined
results. Different to the writeToLog function, neither comment characters ("//") nor
timestamps will be printed at the beginning of a line.
Return values —
All — • •
Example
// write marker with current date and time to logging file
void MarkLogFileWithTimeString(void)
{
char timeBuffer[64];
getLocalTimeString(timeBuffer);
writeToLogEx("===> %s",timeBuffer);
}
xlAcquireLED
CAPL Function Overview » General » xlAcquireLED
Function Acquires the specified LEDs of a hardware device in order to set their operation mode
with xlSetLED afterwards.
This function is supported by the following device: VN8900 (driver version > 7.5)
Note that for every successful call of xlAcquireLED on a specific LED, you have to call
xlReleaseLED to release this LED again.
Parameters ledBitMask
Keypad S1 0x200
Keypad S2 0x400
!= 0: error, function failed. Check whether your device supports this function and you
have an appropriate driver installed on the device.
7.2 SP6 — — •
Example
At measurement start three LEDs are acquired, two LEDs are set to condition "orange
glowing", and one is set to the condition "orange flashing". At measurement stop the LEDs
should be released.
/*@@var:*/
variables
{
// constants for LED access
dword status;
}
/*@@end*/
/*@@startStart:Start:*/
on start
{
status = xlAcquireLED(kLedMaskC1 | kLedMaskC2 | kLedMaskC3);
if( 0 == status)
{
xlSetLed(kLedMaskC1 | kLedMaskC2, kLedOrangeOn);
xlSetLed(kLedMaskC3, kLedOrangeBlinking);
}
}
/*@@end*/
/*@@stop:StopMeasurement:*/
on stopMeasurement
{
if( 0 == status)
{
xlReleaseLED(kLedMaskC1 | kLedMaskC2 | kLedMaskC3);
}
}
/*@@end*/
xlReleaseLED
CAPL Function Overview » General » xlReleaseLED
Function Releases the specified LEDs after they were successfully acquired with a call of
xlAcquireLED.
This function is supported by the following device: VN8900 (driver version > 7.5)
Parameters ledBitMask
Keypad S1 0x200
Keypad S2 0x400
!= 0: error, function failed. Check whether your device supports this function and you
have an appropriate driver installed on the device.
7.2 SP6 — — •
Example
See xlAcquireLED
xlSetLED
CAPL Function Overview » General » xlSetLED
Function Sets the LEDs specified by ledBitMask to the operation mode specified by ledMode. A
successful call of xlAcquireLED is necessary before the operation mode of an LED can be
set with this function.
This function is supported by the following device: VN8900 (driver version > 7.5)
Note that for every successful call of xlAcquireLED on a specific LED, you have to call
xlReleaseLED to release this LED again.
Parameters ledBitMask
The LEDs you want to set. You can bitwise combine the values to specify multiple LEDs.
Keypad S1 0x200
Keypad S2 0x400
ledMode
The operation mode which shall be valid for the specified LEDs. The operation modes are
mutually exclusive and only one LED can be in one operation mode.
No Change 0x00000000
Info
For the LEDs S1 and S2 only the No Change, LED Off and LED On Green
operation modes are valid.
!= 0: error, function failed. Check whether your device supports this function and you
have an appropriate driver installed on the device.
7.2 SP6 — — •
Example
See xlAcquireLED
clear
CAPL Function Overview » Associative Fields » clear
Method m.clear();
Parameters —
Return values —
Complexity O(log(N) + N)
7.0 SP5 — • •
Example
m.clear();
containsKey
CAPL Function Overview » Associative Fields » containsKey
Method m.containsKey(key)
Parameters key
Complexity O(log(N))
7.0 SP5 — • •
Example
if (m.containsKey(3)) { // …
remove
CAPL Function Overview » Associative Fields » remove
Method m.remove(key)
Parameters key
Complexity O(log(N))
7.0 SP5 — • •
Example
Text
m.remove(3);
size
CAPL Function Overview » Associative Fields » size
Method m.size()
Parameters —
Complexity O(1)
7.0 SP5 — • •
Example
if (m.size() == 0) write("Map is empty!");
Info
Former releases (before 7.1) offered an 'old' API that has been extended. The support of the 'old'
API is continued but the functions are marked as obsolete.
RS232OnSend Handler will be called after completion of request issued with RS232Send.
RS232OnReceive Handler will be called regularly if data has been received at port. Starts with
RS232Receive.
General Usage
First, open a port, then transmit and receive data, then close it.
Example
byte data[2];
int length = 2;
data[0] = 1;
data[1] = 2;
if ( 1==RS232Open(1) ) write(“Port 1 has been opened.”);
if ( 1==RS232Send(1,data,length) ) write(“Send bytes to port 1.”);
if ( 1==RS232Close(1) ) write(“Port 1 has been closed.”);
INI files called v24.ini or rs232.ini can be used to configure ports. Though, it is not advised to do so. It
is much clearer to set parameters directly by use of RS232Configure. The configuration files have to be
inserted into the CANoeExec32 directory.
Section Description
[COMsettings] General section the key-value pairs of which apply to all ports used.
Info
[COMsettings_COM1] Specific section the key-value pairs of which apply to one port specified (COM1).
...
[COMsettings_COM255] Specific section the key-value pairs of which apply to one port specified
(COM255).
[Queue-Sizes] General section to give (serial port) driver queue sizes which will be used as
recommendation by the driver. Applies to all ports.
Info
[Queue-Sizes_COM1] Specific section to give (serial port) driver queue sizes which will be used as
recommendation by the driver. Applies to one port (COM1).
...
[Queue-Sizes_COM255] Specific section to give (serial port) driver queue sizes which will be used as
recommendation by the driver. Applies to one port (COM255).
[COMsettings] Baud The symbol rate to use for reception and transmission.
as well as
[COMsettings_COMx]
with x a number
[COMsettings] StopBits A code which sets the number of stop bits within a
as well as transmission frame.
[COMsettings_COMx]
with x a number 0 1 stop bit is used;
between 1 and 255 it is the typical and most reasonable value
1 1.5 stop bits are used
2 2 stop bits are used
[COMsettings] Parity A code which identifies the parity mode to use.
as well as
[COMsettings_COMx] 0 no parity used, i.e. frame contains no parity bit
with x a number
between 1 and 255 1 odd parity
2 even parity
[Queue-Sizes] QueueSize_Rx The size of the receiver buffer of the driver. The size is
as well as given in bytes. The range of numbers and the
[Queue-Sizes _COMx] constraints (e.g. dividable by 8) are dependent on the
with x a number driver. The number will be used as recommendation by
between 1 and 255 the driver.
Info
[Queue-Sizes] QueueSize_Tx The size of the transmission buffer of the driver. The
as well as size is given in bytes. The range of numbers and the
[Queue-Sizes _COMx] constraints (e.g. dividable by 8) are dependent on the
with x a number driver. The number will be used as recommendation by
between 1 and 255 the driver.
Info
Example
; THIS FILE IS DEPRECATED
; it is better to program the serial interface by means of CAPL
; standard section, settings used for ALL ports
; can be overwritten by a prot specific section
; settings can be controlled directly by CAPL functions
[COMsettings]
; "COMport" opens "shared" ports the results of which will be given
; to all listening nodes (nodes implementing a callback)
; e.g. "COMport=2;3 ;5" means to open COM2, COM3 and COM5 as shared port
; note: the former limitation that only ports listed for "COMport" could be used
; within CAPL has been removed
COMport=1
[COMsettings_COM1]
; "UseCOMspecificSettings" needs to be set to really enable usage of
; specific section
; possible values: 0 or 1
UseCOMspecificSettings=1
; following values overwrite the values out of the general section for COM1
; if and only if "UseCOMspecificSettings=1" holds true
Baud=115200
ByteSize=8
StopBits=0
Parity=0
RS232Close
CAPL Function Overview » RS232 » RS232Close
The serial port will be closed for all nodes. One and the same port may be closed by
several nodes (or repetitively). After closure other programs may use the serial port.
After closing the serial port the configuration of the port is lost. The next time the port is
opened it will be configured with the system default.
Parameters port
The error occurs if the serial port with the given number does not exist on the system.
1: success
7.1 — — •
Example
if ( 1==RS232Close(1) ) write(“It works with port 1.”);
RS232Configure
CAPL Function Overview » RS232 » RS232Configure
If a deprecated INI file exists, then the data of the INI file will be used.
Parameters port
baudrate
Typically, 9600 is used. There is a list of possible values which depends on the serial port.
Normally, 115.200 is the allowed maximum.
numberOfDataBits
8 is used at most. Only values between 5 and 8 are possible. Not all values and not all
combinations with other frame parameters may be supported by the serial port.
numberOfStopBits
A code which sets the number of stop bits within a transmission frame.
Info
parity
1 odd parity
2 even parity
• the serial port with the given number does not exist on the system
• the port has not been opened
1: success
7.1 — — •
Example
if ( 0!=RS232Configure(1,9600,8,1,0) )
write(“Set typical default at port 1.”);
RS232OnError
CAPL Function Overview » RS232 » RS232OnError
Info
For repetitive errors (stable error condition) just the first one is returned.
That case may happen for reception errors above all, i.e. at configuration
mismatches of both connected ends.
Parameters port
errorFlags
Cumulative summary of what went wrong. Bits are set to flag conditions.
Bit Error
2 Frame error. May be caused by parity mismatch or any other frame mismatch
(e.g. number of stop bits).
4 Buffer overrun. It is not specified if the driver of the sender cannot send fast
enough, if it is up to the receiver which got too much data in too short time or
anything else.
7 Timeout. May be caused by wrongly set too short timeout. See RS232SetHandshake
for setting the timeout.
Info
Several error bits may be set at the same time. Some error flags are up to the
driver manufacturer what they mean and when they are issued.
Return values —
7.1 — — •
Example
RS232OnError(dword port, dword errorFlags)
{
if ( errorFlags & 1 )
writeLineEx(0,3,“send failed”);
if ( errorFlags & 2 )
writeLineEx(0,3,“receive failed”);
}
RS232OnReceive
CAPL Function Overview » RS232 » RS232OnReceive
Info
Will be called only at the nodes which issued a RS232Receive operation for
the given port.
The handler will only be called for success. For errors RS232OnError will be
called.
The buffer may be much larger than number. For very slow connections, the
handler may get called for few bytes. At least one byte is given.
It is possible to listen to one and the same port at several nodes. All nodes
will be called with the same data.
Parameters port
buffer
number
Info
The number of received bytes will vary strongly with the speed of the
connection.
1: success
7.1 — — •
Example
// at sender node
char text[20] = “Hello World !”;
byte block[20];
int i;
int length;
length=strlen(text)+1;
for (i=0;i<length;i++) block[i]=text[i];
if ( 0!=RS232Send(1,block,length) )
write(“Written block of bytes to port 1.”);
...
// at receiver node (here 2)
byte mybuffer[100];
int mysize = 100;
RS232Receive(2,mybuffer,mysize);
...
// at node which issued the receive request
RS232OnReceive(dword port, byte buffer[], dword number)
{
// port==2 here
// buffer==mybuffer, number<=mysize
// buffer contains some parts of block
}
RS232OnSend
CAPL Function Overview » RS232 » RS232OnSend
Info
Will be called only at the node which issued the send operation.
The handler will only be called for success. For errors RS232OnError will be
called.
Parameters port
buffer
number
1: success
7.1 — — •
Example
char text[20] = “Hello World !”;
byte block[20];
int i;
int length;
length=strlen(text)+1;
for (i=0;i<length;i++) block[i]=text[i];
if ( 0!=RS232Send(1,block,length) )
write(“Written block of bytes to port 1.”);
...
// at node which issued the send request
RS232OnSend(dword port, byte buffer[], dword number)
{
// send completed now, it may time to issue the next send
// buffer==block, number==length
}
RS232Open
CAPL Function Overview » RS232 » RS232Open
Info
The serial port is available on exactly the node which executed the CAPL
code. One and the same port may be opened by several nodes. If the port has
been opened, other programs cannot access the serial port any more.
Parameters port
• the serial port with the given number does not exist on the system
• another program uses the serial port according to the port number
1: success
7.1 — — •
Example
if ( 1==RS232Open(1) ) write(“It works with port 1.”);
RS232Receive
CAPL Function Overview » RS232 » RS232Receive
Parameters port
buffer
An array of bytes.
size
• the serial port with the given number does not exist on the system
• the port has not been opened
To get informed about errors occurring in later stages of the operation use RS232OnError.
1: success
Success means here, that the receive operation could be started properly.
7.1 — — •
Example
byte mybuffer[20];
int mysize=20;
if ( 1==RS232Receive(1,mybuffer,mysize) )
write(“It works with port 1.”);
...
RS232OnReceive( dword port, dword buffer[], dword number )
{
// works after first RS232Receive !
// buffer == mybuffer, 1<number<=mysize
RS232Send
CAPL Function Overview » RS232 » RS232Send
Parameters port
buffer
number
• the serial port with the given number does not exist on the system
• the port has not been opened
• another non-blocking send operation (this one, RS232WriteByte or RS232WriteBlock
made by non-blocking CAN.INI switch) has been used shortly before, then the
previous send operation may not have finished which leads to an error. Use the
RS232OnSend callback handler to synchronize operations.
To get informed about errors occurring in later stages of the operation use RS232OnError.
1: success
The operation may fail in later stages. Success means here, that the send operation could
be started properly.
7.1 — — •
Example
char text[20] = “Hello World !”;
byte buffer[20];
int i;
int length;
length=strlen(text)+1;
for (i=0;i<length;i++) buffer[i]=text[i];
if ( 1==RS232Send(1,buffer,length) )
write(“It works with port 1.”);
RS232SetHandshake
CAPL Function Overview » RS232 » RS232SetHandshake
Note
Syntax Obsolete
dword RS232SetHandshake( dword port, dword handshake, dword XonLimit, dword
XoffLimit, dword XonChar, dword XoffChar, dword timeout )
Info
If you use hardware handshake, then the functions which change signal lines
directly (RS232SetSignalLine, RS232EscapeCommFunc, RS232EscapeCommExt)
may conflict with the automatic handshaking.
Parameters port
handshake
0 no handshake at all
Info
For sake of compatibility, it is possible to set signal lines to fixed levels with
this function. Please prefer for that purpose RS232SetSignalLine.
XonLimit
Parameter for software flow control. It specifies a limit after which flow control shall
become active (send XonChar). It relates to the receiver buffer (of the driver) and defines
the buffer level in bytes for starting transfer requests.
XoffLimit
Parameter for software flow control. It specifies a limit after which flow control shall
become active (send XoffChar). It relates to the receiver buffer (of the driver) and
defines the level margin from the buffer size for starting hold requests.
Info
It may lead to errors if XonLimit and XoffLimit are not set properly.
Both ranges may overlap so that Xon and Xoff would be signalled at the same
time.
XonChar
Parameter for software flow control. It the symbol sent to signalize start of operations
(for reception as well as transmission).
XoffChar
Parameter for software flow control. It the symbol sent to signalize start of operations
(for reception as well as transmission).
Info
Neither XonChar nor XoffChar should ever be found in the received data (if
software flow control is used). The symbols will be removed by the lower
layers.
timeout
-1 infinite
If this parameter isn't set, the timeout default value will be used: 5 sec.
Info
It should not be used at all since it may lead to errors. E.g. it is possible to
set up a slow connection and transmit much data (some kilobytes) as a block.
Then, the send block operation will time out.
• the serial port with the given number does not exist on the system
• the port has not been opened
1: success
7.1 — — •
Example
if ( 0!=RS232SetHandshake(1,0,0,0,0,0) )
write(“No handshake at port 1.”);
RS232SetSignalLine
CAPL Function Overview » RS232 » RS232SetSignalLine
Info
If you use hardware handshake, then this function may conflict with the
automatic handshaking.
Parameters port
line
0 RTS
1 DTR
state
0 disabled
1 enabled
• the serial port with the given number does not exist on the system
• the port has not been opened
1: success
7.1 — — •
Example
getSignalTime Gets the time point relative to the measurement start at which the
signal was last sent on the bus.
RegisterSignalDriver Registers the given callback as a 'signal driver' for the signal.
testValidateSignalOutsideRange
CheckSignalMatch Checks a given value against the value of the signal, the system variable
or the environment variable.
TestValidateSignalMatch
memcpy_h2n Copies the bytes from the struct into the array.
memcpy_off Copies bytes from a source to destination, giving a destination start offset.
memcmp
CAPL Function Overview » Struct Byte Access » memcmp
Function Compares the bytes of the parameters. In form 3, both structs must have the same type.
Parameters s
A struct
buffer
A byte-array
Another struct
Return values 0 if the bytes are equal; a value different from 0 if they are unequal
7.0 SP3 — • •
Example
byte data[4];
struct WrapDword
{
dword dw;
} dwordWrapper;
int i;
for (i = 0; i < elcount(data); ++i)
data[i] = i;
dwordWrapper.dw = 0x03020100;
if (memcmp(dwordWrapper, data) == 0)
write("Data represents the number: Little Endian is used.");
memcpy
CAPL Function Overview » Struct Byte Access » memcpy
Function Copies bytes from a source to a destination. In form 5, both structs must have the same
type. In other forms with structs, the arrays must be large enough to contain the struct
data.
Parameters source
dest
offset
(form 2, 4, 7): Offset in the array which marks the start of the data.
length
Return values —
7.0 SP3 — • •
Example
byte data[4];
struct WrapDword
{
dword dw;
} dwordWrapper;
int i;
for (i = 0; i < elcount(data); ++i)
data[i] = i;
memcpy(dwordWrapper, data);
write("Bytes as dword: %0#10lx", dwordWrapper.dw);
dwordWrapper.dw = 0x12345678;
memcpy(data, dwordWrapper);
write("Dword as bytes: %#lx %#lx %#lx %#lx", data[0], data[1], data[2],
data[3]);
memcpy_h2n
CAPL Function Overview » Struct Byte Access » memcpy_h2n
Function Copies the bytes from the struct into the array, and translates the byte order of the
elements from little-endian to big-endian (h2n stands for "host to network").
Parameters source
dest
offset (form 2)
Return values —
7.0 SP3 — • •
Example
byte data[4];
struct WrapDword
{
dword dw;
} dwordWrapper;
int i;
for (i = 0; i < elcount(data); ++i)
data[i] = i;
memcpy_n2h(dwordWrapper, data);
write("Bytes as dword: %0#10lx", dwordWrapper.dw);
dwordWrapper.dw = 0x12345678;
memcpy_h2n(data, dwordWrapper);
write("Dword as bytes: %#lx %#lx %#lx %#lx", data[0], data[1], data[2],
data[3]);
memcpy_n2h
CAPL Function Overview » Struct Byte Access » memcpy_n2h
Function Fills the struct with bytes from the array, and translates the byte order of the elements
from big-endian to little-endian (n2h stands for "network to host").
Parameters source
dest
offset (form 2)
Return values —
7.0 SP3 — • •
Example
memcpy_off
CAPL Function Overview » Struct Byte Access » memcpy_off
Syntax void memcpy_off( struct type dest, dword destOffset, byte source[], dword
sourceOffset, dword length); // form 1
void memcpy_off( struct type dest, dword destOffset, char source[], dword
sourceOffset, dword length); // form 2
void memcpy_off( byte dest[], dword destOffset, struct type source, dword
sourceOffset, dword length); // form 3
void memcpy_off( char dest[], dword destOffset, struct type source, dword
sourceOffset, dword length); // form 4
Function Copies bytes from a source to destination, giving a destination start offset. The size of the
destination must be at least destOffset + length.
Parameters dest
source
destOffset
sourceOffset
length
Return values —
7.2 — • •
Example
SysGetOrigTimeNS Returns the original time stamp of the last update to the variable value.
SysGetVariableTimeNS Returns the time stamp of the last update to the variable value.
sysSetAnalysisOnlyVariable Defines whether the variable shall be used only in the analysis part of
CANoe.
SysDefineNamespace
CAPL Function Overview » System Variables » SysDefineNamespace
Parameters namespace
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2 — — •
Example
SysDefineVariableData
CAPL Function Overview » System Variables » SysDefineVariableData
Parameters namespace
variable
initialData
initialSize
Initial size (in bytes) of the variable. Must not exceed the length of the initialData array.
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
7.6 — — •
Example
SysDefineVariableFloat
CAPL Function Overview » System Variables » SysDefineVariableFloat
Info
Variables defined with this function can only be accessed using the
sysGetVariable.../sysSetVariable... functions where namespace and variable name
are given as string parameters.
Parameters namespace
variable
initialValue
minimum
maximum
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2 — — •
7.2: form 2 — — •
Example
SysDefineVariableFloatArray
CAPL Function Overview » System Variables » SysDefineVariableFloatArray
Info
Variables defined with this function can only be accessed using the
sysGetVariable.../sysSetVariable... functions where namespace and variable name
are given as string parameters.
Parameters namespace
variable
initialValue
arraySize
minimum
maximum
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2 — — •
7.2: form 2 — — •
Example
SysDefineVariableInt
CAPL Function Overview » System Variables » SysDefineVariableInt
Info
Variables defined with this function can only be accessed using the
sysGetVariable.../sysSetVariable... functions where namespace and variable name
are given as string parameters.
Parameters namespace
variable
initialValue
minimum
maximum
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5,2 — — •
7.2: form 2 — — •
Example
SysDefineVariableIntArray
CAPL Function Overview » System Variables » SysDefineVariableIntArray
Info
Variables defined with this function can only be accessed using the
sysGetVariable.../sysSetVariable... functions where namespace and variable name
are given as string parameters.
Parameters namespace
variable
initialValue
arraySize
minimum
maximum
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2 — — •
7.2: form 2 — — •
Example
SysDefineVariableString
CAPL Function Overview » System Variables » SysDefineVariableString
Info
Variables defined with this function can only be accessed using the
sysGetVariable.../sysSetVariable... functions where namespace and variable name
are given as string parameters.
Parameters namespace
variable
initialValue
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2 — — •
Example
SysGetOrigTimeNS
CAPL Function Overview » System Variables » SysGetOrigTimeNS
Function Returns the original time stamp of the last update to the variable value, before time
synchronization may have changed it.
Parameters SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::".
Return values Original time stamp of the last update to the variable value in nanoseconds since
measurement start.
7.2 — • •
Example
int64 timeStamp;
timeStamp = SysGetOrigTimeNS(sysvar::MyNamespace::FloatVar);
| SysGetVariableTimeNS |
sysGetVariableArrayLength
CAPL Function Overview » System Variables » sysGetVariableArrayLength
Info
Parameters namespace
variable
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::".
Return values For system variables of type data, returns the current size (in bytes) of the value.
For system variables of type long or float array, returns the number of elements in the
array.
For system variables of type string, returns the length of the string, excluding the
terminating 0 character.
Example
// calculate the norm of a vector
dword length, i;
double element, sum, norm;
sum = 0.0;
length = SysGetVariableArrayLength(sysvar::MyVariables::MyVector);
for (i = 0; i < length; ++i)
{
element = @sysvar::MyVariables::MyVector[i];
sum += element * element;
}
norm = sqrt(sum);
SysGetVariableData
CAPL Function Overview » System Variables » SysGetVariableData
Parameters namespace
variable
buffer
copiedBytes
Receives the number of bytes which were copied into the buffer. If the buffer is too
small, no bytes will be copied; else the parameter will contain the current size of the
variable.
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::".
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
7.6: form 1 — — •
7.6: form 2 — • •
Example
SysGetVariableFloat
CAPL Function Overview » System Variables » SysGetVariableFloat
Parameters namespace
variable
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
5.1/5.2: form 1 — — •
7.0: form 2 — • •
Example
SysGetVariableFloat(sysvar::MyNamespace::FloatVar);
SysGetVariableFloatArray
CAPL Function Overview » System Variables » SysGetVariableFloatArray
If the actual array size of the system variable is larger than the array size given as
parameter, all elements in the values array up to the array size given as parameter will
receive the current values of the system variable. Elements in the values array beyond
the array size given as parameter will remain unchanged.
If the actual array size of the system variable is smaller than the array size given as
parameter, additional elements in the values array will be set to 0. Elements in the
values array beyond the array size given as parameter will remain unchanged.
Never give as parameter an array size which is larger than real size of the values array,
this would lead to unpredictable behavior.
Info
Parameters namespace
variable
values
arraySize
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2 — — •
7.0: form 2 — • •
Example
float fVarArr[10]; // array size should match the size of the system
variable
...
SysGetVariableFloatArray(sysvar::MyNamespace::FloatArrayVar, fVarArr,
elcount(fVarArr));
SysGetVariableInt
CAPL Function Overview » System Variables » SysGetVariableInt
Parameters namespace
variable
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
5.1/5.2 — — •
7.0: form 2 — • •
Example
SysGetVariableInt(sysvar::MyNamespace::IntVar);
SysGetVariableLongArray
CAPL Function Overview » System Variables » SysGetVariableLongArray
If the actual array size of the system variable is larger than the array size given as
parameter, all elements in the values array up to the array size given as parameter will
receive the current values of the system variable. Elements in the values array beyond
the array size given as parameter will remain unchanged.
If the actual array size of the system variable is smaller than the array size given as
parameter, additional elements in the values array will be set to 0. Elements in the
values array beyond the array size given as parameter will remain unchanged.
Never give as parameter an array size which is larger than real size of the values array,
this would lead to unpredictable behavior.
Info
Parameters namespace
variable
values
arraySize
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
7.0 SP3 — — •
Example
long lVarArr[10]; // array size should match the size of the system
variable
...
SysGetVariableLongArray(sysvar::MyNamespace::LongArrayVar, lVarArr,
elcount(lVarArr));
SysGetVariableMax
CAPL Function Overview » System Variables » SysGetVariableMax
Parameters SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::".
The name must be preceded by "sysVar::". (form 1 and 2)
namespace
variable
maximum
Receives the maximum of the variable if no errors occur (reference parameter). Must be
the correct type for the system variable.
7.2 — • •
Example
SysGetVariableMin
CAPL Function Overview » System Variables » SysGetVariableMin
Parameters SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::".
The name must be preceded by "sysVar::". (form 1 and 2)
namespace
variable
minimum
Receives the minimum of the variable if no errors occur (reference parameter). Must be
the correct type for the system variable.
7.2 — • •
Example
SysGetVariableString
CAPL Function Overview » System Variables » SysGetVariableString
Info
Parameters namespace
variable
buffer
bufferSize
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2: form 1 — — •
7.0: form 2 — • •
Example
SysGetVariableString(sysvar::MyNamespace::StringVar, buf, elcount(buf));
SysGetVariableTimeNS
CAPL Function Overview » System Variables » SysGetVariableTimeNS
Function Returns the time stamp of the last update to the variable value.
Parameters SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::".
The name must be preceded by "sysVar::".
Return values Time stamp of the last update to the variable value, in nanoseconds since measurement
start.
7.1 SP4 — • •
Example
int64 timeStamp;
timeStamp = SysGetVariableTimeNS(sysvar::MyNamespace::FloatVar);
SysSetAnalysisOnlyVariable
CAPL Function Overview » System Variables » SysSetAnalysisOnlyVariable
Function Determines whether the variable is meant to be used for analysis purposes.
If this is true (anlyzLocal is set to 1), and the variable is changed in a CAPL program in the
Measurement setup, the value change is not transmitted to the real time part of CANoe,
but used immediately in the analysis part. This is the default.
If it is false (anlyzLocal is set to 0), value changes are always transmitted to the real time
part.
Parameters anlyzLocal
Defines whether the variable shall be used only in the analysis part of CANoe.
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::".
Return values —
7.0 — • —
Example
SysSetAnalysisOnlyVariable(sysvar::MyNamespace::StringVar, 1);
SysSetVariableData
CAPL Function Overview » System Variables » SysSetVariableData
Parameters namespace
variable
data
size
New size for the variable. Must not exceed the length of the data array.
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::".
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
7.6: form 1 — — •
7.6: form 2 — • •
Example
SysSetVariableFloat
CAPL Function Overview » System Variables » SysSetVariableFloat
Parameters namespace
variable
value
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2: form 1 — — •
7.0: form 2 — • •
Example
float fVar;
...
SysSetVariableFloat(sysvar::MyNamespace::FloatVar, fVar);
SysSetVariableFloatArray
CAPL Function Overview » System Variables » SysSetVariableFloatArray
The call will only succeed if the array size given as parameter is equal to the actual array
size of the system variable (you cannot change that size dynamically). The current values
of the system variable will then be set to the elements in the values array in the range
from 0 to arraySize.
Never give as parameter an array size which is larger than real size of the values array,
this would lead to unpredictable behavior.
Info
Parameters namespace
variable
values
arraySize
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2: form 1 — — •
7.0: form 2 — • •
Example
float fVarArr[10];
...
SysSetVariableFloatArray(sysvar::MyNamespace::FloatArrayVar, fVarArr,
elcount(fVarArr));
SysSetVariableInt
CAPL Function Overview » System Variables » SysSetVariableInt
Parameters namespace
variable
value
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2: form 1 — — •
7.0: form 2 — • •
Example
long lVar;
...
SysSetVariableInt(sysvar::MyNamespace::IntVar, lVar);
SysSetVariableLongArray
CAPL Function Overview » System Variables » SysSetVariableLongArray
The call will only succeed if the array size given as parameter is equal to the actual array
size of the system variable (you cannot change that size dynamically). The current values
of the system variable will then be set to the elements in the values array in the range
from 0 to arraySize.
Never give as parameter an array size which is larger than real size of the values array,
this would lead to unpredictable behavior.
Info
Parameters namespace
variable
values
arraySize
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
Example
long lVarArr[10];
...
SysSetVariableLongArray(sysvar::MyNamespace::LongArrayVar, lVarArr,
elcount(lVarArr));
SysSetVariableString
CAPL Function Overview » System Variables » SysSetVariableString
Info
Parameters namespace
variable
value
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2: form 1 — — •
7.0: form 2 — • •
Example
SysSetVariableString(sysvar::MyNamespace::StringVar, "Vector");
SysUndefineNamespace
CAPL Function Overview » System Variables » SysUndefineNamespace
Function Deletes a name space. Also all variables in this name space are automatically deleted.
Parameters namespace
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2 — — •
Example
SysUndefineVariable
CAPL Function Overview » System Variables » SysUndefineVariable
Parameters namespace
variable
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1/5.2 — — •
Example
TCP/IP API
CAPL Function Overview » TCP/IP API
The CAPL Socket API provides access to TCP/IP networking features. It is implemented on top of the
native Winsock 2 API of the Windows operating system. The API falls into the following three categories:
IP API
The IP API consists of general functions for network information retrieval such as the querying for installed
network interface cards (NIC), IP addresses, address conversion functions, error handling and so on. In
addition, the IP API has some special functions for socket manipulations such as setting socket options or
binding.
UDP API
The UDP API is used for UDP communications. It provides a high level interface for implementing
connectionless, datagram-oriented communications.
TCP API
The TCP API is used for TCP connections. It provides a high level interface for implementing connection-
based, message-oriented communications.
For your convenience, the Winsock 2 Error Codes are re-printed from the MSDN Online-Library:
10013 An attempt was made to access a socket in a way forbidden by its access
permissions. An example is using a broadcast address for sendto without
broadcast permission being set using setsockopt(SO_BROADCAST).
Another possible reason for the WSAEAC-CES error is that when the bind
function is called (on Windows NT 4 SP4 or later), an-other application,
service, or kernel mode driver is bound to the same address with exclusive
access. Such exclusive access is a new feature of Windows NT 4 SP4 and
later, and is implemented by using the SO_EXCLUSIVEADDRUSE option..
10022 Some invalid argument was supplied (for ex-ample, specifying an invalid
level to the setsockopt function). In some instances, it also refers to the
current state of the socket—for in-stance, calling accept on a socket that is
not listening.
10024 Too many open sockets. Each implementation may have a maximum
number of socket handles available, either globally, per process, or per
thread.
10035 This error is returned from operations on non-blocking sockets that cannot
be completed immediately, for example recv when no data is queued to be
read from the socket. It is a nonfatal error, and the operation should be
retried later. It is normal for WSAEWOULDBLOCK to be reported as the
result from calling connect on a non-blocking SOCK_STREAM socket, since
some time must elapse for the connection to be established.
10038 An operation was attempted on something that is not a socket. Either the
socket handle parameter did not reference a valid socket, or for select, a
member of an fd_set was not valid.
10040 A message sent on a datagram socket was larger than the internal message
buffer or some other network limit, or the buffer used to receive a
datagram was smaller than the datagram itself.
10041 A protocol was specified in the socket function call that does not support
the semantics of the socket type requested. For example, the ARPA
Internet UDP protocol cannot be specified with a socket type of
SOCK_STREAM.
10043 The requested protocol has not been configured into the system, or no
implementation for it exists. For example, a socket call requests a
SOCK_DGRAM socket, but specifies a stream protocol.
10044 The support for the specified socket type does not exist in this address
family. For example, the optional type SOCK_RAW might be selected in a
socket call, and the implementation does not support SOCK_RAW sockets at
all.
10045 The attempted operation is not supported for the type of object
referenced. Usually this occurs when a socket descriptor to a socket that
cannot support this operation is trying to accept a connection on a
datagram socket.
10046 The protocol family has not been configured into the system or no
implementation for it exists. This message has a slightly different meaning
from WSAEAFNOSUP-PORT. However, it is interchangeable in most cases,
and all Windows Sockets functions that return one of these messages also
specify WSAEAFNOSUPPORT.
10047 An address incompatible with the requested protocol was used. All sockets
are created with an associated address family (that is, AF_INET for Internet
Protocols) and a generic protocol type (that is, SOCK_STREAM). This error is
returned if an incorrect protocol is explicitly re-quested in the socket call,
or if an address of the wrong family is used for a socket, for ex-ample, in
sendto.
10049 The requested address is not valid in its context. This normally results from
an attempt to bind to an address that is not valid for the local computer.
This can also result from connect, sendto, WSAConnect, WSAJoinLeaf, or
WSASendTo when the remote address or port is not valid for a remote
computer (for example, address or port 0).
10052 The connection has been broken due to keep-alive activity detecting a
failure while the operation was in progress. It can also be returned by
setsockopt if an attempt is made to set SO_KEEPALIVE on a connection that
has al-ready failed.
10054 An existing connection was forcibly closed by the remote host. This
normally results if the peer application on the remote host is suddenly
stopped, the host is rebooted, the host or remote network interface is
disabled, or the remote host uses a hard close (see setsockopt for more in-
formation on the SO_LINGER option on the remote socket). This error may
also result if a connection was broken due to keep-alive activity detecting a
failure while one or more operations are in progress. Operations that were
in progress fail with WSAENETRESET. Subsequent operations fail with
WSAECONNRE-SET.
10057 A request to send or receive data was disallowed because the socket is not
connected and (when sending on a datagram socket using sendto) no
address was supplied. Any other type of operation might also return this
error—for example, setsockopt setting SO_KEEPALIVE if the connection has
been reset.
10058 A request to send or receive data was disallowed because the socket had
already been shut down in that direction with a previous shutdown call. By
calling shutdown a partial close of a socket is requested, which is a signal
that sending or receiving, or both have been discontinued.
10060 A connection attempt failed because the connected party did not properly
respond after a period of time, or the established connection failed
because the connected host has failed to respond.
10061 No connection could be made because the target computer actively refused
it. This usually results from trying to connect to a service that is inactive on
the foreign host—that is, one with no server application running.
10064 A socket operation failed because the destination host is down. A socket
operation en-countered a dead host. Networking activity on the local host
has not been initiated. These conditions are more likely to be indicated by
the error WSAETIMEDOUT.
• That the appropriate Windows Sockets DLL file is in the current path.
• That they are not trying to use more than one Windows Sockets
implementation simultaneously. If there is more than one Winsock DLL
on your system, be sure the first one in the path is appropriate for the
network subsystem currently loaded.
• The Windows Sockets implementation documentation to be sure all
necessary components are currently installed and configured correctly.
10092 The current Windows Sockets implementation does not support the
Windows Sockets specification version requested by the application. Check
that no old Windows Sockets DLL files are being accessed.
10093 Either the application has not called WSAStartup or WSAStartup failed. The
application may be accessing a socket that the current active task does not
own (that is, trying to share a socket between tasks), or WSACleanup has
been called too many times.
10101 Returned by WSARecv and WSARecvFrom to indicate that the remote party
has initiated a graceful shutdown sequence.
11001 No such host is known. The name is not an official host name or alias, or it
cannot be found in the database(s) being queried. This error may also be
returned for protocol and service queries, and means that the specified
name could not be found in the relevant database.
11002 This is usually a temporary error during host name resolution and means
that the local server did not receive a response from an authoritative
server. A retry at some time later may be successful.
11003 This indicates that some sort of nonrecoverable error occurred during a
database lookup. This may be because the database files (for example,
BSD-compatible HOSTS, SERVICES, or PROTOCOLS files) could not be found,
11004 The requested name is valid and was found in the database, but it does not
have the correct associated data being resolved for. The usual ex-ample for
this is a host name-to-address translation attempt (using gethostbyname or
WSAAsyncGetHostByName) which uses the DNS (Domain Name Server). An
MX record is returned but no A record—indicating the host itself exists, but
is not directly reachable.
995 An overlapped operation was canceled due to the closure of the socket, or
the execution of the SIO_FLUSH command in WSAIoctl.
10106 Either a service provider's DLL could not be loaded (LoadLibrary failed) or
the provider's WSPStartup/NSPStartup function failed.
Returned when a system call that should never fail does fail. For example,
if a call to WaitForMultipleEvents fails or one of the registry functions fails
trying to manipulate the protocol/namespace catalogs.
Returned when a provider does not return SUCCESS and does not provide an
ex-tended error code. Can indicate a service provider implementation
error.
| Technical Details |
Technical Details
CAPL Function Overview » TCP/IP API » Technical Details
Socket handles
Except for the network information functions of the IP API most of the CAPL Socket API functions take a
socket handle of type dword as a first parameter.
Info
This handle parameter is not the underlying WIN32 SOCKET handle and thus of no general use.
You should treat this parameter as an opaque handle.
Socket behaviour
All sockets are created as overlapped sockets and are operated in non-blocking mode. All functions, which
cannot complete immediately, are performed in an overlapped and asynchronous manner. Upon
completion (successful or not) the CAPL program receives a callback provided that it implements the
required completion routine.
Error handling
Almost all of the functions have a return value of type long. The value returned indicates the status of
the operation (successful or not) and is – in almost all cases - identical to the return value of the
underlying Winsock 2 API. That means that the return value is typically either zero if no error occurs or
SOCKET_ERROR (-1) otherwise. To get a specific error code for the last socket operation, use the
IpGetLastSocketError function. If an invalid socket handle is passed to a CAPL Socket API function the
value WSA_INVALID_PARAMETER (87) is returned.
Info
Because the entire Winsock 2 API is used in an overlapped, asynchronous manner, functions such
as UdpReceiveFrom, TcpReceive and TcpConnect will almost always return the value
SOCKET_ERROR. Use the IpGetLastSocketError function to determine whether the operation is
just pending or a real error has occurred.
OnTcpClose
CAPL Function Overview » TCP/IP API » OnTcpClose
Function Provided the CAPL program implements this callback it is dispatched when a TCP socket
receives a close notification.
Parameters socket
result
The specific result code of the operation. If the operation completed successfully the
value is zero. Otherwise the value is non-zero.
Return values —
7.0 — — •
Example
OnTcpConnect
CAPL Function Overview » TCP/IP API » OnTcpConnect
Function Provided the CAPL program implements this callback it is dispatched when an
asynchronous connection operation completes.
Parameters socket
result
The specific result code of the operation. If the operation completed successfully the
value is zero. Otherwise the value is non-zero.
Return values —
7.0 — — •
Example
OnTcpListen
CAPL Function Overview » TCP/IP API » OnTcpListen
Function Provided the CAPL program implements this callback it is dispatched when a connection
request for the specified socket is received.
Parameters socket
result
The specific result code of the operation. If the operation completed successfully the
value is zero. Otherwise the value is non-zero.
Return values —
7.0 — — •
Example
OnTcpReceive
CAPL Function Overview » TCP/IP API » OnTcpReceive
Syntax void OnTcpReceive( dword socket, long result, dword address, dword port,
char buffer[], dword size)
Function Provided the CAPL program implements this callback it is dispatched when an
asynchronous receive operation on a TCP socket completes.
Parameters socket
result
The specific result code of the operation. If the operation completed successfully the
value is zero. Otherwise the value is non-zero.
address
The remote address of the location which sent the data in network-byte order.
port
The remote port of the location which sent the data in host-byte order.
buffer
size
Return values —
7.0 — — •
Example
OnTcpSend
CAPL Function Overview » TCP/IP API » OnTcpSend
Syntax void OnTcpSend( dword socket, long result, char buffer[], dword size)
Function Provided the CAPL program implements this callback it is dispatched when an
asynchronous send operation on a TCP socket completes.
Parameters socket
result
The result code of the asynchronous operation. If the operation completed successfully
the value is zero. Otherwise the value is non-zero.
buffer
size
Return values —
7.0 — — •
Example
OnUdpReceiveFrom
CAPL Function Overview » TCP/IP API » OnUdpReceiveFrom
Syntax void OnUdpReceiveFrom( dword socket, long result, dword address, dword
port, char buffer[], dword size)
Function Provided the CAPL program implements this callback it is dispatched when an
asynchronous receive operation on an UDP socket completes.
Parameters socket
result
The result code of the asynchronous operation. If the operation completed successfully
the value is zero. Otherwise the value is non-zero.
address
The remote address of the location which sent the data in network-byte order.
port
The remote port of the location which sent the data in host-byte order.
buffer
size
Return values —
7.0 — — •
Example
OnUdpSendTo
CAPL Function Overview » TCP/IP API » OnUdpSendTo
Syntax void OnUdpSendTo( dword socket, long result, char buffer[], dword size)
Function Provided the CAPL program implements this callback it is dispatched when an
asynchronous send operation on an UDP socket completes.
Parameters socket
result
The result code of the asynchronous operation. If the operation completed successfully
the value is zero. Otherwise the value is non-zero.
buffer
size
Return values —
7.0 — — •
Example
IpBind
CAPL Function Overview » TCP/IP API » IpBind
Function The function associates an address and a port with the specified socket.
Parameters socket
address
port
SOCKET_ERROR (-1): The function failed. Call IpGetLastError to get a more specific error
code.
7.0 — — •
Example
IpGetAdapterAddress
CAPL Function Overview » TCP/IP API » IpGetAdapterAddress
Function The function retrieves the addresses associated with a network interface. The interface is
specified by it's 1-based index in the list of network interfaces, i.e. the first interface has
index 1.
Parameters index
address
count
7.0 — — •
Example
IpGetAdapterAddressAsString
CAPL Function Overview » TCP/IP API » IpGetAdapterAddressAsString
Function The function retrieves the string representation of the first address associated with the
specified network interface.
Parameters index
address
count
7.0 — — •
Example
IpGetAdapterCount
CAPL Function Overview » TCP/IP API » IpGetAdapterCount
Function The function returns the number of network interfaces for the local computer, not
including the loopback interface.
Parameters —
7.0 — — •
Example
IpGetAdapterDescription
CAPL Function Overview » TCP/IP API » IpGetAdapterDescription
Function The function retrieves the description of the specified network interface.
Parameters index
name
count
7.0 — — •
Example
IpGetAdapterGateway
CAPL Function Overview » TCP/IP API » IpGetAdapterGateway
Function The function retrieves the default gateway address associated with the specified network
interface.
Parameters index
address
count
7.0 — — •
Example
IpGetAdapterGatewayAsString
CAPL Function Overview » TCP/IP API » IpGetAdapterGatewayAsString
Function The function retrieves the string representation of the default gateway address
associated with the specified network interface.
Parameters index
address
The buffer used to store the gateway address string in dot notation.
count
7.0 — — •
Example
IpGetAdapterMask
CAPL Function Overview » TCP/IP API » IpGetAdapterMask
Function The function retrieves the address masks (subnet masks) associated with the specified
network interface.
Parameters index
mask
count
7.0 — — •
Example
IpGetAdapterMaskAsString
CAPL Function Overview » TCP/IP API » IpGetAdapterMaskAsString
Function The function retrieves the string representation of the first address mask associated with
the specified network interface.
Parameters index
mask
The buffer used to store the address mask string in dot notation.
count
7.0 — — •
Example
IpGetAddressAsNumber
CAPL Function Overview » TCP/IP API » IpGetAddressAsNumber
Function The function converts an address string in dot notation to it's numerical value in network-
byte order.
Parameters address
Return values 4294967295 (0xFFFFFFF, the equivalent of "255.255.255.255"): The specified address
string was invalid.
Any other value: The numeric equivalent of the given address string.
7.0 — — •
Example
IpGetAddressAsString
CAPL Function Overview » TCP/IP API » IpGetAddressAsString
Function The function converts a numeric address in network-byte order to a address string in dot
notation as in "192.168.0.10".
Parameters numericAddress
address
count
7.0 — — •
Example
IpGetLastError
CAPL Function Overview » TCP/IP API » IpGetLastError
Function The function returns the Winsock 2 error code of the last operation that failed.
Parameters —
Return values The error code as provided by the Winsock 2 WSAGetLastError function.
7.0 — — •
Example
IpGetLastSocketError
CAPL Function Overview » TCP/IP API » IpGetLastSocketError
Method socket.GetLastSocketError()
Function The function returns the Winsock 2 error code of the last operation that failed on the
specified socket.
Parameters socket
Any other value: The error code as provided by the Winsock 2 WSAGetLastError function.
7.0 — — •
Example
IpGetLastSocketErrorAsString
CAPL Function Overview » TCP/IP API » IpGetLastSocketErrorAsString
Function The function retrieves the error message of the last operation that failed on the specified
socket (see Winsock 2 error code).
Parameters socket
text
count
Return values 0: The error message was written into the text buffer. In case of an invalid error code,
the error message has the format "Unknown error: x" assuming the last error code x for
the specified socket.
7.0 — — •
Example
IpSetSocketOption
CAPL Function Overview » TCP/IP API » IpSetSocketOption
Syntax long IpSetSocketOption( dword socket, long level, long name, long value)
Parameters socket
level
name
value
SOCKET_ERROR (-1): The function failed. Call IpGetLastError to get a more specific error
code.
7.0 — — •
Example
TcpAccept
CAPL Function Overview » TCP/IP API » TcpAccept
Function The function accepts an incoming connection request on the specified socket resulting in
a new socket . If the operation fails, the function will return INVALID_SOCKET (~0).
Parameters socket
Return values INVALID_SOCKET (~0): The function failed. Call IpGetLastError to get a more specific
error code. If this error code is WSA_INVALID_PARAMETER (87), the specified socket was
invalid. Otherwise use IpGetLastSocketError to get the reason for the failing.
Any other value: A valid socket handle identifying the created socket.
7.0 — — •
Example
TcpClose
CAPL Function Overview » TCP/IP API » TcpClose
Destructor socket.close()
Function The function closes the TCP socket. Upon successful completion the passed socket is no
longer valid.
Parameters socket
SOCKET_ERROR (-1): The function failed. Call IpGetLastError to get a more specific error
code.
7.0 — — •
Example
TcpConnect
CAPL Function Overview » TCP/IP API » TcpConnect
Function The function establishes a connection with the specified location. If the connect
operation does not complete immediately the operation is performed asynchronously and
the function will return SOCKET_ERROR (-1). Use IpGetLastSocketError to get a more
specific error code. If the specific error code is WSAWOULDBLOCK (10035), the CAPL
callback OnTcpConnect will be called on completion (successful or not), provided it is
implemented in the same CAPL program.
Parameters socket
address
port
SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific
error code.
7.0 — — •
Example
TCPGetRemoteAddress
CAPL Function Overview » TCP/IP API » TCPGetRemoteAddress
Function This function retrieves the remote address of the specified socket.
Parameters socket
7.2 — — •
Example
TCPGetRemoteAddressAsString
CAPL Function Overview » TCP/IP API » TCPGetRemoteAddressAsString
Function This function retrieves the remote address of the specified socket in Internet standard
dotted-decimal format.
Parameters socket
buffer
size
7.2 — — •
Example
TcpListen
CAPL Function Overview » TCP/IP API » TcpListen
Method socket.Listen()
Function The function causes the socket to listen for incoming connection requests, which will be
provided in the CAPL callback OnTcpListen, if it is implemented in the same CAPL
program. If the operation fails, the function will return SOCKET_ERROR (-1). Use
IpGetLastSocketError to get a more specific error code.
Parameters socket
SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific
error code.
7.0 — — •
Example
TcpOpen
CAPL Function Overview » TCP/IP API » TcpOpen
Function The function creates a TCP socket for use in connection-based, message-oriented
communications. All parameters may be zero. If the port parameter is non-zero the
socket is implicitly bound to the given port.
Parameters address
port
Return values INVALID_SOCKET (~0): The function failed. Call IpGetLastError to get a more specific
error code.
Any other value: A valid socket handle identifying the created socket.
7.0 — — •
Example
TcpReceive
CAPL Function Overview » TCP/IP API » TcpReceive
Function The function receives data into the specified buffer. If the receive operation does not
complete immediately the operation is performed asynchronously and the function will
return SOCKET_ERROR (-1). Use IpGetLastSocketError to get a more specific error code. If
the specific error code is WSA_IO_PENDING (997) the CAPL callback OnTcpReceive will be
called on completion (successful or not), provided it is implemented in the same CAPL
program.
Parameters socket
buffer
size
SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific
error code.
7.0 — — •
Example
TcpSend
CAPL Function Overview » TCP/IP API » TcpSend
Function The function sends data on the specified socket. If the send operation does not complete
immediately the operation is performed asynchronously and the function will return
SOCKET_ERROR (-1). Use IpGetLastSocketError to get a more specific error code. If the
specific error code is WSA_IO_PENDING (997) the CAPL callback OnTcpSend will be called
on completion (successful or not), provided it is implemented in the same CAPL program.
Parameters socket
buffer
size
SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific
error code.
7.0 — — •
Example
TcpShutdown
CAPL Function Overview » TCP/IP API » TcpShutdown
Function The function disables send operations on the specified socket. This function may be used
to shutdown a TCP connection.
Parameters socket
SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific
error code.
7.0 — — •
Example
UdpClose
CAPL Function Overview » TCP/IP API » UdpClose
Destructor socket.Close()
Function The function closes the UDP socket. Upon successful completion the passed socket is no
longer valid.
Parameters socket
SOCKET_ERROR (-1): The function failed. Call IpGetLastError to get a more specific error
code.
7.0 — — •
Example
UdpOpen
CAPL Function Overview » TCP/IP API » UdpOpen
Function The function creates an UDP socket for use in connectionless, datagramm-oriented
communications. All parameters may be zero. If the port parameter is non-zero the
socket is implicitly bound to the given port.
Parameters address
port
Return values INVALID_SOCKET (~0): The function failed. Call IpGetLastError to get a more specific
error code.
Any other value: A valid socket handle identifying the created socket.
7.0 — — •
Example
UdpReceiveFrom
CAPL Function Overview » TCP/IP API » UdpReceiveFrom
Function The function receives data into the specified buffer. If the receive operation does not
complete immediately the operation is performed asynchronously and the function will
return SOCKET_ERROR (-1). Use IpGetLastSocketError to get a more specific error code. If
the specific error code is WSA_IO_PENDING (997) the CAPL callback OnUdpReceiveFrom
will be called on completion (successful or not), provided it is implemented in the same
CAPL program.
Parameters socket
buffer
size
SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific
error code.
7.0 — — •
Example
UdpSendTo
CAPL Function Overview » TCP/IP API » UdpSendTo
Syntax long UdpSendTo( dword socket, dword address, dword port, char buffer[],
dword size)
Method socket.SendTo( dword address, dword port, char buffer[], dword size
Function The function sends data to the specified location. If the send operation does not complete
immediately the operation is performed asynchronously and the function will return
SOCKET_ERROR (-1). Use IpGetLastSocketError to get a more specific error code. If the
specific error code is WSA_IO_PENDING (997) the CAPL callback OnUdpSendTo will be
called on completion (successful or not), provided it is implemented in the same CAPL
program.
Parameters socket
address
port
buffer
size
SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific
error code.
7.0 — — •
Example
File Functions
CAPL Function Overview » General » File Functions
There is often the need to save variables or measurement values over a period of time covering a number
of measurements. File functions are provided in CAPL for this purpose.
While file access operations are generally conceived to be easy to use and reliable they are rather slow.
Therefore file access should not be done in time-critical phases during measurement. It is recommended
to use CAPL file access mainly in the on prestart and on stop event handlers.
Info
If file functions are used in CAPL programs in the simulation setup or test setup and CANoe is
running in a distributed environment (CANoe RT or VN8900), it is required to predefine the files
to be accessed in advance under Configuration|Options|Configuration Settings|User Files.
The files on the user PC and on the remote device are synchronized before measurement start
and after measurement end.
A file search procedure is used to determine the absolute file path. There are different procedures for
writing and reading files.
1. If the CAPL file function is used in the CANoe simulation or test setup and if the file name doesn’t
contain a path (drive or directory), look up the file name in the list of pre-defined user files
(Configuration|Options|Configuration Settings|User Files) and take the path specified there.
2. If the file name is not found in the list of pre-defined user files and the CAPL function setFilePath
has been called before, use the directory specified with setFilePath as base to determine the
absolute path.
3. If setFilePath was not called before opening a file for read access search the file in the directory of
the first database.
4. If the file could not be found there, the directories of further databases will be used.
5. If the file still could not be found, the directory of the configuration file will be used.
1. If the CAPL file function is used in the CANoe simulation or test setup and if the file name doesn’t
contain a path (drive or directory), look up the file name in the list of pre-defined user files
(Configuration|Options|Configuration Settings|User Files) and take the path specified there.
2. If the file name is not found in the list of pre-defined user files and the CAPL functions setFilePath
or setWritePath have been called before, use the directory specified with
setFilePath/setWritePath as base to determine the absolute path.
3. If setFilePath/setWritePath was not called before opening a file for write access, the configuration
directory will be used as base to determine the absolute path instead.
The CAPL functions that require a file name don’t accept path names (including a drive name or directory
names).
CAPL functions setFilePath, setWritePath and getAbsFilePath are not available in case of a
distributed environment.
Runtime Errors
CAPL Function Overview » General » Runtime Errors
• Division by zero
• Exceeding upper or lower limits of the array
• Exceeding upper or lower limits of offset in the data range of messages.
• Stack overflow when CAPL subroutines are called.
If a runtime error is detected the function runError is called. This outputs a comment to the Write
window, which contains the name of the CAPL program, the type of error and an error index. With the
help of the error index, the point in the CAPL source text which generated the error is found.
Measurement is terminated after output of the comment.
The user can also call the function runError directly to generate assertions.
String Literal
CAPL Function Overview » General » String Literal
Escape Sequences
Certain characters are displayed as a combination of characters with a preceding backslash (escape
sequence) within a character string, e.g:
New line \n
Tabulator \t
Backslash \\
Carriage return \r
Backspace \b
Double quotation mark \"
Single quotation mark \'
on key 'i'
{
int defaultPara1;
int returnParaInt;
int returnArray;
int counter;
double defaultPara2;
double returnParaFloat;
defaultPara1 = -1;
defaultPara2 = -1;
// Write different values into the section "Parameter" of the INI file "Test.Ini"
writeProfileString ("Parameter","String","TestString","Test.Ini");
writeProfileFloat ("Parameter","Float", 1.7845,"Test.Ini");
writeProfileInt ("Parameter", "Integer", 8, "Test.Ini");
// Read different values from the Section "Parameter" of the INI file "Test.Ini"
// And display the values in the Write window
returnParaInt = getProfileInt("Parameter","Integer",defaultPara1,"Test.Ini");
returnParaFloat = getProfileFloat("Parameter","Float",defaultPara2,"Test.Ini");
getProfileString("Parameter","String","Default String", buffer, elcount(buffer),
"Test.Ini");
returnArray = getProfileArray("Parameter","Array", buffarray, elcount(buffarray),
"Test.Ini");
if (returnArray == 0)
{
write("Non array content!");
}
else
{
for (counter = 0; counter <= returnArray - 1; counter++)
{
write("Array: %d", buffarray[counter]);
}
}
}
variables
{
char replayName[32] = "ibus_data";
}
on key 'b'
{
replayStart( replayName);
}
on key 'e'
{
replayStop( replayName);
}
on key 's'
{
replaySuspend( replayName);
}
on key 'r'
{
replayResume( replayName);
}
on key 'w'
{
writeReplayState( replayName);
}
void writeReplayState( char name[])
{
switch ( replayState( name))
{
case 0:
write( "Replay block %s is stopped", replayName);
break;
case 1:
write( "Replay block %s is running", replayName);
break;
case 2:
write( "Replay block %s is suspended", replayName);
break;
default:
write( "Error: Replay block %s has an unknown state!", replayName);
break;
};
}
variables {
message 100 msg = {DLC=8};
char filename[50] = "test.dat";
long handle;
msTimer ReadNextBlock;
}
variables
{
dword mNewPage; // Sink identifier
}
on start
{
//Create a new page at the write window
mNewPage= writeCreate("New Page");
on key *
{
//show the current key at the "New Page"
char currentKey;
currentKey = this;
writeEx(mNewPage,4,"%c ",currentKey);
}
on stopMeasurement
{
//destroy the new craeated Page
writeDestroy(mNewPage);
}
variables
{
msTimer writeTimer;
long glbPeriod = 250;
dword glbHandle = 0;
long glbValue;
}
on Start
{
char buffer[64];
long ret;
//
// Opens the file in ASCII mode for read access.
//
// To determine the absolute path, the search procedure will be used.
// The file must be located in the directory of the databases or the
// configuration directory.
//
glbHandle = OpenFileRead ("Data.Txt",0);
if ( glbHandle!=0 )
{
//
// got to end of file ...
//
while ( fileGetString(buffer,elcount(buffer),glbHandle)!=0 ) {};
//
// Get the last parameters
// (saved on disk after the end the last measurement)
//
glbValue = atol (buffer);
write ("Last value %d.",glbValue);
fileClose (glbHandle);
}
else
{
write ("File 'Data.Txt' was not opened for read access.");
}
//
// Open the file in ASCII mode for write access.
//
// The write path was not set using the function setWritePath(), so
// the configuration directory will be used instead. This is the
// default behavior.
//
glbHandle = OpenFileWrite ("Data.Txt",2);
if ( glbHandle!=0 )
{
setTimer (writeTimer,glbPeriod);
}
else
{
write ("File 'Data.Txt' was not opened for write access.");
}
}
on timer writeTimer
{
long randomValue;
char buffer [64];
if ( glbHandle!=0 )
{
randomValue = random (32767);
snprintf (buffer,elcount(buffer)," %d \n",randomValue);
filePutString (buffer, elcount(buffer),glbHandle);
setTimer (writeTimer,glbPeriod);
}
else
{
write ("Error, invalid file handle.");
}
}
on StopMeasurement
{
fileClose (glbHandle);
}
ExtendedFrameCount Returns the number of extended CAN frames on a channel since start of
measurement.
ExtendedRemoteFrameCount Returns the current rate of extended remote CAN messages on a channel.
ExtendedRemoteFrameRate Returns the number of extended remote CAN messages on a channel since
start of measurement.
OverloadFrameCount Returns the number of CAN overload frames on a channel since start of
measurement.
StandardFrameCount Returns the number of standard CAN frames on a channel since start of
measurement.
StandardRemoteFrameCount Returns the number of standard remote CAN frames on channel x since
start of measurement.
TxChipErrorCount Returns the current number of Tx errors in the CAN receiver of a channel.
BusLoad
CAPL Function Overview » CAN » BusLoad
Method CANx.BusLoad
7.1 CAN • •
Example
write ("CAN1 busload = %d", CAN1.BusLoad);
ChipState
CAPL Function Overview » CAN » ChipState
Method CANx.ChipState
Return values Chip state of the CAN x controller. See the following table for a description of the return
values.
1 Simulated
2 Not used
3 Error Active
4 Warning Level
5 Error Passive
6 Bus Off
A description of the chip states can also be found here: Bus Statistics window of option
CAN.
7.1 CAN • •
Example
write ("Chip state of CAN1 = %d", CAN1.ChipState);
ErrorFrameCount
CAPL Function Overview » CAN » ErrorFrameCount
Method CANx.ErrorFrameCount
Function Returns the number of error frames on channel x since start of measurement.
7.1 CAN • •
Example
write ("Number of error frames on CAN1 = %d", CAN1.ErrorFrameCount);
ErrorFrameRate
CAPL Function Overview » CAN » ErrorFrameRate
Method CANx.ErrorFrameRate
Return values Current rate of CAN error messages on channel x in messages per second.
7.1 CAN • •
Example
write ("Rate of error messages on CAN1 = %d", CAN1.ErrorFrameRate);
ExtendedFrameCount
CAPL Function Overview » CAN » ExtendedFrameCount
Method CANx.ExtendedFrameCount
Function Returns the number of extended CAN frames on channel x since start of measurement.
Return values Number of extended CAN frames on channel x since start of measurement
7.1 CAN • •
Example
write ("Number of extended frames on CAN1 = %d", CAN1.ExtendedFrameCount);
ExtendedFrameRate
CAPL Function Overview » CAN » ExtendedFrameRate
Method CANx.ExtendedFrameRate
Return values Current rate of extended CAN frames on channel x in messages per second.
7.1 CAN • •
Example
write ("Rate of extended frames on CAN1 = %d", CAN1.ExtendedFrameRate);
ExtendedRemoteFrameCount
CAPL Function Overview » CAN » ExtendedRemoteFrameCount
Method CANx.ExtendedRemoteFrameCount
Function Returns the number of extended remote CAN messages on channel x since start of
measurement.
Return values Number of extended remote CAN messages on channel x since start of measurement.
7.1 CAN • •
Example
write ("Number of extended remote messages on CAN1 = %d",
CAN1.ExtendedRemoteFrameCount);
ExtendedRemoteFrameRate
CAPL Function Overview » CAN » ExtendedRemoteFrameRate
Method CANx.ExtendedRemoteFrameRate
Function Returns the current rate of extended remote CAN messages on channel x.
Return values Current rate of extended remote CAN messages on channel x in frames per second.
7.1 CAN • •
Example
write ("Rate of extended remote messages on CAN1 = %d",
CAN1.ExtendedRemoteFrameRate);
OverloadFrameCount
CAPL Function Overview » CAN » OverloadFrameCount
Method CANx.OverloadFrameCount
Function Returns the number of CAN overload frames on channel x since start of measurement.
Return values Number of CAN overload frames on channel x since start of measurement.
7.1 CAN • •
Example
write ("Number of overload frames on CAN1 = %d", CAN1.OverloadFrameCount);
OverloadFrameRate
CAPL Function Overview » CAN » OverloadFrameRate
Method CANx.OverloadFrameRate
Return values Current rate of CAN overload frames on channel x in messages per second.
7.1 CAN • •
Example
write ("Rate of overload frames on CAN1 = %d", CAN1.OverloadFrameRate);
PeakLoad
CAPL Function Overview » CAN » PeakLoad
Method CANx.PeakLoad
7.1 CAN • •
Example
write ("CAN1 peakload = %d", CAN1.PeakLoad);
RxChipErrorCount
CAPL Function Overview » CAN » RxChipErrorCount
Method CANx.RxChipErrorCount
7.1 CAN • •
Example
write ("Rx error count in the receiver of CAN1 = %d",
CAN1.RxChipErrorCount);
StandardFrameCount
CAPL Function Overview » CAN » StandardFrameCount
Method CANx.StandardFrameCount
Function Returns the number of standard CAN frames on channel x since start of measurement.
Return values Number of standard CAN frames on channel x since start of measurement.
7.1 CAN • •
Example
write ("Number of standard frames on CAN1 = %d", CAN1.StandardFrameCount);
StandardFrameRate
CAPL Function Overview » CAN » StandardFrameRate
Method CANx.StandardFrameRate
Return values Current rate of standard CAN frames on channel x in messages per second.
7.1 CAN • •
Example
write ("Rate of standard frames on CAN1 = %d", CAN1.StandardFrameRate);
StandardRemoteFrameCount
CAPL Function Overview » CAN » StandardRemoteFrameCount
Method CANx.StandardRemoteFrameCount
Function Returns the number of standard remote CAN frames on channel x since start of
measurement.
Return values Number of standard remote CAN frames on channel x since start of measurement.
7.1 CAN • •
Example
write ("Number of standard remote frames on CAN1 = %d",
CAN1.StandardRemoteFrameCount);
StandardRemoteFrameRate
CAPL Function Overview » CAN » StandardRemoteFrameRate
Method CANx.StandardRemoteFrameRate
Function Returns the current rate of standard remote CAN frames of channel x.
Return values Current rate of standard remote CAN frames of channel x in messages per second.
7.1 CAN • •
Example
write ("Rate of standard remote frames of CAN1 = %d",
CAN1.StandardRemoteFrameRate);
TxChipErrorCount
CAPL Function Overview » CAN » TxChipErrorCount
Method CANx.TxChipErrorCount
Function Returns the current number of Tx errors in the CAN receiver of channel x.
7.1 CAN • •
Example
write ("Number of Tx errors in receiver of CAN1 = %d",
CAN1.TxChipErrorCount);
linActivateSlot Reactivates a schedule table slot defined in the LIN database file.
linCheckRespError Queries the response_error flags of all Slave nodes defined in the LIN
network.
linSetInterByteSpace Sets an inter-byte space for a specified frame and a specified byte filed.
linSetInterByteSpaces Sets the inter-byte spaces for all data byte fields of all published frames of
the calling LIN Slave node.
linSetMasterRequestDirtyFlag Sets the dirty flag for the LIN master request frame.
linSetOEMDataInd Sets/resets the data indication bit for a calling slave node.
linSetOEMSleepInd Sets/resets the sleep indication bit for a calling slave node.
linSetOEMWakeupInd Sets/resets the wakeup indication bit for a calling slave node.
linSetSchedulerJitter Sets/resets the jitter mode and the jitter of the LIN hardware scheduler.
linSetWakeupParams Determines the conditions under which the LIN hardware can be
reactivated.
output Applies frame header on the bus or reconfigures response data of LIN
frame.
linChangeDlc Changes the Data Length Code of a LIN frame during the
measurement.
linGetRespError Queries the response error flag of the calling Slave node or of the
Slave node.
linResetNAD Resets NAD of the Slave node determined by the CAPL program
context to its initial NAD.
linSetInterByteSpace Sets an inter-byte space for a specified frame and a specified byte
filed.
linSetInterByteSpaces Sets the inter-byte spaces for all data byte fields.
linSetOEMDataInd Sets/resets the data indication bit for a calling slave node.
linSetOEMSleepInd Sets/resets the sleep indication bit for a calling slave node.
linSetOEMWakeupInd Sets/resets the wakeup indication bit for a calling slave node.
linSetRespCounter Limits the number of responses sent for the specified frame
identifier.
linSetRespError Sets/resets the response error flag for a calling slave node.
linSetRespLength Configures how many data bytes of the frame response should be
sent.
linSetValidBreakLimits Sets limits for the accepted sync break and delimiter lengths.
linBusIsAwake Inverts a specified bit when the next bus event for a specified ID
occurs.
linCheckOEMDataInd Checks the data indication bits of all slave nodes defined in the
LIN network.
linCheckOEMSleepInd Checks the sleep indication bits of all slave nodes defined in the
LIN network.
linCheckOEMWakeupInd Checks the wakeup indication bits of all slave nodes defined in the
LIN network.
linCheckRespError Queries the response_error flags of all Slave nodes defined in the
LIN network.
linGetRespError Queries the response error flag of the calling Slave node or of the
Slave node.
linSetOEMDataInd Sets/resets the data indication bit for a calling slave node.
linSetOEMSleepInd Sets/resets the sleep indication bit for a calling slave node.
linSetOEMWakeupInd Sets/resets the wakeup indication bit for a calling slave node.
linSetRespError Sets/resets the response error flag for a calling slave node.
linSetWakeupParams Determines the conditions under which the LIN hardware can be
reactivated.
linSilentWakeup Wakes up the LIN bus without sending any wakeup frames.
linBits2Time_ns
linGetEndOfHeader Retrieves a timestamp of the header part for a certain LIN bus event.
linGetResponseData Queries LIN frame response data for specified FrameId on certain LIN
channel.
linGetSyncBreakLength Retrieves the sync break (dominant bits) length of a LIN bus event.
linGetSyncDelLength Retrieves the synch delimiter (recessive bits) length of a LIN bus event.
linMeasHeaderBaudrate Sets request to measure the baud rate value for next LIN header event.
linMeasEdgeTimeDiffs Activates the measurement of the falling edges of the specified bytes in
the next message.
linMeasRespBaudrate Sets request to measure the baud rate value according to a certain data
byte of a certain LIN frame.
linResetMaxHeaderLength Resets the maximum header length to the protocol version dependent
default.
linSetValidBreakLimits Sets limits for the accepted sync break and delimiter lengths.
linTime2Bits_ns
linDisturbHeaderWithBitStream Configures the LIN hardware to disturb the next header with a
bit stream.
linDisturbHeaderWithHeader Configures the LIN hardware to disturb the next header with a
new header.
linDisturbHeaderWithVariableBitStream Configures the LIN hardware to disturb the next header with a
variable bit stream.
linInvertMultipleHeaderBits Inverts the multiple bits in specified locations in the next LIN
header.
linInvertRespBit Inverts the specified bit when the next bus event for the
specified ID occurs.
linInvertMultipleRespBits Inverts the multiple bits in specified locations in the next LIN
header.
linIsFlashModeActive Reports the flash mode state on high speed capable transceivers.
linSendHeaderError Sends a header with the current sync break, sync delimiter and
interbyte space settings and the specified sync byte and id byte.
linSetSchedulerJitter Sets/resets the jitter mode and the jitter of the LIN hardware
scheduler.
linSetManualChecksum Sets a checksum (that is usually not a correct one) for a LIN frame.
linSetInterByteSpace Sets an inter-byte space for a specified frame and a specified byte
filed.
linSetInterByteSpaces Sets the inter-byte spaces for all data byte fields of all published
frames of the calling LIN Slave node.
linSetRespCounter Limits the number of responses sent for the specified frame
identifier.
linSetRespLength Configures how many data bytes of the frame response should be
sent.
TestGetWaitEventMsgData Calls up the frame content if a LIN frame with a valid response is
the last event that triggers a wait instruction.
TestGetWaitLinCSErrorData Retrieves the data of a checksum error triggered by the last wait
instruction.
TestGetWaitLinHdrData Calls up the header content if LIN Header event is the last event
that triggers a wait instruction.
TestGetWaitLinReceiveErrData Calls up the error content if LIN Receive Error event is the last
event that triggers a wait instruction.
TestGetWaitLinTransmErrData Calls up the error content if LIN Transmission Error event is the
last event that triggers a wait instruction.
TestGetWaitLinWakeupData Calls up the frame content if LIN Wakeup frame is the last event
that triggers a wait instruction.
TestJoinLinCSErrorEvent Adds an event of type checksum error to the set of joined events.
TestJoinLinHeaderEvent Adds an event of type LIN Header to the set of joined events.
TestJoinLinReceiveErrorEvent Adds an event of type LIN Receive Error to the set of joined
events.
TestJoinLinTransmErrorEvent Adds an event of type LIN Transmission Error to the set of joined
events.
TestJoinLinWakeupEvent Adds an event of type LIN Wakeup frame to the set of joined
events.
TestWaitForLinCSError Waits for a checksum error for the specified amount of time.
TestWaitForLinHeader Waits for the Header occurrence of the specified LIN frame.
TestWaitForMessage Waits for the occurrence of LIN frame with a valid response.
ChkStart_AllNodesDead This check reports a problem, if the node has not send any
of its Tx messages within a given time-interval.
ChkStart_NodeDead
ChkStart_LINWakeupRetryViolation Checks number of LIN wakeup signals and the time between
them.
ChkStart_MsgSignalValueInvalid
Event Procedures
Access to the data of the corresponding event is possible in event procedures through this.
on linBaudrateEvent Is called when the LIN hardware has successfully measured the baud
rate of an external master or if the baud rate deviates by more than
0.5% from the last reported value.
on linDlcInfo Is called when the LIN hardware has successfully measured the length of
an unknown frame.
on linSleepModeEvent Is called when the wake status of the LIN hardware changes.
on linWakeupFrame Is called when the LIN hardware detects a wakeup signal on the bus.
on linCsError Is called when a frame was transmitted without a failure, but with an
incorrect checksum.
on linSyncError Is called when the LIN hardware was unable to become synchronized to
an external master.
Selectors
linActivateCollisionResolution
CAPL Function Overview » LIN » linActivateCollisionResolution
Function Activates or deactivates the Master node's automatic collision resolution of an event-
triggered frame.
Per default the automatic collision resolution is active. If a collision occurs for any event-
triggered frame, the Master resolves this collision by sending headers for all associated
frames using the event-triggered frame slot. After all associated frames have sent new
data, the Master sends the event-triggered frame header until the next collision occurs.
If the automatic collision resolution is deactivated, the Master always sends the event-
triggered frame's header.
Info
If the Master node is not simulated or no schedule tables are defined, then
this function will have no effect.
Parameters etfId
activate
0: Disable
1: Enable
5.2 LIN — •
Example
linActivateFlashMode
CAPL Function Overview » LIN » linActivateFlashMode
Function This function activates flash mode on high speed capable transceivers. Note that in flash
mode such a transceiver will use faster rising and falling edges and will disregard the EMC
limitations of the LIN network. Note also, that the activation of the flash mode cannot be
done while the channel is transmitting or the scheduler is running.
Parameters activate
Example
// test case for disturbing parts of a bit
// note, that test cases can only be used in the context of test module
nodes
testcase tcDisturbPartialBit()
{
dword flashModeActive;
flashModeActive = 0;
do
{
if (!linActivateFlashMode(1)) // request activation of flash mode
{
break; // if the request has been denied, either the cab/piggy is
incapable of
// flash mode or the scheduler is still running
}
testWaitForTimeout(10); // give the hardware time to activate the
flash mode
flashModeActive = linIsFlashModeActive(); // check if flash mode has
been
// activated successfully
} while (!flashModeActive);
if (!flashModeActive)
{
testStepFail(“tcDisturbPartialBit”, “Flash mode could not be
activated because of active scheduler or because the cab/piggy does not
support flash mode.”);
return;
}
...
}
| linIsFlashModeActive |
linActivateGlobalNetworkManagement
CAPL Function Overview » LIN » linActivateGlobalNetworkManagement
Function Activates/deactivates network management for the entire LIN network (the channel is
determined by the CAPL program context).
Network management is responsible for the automatic setting and resetting of response
error signals in the simulated Slave nodes.
Parameters active
0: deactivate
1: activate
5.2 LIN — •
Example
| linActivateSlaveNetworkManagement | linCheckRespError |
linActivateResps
CAPL Function Overview » LIN » linActivateResps
Function Reactivates all frame responses published by the calling Slave node according to the LIN
database file (LDF), after having been previously deactivated by linDeactiveResps() or
linResetSlave().
Per default all frame responses are activated for Slave nodes on measurement start i.e. it
is assumed that Slave nodes have non-volatile memory.
LIN2.0 Slave nodes will automatically activate responses for re-configurable frames on
receiving valid reconfiguration commands i.e. AssignFrameID.
Parameters —
5.1 LIN — •
Example
linActivateSlaveNetworkManagement
CAPL Function Overview » LIN » linActivateSlaveNetworkManagement
Network management is responsible for the automatic setting and resetting of response
error signals in the simulated Slave nodes.
Parameters active
0: deactivate
1: activate
5.2 LIN • •
Example
linActivateSlot
CAPL Function Overview » LIN » linActivateSlot
Function Reactivates a schedule table slot defined in the LIN database file (LDF), after having been
previously deactivated by linDeactivateSlot().
Schedule slots containing MasterRequests are automatically sent only if their data is
updated i.e. using output().
Info
If the Master node is not simulated or no schedule tables are defined, then
this function will have no effect.
Parameters tableIndex
Schedule table index according to the LIN database file (LDF). First table in the LDF has
the index 0.
slotIndex
5.1 LIN — •
Example
| linDeactivateSlots |
linBits2Time
CAPL Function Overview » LIN » linBits2Time
The absolute time is calculated using the current baud rate on the channel determined by
the CAPL program context.
Parameters bitTimes
Time in bits.
channel
5.1 LIN — •
6.0 LIN • •
Example
| linTime2Bits |
linBits2Time_ns
CAPL Function Overview » LIN » linBits2Time_ns
The absolute time is calculated using the current baud rate on the channel determined by
the CAPL program context.
Parameters bitTimes
Time in bits.
channel
7.0 LIN • •
Example
| linTime2Bits_ns |
linBusIsAwake
CAPL Function Overview » LIN » linBusIsAwake
Parameters —
Return values Returns a value unequal to zero if the bus is awake, otherwise zero.
7.0 LIN — •
Example
linChangeDlc
CAPL Function Overview » LIN » linChangeDlc
Function Changes the Data Length Code (i.e. length in bytes) of a LIN frame during the
measurement.
Per default the DLC of LIN frames is initialized according to the LIN Description File (LDF).
This function is therefore only needed if you are simulating LIN nodes without using a LDF
and need to change the DLC of a LIN frame during the measurement.
To initialize the DLC of a LIN frame the function linSetDlc should be used in the event
procedure on preStart.
Parameters frameID
dlc
5.1 LIN — •
Example
| linGetDlc |
linChangeSchedtable
CAPL Function Overview » LIN » linChangeSchedtable
Function This function switches from the current schedule table to another one.
Info
If the Master node is not simulated or no schedule tables are defined, then
this function will have no effect.
Parameters tableIndex
slotIndex
Default value: 0
Value range: 0..Y-1, where Y is a total number of slots in the new schedule table
onSlotIndex
Index of last slot in the current schedule table to be sent before changing to the new
schedule table.
Value range: -2..X-1, where X is a total number of slots in the current schedule table.
Value: -1 - makes change on reaching the end of current schedule table.
Value: -2 - makes change immediately.
Return values Index of the current schedule table or -1 if no active schedule table exists and on failure.
3.2 LIN — •
Example
linChangeWakeupSettings
CAPL Function Overview » LIN » linChangeWakeupSettings
Info
When LIN hardware is not in Sleep mode calling this function will have no
effect.
Parameters restartScheduler
0: After wakeup the current schedule table is started with the slot before entering sleep
mode.
1: After wakeup the current schedule table is started from the beginning.
wakeupIdentifier
LIN frame identifier to be sent additionally directly after sending a wakeup signal.
5.1 LIN — •
Example
linCheckOEMDataInd
CAPL Function Overview » LIN » linCheckOEMDataInd
Info
This function can be used for OEM specific variant of LIN protocol only.
Function This function checks the data indication bits of all slave nodes defined in the LIN network
(the channel is determined by the CAPL program context).
Parameters —
Return values Returns non-zero if all queried data indication bits are set, otherwise zero.
7.2 LIN — •
Example
linCheckOEMSleepInd
CAPL Function Overview » LIN » linCheckOEMSleepInd
Info
This function can be used for OEM specific variant of LIN protocol only.
Function This function checks the sleep indication bits of all slave nodes defined in the LIN network
(the channel is determined by the CAPL program context).
Parameters —
Return values Returns non-zero if all queried sleep indication bits are set, otherwise zero.
7.2 LIN — •
Example
| linGetOEMSleepInd | linSetOEMSleepInd |
linCheckOEMWakeupInd
CAPL Function Overview » LIN » linCheckOEMWakeupInd
Info
This function can be used for OEM specific variant of LIN protocol only.
Function This function checks the wakeup indication bits of all slave nodes defined in the LIN
network (the channel is determined by the CAPL program context).
Parameters —
Return values Returns non-zero if at least one of the queried wakeup indication bits is set, otherwise
zero.
7.2 LIN — •
Example
| linGetOEMWakeupInd | linSetOEMWakeupInd |
linCheckRespError
CAPL Function Overview » LIN » linCheckRespError
Function Queries the response_error flags of all Slave nodes defined in the LIN network.
Parameters —
Return values Returns one if at least one of the Slave nodes has the response_error flag set, otherwise
zero.
6.0 LIN — •
Example
linDeactivateBitInversion
CAPL Function Overview » LIN » linDeactivateBitInversion
Function With this function it is possible to cancel a previously activated bits inversion for LIN
header or response. This function is useful when after calling linInvertHeaderBit() no
header occurred yet on the bus or when after calling linInvertRespBit() no frame occurred
yet.
Parameters —
5.2 • LIN — •
• Real bus mode
Example
| linInvertHeaderBit | linInvertRespBit |
linDeactivateResps
CAPL Function Overview » LIN » linDeactivateResps
Function This function deactivates frame responses for all frames published by the calling slave
node. The frame responses can be deactivated individually using the function
linSetRespCounter().
Info
If the CAPL-program calling this function, does not model a Slave node, then
this function will have no effect.
Parameters —
5.1 LIN — •
Example
linDeactivateSlot
CAPL Function Overview » LIN » linDeactivateSlot
Function This function deactivates the specified slot of schedule table. For example, it can be used
to turn slots off in a diagnostic table.
Info
If the Master node is not simulated or no schedule tables are defined, then
this function will have no effect.
Parameters tableIndex
slotIndex
Value range: 0..Y-1, where Y is a total number of slots in the specified schedule table
5.1 LIN — •
Example
| linActivateSlot |
linDetectMultipleErrors
CAPL Function Overview » LIN » linDetectMultipleErrors
Function This function can be used to instruct LIN Hardware to enable/disable detection of more
than one error per a LIN frame.
This function can be useful during tests of the stress functionality. For example, an
inversion of bits in a frame response may lead to a receive error and checksum error
simultaneously. By default only one error per frame is detected, but with this function
the detection of both errors can be activated.
Parameters activate
0: Disable
1: Enable
5.1 LIN — •
Example
linDisturbHeaderWithBitStream
CAPL Function Overview » LIN » linDisturbHeaderWithBitStream
Function Configures the LIN hardware to disturb the next header with a bit stream.
Parameters byteIndex
0: Sync Byte
1: ProtectedId Byte
bitIndex
The index of the bit where the interrupting bit stream will start.
An index in the range 0-7 specifies a data bit, while the index 8 specifies the stop bit.
Higher index values specify the interbyte-space after the indexed data byte. In which
case, the user should make sure that the interbyte space is large enough.
bitStream
numberOfBits
timeoutPrevention
7.5 • LIN — •
• Real bus mode
Example
linDisturbHeaderWithHeader
CAPL Function Overview » LIN » linDisturbHeaderWithHeader
Function Configures the LIN hardware to disturb the next header with a new header
(id=<disturbanceHeaderID>).
Parameters byteIndex
0: Sync Byte
1: ProtectedId Byte
bitIndex
disturbanceHeaderID
Info
This is not the ID of the header to be disturbed, but the ID of the header
disturbance itself.
7.5 • LIN — •
• Real bus mode
Example
linDisturbHeaderWithVariableBitStream
CAPL Function Overview » LIN » linDisturbHeaderWithVariableBitStream
Function Configures the LIN hardware to disturb the next header with a variable bit stream.
Parameters byteIndex
0: Sync Byte
1: ProtectedId Byte
bitIndex
The index of the bit where the interrupting bit stream will start.
An index in the range 0-7 specifies a data bit, while the index 8 specifies the stop bit.
Higher index values specify the interbyte-space after the indexed data byte. In which
case, the user should make sure that the interbyte space is large enough.
bitStream
lengthInNS
numberOfBits
The number of bits in the bitStream-array. Note that while the dataBuffer-array will
usually have a size of ceil (numberOfBits / 8), the size of lengthInNS will need to be at
least numberOfBits.
roundup
If true, the lengths specified in lengthInNS will be rounded up to the next possible length
that can be transmitted by the LIN hardware, otherwise the lengths will be rounded
down.
timeoutPrevention
7.5 • LIN — •
Example
linDisturbRespWithBitStream
CAPL Function Overview » LIN » linDisturbRespWithBitStream
Function Configures the LIN hardware to disturb the specified response with a bit stream.
Parameters disturbedFrameID
byteIndex
The index of the byte to be disturbed (use 0 for the first byte).
If the index is equal to the frame’s length, then the checksum byte will be disturbed. An
index larger than the frame length is invalid.
bitIndex
The index of the bit where the interrupting bit stream will start.
An index in the range 0-7 specifies a data bit, while the index 8 specifies the stop bit.
Higher index values specify the interbyte-space after the indexed data byte. In which
case, the user should make sure that the interbyte space is large enough.
bitStream
numberOfBits
timeoutPrevention
7.5 • LIN — •
• Real bus mode
Example
linDisturbRespWithHeader
CAPL Function Overview » LIN » linDisturbRespWithHeader
Function Configures the LIN hardware to disturb the specified response with a new header
(id=<disturbanceHeaderID>).
Parameters disturbedFrameID
byteIndex
The index of the byte to be disturbed (use 0 for the first byte).
If the index is equal to the frame’s length, then the checksum byte will be disturbed. An
index larger than the frame length is invalid.
bitIndex
The index of the bit where the interrupting header will start.
An index in the range 0-7 specifies a data bit, while the index 8 specifies the stop bit.
Higher index values specify the interbyte-space after the indexed data byte. In which
case, the user should make sure that the interbyte space is large enough.
disturbingFrameId
The identifier of the header that will interrupt the specified header byte.
7.5 • LIN — •
• Real bus mode
Example
linDisturbRespWithVariableBitStream
CAPL Function Overview » LIN » linDisturbRespWithVariableBitStream
Function Configures the LIN hardware to disturb the specified response with a variable bit stream.
Parameters disturbedFrameID
byteIndex
The index of the byte to be disturbed (use 0 for the first byte).
If the index is equal to the frame’s length, then the checksum byte will be disturbed. An
index larger than the frame length is invalid.
bitIndex
The index of the bit where the interrupting bit stream will start.
An index in the range 0-7 specifies a data bit, while the index 8 specifies the stop bit.
Higher index values specify the interbyte-space after the indexed data byte. In which
case, the user should make sure that the interbyte space is large enough.
bitStream
lengthInNS
umberOfBits
The number of bits in the bitStream-array. Note that while the dataBuffer-array will
usually have a size of ceil (numberOfBits / 8), the size of lengthInNS will need to be at
least numberOfBits.
roundup
If true, the lengths specified in lengthInNS will be rounded up to the next possible length
that can be transmitted by the LIN hardware, otherwise the lengths will be rounded
down.
timeoutPrevention
7.5 • LIN — •
• Real bus mode
Example
linETFSendOnSignalUpdate
CAPL Function Overview » LIN » linETFSendOnSignalUpdate
Parameters etfId
active
1: Activate
0: Deactivate
5.2 LIN — •
Example
| linActivateCollisionResolution | linETFSetDirtyFlag |
linETFSetDirtyFlag
CAPL Function Overview » LIN » linETFSetDirtyFlag
Function With this function it is possible to set/clear the dirty flag of an associated frame. If the
dirty flag of an associated frame is set when the corresponding event-triggered frame is
being requested, then the LIN hardware will try to transmit the associated frame's data.
The dirty flag gets reset automatically when the associated frame has been sent
successfully – either via the event-triggered frame or unconditionally.
Parameters assocId
LIN frame identifier of associated (unconditional) frame whose dirty flag should be set or
cleared.
Value range: 0 .. 63
dirty
5.2 LIN — •
Example
| linActivateCollisionResolution | linETFSendOnSignalUpdate |
linGetBusIdleTimeout
CAPL Function Overview » LIN » linGetBusIdleTimeout
Function This function returns the currently set bus idle timeout. Depending on the protocol
version, the timeout will be specified in bit times (LIN 1.x and Cooling) or in milliseconds
(all others).
Parameters —
Return values On success, returns the bus idle timeout, otherwise zero.
6.1 LIN — •
Example
| linSetBusIdleTimeout |
linGetByteEndTime
CAPL Function Overview » LIN » linGetByteEndTime
Function This function can be used to retrieve a data byte timestamp of a certain LIN bus event.
The resulting timestamp is a time elapsed since measurement start [in units of 10 µsec].
Info
The time returned by this function corresponds to the end of the data byte
field as detected by an UART. For the XL-hardware, this includes 9/16 of the
stop bit. To calculate the theoretical end of data byte field including the stop
bit, 7/16 of a bit time should be added. Similarly to calculate the start of the
data byte field, 9 and 9/16 bit times should be subtracted.
Parameters busEvent
index
Value range: 1..N, where N = data bytes count of the current bus event
Return values Returns the retrieved timestamp [in units of 10 µsec] or 0 on failure.
5.1 LIN • •
Example
| linGetStartOfFrame | linGetEndOfHeader |
linGetChecksum
CAPL Function Overview » LIN » linGetChecksum
Parameters linFrame
linCsError
6.0 LIN • •
Example
| linSetChecksumError | linSetManualChecksum |
linGetDlc
CAPL Function Overview » LIN » linGetDlc
Function Queries the Data Length Code (i.e. length in bytes) of a LIN frame.
Per default the DLC of LIN frames is initialized according to the LIN Description File (LDF).
If no LDF is used, this function returns the DLC initialized in on preStart e.g. using
linSetDlc, for LIN frames sent by simulated LIN nodes.
For LIN frames whose DLC has not been initialized, this function will return the default
DLC for the selected ID as defined in the LIN1.1 protocol specification.
For LIN frames sent by external LIN nodes, the measured DLC is returned.
Parameters frameID
3.1 LIN — •
Example
| linChangeDlc |
linGetDominantTimeout
CAPL Function Overview » LIN » linGetDominantTimeout
Function Returns the dominant timeout of the current channel’s transceiver in nanoseconds. If
zero, the transceiver does not have any dominant timeout.
Parameters —
Return values Returns the dominant timeout of the LINcab/LINpiggy or zero, if the transceiver does not
have any dominant timeout.
7.5 • LIN — •
• Real bus mode
Example
| linSetGlobalTimeoutPrevention |
linGetEndOfHeader
CAPL Function Overview » LIN » linGetEndOfHeader
Function This function can be used to retrieve a timestamp of the header part for a certain LIN bus
event. The resulting timestamp is a time elapsed since measurement start [in units of 10
µsec].
Info
The time returned by this function corresponds to the end of the Protected ID
field as detected by an UART. For the XL-hardware, this includes 9/16 of the
stop bit. To calculate the theoretical end of Protected ID field including the
stop bit, 7/16 of a bit time should be added. Similarly to calculate the start
of the Protected ID field, 9 and 9/16 bit times should be subtracted.
Parameters busEvent
Return values Returns the retrieved timestamp [in units of 10 µsec] or 0 on failure.
5.1 LIN • •
Example
Retrieve time stamps of header (ID byte) on analyzing a receive error event
on linReceiveError
{
long byteIndex;
dword endHeaderTime;
endHeaderTime = linGetEndOfHeader(this);
...
}
| linGetStartOfFrame | linGetByteEndTime |
linGetFallingEdgesOfDisturbedByte
CAPL Function Overview » LIN » linGetFallingEdgesOfDisturbedByte
Function With this function it is possible to retrieve timestamps of all falling edges in the disturbed
byte or in the pseudo-byte caused by the last bit inversion.
Note, that prior to calling this function the measurement of the falling edges has to be
activated and the bit inversion has to be executed (see linInvertRespBit,
linInvertHeaderBit)
Parameters fallingEdges
Example
linGetHWReceiveAccuracy
CAPL Function Overview » LIN » linGetHWReceiveAccuracy
Function This function can be used to query the receive resolution of the LIN hardware in units of 1
Hz.
Parameters —
Example
on key 't'
{
write("Transmit accuracy = %d", linGetHWTransmitAccuracy());
write("Receive accuracy = %d", linGetHWReceiveAccuracy());
}
| linGetHWTransmitAccuracy |
linGetHWTransmitAccuracy
CAPL Function Overview » LIN » linGetHWTransmitAccuracy
Function This function can be used to query the transmit resolution of the LIN hardware in units of
1 Hz.
Parameters —
Example
on key 't'
{
write("Transmit accuracy = %d", linGetHWTransmitAccuracy());
write("Receive accuracy = %d", linGetHWReceiveAccuracy());
}
| linGetHWReceiveAccuracy |
linGetMeasBaudrate
CAPL Function Overview » LIN » linGetMeasBaudrate
Function With this function it is possible to retrieve results of a last baud rate measurement, which
is done by calling linMeasHeaderBaudrate() or linMeasRespBaudrate() functions.
Parameters —
Return values Returns the last measured baud rate [in bit/sec] or -1 on failure.
5.1 • LIN — •
• Real bus mode
Example
Test case for measuring baud rate using LIN header event.
testcase tcMeasureHeaderBaudrate ()
{
long waitResult, measBaudrate;
// set request to measure baudrate according to Synch field of a LIN header
linMeasHeaderBaudrate(0);
// wait maximum 1000 [ms] for LIN header with identifier 0x33
waitResult = TestWaitForLinHeader(0x33, 1000);
// declare failure if Wait has resumed not due to expected event
if (1 != waitResult)
{
TestStepFail("Test 1.1","No LIN header with ID=0x33 occurred during 1000
ms!");
}
// retrieve measured baudrate
measBaudrate = linGetMeasBaudrate();
if (-1 == measBaudrate)
{
TestStepFail("Test 1.1", "Failed to measure header baudrate!");
}
TestStepPass("Test 1.1", "Header baudrate measurement done...");
Info
These test cases can only be used in the context of test module nodes.
Example
Test case for measuring baud rate using certain data byte of a LIN frame.
testcase tcMeasureDatabyteBaudrate (int byteIndex)
{
long waitResult, measBaudrate;
// set request to measure baudrate using the specified byte of a frame with
ID=0x33
linMeasRespBaudrate(0x33, byteIndex);
// wait maximum 1000 [ms] for a frame with ID=0x33
waitResult = TestWaitForMessage(0x33, 1000);
// declare failure if Wait has resumed not due to expected event
if (1 != waitResult) {
TestStepFail("Test 1.1","Expected frame has not occurred during 1000 ms!");
}
// retrieve measured baudrate
measBaudrate = linGetMeasBaudrate();
if (-1 == measBaudrate)
{
TestStepFail("Test 1.1", "Failed to measure response baudrate!");
}
TestStepPass("Test 1.1", "Response baudrate measurement done...");
}
Info
These test cases can only be used in the context of test module nodes.
| linMeasHeaderBaudrate | linMeasRespBaudrate |
linGetMeasEdgeTimeDiffs
CAPL Function Overview » LIN » linGetMeasEdgeTimeDiffs
Function This function retrieves the time differences between edges measured with
linMeasEdgeTimeDiffs(). Note that for each byte measured four time differences will
be returned, although all of them might be 0 (if there had been only one falling edge in
the measured byte). This means that time differences 0 to 3 contain the values for the
first measured byte, time differences 4 to 7 contain the values for the second measured
byte, etc.
Parameters arrSize
timeDiffs
Return values Returns the number of time differences copied into the timeDiffs-array.
6.1 • LIN — •
• Real bus mode
Example
| LinMeasEdgeTimeDiffs |
linGetOEMDataInd
CAPL Function Overview » LIN » linGetOEMDataInd
Info
This function can be used for OEM specific variant of LIN protocol only.
Function With this function it's possible to query the data indication bit of a Slave node.
Without parameter, the data indication bit of the calling slave node is returned or zero if
the caller is not a slave node.
Parameters slaveName
Return values Returns non-zero if the queried data indication bit is set, otherwise zero.
7.2 LIN — •
Example
linGetOEMSleepInd
CAPL Function Overview » LIN » linGetOEMSleepInd
Info
This function can be used for OEM specific variant of LIN protocol only.
Function With this function it's possible to query the sleep indication bit of a Slave node.
Without parameter, the sleep indication bit of the calling slave is returned or zero if the
caller is not a slave.
Parameters slaveName
Return values Returns non-zero if the queried sleep indication bit is set, otherwise zero.
7.2 LIN — •
Example
| linCheckOEMSleepInd | linSetOEMSleepInd |
linGetOEMWakeupInd
CAPL Function Overview » LIN » linGetOEMWakeupInd
Info
This function can be used for OEM specific variant of LIN protocol only.
Function With this function it's possible to query the wakeup indication bit of a Slave node.
Without parameter, the wakeup indication bit of the calling slave is returned or zero if
the caller is not a slave node.
Parameters slaveName
Return values Returns non-zero if the queried wakeup indication bit is set, zero otherwise.
7.2 LIN — •
Example
| linCheckOEMWakeupInd | linSetOEMWakeupInd |
linGetProtectedID
CAPL Function Overview » LIN » linGetProtectedID
Function With this function it is possible to calculate protected ID for the corresponding LIN frame
identifier (i.e. the frame identifier with parity bits).
Parameters frameID
Value range: 0 .. 63
5.1 LIN • •
Example
Display in Write window a protected ID for each LIN frame seen on the bus
on linMessage *
{
dword pid;
pid = linGetProtectedID(this.ID);
writeLineEx(0,0, "Protected ID for LIN frame identifier 0x%x is 0x%x",
this.ID, pid);
linGetRespError
CAPL Function Overview » LIN » linGetRespError
Function With this function it’s possible to query the response error flag of the calling Slave node
or of the Slave node specified by its node address (NAD) as last seen on the LIN bus.
Parameters NAD
Return values Returns one if the queried response_error flag is set, zero if it is not set and -1 if it has
not been sent yet.
6.0 LIN — •
Example
linGetResponseData
CAPL Function Overview » LIN » linGetResponseData
Function Queries LIN frame response data for specified FrameId on certain LIN channel.
The FrameId and desired LIN channel number are expected to be set in the linmessage
prior to calling this function.
The frame length, dataybte and checksum byte values will be copied into corresponding
fields of linmessage object.
Note, that in the case there is no response data for the specified FrameId no data is
copied.
Context Any
Parameters frameObject
The data structure to be filled in. Note, that the following selectors have to be set prior
to calling this function:
• ID
• MsgChannel
The non-zero value in real mode is the initial and in simulated mode the actual response
counter value.
Example
on key 'a'
{
linmessage 0x1 testMsg;
testMsg.MsgChannel = 1;
testMsg.ID = 0;
if (LINGetResponseData(testMsg) > 0)
{
writelineex(1,1,"FrameId=%d Length=%d, 0x%X 0x%X 0x%X 0x%X 0x%X 0x%X
0x%X 0x%X;", testMsg.ID, testMsg.DLC,
testMsg.byte(0), testMsg.byte(1), testMsg.byte(1), testMsg.byte(3),
testMsg.byte(4), testMsg.byte(5), testMsg.byte(6), testMsg.byte(7));
}
}
| linSetRespCounter |
linGetStartOfFrame
CAPL Function Overview » LIN » linGetStartOfFrame
Function This function can be used to retrieve a start timestamp of a LIN bus event. The resulting
timestamp is a time elapsed since the measurement start [in units of 10 µsec].
Parameters busEvent
LIN bus event of type frame, checksum error, receive error, transmission error,
synchronization error or wakeup signal.
Return values Returns the retrieved timestamp [in units of 10 µsec] or 0 on failure.
5.1 LIN • •
Example
Calculate header length [in bit times] for each received LIN frame
on linMessage *
{
dword startOfFrame, endOfHeader, headerLength;
if (this.dir != RX)
{
return; // ignore transmitted frames
}
startOfFrame = linGetStartOfFrame(this); // retrieve frame start time
endOfHeader = linGetEndOfHeader(this); // retrieve header end time
headerLength = linTime2Bits(endOfHeader - startOfFrame); // calculate
header length in bit times
// display the result in Write window
writeLineEx(0,0, "Header length for LIN frame with identifier 0x%x is %d
bit times", this.ID, headerLength);
}
| linGetEndOfHeader | linGetByteEndTime |
linGetSyncBreakLength
CAPL Function Overview » LIN » linGetSyncBreakLength
Function This function can be used to retrieve the sync break (dominant bits) length of a LIN bus
event. The resulting length is in units of 10 µsec (microseconds). To get the result in bit
times linTime2Bits() function can be used.
Parameters busEvent
LIN bus event of type frame, checksum error, receive error, transmission error,
synchronization error or wakeup signal.
Return values Returns the retrieved length [in units of 10 µsec] or 0 on failure.
5.1 LIN • •
Example
Analyze receive error event by retrieving length of sync break and sync delimiter
on linReceiveError
{
dword timelenBreak,timelenDel;
dword bitlenBreak,bitlenDel;
timelenBreak = linGetSyncBreakLength(this); // retrieve break length in
time units
bitlenBreak = linTime2Bits(timelenBreak); // convert time units to bit
times
timelenDel = linGetSyncDelLength(this); // retrieve delimiter length in
time units
bitlenDel = linTime2Bits(timelenDel); // convert time units to bit
times
...
}
linGetSyncDelLength
CAPL Function Overview » LIN » linGetSyncDelLength
Function This function can be used to retrieve the synch delimiter (recessive bits) length of a LIN
bus event. The resulting length is in units of 10 µsec (microseconds).To get the result in
bit times linTime2Bits() function can be used.
Parameters busEvent
LIN bus event of type frame, checksum error, receive error, transmission error,
synchronization error or wakeup signal.
Return values Returns the retrieved length [in units of 10 µsec] or 0 on failure.
5.1 LIN • •
Example
Analyze receive error event by retrieving length of synch break and sync delimiter
on linReceiveError
{
dword timelenBreak,timelenDel;
dword bitlenBreak,bitlenDel;
timelenBreak = linGetSyncBreakLength(this); // retrieve break length in
time units
bitlenBreak = linTime2Bits(timelenBreak); // convert time units to bit
times
timelenDel = linGetSyncDelLength(this); // retrieve delimiter length in
time units
bitlenDel = linTime2Bits(timelenDel); // convert time units to bit
times
...
}
| linGetSyncBreakLength | linSetBreakLength |
linGetWakeupLength
CAPL Function Overview » LIN » linGetWakeupLength
Parameters wakeupFrame
Return values Returns the retrieved length [in units of 10 µsec] or zero on failure.
5.2 LIN • •
Example
| linSendWakeup |
linInvertHeaderBit
CAPL Function Overview » LIN » linInvertHeaderBit
Parameters byteIndex
0: Sync Byte
1: ProtectedId Byte
bitIndex
The index of the bit to be manipulated. An index in the range 0-7 will manipulate a data
bit, while the index 8 will manipulate the stop bit. Higher index values will cause the
interbyte-space after the data byte to be manipulated. In this case, the user should make
sure that the interbyte-space is large enough.
level
Info
The default level used for the first type of the function is 0!
numberOfExecutions
The number of consecutive headers in which the bit inversion will be executed.
reportFallingEdges
Flag indicating whether timestamps of the falling edges in the resulting pseudo-byte have
to be reported. The timestamps can be retrieved by calling
linGetFallingEdgesOfDisturbedByte.
0: Deactivate report
1: Activate report
disturbAfterHeaderID
With this parameter and the next one it is possible to define exactly which header will be
disturbed. The LIN hardware will first wait for a header with ID = disturbAfterHeaderID
before additionally awaiting the number of headers defined by waitForHeaders. The next
header following these headers will then be disturbed.
For example: To disturb the next header directly after a header with the ID=5, set the
disturbAfterHeaderID parameter to 5 and the waitForHeaders to 0.
waitForHeaders
5.2 LIN — •
Example
on key 'i'
{
if (0!=linInvertHeaderBit(0, 0, 0))
{
// for the next LIN header invert first bit (it’s the recessive one) of the
Sync byte
}
}
| linInvertRespBit | linDeactivateBitInversion |
linInvertHeaderBitEx
CAPL Function Overview » LIN » linInvertHeaderBitEx
Function Inverts the specified number of 1/16th bits at the specified position in the next LIN
header.
Parameters byteIndex
0: Sync Byte
1: ProtectedId Byte
bitIndex
The index of the bit to be manipulated. An index in the range 0-7 will manipulate a data
bit, while the index 8 will manipulate the stop bit. Higher index values will cause the
interbyte-space after the data byte to be manipulated. In this case, the user should make
sure that the interbyte-space is large enough.
bitOffsetInSixteenthBits
distLengthInSixteenthBits
Level
numberOfExecutions
The number of consecutive headers in which the bit inversion will be executed. The
default is 1 (single shot).
reportFallingEdges
Flag indicating whether timestamps of the falling edges in the resulting pseudo-byte have
to be reported. The timestamps can be retrieved by calling
linGetFallingEdgesOfDisturbedByte.
0: Deactivate report
disturbAfterHeaderID
With this parameter and the next one it is possible to define exactly which header will be
disturbed. The LIN hardware will first wait for a header with ID = disturbAfterHeaderID
before additionally awaiting the number of headers defined by waitForHeaders. The next
header following these headers will then be disturbed.
For example: To disturb the next header directly after a header with the ID=5, set the
disturbAfterHeaderID parameter to 5 and the waitForHeaders to 0.
waitForHeaders
Example
on key 'i'
{
if (0!=linInvertHeaderBitEx(0, 0, 8, 8, 0))
{
// for the next LIN header invert the second half of the first bit (it’s
the recessive one) of the Sync byte
}
}
| linInvertRespBitEx |
linInvertMultipleHeaderBits
CAPL Function Overview » LIN » linInvertMultipleHeaderBits
Function Inverts the multiple bits in specified locations in the next LIN header.
Info
Some driver versions only support inverting multiple (consecutive) bits in one
position (arrSize == 1).
Parameters byteIndices
0: Sync Byte
1: ProtectedId Byte
bitIndices
An array of the indices of the bits to be manipulated. Indices in the range 0-7 will
manipulate a data bit, while the index 8 will manipulate the stop bit. Higher index values
will cause the interbyte-space after the data byte to be manipulated. In this case, the
user should make sure that the interbyte-space is large enough.
numberOfDisturbedBits
An array specifying how many consecutive bits shall be inverted at the specified locations.
level
arrSize
The number of elements in the above arrays. This value should not be greater than the
size of the smallest array.
numberOfExecutions
The number of consecutive headers in which the bit inversions will be executed.
disturbAfterHeaderID
With this parameter and the next one it is possible to define exactly which header will be
disturbed. The LIN hardware will first wait for a header with ID = disturbAfterHeaderID
before additionally awaiting the number of headers defined by waitForHeaders. The next
header following these headers will then be disturbed.
For example: To disturb the next header directly after a header with the ID=5, set the
<disturbAfterHeaderID> parameter to 5 and the <waitForHeaders> to 0.
waitForHeaders
6.1 • LIN — •
• Real bus mode
Example
on key 'i'
{
dword byteIndices[2] = { 0, 1}; // invert in sync field and in id-byte
dword bitIndices[2] = { 0, 0 }; // invert the first data bits in each
byte
dword numberOfDisturbedBits[2] = { 1, 2 }; // invert 1 bit in sync
field, 2 bits in id-byte
,dword levels[2] = { 0, 1 }; // push sync field bit to dominant, id-byte
bits to recessive
if (0!=linInvertMultipleHeaderBits(byteIndices, bitIndices,
numberOfDisturbedBits, levels, 2))
{
}
}
linInvertMultipleRespBits
CAPL Function Overview » LIN » linInvertMultipleRespBits
Function Inverts the multiple bits in specified locations in the next LIN header.
Info
Some driver versions only support inverting multiple (consecutive) bits in one
position (arrSize == 1).
Parameters frameID
byteIndices
An array of the indices of the bytes to be manipulated (use 0 for the first byte). If an
index is equal to the frame’s length, then the checksum byte will be manipulated. An
index larger than the frame length is invalid.
bitIndices
An array of the indices of the bits to be manipulated. An index in the range 0-7 will
manipulate a data bit, while the index 8 will manipulate the stop bit. Higher index values
will cause the interbyte-space after the data byte to be manipulated. In this case, the
user should make sure that the interbyte-space is large enough.
numberOfDisturbedBits
An array specifying how many consecutive bits shall be inverted at the specified
locations.
levels
arrSize
The number of elements in the above arrays. This value should not be greater than the
size of the smallest array.
numberOfExecutions
The number of consecutive frames with the specified identifier in which the bit inversions
will be executed.
6.1 • LIN — •
• Real bus mode
Example
// Invert response bits on keyboard event
on key 'i'
{
dword byteIndices[2] = { 1, 5 };
dword bitIndices[2] = { 0, 1 };
dword numberOfDisturbedBits[2] = { 1, 2 };
dword levels[2] = { 0, 1 };
...
// Invert first bit 0 of byte 1 to dominant and bits 1 and 2
// (numberOfDisturbedBits[1] is 2) of byte 5 to recessive
linInvertMultipleRespBits(0x33, byteIndices, bitIndices,
numberOfDisturbedBits, levels, 2);
...
}
linInvertRespBit
CAPL Function Overview » LIN » linInvertRespBit
Function This function inverts the specified bit when the next bus event for the specified ID occurs,
provided that the bus event contains the specified data byte.
Parameters frameID
byteIndex
The index of the byte to be manipulated (use 0 for the first byte). If the index is equal to
the frame’s length, then the checksum byte will be manipulated. An index larger than the
frame length is invalid.
bitIndex
The index of the bit to be manipulated. An index in the range 0-7 will manipulate a data
bit, while the index 8 will manipulate the stop bit. Higher index values will cause the
interbyte-space after the data byte to be manipulated. In this case, the user should make
sure that the interbyte-space is large enough.
level
numberOfExecutions
The number of consecutive frames with the specified identifier in which the bit inversion
will be executed.
eportFallingEdges
Flag indicating whether timestamps of the falling edges in the resulting pseudo-byte have
to be reported. The timestamps can be retrieved by calling
linGetFallingEdgesOfDisturbedByte.
0: Deactivate report
1: Activate report
5.1 • LIN — •
• Real bus mode
Example
| linInvertHeaderBit | linDeactivateBitInversion |
linInvertRespBitEx
CAPL Function Overview » LIN » linInvertRespBitEx
Function Inverts the specified number of 1/16th bits at the specified position in the next LIN
message’s response with the specified frame ID.
Parameters frameID
byteIndex
0: Sync Byte
1: ProtectedId Byte
bitIndex
The index of the bit to be manipulated. An index in the range 0-7 will manipulate a data
bit, while the index 8 will manipulate the stop bit. Higher index values will cause the
interbyte-space after the data byte to be manipulated. In this case, the user should make
sure that the interbyte-space is large enough.
bitOffsetInSixteenthBits
distLengthInSixteenthBits
Level
numberOfExecutions
The number of consecutive headers in which the bit inversion will be executed.
reportFallingEdges
Flag indicating whether timestamps of the falling edges in the resulting pseudo-byte have
0: Deactivate report
Example
on key 'i'
{
if (0!=linInvertRespBitEx(42, 1, 0, 8, 8, 0))
{
// in the next response of lin frame 42 invert the second half of the
first bit of the first data byte (the bit has to be recessive)
}
}
| linInvertHeaderBitEx |
linIsFlashModeActive
CAPL Function Overview » LIN » linIsFlashModeActive
Function This function reports the flash mode state on high speed capable transceivers.
Parameters —
Example
// test case for disturbing parts of a bit
// note, that test cases can only be used in the context of test module
nodes
testcase tcDisturbPartialBit()
{
dword flashModeActive;
flashModeActive = 0;
do
{
if (!linActivateFlashMode(1)) // request activation of flash mode
{
break; // if the request has been denied, either the cab/piggy is
incapable of
// flash mode or the scheduler is still running
}
testWaitForTimeout(10); // give the hardware time to activate the
flash mode
flashModeActive = linIsFlashModeActive(); // check if flash mode has
been
// activated successfully
} while (!flashModeActive);
if (!flashModeActive)
{
testStepFail(“tcDisturbPartialBit”, “Flash mode could not be
activated because of active scheduler or because the cab/piggy does not
support flash mode.”);
return;
}
...
}
| linActivateFlashMode |
linMeasEdgeTimeDiffs
CAPL Function Overview » LIN » linMeasEdgeTimeDiffs
Function This function activates the measurement of the falling edges of the specified bytes in the
next message with the correct id if specified or in the next message if no id was
specified. The measured values can be queried with LINGetMeasEdgeTimeDiffs.
Parameters numIndices
indices
An array containing the indices of the bytes to be measured. Note that the minimum
size for this array is numIndices.
id
6.1 • LIN — •
• Real bus mode
Example
// Test case for measuring edges of a number of data bytes of a LIN frame.
// Note: This test case can only be used in the context of test module
nodes
testcase tcMeasureEdges(int byteIndex)
{
long indices[1];
float timeDiffs[4];
dword numDiffs;
indices[0] = byteIndex;
// set request to measure the edges of the specified byte of the frame
with ID=0x33
linMeasEdgeTimeDiffs(1, indices, 0x33);
// wait maximum 1000 [ms] for frame with ID=0x33
waitResult = TestWaitForMessage(0x33, 1000);
// declare failure if Wait has resumed not due to expected event
if (1 != waitResult)
{
TestStepFail("Test1.1","Expected frame has not occurred during 1000
ms!");
}
// retrieve measured edges
numDiffs = LINGetMeasEdgeTimeDiffs(4, timeDiffs);
if (numDiffs == 0)
{
TestStepFail("Test1.1", "Failed to measure edges!");
}
else
{
TestStepPass("Test 1.1", "Edge measurement done...");
}
| linGetMeasEdgeTimeDiffs |
linMeasHeaderBaudrate
CAPL Function Overview » LIN » linMeasHeaderBaudrate
Function With this function it is possible to set request to measure the baud rate value for next LIN
header event. Channel, where the baud rate is measured, is determined by the CAPL
program context.
This function only initiates the baud rate measurement. The result becomes available
when the next LIN header occurs and it remains valid until next measurement request. To
retrieve the result the function linGetMeasBaudrate() shall be used.
Info
When LIN hardware is in Master mode calling this function will have no
effect.
Parameters index
This parameter specifies a field of LIN header which will be used for baud rate
measurement.
0: Synch field
1: Identifier field
5.1 LIN — •
Example
Test case for measuring baud rate using LIN header event
testcase tcMeasureHeaderBaudrate ()
{
long waitResult, measBaudrate;
// set request to measure baudrate according to Synch field of a LIN header
linMeasHeaderBaudrate(0);
// wait maximum 1000 [ms] for LIN header with identifier 0x33
waitResult = TestWaitForLinHeader(0x33, 1000);
// declare failure if Wait has resumed not due to expected event
if (1 != waitResult)
{
TestStepFail("Test 1.1","No LIN header with ID=0x33 occurred during 1000
ms!");
}
// retrieve measured baudrate
measBaudrate = linGetMeasBaudrate();
if (-1 == measBaudrate)
{
TestStepFail("Test 1.1", "Failed to measure header baudrate!");
}
TestStepPass("Test 1.1", "Header baudrate measurement done...");
}
Info
These test cases can only be used in the context of test module nodes
linMeasRespBaudrate
CAPL Function Overview » LIN » linMeasRespBaudrate
Function With this function it is possible to set request to measure the baud rate value according
to a certain data byte of a certain LIN frame. Channel, where the baud rate is measured,
is determined by the CAPL program context.
This function only initiates the baud rate measurement. The result becomes available
when the next bus event for the specified ID occurs and it remains valid until next
measurement request. To retrieve the result the function linGetMeasBaudrate() shall be
used.
Info
Baud rate can be measured only if the specified data byte field contains at
least one falling edge i.e. there has to be at least one recessive bit followed
by a dominant one. For example, value 0x80 is not a valid one.
Parameters frameID
index
Value range: 0..N, where N = length [in bytes] of specified LIN frame
5.1 • LIN — •
• Real bus mode
Example
Test case for measuring baud rate using certain data byte of a LIN frame.
testcase tcMeasureDatabyteBaudrate (int byteIndex)
{
long waitResult, measBaudrate;
// set request to measure baudrate using the specified byte of a frame with
ID=0x33
linMeasRespBaudrate(0x33, byteIndex);
// wait maximum 1000 [ms] for a frame with ID=0x33
waitResult = TestWaitForMessage(0x33, 1000);
// declare failure if Wait has resumed not due to expected event
if (1 != waitResult) {
TestStepFail("Test 1.1","Expected frame has not occurred during 1000 ms!");
}
// retrieve measured baudrate
measBaudrate = linGetMeasBaudrate();
if (-1 == measBaudrate)
{
TestStepFail("Test 1.1", "Failed to measure response baudrate!");
}
TestStepPass("Test 1.1", "Response baudrate measurement done...");
}
Info
These test cases can only be used in the context of test module nodes
output
CAPL Function Overview » LIN » output
• To apply frame header on the bus, i.e. to transmit the frame. In that case RTR
selector has to be set to 1.
• To reconfigure response data of LIN frame. In that case RTR selector has to be set to
0. The LIN hardware responds to the next request of the specified frame with the
newly configured data.
• If working without a database it is necessary to configure a message in the handler on
prestart. The configuration is done via the output function.
Parameters Msgext
Variable of type linmessage. List of available selectors for this type of objects can be
found under linMessage selectors.
Return values —
3.2 LIN • •
Example
linmessage MotorControl frameMotorControl;
...
// Reconfigure response of the frame defined in database linmessage
MotorControl frameMotorControl;
frameMotorControl.RTR = 0;
frameMotorControl.byte(0)=0xDF;
frameMotorControl.byte(1)=0x20;
output(frameMotorControl);
...
// Send the frame header
frameMotorControl.RTR = 1;
output(frameMotorControl);
...
// Function to set response on channel 2 for any frame.
// The specified frame might not be defined in database.
void SetFrameResponse(byte frameID, byte frameSize)
{
int index;
linmessage 0x0 frame = {msgChannel=2}; // define frame object on channel 2
// Setting frame size in run-time possible only with this function
linChangeDLC(frameID, frameSize);
frame.ID = frameID; // set specified frame ID
// initialize data byte fields
for (index=0; index < frameSize; ++index)
{
frame.byte(index) = 0xFF;
}
// issue request to update the configured response
frame.RTR = 0;
output(frame);
linSetRespCounter(frameID, -1); // enable unlimited number of responses
}
...
// Configuring a message in on prestart when working without database.
linmessage 0x20 aLinMsg;
output(aLinMsg);
Info
When LIN hardware is not in Master mode calling this function will have no effect.
linResetManualChecksum
CAPL Function Overview » LIN » linResetManualChecksum
Function Sets the correct checksum of a LIN frame, whose checksum has been changed by using
linSetManualChecksum() function. The checksum is calculated using the frame data.
Parameters linFrame
LIN frame for which the correct checksum will be used again.
Return values —
6.0 LIN • •
Example
linResetMaxHeaderLength
CAPL Function Overview » LIN » linResetMaxHeaderLength
Function Resets the maximum header length to the protocol version dependent default.
Parameters —
7.0 • LIN — •
• Real bus mode
Example
| linSetMaxHeaderLength |
linResetNAD
CAPL Function Overview » LIN » linResetNAD
Function This function resets NAD (Node Address for Diagnostic) of the Slave node determined by
the CAPL program context to its initial NAD.
See Option .LIN: Notes to the way initial NAD is determined to understand how initial NAD
is determined in CANoe.
Info
If the CAPL program calling this function, does not model a LIN 2.x Slave
node, then this function will have no effect.
Parameters —
Return values On success this function returns a value unequal to -1, otherwise -1.
5.1 LIN — •
Example
linResetRespBaudrate
CAPL Function Overview » LIN » linResetRespBaudrate
Function Resets a response baudrate for a specified frame to the master baudrate.
Parameters frameId
The identifier of the frame for which the response baudrate will be reset.
7.0 • LIN — •
• Real bus mode
Example
| linSetRespBaudrate |
linResetRespBitStream
CAPL Function Overview » LIN » linResetRespBitStream
Parameters frameId
6.0 • LIN — •
• Real bus mode
Example
| linSetRespBitStream |
linResetRespDisturbance
CAPL Function Overview » LIN » linResetRespDisturbance
Function Deactivates the disturbance in the response space of the specified frame.
Parameters frameId
6.0 • LIN — •
• Real bus mode
Example
| linSetRespDisturbance |
linResetScopeTrigger
CAPL Function Overview » LIN » linResetScopeTrigger
Info
If this function is called from on-prestart part of the CAPL-program, then this
function will have no effect.
Parameters —
6.0 • LIN — •
• Real bus mode
Example
| linSetScopeTrigger |
linResetSlave
CAPL Function Overview » LIN » linResetSlave
Function This function resets the NAD (Node Address for Diagnostic) of the modeled Slave node and
marks all its protected identifiers as invalid or it will load the last saved configuration if
resetToLastConfiguration is set.
See Notes to the way initial NAD is determined to understand how initial NAD is
determined in CANoe.
Info
If the CAPL-program calling this function, does not model a LIN 2.x Slave
node, then this function will have no effect.
Parameters resetToLastConfiguration
Return values On success this function returns a value unequal to -1, otherwise -1.
5.1 LIN — •
Example
linSendAsSporadic
CAPL Function Overview » LIN » linSendAsSporadic
Function This function can be used to configure an associated frame as being ready for
transmission. At the next time slot, corresponding to its sporadic frame, the associated
frame will be sent once.
Info
Parameters frameID
5.0 LIN — •
Example
linSendBitStream
CAPL Function Overview » LIN » linSendBitStream
Parameters bitStream
numberOfBits
timeoutPrevention
5.2 • LIN — •
• Real bus mode
Example
++currentPosition;
}
}
currentPosition += delimiterLength; // set synch delimiter
// set sync byte
data[currentPosition >> 3] &= ~(1 << (currentPosition & 0x7)); // start bit
++currentPosition;
for (i = 0; i < 8; ++i)
{
if ((syncByte & (1 << i)) == 0) // dominant bit in syncByte
{
data[currentPosition >> 3] &= ~(1 << (currentPosition & 0x7));
}
++currentPosition;
}
++currentPosition; // set recessive stop bit
// set protected id
data[currentPosition >> 3] &= ~(1 << (currentPosition & 0x7)); // start bit
++currentPosition;
for (i = 0; i < 8; ++i)
{
if ((idByte & (1 << i)) == 0) // dominant bit in idByte
{
data[currentPosition >> 3] &= ~(1 << (currentPosition & 0x7));
}
++currentPosition;
}
++currentPosition; // set recessive stop bit
linSendBitStream(data, headerLength); // send created header
return headerLength;
}
linSendDominantSignal
CAPL Function Overview » LIN » linSendDominantSignal
Parameters lengthInMicroseconds
7.5 • LIN — •
• Real bus mode
Example
linSendHeaderError
CAPL Function Overview » LIN » linSendHeaderError
Function This function sends a header with the current sync break, sync delimiter and interbyte
space settings and the specified sync byte and id byte.
Info
If the LIN hardware is not in Master mode calling this function will have no
effect.
Parameters syncByte
idWithParity
Data value to be sent in the Protected Identifier field. The lower 6 bits specify the
identifier to be used. The upper 2 bits specify the identifier parity to be used. The
correct value can be calculated using the linGetProtectedID function.
StopAfterError
Specifies whether the transmission should be stopped after an error. If an incorrect synch
byte is set by this function and StopAfterError is 1, the identifier will not be sent.
A simulated message response (has to be activated independently) will generally not be
sent if there is an error in the header.
Example
// Force an error in header of LIN frame with ID=0x33 by setting wrong
protected ID
on key 'h'
{
byte linID, protectedID, corParity, errParity, errPID;
// calculate protected ID with wrong parity bits
linID = 0x33; // use frame ID=0x33
protectedID = linGetProtectedID(linID); // get protected ID
corParity = (protectedID & 0xC0) >> 6; // extract parity
(0xC=0=11000000)
errParity = (corParity ^ 0x2) & 0x3; // calculate wrong parity using XOR
errPID = linID | (errParity << 6); // calculate PID with wrong parity
linSendHeaderError(0x55, errPID, 0);
}
...
or
...
// Force an error in header of LIN frame with ID=0x33 by setting wrong
Synch byte
linSendHeaderError(0x50, linGetProtectedID(0x33), 0);
linSendSamplingTestHeader
CAPL Function Overview » LIN » linSendSamplingTestHeader
Function Sends a slave response header with the start bit of the id byte set to the specified length.
Parameters startBitLengthInMicSec
The length of the start bit in microseconds. The first data bit will be adjusted to ensure
that the start bit and the first data bit have a total length of two bit times.
7.0 • LIN — •
• Real bus mode
Example
linSendSleepModFrm
CAPL Function Overview » LIN » linSendSleepModFrm
Function This function leads to a transmission of a go-to-sleep-command. Frame identifier and data
byte values of that command depend on the used LIN specification:
Frame length is 8 bytes. The first data byte is set to 0, the other data bytes remain
not changed.
Calling this function in the event procedure on preStart (parameter silent = 1) leads to
measurement start in Sleep mode.
Parameters silent
When this flag is set the LIN hardware switches to Sleep mode without sending a go-to-
sleep-command before. By this way the LIN hardware can be switched to Sleep mode even
it is not the Master. So the BusIdle timeout is reduced.
Value range: 0 .. 1
restartScheduler
Determines if index of the slot to be started with after wakeup has to be reset, i.e. it
becomes 0. If it’s not reset the next slot before entering sleep mode is used
Value range: 0 .. 1
wakeupIdentifier
LIN frame identifier to be sent additionally directly after sending a wakeup signal.
3.1 LIN — •
Example
on preStart
{
linSendSleepModFrm(1, 0 , 0x1); // use 0x1 as wake-up identifier
}
or
// send go-to-sleep-command during measurement
...
linSendSleepModFrm(0, 0 , 0xFF); // explicit sleep frame, no wake-up
identifier
linSendVariableBitStream
CAPL Function Overview » LIN » linSendVariableBitStream
Function Sends an arbitrary bit stream with bits of variable length on the LIN bus.
Parameters dataBuffer
lengthInNS
numberOfBits
The number of bits in the bitStream-array. Note that while the dataBuffer-array will
usually have a size of ceil(numberOfBits / 8), the size of lengthInNS will need to be at
least numberOfBits
roundUp
If true, the lengths specified in lengthInNS will be rounded up to the next possible length
that can be transmitted by the LIN hardware, otherwise the lengths will be rounded
down.
timeoutPrevention
Example
// This function sends a disturbance of 1 second, followed by a pause of 1
second,
// followed by a disturbance of 7 seconds using the variable bit stream
functionality
void SendDisturbances()
{
byte data[1] = { 2 };
int64 lengthInNS[3] = { 1000000000LL, 1000000000LL, 7000000000LL };
linSendVariableBitStream(data, lengthInNS, 3, 1, 1); byte data[25];
}
| linSendBitStream |
linSendWakeup
CAPL Function Overview » LIN » linSendWakeup
Function This command is used to send Wakeup frames. Wakeup frames can only be sent while the
LIN hardware is in Sleep mode. If no parameters are given, the default values of the
parameters are used.
Info
When LIN hardware is not in Sleep mode calling this function will have no
effect.
Parameters ttobrk
This parameter specifies the time difference between the transmissions of two
consecutive Wakeup frames, i.e. the time between end of one wakeup frame and start of
the next one.
Units of this parameter as well as default value depend on the hardware settings (see
Hardware Configuration: LIN).
count
Default value depends on the hardware settings: see Hardware Configuration: LIN
length
This parameter sets the length of the wakeup frame to be sent in microseconds. The
resolution is 50 µs.
Default value depends on the hardware settings: see Hardware Configuration: LIN
3.1 LIN — •
Example
{
linSendWakeup();
}
or
// simulate LIN 2.0 “slow” Master
...
// configure LIN hardware to wakeup after 3 wakeup frames and to send first
header
// 100 ms after wakeup
linSetWakeupParams(100, 3);
// send wakeup frame 3 times with 150 ms delay between 2 consecutive frames
linSendWakeup(150, 3);
...
linSetBaudrate
CAPL Function Overview » LIN » linSetBaudrate
Function With this function it is possible to change the baud rate during the measurement.
Info
Parameters baudrate
minBaudrate
maxBaudrate
Return values —
5.1 • LIN — •
• Real bus mode
Example
| linMeasHeaderBaudrate | linMeasRespBaudrate |
linSetBaudrateDetectionRange
CAPL Function Overview » LIN » linSetBaudrateDetectionRange
Function With this function the baud rate detection range can be increased or decreased. The
default range is +/- 15%. Note that the detection range will always be symmetrical.
Parameters rangeInPercent
Default: 15
6.0 LIN — •
Example
| linSetBaudrate |
linSetBreakLength
CAPL Function Overview » LIN » linSetBreakLength
Function With this function it is possible to change length of break/synch symbol parts. Particularly
the length of its synch break (dominant bits) and its synch delimiter (recessive bits).
The version using float parameters allows setting the break and delimiter lengths in
increments of 1/16th bits, but the unit still is bit times (i.e. linSetBreakLength(14.5, 2.5)
will set a break length of 14 8/16th bit times and a delimiter length of 2 8/16th bit times).
Note that setting non-integer break and delimiter lengths is not supported by every
hardware.
Info
When LIN hardware is not in Master mode calling this function will have no
effect.
Parameters syncBreakLen
Default value: 18
syncDelLen
Default value: 2
• syncBreakLength >= 13
• syncDelimiterLength >= 1
5.1 LIN — •
Example
linSetBusIdleTimeout
CAPL Function Overview » LIN » linSetBusIdleTimeout
Function This function sets a new bus idle timeout. Depending on the protocol version, the timeout
will be specified in bit times (LIN 1.x and Cooling) or in milliseconds (all others).
Parameters timeout
The timeout in bit times (LIN 1.x and Cooling) or milliseconds (all other LIN protocols).
6.1 LIN — •
Example
| linGetBusIdleTimeout |
linSetChecksumError
CAPL Function Overview » LIN » linSetChecksumError
Function Sets/resets a checksum error of a LIN frame. The activated checksum error is then
constant and will not be affected by changes in the frame data.
Parameters frameId
activate
6.0 • LIN — •
• Real bus mode
Example
Cause check sum error for all LIN frames on the bus
on linMessage *
{
linSetChecksumError(this.id, 1);
}
| linGetChecksum |
linSetGlobalInterByteSpace
CAPL Function Overview » LIN » linSetGlobalInterByteSpace
Function With this function it is possible to change the inter-byte space for all frame responses.
Inter-byte space is the period between the end of the stop bit of the preceding byte and
the start bit of the following byte.
Info
This function affects only frames published by the modeled LIN node(s), i.e.
frames sent not by external hardware.
Parameters sixteenthBits
Length of the inter-byte space to set [in units of 1/16th of bit time].
For a LIN standard compliance: The maximum space between the bytes cannot exceed
40% duration compared to nominal transmission time.
5.1 • LIN — •
• Real bus mode
Example
on key 's'
{
if ( linSetGlobalInterByteSpace(16) != 0)
{
// from now on the inter-byte space in all frame responses is 1 bit time
...
}
}
linSetGlobalTimeoutPrevention
CAPL Function Overview » LIN » linSetGlobalTimeoutPrevention
Function Activates/deactivates the global timeout prevention for transceivers with a dominant
timeout. If active, the cab/piggy will use an inbuilt transistor to keep the bus signal at a
dominant level after the dominant timeout stopped the transceiver from transmitting a
dominant signal.
Parameters on
0: Disable
1: Enable
7.5 • LIN — •
• Real bus mode
Example
| linGetDominantTimeout |
linSetInterByteSpace
CAPL Function Overview » LIN » linSetInterByteSpace
Function With this function it is possible to set an inter-byte space for a specified frame and a
specified byte filed. The byte field may belong to the frame header as well as to the
frame response.
Inter-byte space is the period between the end of the stop bit of the preceding byte and
the start bit of the following byte.
Parameters frameID
index
Index of the byte field, in front of which the inter-byte space should be inserted.
0: Inter-byte is inserted between the Synch byte and the Identifier byte.
1: Inter-byte is inserted in front of the first data byte.
N+1: Inter-byte is inserted in front of the Checksum byte.
sixteenthBits
Length of the inter-byte space to set [in units of 1/16th of bit time].
For a LIN standard compliance: The maximum space between the bytes cannot exceed
40% duration compared to nominal transmission time.
5.1 • LIN — •
• Real bus mode
Example
on key 's'
{
if ( linSetInterByteSpace(0x33, 9, 32) != 0)
{
// from now on for frame ID=0x33 the inter-byte space between last data
byte field
// and Checksum byte is 2 bit times
...
}
}
linSetInterByteSpaces
CAPL Function Overview » LIN » linSetInterByteSpaces
Function With the first function it is possible to set the inter-byte spaces [in bit times] for all data
byte fields of all published frames (except for diagnostic frame 0x3D) of the calling LIN
Slave node.
With the second function it is possible to set the inter-byte spaces [in bit times] for all
data byte fields of a specified frame.
Inter-byte space is the period between the end of the stop bit of the preceding byte and
the start bit of the following byte.
Parameters frameID
Value range: 0 .. 63
arrayOfSixteenthBits[]
Array of 9 elements for inter-byte space lengths, when the length of the inter-byte space
is in units of 1/16th of bit time.
The first element specifies the inter-byte space before the first data byte. It continues in
the same manner until Checksum byte. All not used elements must be set to 0.
Value range for inter-byte lengthes: 0..65535. This corresponds to 0..4095.93 bit times.
For a LIN standard compliance: The maximum space between the bytes cannot exceed
40% duration compared to nominal transmission time.
5.1 • LIN — •
• Real bus mode
Example
on key 's'
{
int index;
dword arrayOfSixteenthBits[9];
linmessage MotorControl frameMotorControl;
for (index=0; index < 9; ++index)
{
if (index <= frameMotorControl.DLC+1) {
// for all valid data bytes and checksum byte set inter-byte space to 2 bit
times
arrayOfSixteenthBits[index] = 32;
}
else {
// initialize unused array elements
arrayOfSixteenthBits[index] = 0;
}
}
if (linSetInterByteSpaces(0x33, arrayOfSixteenthBits) != 0) {
// the inter-byte spaces successfully set
...
}
}
linSetInterframeSpace
CAPL Function Overview » LIN » linSetInterframeSpace
With this function it is possible to change the inter-frame space for all frames.
The inter-frame space is the time from the end of the frame until start of the next frame.
Info
If the LIN hardware is not in Master mode calling this function will have no
effect.
If large inter-frame space is set, the schedule slots time may be affected.
Parameters bitTimes
5.1 • LIN — •
• Real bus mode
Example
on key 's'
{
if (linSetInterframeSpace (200) != 0)
{
// from now on inter-frame space is minimum 200 bit times
...
}
}
linSetManualChecksum
CAPL Function Overview » LIN » linSetManualChecksum
Function Sets a checksum (that is usually not a correct one) for a LIN frame.Text
Parameters linFrame
csValue
Return values —
6.0 LIN • •
Example
...
linmessage MotorControl frmMotorControl;
linSetManualChecksum(frmMotorControl, 0x1A);
output(frmMotorControl); // it is important to call output() to make the
changes active
| linResetManualChecksum |
linSetMasterReqDirtyFlag
CAPL Function Overview » LIN » linSetMasterReqDirtyFlag
A MasterRequest in a send table will only be sent, if new data for that frame is available
or if the dirty flag has been set explicitly. Reconfiguration commands will always be sent.
Parameters dirty
5.2 LIN — •
Example
| linInvertHeaderBit | linInvertRespBit |
linSetMasterRequestDirtyFlag
CAPL Function Overview » LIN » linSetMasterRequestDirtyFlag
Function Sets the dirty flag for the LIN master request frame (frame identifier=0x3C). The master
request only gets transmitted when the dirty flag is set.
Info
The dirty flag also gets set implicitly with every data update on the master
request.
Parameters dirty
5.2 LIN — •
Example
linSetMaxHeaderLength
CAPL Function Overview » LIN » linSetMaxHeaderLength
Parameters bitTimes
The new maximum header length in bit times. Headers longer than the maximum header
length will be considered illegal. CANoe will not generate any response to these headers.
7.0 • LIN — •
• Real bus mode
Example
| linResetMaxHeaderLength |
linSetNAD
CAPL Function Overview » LIN » linSetNAD
Parameters nad
6.1 • LIN — •
• Real bus mode
Example
linSetOEMDataInd
CAPL Function Overview » LIN » linSetOEMDataInd
Info
This function can be used for OEM specific variant of LIN protocol only.
Function Sets/resets the data indication bit for a calling slave node.
Parameters active
0: set
1: reset
7.2 LIN — •
Example
linSetOEMDataIndTime
CAPL Function Overview » LIN » linSetOEMDataIndTime
Info
This function can be used for OEM specific variant of LIN protocol only.
Function Sets the time in milliseconds after which a simulated slave automatically sets its data
indication bit.
Parameters timeInMS
Time value.
Unit: milliseconds
7.2 LIN — •
Example
linSetOEMSleepInd
CAPL Function Overview » LIN » linSetOEMSleepInd
Info
This function can be used for OEM specific variant of LIN protocol only.
Function Sets/resets the sleep indication bit for a calling slave node.
Parameters active
0: set
1: reset
7.2 LIN — •
Example
| linCheckOEMSleepInd | linGetOEMSleepInd |
linSetOEMWakeupInd
CAPL Function Overview » LIN » linSetOEMWakeupInd
Info
This function can be used for OEM specific variant of LIN protocol only.
Function Sets/resets the wakeup indication bit for a calling slave node.
Parameters active
0: set
1: reset
7.2 LIN — •
Example
| linCheckOEMWakeupInd | linGetOEMWakeupInd |
linSetRespBaudrate
CAPL Function Overview » LIN » linSetRespBaudrate
Function Sets a response baudrate for a specified frame. This baudrate will be used for the
response, regardless of the master baudrate.
Parameters frameId
The identifier of the frame for which the response baudrate will be set.
baudrate
7.0 • LIN — •
• Real bus mode
Example
| linResetRespBaudrate |
linSetRespBitStream
CAPL Function Overview » LIN » linSetRespBitStream
Parameters frameId
bitStream
numberOfBits
timeoutPrevention
count
Number of times, the bit stream shall be sent as a response before deactivating itself.
6.0 • LIN — •
• Real bus mode
Example
bitStream[4] = 0x84;
bitStream[5] = 0x20;
bitStream[6] = 0x2;
bitStream[7] = 0x9;
bitStream[8] = 0x28;
bitStream[9] = 0xC0;
bitStream[10] = 0xA4;
bitStream[11] = 0x2;
numberOfBits = 90; // Each byte requires 10 bits (start bit + data bits +
stop bit)
if (0!=linSetRespBitStream(mMotorControl.id, bitStream, numberOfBits))
{
// for the next response of frame "MotorControl" is as specified
}
}
| linResetRespBitStream |
linSetRespCounter
CAPL Function Overview » LIN » linSetRespCounter
Function With this function it is possible to limit the number of responses sent for the specified
frame identifier.
With count = -1 a frame response is always sent when a correct frame header is received.
This is the default configuration for newly configured frames.
Parameters frameID
count
n-times: 0..254
unlimited: -1
5.0 LIN — •
Example
| linActivateResps | linDeactivateResps |
linSetRespDisturbance
CAPL Function Overview » LIN » linSetRespDisturbance
Function Activates a disturbance in the response space of the specified LIN frame. A normal
response by a simulated slave will be deactivated as long as the disturbance is active.
Info
The disturbance starts with the next occurrence of the specified frame. To
stop the disturbance the functions linResetRespDisturbance() shall be used.
Parameters frameId
lengthInBits
level
offsetInSixteenthBits
The offset [in 1/16th bits] of the disturbance relative to the end of the header, i.e. to the
PID byte.
6.0 • LIN — •
• Real bus mode
Example
On pressing 'c' key start corrupting the response space and the first databyte of the
response for LIN frame Motor1State_Cycl.
on key 'c'
{
linmessage Motor1State_Cycl mMotor1State_Cycl;
if (0!=linSetRespDisturbance (mMotor1State_Cycl.id, 1, 0, 20))
{
// for the next the first bit of the response space or of the first
databyte
// (if the response space is zero) is inverted from recessive to
dominant
}
}
| linResetRespDisturbance | linStartDisturbance |
linSetRespError
CAPL Function Overview » LIN » linSetRespError
Function Sets/resets the response error flag for a calling slave node.
Info
Parameters activate
0: reset
1: set
6.0 LIN — •
Example
linSetRespLength
CAPL Function Overview » LIN » linSetRespLength
Function This function can be used to configure how many data bytes of the frame response should
be sent. The frame’s length is not changed by this function.
To send a correct response the numberOfBytes should be set equal to DLC+1 i.e for the
frame data bytes and their checksum.
If the numberOfBytes is to set to a value larger than DLC + 1, then a complete response
is also sent.
If the numberOfBytes is set to a value smaller than DLC+1, then a receiving error will
occur or if numberOfBytes = 0 a transmission error.
Info
Parameters frameID
numberOfBytes
5.0 LIN — •
Example
linmessage MotorControl frameMotorControl;
...
if (linSetRespLength (frameMotorControl.ID, frameMotorControl.DLC) != 0) {
// from now on a receive error notified for the MotorControl frame
...
}
if (linSetRespLength (frameMotorControl.ID, 0) != 0)
{
// from now on a transmission error notified for the MotorControl frame
...
}
}
linSetRespTolerance
CAPL Function Overview » LIN » linSetRespTolerance
Parameters frameId
The identifier of the frame for which the response tolerance shall be set.
toleranceInPercent
7.0 • LIN — •
• Real bus mode
Example
| linResetMaxHeaderLength |
linSetSchedulerJitter
CAPL Function Overview » LIN » linSetSchedulerJitter
Function Sets/resets the jitter mode and the jitter of the LIN hardware scheduler. (the channel is
determined by the CAPL program context).
Info
If the Master node is not simulated or no schedule tables are defined, then
this function will have no effect.
Parameters mode
jitterInMicSecs
6.0 • LIN — •
• Real bus mode
Example
on key 'j'
{
if (0!=linSetSchedulerJitter(1))
{
// for the next LIN hardware scheduler will use jitter specified in the LDF
}
}
linSetScopeTrigger
CAPL Function Overview » LIN » linSetScopeTrigger
Function With these functions it is possible to define trigger conditions for an oscilloscope. If the
trigger conditions are satisfied, the LIN hardware will send an impulse on the sync cable.
The first function defines a single trigger condition for a valid frame or an error in a
response.
Info
If this function is called from on prestart part of the CAPL program, then
this function will have no effect.
Parameters ID
Identifier of the frame to be triggered on. The parameter is only evaluated for trigger
conditions after the ID field.
Position
eventCount
triggerCount
Number n, how often the trigger will be activated. For every trigger activation the
number of fulfilled trigger conditions (EventCount) has been occurred before, i.e. the
triggering starts after 1 time of EventCount, 2 times of EventCount...n times of
EventCount.
triggerMask
0 Sync break detection (about 9.6 bit times after start of sync break)
2 Start of sync field (beginning of start bit if sync break could not have been a 2.0
wakeup frame, end of start bit otherwise)
idMask
An array specifying the LIN identifiers on which to trigger. Bit 0 in byte 0 specifies id 0,
bit 0 in byte 1 specifies id 8, bit 3 in byte 5 specifies id 5 * 8 + 3 = 43, etc. The parameter
is only evaluated for trigger conditions after the ID field.
6.0 • LIN — •
• Real bus mode
Example
on key 'a'
{
long lresp;
long position=0;
| linResetScopeTrigger |
linSetValidBreakLimits
CAPL Function Overview » LIN » linSetValidBreakLimits
Function Sets limits for the accepted sync break and delimiter lengths. Any sync break and
delimiter outside of this range is considered invalid, resulting in a receive error. Note that
this function does not change the current sync break and delimiter length sent by a
simulated master. This function can also be called in slave mode to test an external
master.
This function does not change the header length restrictions of 47.6 bit times for LIN 2.x
and 49 bit times for LIN 1.x. This means that a header can still be invalid even if the
modified sync break and delimiter limits are met.
Parameters breakMin16thBits
The minimum legal sync break length, specified in units of 1/16th bit times.
breakMax16thBits
The maximum legal sync break length, specified in units of 1/16th bit times.
Range: 152 (9.5 bit times) – 784 (49 bit times), has to be greater than breakMin16thBits
delMin16thBits
The minimum legal sync delimiter length, specified in units of 1/16th bit times.
delMax16thBits
The maximum legal sync delimiter length, specified in units of 1/16th bit times.
6.1 • LIN — •
• Real bus mode
Example
| linSetBreakLength |
linSetWakeupParams
CAPL Function Overview » LIN » linSetWakeupParams
Function This command determines the conditions under which the LIN hardware can be
reactivated (leaves the Sleep mode).
Default wakeup delimiter depends on the hardware settings (see Hardware Configuration:
LIN) while the number of expected wakeup frames is 1.
Main use case for this function is to simulate slow Master, which does not wake up until
an expected Wakeup frame burst.
Info
When LIN hardware is not in Master mode calling this function will have no
effect.
Parameters WakeupDelimiter
This parameter specifies the wakeup delimiter length, i.e. the time between the end of
wakeup frame and the first sent header.
Units of this parameter as well as default value depend on the hardware settings (see
Hardware Configuration: LIN).
Value range:: 3..255 (ms or bit times)
NumberOfWakeupFrames
This parameter specifies the number of wakeup frames, after that the LIN hardware is
reactivated. If the value 0 is set, the LIN hardware will never leave the Sleep mode.
Value range: 0 .. 31
Default value: 1
3.1 LIN — •
Example
// simulate LIN 2.0 'slow' Master
...
// configure LIN hardware to wakeup after 3 wakeup frames and to send first
header
// 100 ms after wakeup
linSetWakeupParams(100, 3);
// send wakeup frame 3 times with 150 ms delay between 2 consecutive frames
linSendWakeup(150, 3);
...
| linSendWakeup | linSilentWakeup |
linSilentWakeup
CAPL Function Overview » LIN » linSilentWakeup
Function Wakes up the LIN bus without sending any wakeup frames.
Info
Parameters —
6.0 LIN — •
Example
| linSendWakeup |
linSimulateETFCollision
CAPL Function Overview » LIN » linSimulateETFCollision
Function This function can be used to cause collisions for next coming header(s) of an event-
triggered frame.
Parameters etfId
respLength
numCollisions
Databytes
Default: NULL
6.0 • LIN — •
• Real bus mode
Example
| linSetRespLength |
linStartDisturbance
CAPL Function Overview » LIN » linStartDisturbance
Note that disturbances shorter than 64 bit times cannot be stopped with
linStopDisturbance().
Parameters length
level
5.2 • LIN — •
• Real bus mode
Example
| linStopDisturbance | linSetRespDisturbance |
linStartScheduler
CAPL Function Overview » LIN » linStartScheduler
Function This function starts the internal scheduler, which begins a cyclical traversal of a last
configured schedule table.
If this is the first time the scheduler started the first found schedule table, i.e. the
schedule table with index 0, is used.
Calling this function before the measurement start is not necessary, since the scheduler is
started automatically.
Info
If the Master node is not simulated or no schedule tables are defined, then
this function will have no effect.
Parameters —
Return values —
3.2 LIN — •
Example
| linStopScheduler |
linStopDisturbance
CAPL Function Overview » LIN » linStopDisturbance
Function Stops the disturbance on the bus which is started with linStartDisturbance().
Parameters —
5.2 • LIN — •
• Real bus mode
Example
| linStartDisturbance |
linStopScheduler
CAPL Function Overview » LIN » linStopScheduler
Function This function stops the internal scheduler. This way a cyclical traversal of the current
schedule table is stopped.
Info
Parameters —
Return values —
3.2 LIN — •
Example
linTime2Bits
CAPL Function Overview » LIN » linTime2Bits
Function This function converts specified system times to bit times. The conversion is done using
the current baud rate on the channel determined by the CAPL program context.
Info
Calling this function with the explicit channel is only possible from a CAPL
program defined in the measurement setup of CANoe.
Parameters time
channel
5.1 LIN — •
6.0 LIN • •
Example
| linBits2Time |
linTime2Bits_ns
CAPL Function Overview » LIN » linTime2Bits_ns
Function This function converts specified system times to bit times. The conversion is done using
the current baud rate on the channel determined by the CAPL program context.
Info
Calling this function with the explicit channel is only possible from a CAPL
program defined in the measurement setup of CANoe.
Parameters time
channel
7.0 LIN • •
Example
| linBits2Time_ns |
on linBaudrateEvent
CAPL Function Overview » LIN » on linBaudrateEvent
Function The event procedure on linBaudrateEvent is called when the LIN hardware has
successfully measured the baud rate of an external master or if the baud rate deviates by
more than 0.5% from the last reported value. This only occurs if an external master is being
used (in which case the LIN hardware is running in Slave mode).
The keyword this and the selectors can be used to access the data of the event that has
just been received.
Selectors linBaudrateEvent
5.0 LIN • •
Example
on linCsError
CAPL Function Overview » LIN » on linCsError
Function The event procedure on linCsError is called when a frame was transmitted without a
failure, but with an incorrect checksum.
The keyword this and the selectors (see Option .LIN: linCsError selectors) can be used to
access the data of the event that has just been received.
Parameters linCsError
5.0 LIN • •
Example
| LINGetChecksum | LINSetChecksumError |
on linDlcInfo
CAPL Function Overview » LIN » on linDlcInfo
Function The event procedure on linDlcInfo is called when the LIN hardware has successfully
measured the length of an unknown frame. This only occurs when the LIN hardware is in
Slave mode.
In Master mode, when no deviating values are specified by the database or CAPL functions,
the LIN hardware assumes the frame length derived from the frame identifier.
The keyword this and the selectors can be used to access the data of the event that has
just been received.
Selectors linDlcInfo
5.0 LIN • •
Example
on linMessage
CAPL Function Overview » LIN » on linMessage
Note
Function The event procedure on linMessage is called on the receipt of a valid LIN frame.
The keyword this and the selectors (see LIN: linMessage selectors) can be used to access
the data of the frame that has just been received.
CAPL nodes are by default not transparent to LIN frames. This means that a CAPL node in
the evaluation branch of the measurement setup will block the data flow to its right side. To
propagate the received frame to a next node in a chain a call to output(this) can be used.
However, please note that such a call from a CANoe's simulation setup node may lead to a
recursion.
Info
Selectors linMessage
5.0 LIN • •
Example
Display in Write window the transmission time for a frame from the database
on linMessage MotorControl
{
writeLineEx(1, 1, "Entire frame transmission time: %d bit times",
this.LIN_Fulltime);
}
Display in Write window the header transmission time for a frame ID=0x33
on linMessage 0x33
{
writeLineEx(1, 1, "Frame header transmission time: %d bit times",
this.LIN_HeaderTime);
}
on linReceiveError
CAPL Function Overview » LIN » on linReceiveError
Function The event procedure on linReceiveError is called when an error occurred during a frame
transmission. The exact reason of the error is specified by lin_StateReason selector.
The keyword this and the selectors can be used to access the data of the event that has
just been received.
Selectors linReceiveError
5.0 LIN • •
Example
linmessage MotorControl frmMotorControl;
...
// Simulate Receive Error by setting wrong response length
if (linSetRespLength (frmMotorControl.ID, frmMotorControl.DLC) != 0)
{
// from now on a receive error notified for the MotorControl frame
...
}
...
// Handle the error
on linReceiveError
{
int state, reason;
if (this.lin_ShortError != 0)
{
// The received data was too short. No additional info is available.
...
}
else
{
// extract identifier of LIN hardware state at the time the error has
occurred
state = this.lin_StateReason & 0x0F;
// extract identifier of reason caused the error
reason = this.lin_StateReason & 0xF0;
...
}
}
on linSchedulerModeChange
CAPL Function Overview » LIN » on linSchedulerModeChange
Function The event procedure on linSchedulerModeChange is called when modeled LIN Master
switches from the current schedule table to another one. This only occurs when the LIN
hardware is in Master mode.
The keyword this and the selectors can be used to access the data of the event that has
just been received.
Selectors linSchedulerModeChange
5.0 LIN • •
Example
on linSlaveTimeout
CAPL Function Overview » LIN » on linSlaveTimeout
Function This procedure is called for SlaveTimeouts. The timeout of an FSM status can be set with
LINSlFSMSetStTO.
The time stamp of the timeout with which the global time base was synchronized on the PC
(CAN hardware or PC system clock).
The time stamp must be used if you want to take into consideration time relations with
events from other sources. This time stamp is also generated in the Trace Window.
Unit:10 microseconds.
Unit: 10 microseconds.
Status of MsgOrigTime:
Write protected!
5.0 LIN • •
Example
on linSleepModeEvent
CAPL Function Overview » LIN » on linSleepModeEvent
Note
Function The event procedure on linSleepModeEvent is called when the wake status of the LIN
hardware changes.
The keyword this and the selectors can be used to access the data of the event that has
just been received.
Selectors linSleepModeEvent
5.0 LIN • •
Example
on linSyncError
CAPL Function Overview » LIN » on linSyncError
Function The event procedure on linSyncError is called when the LIN hardware was unable to
become synchronized to an external master.
The keyword this and the selectors can be used to access the data of the event that has
just been received.
Selectors linSyncError
5.0 LIN • •
Example
on linTransmError
CAPL Function Overview » LIN » on linTransmError
The keyword this and the selectors (see Option .LIN: linTransmError selectors) can be used
to access the data of the event that has just been received.
Selectors linTransmError
5.0 LIN • •
Example
on linWakeupFrame
CAPL Function Overview » LIN » on linWakeupFrame
Note
Function The event procedure on linWakeupFrame is called when the LIN hardware detects a wakeup
signal on the bus.
The keyword this and the selectors can be used to access the data of the event that has
just been received.
Selectors linWakeupFrame
5.0 LIN • •
Example
linBaudrateEvent Selectors
CAPL Function Overview » LIN » linBaudrateEvent Selectors
Time Time stamp synchronized with the global time base on dword read only
the PC (CAN hardware or PC system clock).
Unit: 10µs
Time_ns Time stamp synchronized with the global time base on int64 read only
the PC (CAN hardware or PC system clock).
Unit: nanoseconds
MsgOrigTime Time stamp generated by the LIN hardware. This time dword read only
stamp is unsynchronized with the global time base on
the PC and thus still original. It can be used to compare
the time of two LIN hardware generated events.
Unit: 10µs
Unit: bits/sec.
linCsError Selectors
CAPL Function Overview » LIN » linCsError Selectors
Time Time stamp synchronized with the global time base on dword read only
the PC (CAN hardware or PC system clock).
Unit: 10µs
Time_ns Time stamp synchronized with the global time base on int64 read only
the PC (CAN hardware or PC system clock).
Unit: nanoseconds
MsgOrigTime Time stamp generated by the LIN hardware. This time dword read only
stamp is unsynchronized with the global time base on
the PC and thus still original. It can be used to compare
the time of two LIN hardware generated events.
Unit: 10µs
DLC Number of data bytes contained in the frame (Data byte read only
Length Code).
MsgChannel Channel through which the checksum error has been word read only
received.
SIMULATED This flag specifies whether the frame was simulated. byte read only
Values:
0: Not simulated
1: Simulated
lin_FsmID Identifier of the FSM that transmitted the frame byte read only
response.
lin_FsmState The status, in which the FSM transmitted the frame byte read only
response.
Dword(x) Frame data double word (32 bit). dword read only
linDlcInfo Selectors
CAPL Function Overview » LIN » linDlcInfo Selectors
Time Time stamp synchronized with the global time base on dword read only
the PC (CAN hardware or PC system clock).
Unit: 10µs
Time_ns Time stamp synchronized with the global time base on int64 read only
the PC (CAN hardware or PC system clock).
Unit: nanoseconds
MsgOrigTime Time stamp generated by the LIN hardware. This time dword read only
stamp is unsynchronized with the global time base on
the PC and thus still original. It can be used to compare
the time of two LIN hardware generated events.
Unit: 10µs
DLC Measured number of data bytes (Data Length Code). byte read only
MsgChannel Channel through which the event was received. word read only
linHeader Selectors
CAPL Function Overview » LIN » linHeader Selectors
DLC Number of data bytes expected for the frame (Data Length Code). byte read only
linMessage Selectors
CAPL Function Overview » LIN » linMessage Selectors
Time Time stamp synchronized with the global time base on dword read only
the PC (CAN hardware or PC system clock).
Unit: 10µs
Time_ns Time stamp synchronized with the global time base on int64 read only
the PC (CAN hardware or PC system clock).
Unit: nanoseconds
MsgOrigTime Time stamp generated by the LIN hardware. This time dword read only
stamp is unsynchronized with the global time base on
the PC and thus still original. It can be used to compare
the time of two LIN hardware generated events.
Unit: 10µs
LIN_Fulltime Entire event transmission time (transmission of the byte read only
frame header by the master and waiting for the
maximum frame duration).
SIMULATED This flag specifies whether the frame was simulated. byte read only
Values:
0: Not simulated
1: Simulated
RTR This flag is only required when a frame is being sent byte
with output().
Meaning:
0: Response data will be reconfigured.
1: Frame header is applied to the bus - only works with
the LIN hardware in Master mode.
linReceiveError Selectors
CAPL Function Overview » LIN » linReceiveError Selectors
Time Time stamp synchronized with the global time base on dword read only
the PC (CAN hardware or PC system clock).
Unit: 10µs
Time_ns Time stamp synchronized with the global time base on int64 read only
the PC (CAN hardware or PC system clock).
Unit: nanoseconds
MsgOrigTime Time stamp generated by the LIN hardware. This time dword read only
stamp is unsynchronized with the global time base on
the PC and thus still original. It can be used to compare
the time of two LIN hardware generated events.
Unit: 10µs
LIN_Fulltime Entire event transmission time (transmission of the byte read only
frame header by the master and waiting for the
maximum frame duration).
lin_ShortError Specifies the detail level of the event. byte read only
lin_StateReason The lower 4 bits indicate the LIN hardware state at the byte read only
time the error has occurred, while the upper 4 bits
indicate the reason of the error.
0 Bus idle
4: DLC 0
12: DLC 8 - the checksum byte.
0 Timeout
4 Unidentified error.
lin_OffendingByte The byte that resulted the protocol violation. byte read only
lin_FsmID Identifier of the FSM that transmitted the frame byte read only
response.
lin_FsmState The status, in which the FSM transmitted the frame. byte read only
Only valid if lin_ShortError is not set.
linSchedulerModeChange Selectors
CAPL Function Overview » LIN » linSchedulerModeChange Selectors
Time Time stamp synchronized with the global time base on dword read only
the PC (CAN hardware or PC system clock).
Unit: 10µs
Time_ns Time stamp synchronized with the global time base on int64 read only
the PC (CAN hardware or PC system clock).
Unit: nanoseconds
MsgOrigTime Time stamp generated by the LIN hardware. This time dword read only
stamp is unsynchronized with the global time base on
the PC and thus still original. It can be used to compare
the time of two LIN hardware generated events.
Unit: 10µs
lin_NewMode Index of the newly activated schedule table. byte read only
linSleepModeEvent Selectors
CAPL Function Overview » LIN » linSleepModeEvent Selectors
Time Time stamp synchronized with the global time base on dword read only
the PC (CAN hardware or PC system clock).
Unit: 10µs
Time_ns Time stamp synchronized with the global time base on int64 read only
the PC (CAN hardware or PC system clock).
Unit: nanoseconds
MsgOrigTime Time stamp generated by the LIN hardware. This time dword read only
stamp is unsynchronized with the global time base on
the PC and thus still original. It can be used to compare
the time of two LIN hardware generated events.
Unit: 10µs
lin_WasAwake Indicates which status the LIN hardware was in before byte read only
the LinSleepModeEvent occurred:
lin_IsAwake Indicates the current state of the LIN hardware: byte read only
lin_External Indicates whether the change of state is the result of byte read only
lin_Reason This value indicates the reason for an event. A variety of byte read only
values can be transferred.
General values:
0: Start state
linSyncError Selectors
CAPL Function Overview » LIN » linSyncError Selectors
Time Time stamp synchronized with the global time base on dword read only
the PC (CAN hardware or PC system clock).
Unit: 10µs
Time_ns Time stamp synchronized with the global time base on int64 read only
the PC (CAN hardware or PC system clock).
Unit: nanoseconds
MsgOrigTime Time stamp generated by the LIN hardware. This time dword read only
stamp is unsynchronized with the global time base on
the PC and thus still original. It can be used to compare
the time of two LIN hardware generated events.
Unit: 10µs
lin_SyncInterval [x] Time intervals detected between the falling signal edges word
of the Synch field. The expected time interval between
consecutive falling signal edges is 2 bit times. After the
first failure interval has been seen the rest of array
elements are initialized to 0.
Unit: Microsecond
linTransmError Selectors
CAPL Function Overview » LIN » linTransmError Selectors
Time Time stamp synchronized with the global time base on dword read only
the PC (CAN hardware or PC system clock).
Unit: 10µs
Time_ns Time stamp synchronized with the global time base on int64 read only
the PC (CAN hardware or PC system clock).
Unit: nanoseconds
MsgOrigTime Time stamp generated by the LIN hardware. This time dword read only
stamp is unsynchronized with the global time base on
the PC and thus still original. It can be used to compare
the time of two LIN hardware generated events.
Unit: 10µs
LIN_Fulltime Entire event transmission time (transmission of the byte read only
frame header by the master and waiting for the
maximum frame duration).
MsgChannel Channel through which the event was received. word read only
lin_FsmID Identifier of the FSM that had to send frame response. byte read only
lin_FsmState The status the FSM is currently in and in which it did not byte
transmit the frame response.
linWakeupFrame Selectors
CAPL Function Overview » LIN » linWakeupFrame Selectors
Time Time stamp synchronized with the global time base on dword read only
the PC (CAN hardware or PC system clock).
Unit: 10µs
Time_ns Time stamp synchronized with the global time base on int64 read only
the PC (CAN hardware or PC system clock).
Unit: nanoseconds
MsgOrigTime Time stamp generated by the LIN hardware. This time dword read only
stamp is unsynchronized with the global time base on
the PC and thus still original. It can be used to compare
the time of two LIN hardware generated events.
Unit: 10µs
lin_External indicates whether the wakeup signal was byte read only
On selecting a LIN channel in the hardware configuration dialog, important parameters for the connected
hardware such as hardware type and firmware version are displayed on the right. Underneath further
hardware settings are displayed:
• Protocol
• Baudrate
• Master Mode
• Master Resistor
The values for these settings are extracted from the LIN database assigned to the channel being displayed.
If no database is currently assigned or the database settings should be overwritten, you can select these
settings manually.
To overwrite the database settings, please activate the Override DB settings option.
LIN 1.x
LIN 2.x
OEM variant
SAE-J2602
Cool-LIN
| linSendWakeup | linSetWakeupParams |
If initial NAD is not explicitly specified in the associated database some heuristic is used to determine it.
By default, the configured NAD (an attribute defined in the associated database) is taken. If there are
schedule tables defined they are searched for corresponding AsssignNAD command and initial NAD is
extracted from the parameters of that command.
To bypass these limitations, the 7259mag-cab and the 7259mag-piggy contain an auxiliary circuit that is
able to keep the bus level dominant. When using this auxiliary circuit, however, LIN conformant signal
edges can not be guaranteed, particularly for the rising edge of a dominant signal that is longer than 6 ms.
MOST50
MostAmsOutput Definition and direct dispatch of an AMS message using the syntax from the
MOST specification and the description in the XML function catalog.
MostAllocTableGetCL Returns the connection label of the respective entry in the allocation table.
MostAllocTableGetSize Returns the number of entries (connection labels) in the allocation table.
MostAllocTableGetWidth Returns the number of channels of the respective entry (connection label) in
the allocation table.
MostAmsSetSizePrefixed Configures the minimum length of an AMS message above which the size
prefixed mode is used.
MostSetSyncAudio Programs the routing engine for the audio input or output of the MOST
interface.
MostSetSyncSpdif Programs the routing engine for S/PDIF input or output of the MOST interface.
MOST150
OutputMostEthPktThis Passes the Ethernet packet on to the next node in the nodal
sequence.
mostConfigureEclSequence Defines a signal sequence for the Electrical Control Line and
prepares the hardware to start the generation.
mostEthPktSetTraceColors Sets the text and background color for displaying the MOST
event in the trace window.
mostSetEclGlitchFilter Configures the timing of the glitch filter for the ECL line.
MostSetSyncAudio Programs the routing engine for the audio input or output of
the MOST interface.
MostSetSyncSpdif Programs the routing engine for S/PDIF input or output of the
MOST interface.
MostPktOrigTime Returns the hardware generated time stamp of the packet event.
MostPktIsSpy Returns wether the packet was received over the Spy of the
asynchronous channel.
Hardware API
mostConfigureEclSequence Defines a signal sequence for the Electrical Control Line and
prepares the hardware to start the generation.
mostSetEclGlitchFilter Configures the timing of the glitch filter for the ECL line.
MostGetEclTermination Returns the current setting of the Electrical Control Line resistor.
MostSetOwnAdr Sets the node and group address of the MOST interface.
MostGetNodePosAdr Returns the current node position address of the MOST interface.
MostGetLockEx Returns the current lock status (unlock, lock, stable lock, critical
unlock).
MostGetMPR Returns the current value of the MPR register (number of nodes in
the ring).
MostGetNPR Returns the current value of the NPR register (current node position
in the ring).
MostGetNceType Returns the type of NCE (can only be called within OnMostMPR).
Bypass Mode
Timing Mode
Spy Mode
MostSetSpyEthPkt Disables or enables the Ethernet packet spy of the MOST interface.
MostGetSpyAsync Returns the current asynchronous spy status of the MOST interface.
MostGetSpyCtrl Returns the current control spy status of the MOST interface.
MostGetSpyEthPkt Returns the current Ethernet packet spy status of the MOST
interface.
Stress Mode
MostConfigureBusloadAsync Configures the bus load generator for the asynchronous channel.
MostConfigureBusloadCtrl Configures the bus load generator for the control channel.
MostConfigureBusloadEthPkt Configures the bus load generator for the Ethernet channel.
MostGenerateBusloadEthPkt Configures the bus load generator for the Ethernet channel.
MostSetTxLightPower Sets the intensity of the light at the Fiber Optical Transmitter (FOT).
Audio
MostSetSyncAudio Programs the routing engine for the audio input or output of the
MOST interface.
MostSetSyncVolume Sets the volume of the audio input or output of the MOST interface.
MostGetSyncMute Returns the current mute status of the audio input or output of the
MOST interface.
MostGetSyncVolume Returns the current volume of the audio input or output of the MOST
interface.
S/PDIF
MostSetSyncSpdif Programs the routing engine for S/PDIF input or output of the MOST
interface.
MostSetSyncSpdifLock Llocks the internal S/PDIF timing generator on the S/PDIF input data
stream.
Other
Registering/ Unregistering
MostApUnregister Removes the function block assigned to a CAPL node from the
Application Socket.
MostApUnregisterEx Removes a function block from the local function block list.
Status
MostApGetFBlockID Returns the function block identifier (FBlockID) of the CAPL node.
The registries of the Application Socket may be read-out during the entire measurement cycle.
MostAsRgGetRxTxLog Returns the logical node address of a specific entry in the desired
registry.
Please note:
The Bus Registry is created in each device during MOST system configuration. It is only valid during
network status 'ConfigOk'. Generally the Network Master administers the Central Bus Registry. The
Network Slaves mirror it in their De-Central Bus Registry.
Example
MostPMResetOverTemperature Signalizes the PowerMaster that the device has reached operating
temperature again.
MostPMTempShutdownWakeupTimeout Sets the timeout duration, after which the PowerMaster tries to
wake-up the ring after an over-temperature shutdown.
Gateway Node
If more than one MOST channel is allocated to a CAPL node (MOST-MOST gateway) the bus context must be
defined before Application Socket functions are used.
MostAsNtfEnable, MostAsNtfDisable Enables or disables the notification service for the function block
assigned to the CAPL node.
function.
MostAsNtfFunctionListGetSize Returns the list size of the functions for which a specific
notification client is registered.
MostAsNtfFunctionListGetFunction Returns the function at a given index in the function list for
which a specific notification client is registered.
Shadow Service:
MostAsFsEnable Enables the function service for a function block assigned to the
CAPL node.
MostAsFsDisable Disables the function service for a function block assigned to the
CAPL node.
Test functions
Message Events:
TestJoinMostAMSReportEvent Adds an AMS report message (OpType > 8) to the set of joined events.
TestJoinMostAMSSpyReportEvent Adds an AMS spy report message (OpType > 8) to the set of joined
events.
TestJoinMostReportEvent Adds a CMS report message (OpType > 8) to the set of joined events.
TestJoinMostSpyReportEvent Adds a CMS spy report message (OpType > 8) to the set of joined
events.
TestSendMostRawMessage Send a CMS raw message and waits for Tx acknowledgement result.
TestWaitForMostAMSReport Waits for specific AMS report message (OpType > 8).
TestWaitForMostAMSRespons Sends a symbolically defined AMS message and waits for the
appropriate response message.
TestWaitForMostAMSSpyReport Waits for specific AMS spy report message (OpType > 8).
TestWaitForMostReport Waits for specific CMS report message (OpType > 8).
TestWaitForMostSpyReport Waits for specific CMS spy report message (OpType > 8).
Controller Events:
TestWaitForMostLightOff Wait for the occurrence of a LightLock event indicating a no light &
no lock state.
TestWaitForMostShortUnlock Wait for the occurrence of a LightLock event indicating a light & no
lock state.
TestMostReadReg Reads one or several MOST chip registers and waits for the result.
Test MostWriteReg Writes one or several MOST chip registers and waits for the result.
| TestWaitForAllJoinedEvents | TestWaitForAnyJoinedEvent |
MostApplicationNode Switches the CAPL node into application mode - only messages (no
spy!) are received/sent fom/on channels to which the CAPL node is
connected to.
MostGetChannel Returns the channel number to which the CAPL node is connected to.
MostRcvSpyMessagesOnly The MOST message handling routines of this node are only called if the
message was received by the Spy of the bus interfaces.
MostStrictChannelMapping The MOST sending and receiving behavior of the node is strictly based
on the configuration in the Simulation Setup.
Message access
getThisMessage Copies the data of an AMS message into a message variable - Obsolete - see
Initialization of Message Variables!
Message transmission
OutputMostPktThis Passes the packet on to the next node in the nodal sequence.
MostAmsOutput Definition and direct dispatch of an AMS message using the syntax from the
MOST specification and the description in the XML function catalog.
MostSendError Generates and sends an error message directly based on a received command
message.
Function catalogue
MostParamGet Query of a parameter value from an AMS message using the parameter name
from the XML function catalog.
MostParamGetData Query of parameters of the String type or RawStream from an AMS message
using the parameter name from the XML function catalog.
MostParamGetString Query of parameters of the String type from an AMS message using the
parameter name from the XML function catalog.
MostParamGetStringAscii Query of parameters of the String type from an AMS message and decode to
ASCII format.
MostParamIsAvailable Check whether a described parameter with the parameter name from the XML
function catalog is in an AMS message.
MostParamSet Setting of a parameter value in an AMS message using the parameter name
from the XML function catalog.
MostParamSetData Setting of parameters of the String type or RawStream in an AMS message using
the parameter name from the XML function catalog.
MostParamSetString Setting of parameters of the String type (for ASCII-coded strings only) or of the
'Enum' type in an AMS message using the parameter name from the XML
function catalog.
MostParamSetStringEnc Encoding and setting of parameters of the String type (for ASCII-coded strings
only).
MostMsgDecodeRLE Decodes the data area of a message and saves the function IDs in a list.
MostMsgEncodeRLE Encodes a list of function IDs and saves it in the data area of a message.
MostMsgGetSymbols Determining the symbolic Names of the function block, the function and the
Optype from an AMS or control message using the XML function catalog.
MostMsgSet Populating an AMS message using the syntax from the MOST specification and
the description in the XML function catalog.
MostAmsOutput Definition and direct dispatch of an AMS message using the syntax from the
MOST specification and the description in the XML function catalog.
Fault injection
MostNwmFiGetParameter implementation.
Trace highlighting
mostEthPktSetTraceColors Sets the text and background color for displaying the MOST event in
(MOST150) the Trace window.
mostMHPBlockSetTraceColors
mostMHPConnectionSetTraceColors
mostMHPConnectionSetTraceColors
mostMHPPacketSetTraceColors
mostPktSetTraceColors
traceSetEventColors
Event procedures
on mostRawMessage Is called on the receipt of MOST frames whose type isn't Normal.
OnMostAllBypass Is called if the bypass of the MOST chip was opened or closed.
OnMostEcl Is called when the state of the Electrical Control Line changed.
OnMostMPR Is called when the value of the MPR register changed (network
change event (NCE)).
OnMostMPRDelayed Is called if the value of the MPR register has not changed since
the last network change event (NCE) for t_MPRDelayed.
OnMostStress Is called before the beginning and after the end of the stress
generation.
OnMostTimingMode Is called if the timing mode of the MOST hardware has been
changed.
OnMostNetOn / OnMostInitReady Is called when the NetOn / InitReady event (first "Stable Lock"
after he loop has been woken up) has occurred.
Fault injection
MOST50
on mostAMSMessage Is called when a message is received from the Application Message Service
(AMS).
OnMostMsgFragment Is called when the spy detects an incomplete transmission on the Control
channel.
OnMostPktFragment Is called when the spy detects an incomplete transmission on the Packet Data
channel.
OnMostAllocTable Is called as soon as the hardware interface detects a change in the MOST
allocation table.
OnMostSyncAudio Is called after routing of audio input or output of the bus interface.
OnMostSyncSpdif Is called after routing of S/PDIF input or output of the bus interface.
MOST150
on mostAMSMessage Is called when a message is received from the Application Message Service (AMS).
OnMostEthPkt Is called when an Ethernet packet is received over the Packet Data channel.
OnMostMsgFragment Is called when the spy detects an incomplete transmission on the Control
channel.
OnMostPktFragment Is called when the spy detects an incomplete transmission on the Packet Data
channel.
OnMostEthPktFragment Is called when the spy detects an incomplete Ethernet packet transmission.
OnMostAllocTable Is called as soon as the hardware interface detects a change in the MOST
allocation table.
OnMostShutdownFlag Is called each time the state of the Shutdown flag changes.
OnMostSyncAudio Is called after routing of audio input or output of the bus interface.
OnMostSyncSpdif Is called after routing of S/PDIF input or output of the bus interface.
OnMostSystemLock Is called each time the state of the System-Lock flag changes.
Selectors
| Error Codes of CAPL functions | Initialization of message variables | Symbolic identification of parameters | Symbolic identification
of messages | General tips on XML function catalog support in CAPL | MOST high observer and combiner |
MostAllocTableGetCL
CAPL Function Overview » MOST » MostAllocTableGetCL
Function Returns the connection label of the respective entry in the allocation table.
Parameters channel
idx
Example
MostAllocTableGetSize
CAPL Function Overview » MOST » MostAllocTableGetSize
Function Returns the number of entries (connection labels) in the allocation table.
Parameters channel
Example
MostAllocTableGetWidth
CAPL Function Overview » MOST » MostAllocTableGetWidth
Function Returns the number of channels of the respective entry (connection label) in the
allocation table.
Parameters channel
idx
Example
MostAmsClearTxQueue
CAPL Function Overview » MOST » MostAmsClearTxQueue
This command can be used to stop further sending of AMS messages in case of errors (e.g.
critical unlock or light off) or if the system state changes to "NotOk".
Parameters channel
6.0 MOST — •
Example
MostAmsOutput
CAPL Function Overview » MOST » MostAmsOutput
Function Definition and direct dispatch of an AMS message using the syntax from the MOST
specification and the description in the XML function catalog.
The description of the message must be complete, i.e. wildcards cannot be used because
the message should then be sent directly. However, the parameter list may be shorter
than specified in the function catalog, in order to be able to generate intentionally
incomplete messages.
Parameters channel
destAdr
Destination address.
symbolicMessage
FBlock.InstanceId.Function.OpType
FBlock.Function.OpType(Parameterlist)
FBlock.Function.OpType
InstId
InstanceID of the function block. This explicit entry overwrites the applicable InstanceID
in symbolicMessage. If neither an instance ID nor the instId parameter is specified in
symbolicMessage, the default is set to 1.
Return values —
5.2 MOST — •
Example
// send 'play' command for DiskPlayer on MOST ring
on key 'p'
{
// Send command on channel 1 to instanceId 1 of functionblock
"AudioDiskPlayer"
mostAmsOutput(1,"AudioDiskPlayer.SourceActivity.StartResult(1,On)",1);
}
| General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Symbolic Identification of
Messages | Input Assistant | MostParamGet | MostParamGetData | MostParamGetString | MostParamSet | MostParamSetData |
MostParamSetString | MostMsgSet | output |
MostAmsSetSizePrefixed
CAPL Function Overview » MOST » MostAmsSetSizePrefixed
Function Configures the minimum length of an AMS message above which an initiating message with
TelID==4 is sent.
Parameters channel
minlength
minlength == -1: use the size configured in the hardware configuration dialog, AMS page
minlength == 0: never send an initiating message with TelID==4
minlength >= 46: send an initiating message with TelID==4, when the length of the AMS
message is >=minlength
Note: Maximum value of minlength is 65535 (0xFFFF), since this is the maximum size of an
AMS message.
Return values 0: OK
7.2 MOST150 — •
Example
Activate special size prefix length for exactly one AMS message.
MostAmsSetSizePrefixed(1, 46);
MostAmsOutput(1, "Telephone.List.Status(0,1,2,3,4,5,6,7)");
MostAmsSetSizePrefixed(1, -1);
Activate special size prefix length for AMS messages with more than 200 bytes payload.
MostAmsSetSizePrefixed(1, 200);
MostApGetFBlockID
CAPL Function Overview » MOST » MostApGetFBlockID
Function MostApGetFBlockID returns the FBlockID of the CAPL node. The function block must be
assigned to the CAPL program exclusively via MostApRegister(fblockID, instIDDefault) or
the database.
Parameters —
5.0 • MOST — •
• While Application Socket
is active
Example
MostApGetInstID
CAPL Function Overview » MOST » MostApGetInstID
Function MostApGetInstID returns the InstID of the CAPL node. The function block must be
assigned to the CAPL program exclusively via MostApRegister (fblockID, instIDDefault) or
the database.
Parameters —
5.0 • MOST — •
• While Application Socket
is active
Example
| OnMostApInstID |
MostApIsAddressed
CAPL Function Overview » MOST » MostApIsAddressed
Function MostApIsAddressed checks whether the functional MOST address {fblockID, instID}
matches the CAPL node function blocks assigned via MostApRegister() or
MostApRegisterEx(). The functional address is permitted to contain wildcard symbols.
Parameters fblockID
instID
msgCommand
0: Otherwise
7.0 • MOST — •
• While Application Socket
is active
Example
MostApIsRegistered
CAPL Function Overview » MOST » MostApIsRegistered
Function This function can be used to poll whether the CAPL node is registered as a function block
in the Local FBlockList. The function block must be assigned to the CAPL program via
MostApRegister(fblockID, instIDDefault) or the database.
Parameters —
5.0 • MOST — •
• While Application Socket
is active
Example
MostApIsRegisteredEx
CAPL Function Overview » MOST » MostApIsRegisteredEx
Function This function can be used to poll whether the function block with functional address
{fblockID, instID} is entered in the Local FBlockList.
Parameters fblockID
instID
5.0 • MOST — •
• While Application Socket
is active
Example
MostApplicationNode
CAPL Function Overview » MOST » MostApplicationNode
Function This CAPL function can only be called in on preStart and switches the CAPL node into
application mode. The node will
Info
This mode is especially useful for nodes connected to a single MOST channel
in the simulation setup.
Checks like "if (this.MsgChannel!=XY) return;" or "if (this.IsSpy()) return;" or
event handler "on mostMessage MsgChannel1.*" explicit for a channel can be
omitted. In many cases the assignment of a channel before sending a message
can be omitted.
With declaration of a message variable the channel will be initialized with a
wildcard (0xFFFF), which will be mapped to the channel with which the node
is connected in the simulation setup on transmission.
This makes the CAPL code easily reusable because it is independent of any
hard coded channel numbers.
The application mode is independent of the activation of the application
socket, however it especially utilizes the implementation of function block
behavior.
Parameters —
Return values —
5.0 MOST — •
Example
MostApRegister
CAPL Function Overview » MOST » MostApRegister
long MostApRegister()
Function The first function registers the CAPL node at the Application Socket as a function block
with the specified FBlockID and InstIDDefault. The function is available in the CAPL
section on prestart and can be applied once per CAPL node only.
Both functions make an entry in the device's Local FBlockList. If an FBlock with the same
FBlockID and InstID has already been registered by another CAPL node the InstID of the
function block to be registered is incremented until the combination {FBlockID, InstID} is
unique within the simulated device.
Parameters fblockID
instdIDDefault
Default instance identifier. The actual registered InstID can be retrieved with
MostApGetInstID().
5.0 • MOST — •
• While Application
Socket is active
Example
MostApRegisterEx
CAPL Function Overview » MOST » MostApRegisterEx
Function MostApRegisterEx() registers the function block with the Application Socket using the
functional address (fblockID, instID).
In network status 'ConfigOk' the device's NetBlock reports the new Local FBlockList to the
Network Master.
Parameters fblockID
instID
5.0 • MOST — •
• While Application Socket
is active
Example
MostApUnregister
CAPL Function Overview » MOST » MostApUnregister
Function MostApUnregister() removes the function block assigned to the CAPL node by CANdb or
MostApRegister(fblockID, instIDDefault) from the Local FBlockList.
In network status 'ConfigOk' the device's NetBlock reports the new Local FBlockList to the
Network Master.
Parameters —
5.0 • MOST — •
• While Application Socket
is active
Example
| MostApRegister | MostApUnregisterEx |
MostApUnregisterEx
CAPL Function Overview » MOST » MostApUnregisterEx
Function Removes the function block with functional address {fblockID, instID} from the Local
FBlockList. It should be noted that CAPL nodes may only remove those function blocks you
have previously registered with MostApRegisterEx.
In network status 'ConfigOk' the device's NetBlock reports the new Local FBlockList to the
Network Master.
Parameters fblockID
instID
5.0 • MOST — •
• While Application Socket
is active
Example
MostAsFiEnable
CAPL Function Overview » MOST » MostAsFiEnable
Function This function allows to temporarily switch the Application Socket Fault Injection on and
off.
Info
The Application Socket Fault Injection allows modifications of the behavior of CANoe’s
Appliction Socket services.
All AMS Tx messages from any Application Socket service will be passed through
OnMostFiAmsPreSend before sending. All AMS Rx messages to any Application Socket
service will be passed through OnMostFiAmsPreReceive before receiving. Incoming and
outgoing messages can be blocked or modified within these callbacks in order to simulate
an imperfect device.
Parameters onoff
0: disable
1: enable
7.2 MOST — •
Example
MostAsFsEnableEx, MostAsFsDisableEx
CAPL Function Overview » MOST » MostAsFsEnableEx, MostAsFsDisableEx
Function MostAsFsEnableEx() makes the function service available for a function block.
Furthermore MostAsFsEnableEx() enables the functions <FktIDs>, <Notification> and
<NotificationCheck> of the given function block for the notification service.
Parameters fblockId
Function block ID
instId
Instance ID
6.0 • MOST — •
• While Application Socket
is active
Example
| MostAsFsFunctionEnableEx | MostAsFsEnable |
MostAsFsEnable, MostAsFsDisable
CAPL Function Overview » MOST » MostAsFsEnable, MostAsFsDisable
long MostAsFsDisable()
Function MostAsFsEnable() makes the function service available for the function block. The
function block must be assigned to the CAPL program via MostApRegister(fblockID,
instIDDefault) or the database. Furthermore MostAsFsEnable() enables the functions
<FktIDs>, <Notification> and <NotificationCheck> of the function block for the notification
service.
Parameters —
6.0 • MOST — •
• While Application
Socket is active
Example
| MostAsFsEnableEx | MostAsFsFunctionEnable |
MostAsFsFunctionEnable
CAPL Function Overview » MOST » MostAsFsFunctionEnable
Function MostAsFsFunctionEnable() registers a function and its operations with the function
service. The service must have been previously enabled for the function block with
MostAsFsEnable.
The second option registers a function with the notification service simultaneously. For
this to be achieved, the function must be of the "Property" type and the notification
service of the function block must have been previously enabled with MostAsNtfEnable.
Database support:
The special value functionID=-1 triggers the execution of the CAPL function for all MOST
functions and operations of the function block from the function catalog.
Parameters functionIdText
Function ID or -1 for all functions of the function block from the database.
cbSendStatus[]
Name of the CAPL function that generates and sends the status message.
opTypes (Property/Method)
Bit 16 All OpTypes corresponding to 0-15, if they are defined in the XML function
catalog.
6.0 • MOST — •
• While Application
Socket is active
Example
MostAsFsFunctionEnableEx
CAPL Function Overview » MOST » MostAsFsFunctionEnableEx
Function MostAsFsFunctionEnableEx() registers a function and its operations with the function
service. The service must have been previously enabled for the function block with
MostAsFsEnableEx.
The second option registers a function with the notification service simultaneously. For
this to be achieved, the function must be of the "Property" type and the notification
service of the function block must have been previously enabled with MostAsNtfEnableEx.
Database support:
The special value functionID=-1 triggers the execution of the CAPL function for all MOST
functions and operations of the function block from the function catalog.
Parameters fblockId
Function block ID
instId
Instance ID
functionId
Function ID or -1 for all functions of the function block from the database.
cbSendStatus[]
Name of the CAPL function that generates and sends the status message.
opTypes (Property/Method)
Bit 16 All OpTypes corresponding to 0-15, if they are defined in the XML function
catalog.
6.0 • MOST — •
• While Application Socket
is active
Example
MostAsNtfDeviceIDListGetSize, MostAsNtfDeviceIDListGetDeviceID
CAPL Function Overview » MOST » MostAsNtfDeviceIDListGetSize, MostAsNtfDeviceIDListGetDeviceID
Function The function makes it possible to output the list of all notification clients registered with
the function (functionID). Functionality is similar to command message
FBlock.Notification.Get(functionID).
The notification matrix can be read out with the function without sending a respective
message.
Parameters fblockID
Function block ID
instID
Instance ID
functionID
Function ID
index
5.2 • MOST — •
• While Application Socket
is active
Example
MostAsNtfEnable, MostAsNtfDisable
CAPL Function Overview » MOST » MostAsNtfEnable, MostAsNtfDisable
long MostAsNtfDisable()
Function MostAsNtfEnable() enables the notification service for the function block. The function
block must be assigned to the CAPL program via MostApRegister(fblockID, instIDDefault)
or the database.
Parameters —
Return values —
5.2 • MOST — •
• While Application Socket
is active
Example
MostAsNtfEnableEx, MostAsNtfDisableEx
CAPL Function Overview » MOST » MostAsNtfEnableEx, MostAsNtfDisableEx
Function MostAsNtfEnableEx() enables the notification service for the function block.
Parameters fblockID
Function block ID
instID
Instance ID
Return values
5.2 • MOST — •
• While Application Socket is
active
Example
MostAsNtfFunctionCheck
CAPL Function Overview » MOST » MostAsNtfFunctionCheck
Function Checks whether a notification client (deviceID) is registered in the notification matrix for
a function.
Parameters deviceID
fblockID
Function block ID
instID
Instance ID
functionID
Function ID
1: deviceID is registered
5.2 • MOST — •
• While Application Socket is
active
Example
MostAsNtfFunctionClear
CAPL Function Overview » MOST » MostAsNtfFunctionClear
Function Clears a notification client entry from the notification matrix. Functionality is similar to
command message FBlock.Notification.Set(Clear, deviceID, functionID).
The notification matrix can be written with the function without sending a respective
message.
Parameters deviceID
fblockID
Function block ID
instID
Instance ID
functionID
Function ID
5.2 • MOST — •
• While Application Socket
is active
Example
MostAsNtfFunctionClearAll
CAPL Function Overview » MOST » MostAsNtfFunctionClearAll
Function Clears notification client entries from the notification matrix (deviceID >= 0).
Functionality is similar to command message FBlock.Notification.Set(ClearAll, deviceID).
The notification matrix can be written with the function without sending a respective
message.
Parameters deviceID
fblockID
Function block ID
instID
Instance ID
5.2 • MOST — •
• While Application Socket
is active
Example
| MostAsNtfFunctionSet | MostAsNtfFunctionClear |
MostAsNtfFunctionEnable, MostAsNtfFunctionDisable,
MostAsNtfFunctionIsEnabled
CAPL Function Overview » MOST » MostAsNtfFunctionEnable, MostAsNtfFunctionDisable, MostAsNtfFunctionIsEnabled
The service must have the name of a CAPL function that generates and sends the status
message of the properties. This is necessary, so that the service can send the current
value of the properties with the FBlock.Notification.Set(SetFunction/SetAll) message to
the client when registering a client (see MOST Specification 2.3 Section 2.3.12).
The CAPL function must be defined by the user and display the following signature:
long <FunctionName>(long destAdr)
or
long <FunctionName>(long destAdr, long fblockID, long instID, long
functionID)
The function must generate and send the status message to the destAdr address. If the
status message could be sent, the function has to return the value 0. Otherwise it must
report it to the notification service with the return value -1. The service then sends an
error message (FBlock.Function.Error(0x41)) to the client instead of the status message.
Database support:
The special value functionID=-1 triggers the execution of the CAPL function for all MOST
functions from the function catalog meeting the following criteria:
Parameters functionID
Function ID or -1 for all functions of the function block from the database.
cbSendStatus[]
Name of the CAPL function that generates and sends the status message.
5.2 • MOST — •
• While Application
Socket is active
Example
MostAsNtfFunctionEnableEx, MostAsNtfFunctionDisableEx,
MostAsNtfFunctionIsEnabledEx
CAPL Function Overview » MOST » MostAsNtfFunctionEnableEx, MostAsNtfFunctionDisableEx, MostAsNtfFunctionIsEnabledEx
Parameters fblockID
Function block ID
instID
Instance ID
functionID
Function ID or -1 for all functions of the function block from the database.
cbSendStatus[]
Name of the CAPL function that generates and sends the status message.
5.2 • MOST — •
• While Application Socket
is active
Example
MostAsNtfFunctionListGetSize, MostAsNtfFunctionListGetFunction
CAPL Function Overview » MOST » MostAsNtfFunctionListGetSize, MostAsNtfFunctionListGetFunction
Function The function makes it possible to output the list of all functions in which the notification
client (deviceID) is registered. Functionality is similar to command message
FBlock.NotificationCheck.Get(deviceID).
The notification matrix can be read out with the function without sending a respective
message.
Parameters deviceID
fblockID
Function block ID
instID
Instance ID
index
5.2 • MOST — •
• While Application Socket
is active
Example
MostAsNtfFunctionSet
CAPL Function Overview » MOST » MostAsNtfFunctionSet
The notification matrix can be written with the function without sending a respective
message.
Info
The notification matrix is deleted on NetOn and if the network status changes
to ConfigNotOk.
Parameters deviceID
fblockID
Function block ID
instID
Instance ID
functionID
Function ID
5.2 • MOST — •
• While Application Socket
is active
Example
MostAsNtfOutput
CAPL Function Overview » MOST » MostAsNtfOutput
destAdr == 0xFFFF:
The message is sent to the address of all notification clients. The FBlockID, InstID and
FunctionID values, which are needed to read the addresses from the notification matrix,
are extracted from the message variable (msg).
Parameters destAdr
msg
Message to be sent.
5.2 • MOST — •
• While Application Socket
is active
Example
MostAsNtfShdFunctionEnable, MostAsNtfShdFunctionDisable
CAPL Function Overview » MOST » MostAsNtfShdFunctionEnable, MostAsNtfShdFunctionDisable
Parameters fblockId
Function block ID
instId
Instance ID
functionId
6.0 • MOST — •
• While Application
Socket is active
Example
| MostAsShdEnable, MostAsShdDisable |
MostAsRgGetFBlockID
CAPL Function Overview » MOST » MostAsRgGetFBlockID
Parameters regsel
1: Local FBlockList
2: Bus registry
5.0 • MOST — •
• While Application Socket is
active
Example
| MostAsRgGetSize | OnMostAsRegistry |
MostAsRgGetInstID
CAPL Function Overview » MOST » MostAsRgGetInstID
Parameters regsel
1: Local FBlockList
2: Bus registry
5.0 • MOST — •
• While Application Socket is
active
Example
| MostAsRgGetSize | OnMostAsRegistry |
MostAsRgGetRxTxLog
CAPL Function Overview » MOST » MostAsRgGetRxTxLog
Function The first one returns the logical device address (node address) at position i of the
registry. Indexing starts at 0.
The second one returns the logical device address (node address) of the function block. If
there is no entry with the given FBlockId and InstId, an error code <0 is returned.
Parameters regsel
1: Local FBlockList
2: Bus registry
fblockId
Function block ID
instId
Instance ID
5.0 • MOST — •
• While Application Socket
is active
Example
| MostAsRgGetSize | OnMostAsRegistry |
MostAsRgGetSize
CAPL Function Overview » MOST » MostAsRgGetSize
Parameters regsel
1: Local FBlockList
2: Bus registry
5.0 • MOST — •
• While Application Socket is
active
Example
MostAsShdEnable, MostAsShdDisable
CAPL Function Overview » MOST » MostAsShdEnable, MostAsShdDisable
Function MostAsShdEnable() adds an entry to the list of searched function blocks. If certain
network events occur, CANoe automatically sends a request to the NetworkMaster to
determine the logical device address of the function block.
Parameters fblockId
Function block ID
instId
Instance ID
6.0 • MOST — •
• While Application Socket
is active
Example
MostConfigureBusloadAsync
CAPL Function Overview » MOST » MostConfigureBusloadAsync
Note
This function is only available with MOST hardware VN2600/VN2610 and VN2640.
Function The function configures the bus load generator for the asynchronous channel. With the
specified rate the generator tries to send packets.
Due to arbitration delays, the bus load actually generated can deviate from the specified
rate.
Bus load can also be generated without CAPL programming using the MOST Stress program
window.
Info
Bus load can also be generated without CAPL programming using the MOST
Stress program window.
Parameters channel
rate
Number of packets per second. The maximum transmission rate depends on the packet
length, the synchronous bandwidth control (SBC) and the MOST loop frequency.
countertype
0 No sequence counter
1 1 byte counter
counterpos
destadr
Destination address
pktdatalen
Number of user data bytes (MOST25: 0 <= pktdatalen <= 1014; MOST150: 0 <= pktdatalen
<= 1524)
pktdata[]
User data
5.2 • MOST — •
• Not in StopMeasurement
Example
MostConfigureBusloadCtrl
CAPL Function Overview » MOST » MostConfigureBusloadCtrl
Note
This function is only available with MOST hardware VN2600/VN2610 for MOST25 and
VN2640/Optolyzer G2 3150o for MOST150.
Function The function configures the bus load generator for the control channel. Load generation
can be started with the MostGenerateBusloadCtrl() function.
Form 1:
With the specified rate the generator tries to send messages on the control channel.
Due to repeated transmissions or arbitration delays, the bus load actually generated can
deviate from the specified rate.
As an option, the messages can be supplied with a sequence counter.
Form 2:
For Optolyzer G2 3150o, rate specifies the delay between two messages in 10 ms steps
and hence it is not possible to specify number of messages sent per second.
Info
Bus load can also be generated without CAPL programming using the MOST
Stress program window.
Parameters channel
rate
countertype
0 No sequence counter
1 1 byte counter
counterpos
prio
rtype
Message type:
0 Normal
1 RemoteRead
2 RemoteWrite
3 Alloc
4 Dealloc
5 GetSource
destadr
pdata[]
msg
5.2 • MOST — •
• Not in StopMeasurement
channel = 1;
rate = 50; // msgs/s
MostConfigureBusloadEthPkt
CAPL Function Overview » MOST » MostConfigureBusloadEthPkt
Note
Function The function configures the bus load generator for the Ethernet channel.
Info
Bus load can also be generated without CAPL programming using the MOST
Stress program window.
Parameters channel
rate
Number of Ethernet packets per second. The maximum transmission rate depends on the
packet length, the synchronous bandwidth control (SBC) and the MOST loop frequency.
Due to arbitration delays, the bus load actually generated can deviate from the specified
rate.
countertype
0 No sequence counter
1 1 byte counter
counterpos
srcadr
Info
It is possible to set another source MAC address as the own one. The value "-
1" is also valid and is used as wildcard to set the own MAC address.
destadr
dataLen
data
Info
At least two bytes have to be sent (Ethernet Type Field). In case more than
1502 Bytes should be sent, the VLAN Tag has to be set in the first two data
bytes (0x81, 0x00).
Example
See MostGenerateBusloadEthPkt
mostConfigureEclSequence
CAPL Function Overview » MOST » mostConfigureEclSequence
Note
Function The function prepares VN2640 to generate a signal sequence on the ECL. The signal
sequence can be started with the MostGenerateEclSeq function.
The sequence is defined in two arrays of dword. The first indicates the level (0:
dominant, 1: recessive) of the generators output for each time interval. The second
describes the duration for each time interval.
Parameters channel
numIntervals
state
0: dominant
1: recessive
duration100us
Example
On key ‘s’
{
dword eclSequenceStates[16] = { 0, 1, 0, 1, 0, 1, 0, 1};
dword eclSequenceDuration[16] = { 100, 100, 100, 100, 100, 100, 100,
100};
// generates a rectangle wave with a period of 200 ms
mostConfigureEclSequence(1, 16, eclSequenceStates, eclSequenceDuration);
ret = mostGenerateEclSequence(1, 1);
}
mostEthPktSetTraceColors
CAPL Function Overview » MOST » mostEthPktSetTraceColors
Function Sets the text and background color for displaying the MOST event in the Trace window.
The makeRGB function can be used for the colors.
Info
• This function can only be used in measurement setup and is only applied
to the trace window.
• The setting of colors with this function has a higher priority than the
color settings for events in the trace window.
Parameters font
bkgnd
Return values 0: OK
7.5 MOST150 • —
Example
OnMostEthPkt
{
mostEthPktSetTraceColors(makeRGB(0, 0, 0), makeRGB(255, 0, 0) );
OutputMostEthPktThis(); // Forwards this packet to the node in the
measurement setup
}
| traceSetEventColors |
Note
The following functions can be use within the event procedures for MOST controller
events to call up further information on events.
DWORD MostEventTime()
DWORD MostEventOrigTime()
float MostEventTimeNs()
Function long MostEventChannel() returns the channel over which the event arrived.
DWORD MostEventTime() returns the time stamp of the event (Units: 10 µs).
float MostEventTimeNs() returns the time stamp of the event (Units: 1 ns).
Parameters —
5.0 MOST • •
Example
OnMostNodeAdr(long nodeadr)
{
write("Node address changed to %04X on channel %d at %fs",
nodeadr,
MostEventChannel(),
MostEventTime() / 100000.0);
}
In the following example whenever a registry changes its contents are output to the Write window.
OnMostAsRegistry(long regsel)
{
long size, i;
long rxtxlog, fblockid, instid;
// display registry type
if(regsel == 1)
write("Local Registry:");
else if(regsel == 2)
write("Bus Registry:");
// get registry size
size = MostAsRgGetSize(regsel);
// print the whole registry
write("Adr FBlock InstID");
for(i = 0; i < size; ++i)
{
rxtxlog = MostAsRgGetRxTxLog(regsel,i);
fblockid = MostAsRgGetFBlockID(regsel,i);
instid = MostAsRgGetInstID(regsel,i);
write("%04X %02X %02X", rxtxlog, fblockid, instid);
}
}
Bus Registry:
Adr FBlock InstID
0100 02 00
0100 04 01
0100 C0 01
0101 C1 01
0101 C5 01
MostFiAmsReceive
CAPL Function Overview » MOST » MostFiAmsReceive
Function Simulates the receipt of an AMS message to the simulation node (CAPL program or node
layer module).
Altered received messages are neither displayed in the trace window nor logged. They are
only visible for the one node in the simulation setup from which MostFiAmsReceive was
called.
Exception: a CAPL program with fault injection for the MOST application socket (see
MostAsFiEnable) can call MostFiAmsReceive as many times as necessary and at any time
in order to simulate a received message to the CANoe-side application socket. These
altered messages are then visible only for the services of the MOST application socket in
CANoe.
Parameters msg
Return values —
7.2 MOST — •
Example
See OnMostFiAmsPreReceive
MostGenerateBusloadAsync
CAPL Function Overview » MOST » MostGenerateBusloadAsync
Note
This function is only available with MOST hardware VN2600/VN2610 for MOST25 and
VN2640/Optolyzer G2 3150o for MOST150.
Function The function sends cyclical packets to the asynchronous channel. Use the
MostConfigureBusloadAsync() function to specify the send parameters and contents of the
packets.
This function shows no effect if the StressNIC is not set to slave mode. For
that purpose use MostSetStressNodeParameter with the proper parameter.
Parameters channel
pkts
5.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostGenerateBusloadCtrl
CAPL Function Overview » MOST » MostGenerateBusloadCtrl
Note
This function is only available with MOST hardware VN2600/VN2610 for MOST25 and
VN2640/Optolyzer G2 3150o for MOST150.
Function The function sends cyclical messages to the control channel. Use the
MostConfigureBusloadCtrl() function to specify the send parameters and contents of the
message.
This function shows no effect if the StressNIC is not set to slave mode. For
that purpose use MostSetStressNodeParameter function with the proper
parameter.
Parameters channel
pkts
5.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostGenerateBusloadEthPkt
CAPL Function Overview » MOST » MostGenerateBusloadEthPkt
Note
Function The function sends cyclical packets on the Ethernet channel. Use the
MostConfigureBusloadEthPkt function to specify the send parameters and payload pattern.
Parameters channel
pkts
Example
channel = 1;
srcadr = -1LL; // use own MAC address as source
destadr = 0x010203040506LL;
rate = 50; // packets per second
countertype = 4; // 4 byte counter
counterpos = 9; // counter in byte6..byte9
datalen =300;
MostGenerateBypassToggle
CAPL Function Overview » MOST » MostGenerateBypassToggle
Note
• VN2640
• OptoLyzer G2 3150o (At least firmware version V1.5.3 is required)
VN2640:
The bypass of the INIC used for simulation and stimulation is toggled. The node has to be
in slave mode.
The range for timing values is 10…65535 ms.
Optolyzer:
The bypass of the additional stress network interface controller (NIC) in the OptoLyzer G2
3150o is switched. The bypass of the main NIC (which is responsible for sending and
receiving) is not affected.
The stress network interface controller (NIC) must have active bypass or bypass opened
(see MostSetStressNodeParameter ).
Parameters channel
invistime
Time during which node has its bypass closed (in ms)
vistime
repeat
0: Stop stress
>0: Number of transitions
0xFFFF: Generate transitions continually
7.2 MOST150 — •
Example
// prepare stress NIC: set "active" bypass
MostSetStressNodeParameter(1, 3, 2);
// make the stress NIC visible two times for 50 ms each
MostGenerateBypassToggle(1, 100, 50, 2);
mostGenerateEclSequence
CAPL Function Overview » MOST » mostGenerateEclSequence
Note
Function Starts the generation of the signal sequence on the ECL which was prepared by
mostConfigureEclSequence. Dominant levels will be set actively whereas during recessive
phases the generator is passive and other devices connected to the ECL may pull the line
to dominant level.
Parameters channel
startstop
Example
See mostConfigureEclSequence
MostGenerateLightError
CAPL Function Overview » MOST » MostGenerateLightError
Note
For OptolyzerOL3150o: The stress network interface controller (NIC) must have active
bypass or bypass opened (see MostSetStressNodeParameter).
Parameters channel
lightofftime
lightontime
repeat
5.1 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostGenerateLockError
CAPL Function Overview » MOST » MostGenerateLockError
Note
For OptolyzerOL3150o: The stress network interface controller (NIC) must have its bypass
opened (see MostSetStressNodeParameter).
Parameters channel
unmodtime
modtime
repeat
5.1 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostGetAllBypass
CAPL Function Overview » MOST » MostGetAllBypass
Function Return indicates whether the MOST hardware bypass is closed (Return value = 1) or open
(Return value = 0).
Parameters channel
1: Bypass is closed
5.0 • MOST — •
• Not in StopMeasurement
Example
MostGetAllocTable
CAPL Function Overview » MOST » MostGetAllocTable
Note
Function The MostGetAllocTable() function copies the MOST Allocation Table (max. 60 bytes) to
a local CAPL buffer. It must be verified that the buffer has the required size (buffersize).
The Allocation Table contains the reservation status of the synchronous MOST channels.
Parameters channel
buffer
Destination buffer
buffersize
5.1 • MOST • •
• After measurement start
• Not in Stopmeasurement
Example
byte allocTable[60];
// copy allocation table to local buffer
MostGetAllocTable(MostGetChannel(), allocTable, elcount(allocTable));
| OnMostAllocTable | MostGetChannel |
MostGetAndFilter
CAPL Function Overview » MOST » MostGetAndFilter
Note
AND-Filter
Syntax long MostGetAndFilter( long channel, long arb, long targetAdr, long
sourceAdr, long type, byte msg[17], long crc, long ack)
Parameters channel
arb
Arbitration byte
targetAdr
Destination address
sourceAdr
Source address
type
Message type
msg
crc
CRC code
ack
3.2 • MOST — •
• Not in StopMeasurement
Example
| MostGetChannel | MostSetAndFilter |
MostGetChannel
CAPL Function Overview » MOST » MostGetChannel
Syntax mostGetChannel ()
Function This query returns the number of the MOST channel to which the CAPL node is connected
in the Simulation Setup.
This query is especially useful with nodes that are only connected to one MOST channel in
the Simulation Setup. The return value can be used directly as a parameter for all CAPL
functions that expect specification of a channel, e.g. in driving the hardware interface.
With the help of this function CAPL programs can be created such that they are
independent of channel numbers. By proper configuration of the Simulation Setup the
user can choose the MOST interface over which the node should be operated.
Parameters —
Return values 0: the node is not connected to any MOST channel in the Simulation Setup
0xFFFF: The node is connected to more than one MOST channel and may operate as a
Gateway. The user must choose, on a case-by-case basis, the MOST channel over which
the node should operate.
In this case, channel numbers and bus names from the Simulation Setup are determined
by the getBusContext or getBusNameContext function.
5.0 MOST — •
Example
MostGetClockSource
CAPL Function Overview » MOST » MostGetClockSource
Note
Function Returns the clock source for the MOST timing master.
Parameters channel
1: Synchronizes the timing master clock to the S/PDIF input signal. The bus interface must
be configured as S/PDIF timing slave.
6.0 MOST — •
Example
MostGetCodingErrors
CAPL Function Overview » MOST » MostGetCodingErrors
Note
Function Returns the number of coding errors since measurement start or the last time this
function was called.
Info
Calling this function resets the counter in the hardware! The total number of
coding errors during measurement is displayed in Bus Statistic window.
Parameters channel
6.0 • MOST — •
• Not in StopMeasurement
Example
MostGetHWCapability
CAPL Function Overview » MOST » MostGetHWCapability
Function MostGetHWCapability()can be used to query the properties of the MOST interface used.
Parameters channel
capID
kMostHWCap_TwinklePowerLed = 3 0, 1 1: The
MostTwinklePowerLed
command functions with
the interface
kMostHWCap_LightLockStress = 4 0, 1 1: The
MostGenerateLightError
and
MostGenerateLockError
commands function with
the interface
5.2 MOST • •
Example
| MostGetChannel | MostGetHWInfo |
MostGetHWFilter
CAPL Function Overview » MOST » MostGetHWFilter
Note
Filter Mode
Parameters channel
1: HW filter active
3.2 • MOST — •
• Not in StopMeasurement
Example
| MostGetChannel | MostSetHWFilter |
MostGetHWInfo
CAPL Function Overview » MOST » MostGetHWInfo
Parameters channel
infoID
1: VN2600/VN2610
2: Optolyzer
3: —
4: OptoLyzer G2 3150o
5: VN2640
6: OptoLyzer G2 3050e
7: PCI Interface 50e
kMostHWInfo_SimulationMode 0, 1 0: real
=1 1: simulated
kMostHWInfo_Manufacturer = 2 Manufacturer:
"Vector", "SMSC"
0: off
1: SW Sync active
2: HW Sync active (bus interface on
<channel> is Sync Master)
3: HW Sync active (bus interface on
<channel> is Sync Slave)
infostring
buffersize
5.2 MOST • •
Example
| MostGetChannel | MostGetHWCapability |
MostGetLock
CAPL Function Overview » MOST » MostGetLock
Parameters channel
0: Unlock
3.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostGetLockEx
CAPL Function Overview » MOST » MostGetLockEx
Function The function returns the lock status of the connected MOST hardware. In contrast to
MostGetLock(), the additional states "Stable Lock" and "Critical Unlock" are considered
according to MOST specification 2.3.
Parameters channel
1: Lock
2: Stable Lock
3: Critical Unlock
5.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostGetMPR
CAPL Function Overview » MOST » MostGetMPR
Function This function returns the "Maximum Position Register (MPR)" value of the MOST hardware
chip connected to the channel. If the loop is stable, MPR represents the number of
devices with opened bypass.
Parameters channel
5.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
| OnMostMPR | MostGetChannel |
MostGetNceType
CAPL Function Overview » MOST » MostGetNceType
Function Returns the type of network change event (NCE) (when changing the MPR register).
Info
This function can only be called within the OnMostMPR() event procedure.
Parameters —
Return values < 0: NCE-. The absolute value corresponds to the number of devices which closed their
bypass.
0: No information available (e.g. first MPR register event, the function was not called in
the OnMostMPR() event procedure).
> 0: NCE+. The value corresponds to the number of devices which opened their bypass.
6.1 MOST • •
Example
MostGetNetState
CAPL Function Overview » MOST » MostGetNetState
Parameters —
5.0 • MOST — •
• While Application Socket is
active
Example
Function Return of the node address, group address, alternative packet address or node position
address of the MOST hardware associated with the specified channel.
Parameters channel
3.2 • MOST — •
• Not in
StopMeasurement
5.0: • MOST — •
MostGetAltPktAdr
• Not in
StopMeasurement
Example
MostGetNPR
CAPL Function Overview » MOST » MostGetNPR
Function This function returns the "Node Position Register (NPR)" value of the MOST hardware chip
connected to the channel.
Parameters channel
5.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostGetRxLight
CAPL Function Overview » MOST » MostGetRxLight
Function Queries the Light Status at the Fiber Optical Receiver (FOR).
Parameters channel
0: Light out
5.1 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostGetSBC
CAPL Function Overview » MOST » MostGetSBC
Function This function returns the "Synchronous Bandwidth Control (SBC) Register" value of the
MOST hardware chip connected to the channel.
Parameters channel
5.2 • MOST — •
• Not in StopMeasurement
Example
MostGetShutdownFlag
CAPL Function Overview » MOST » MostGetShutdownFlag
Parameters channel
Example
MostGetSpecVersion
CAPL Function Overview » MOST » MostGetSpecVersion
Parameters channel
Info
Currently the MOST Specification version depends on the chosen speed grade:
Example
MostGetSpeedGrade
CAPL Function Overview » MOST » MostGetSpeedGrade
Parameters channel
1: MOST25
2: MOST50
3: MOST150
Example
Function Determines whether Spy mode for the Control, Asynchronous or Ethernet transmission
channel is activated (Return value = 1) or deactivated (Return value = 0).
Parameters channel
1: Spy activated
5.0 • MOST — •
• Not in StopMeasurement
Example
MostGetSyncMute
CAPL Function Overview » MOST » MostGetSyncMute
Parameters channel
device
0: Line-In
1: Line-Out
2: S/PDIF In (VN2640 only)
3: S/PDIF Out (VN2640 only)
1: mute on
5.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostGetSyncSpdifMode
CAPL Function Overview » MOST » MostGetSyncSpdifMode
Note
Parameters channel
1: S/PDIF master
6.0 MOST — •
Example
MostGetSyncVolume
CAPL Function Overview » MOST » MostGetSyncVolume
Parameters channel
device
0: Line-In
1: Line-Out
5.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostGetSystemLock
CAPL Function Overview » MOST » MostGetSystemLock
Parameters channel
Example
getThisMessage
CAPL Function Overview » MOST » getThisMessage
Function Copies the data of a AMS message into the msg variable.
Parameters msg
count
Return values —
3.1 MOST • •
Example
The following program section copies 1000 bytes of a message's useful data to the local
variable msg on Channel 1. Afterwards the contents of byte 500 are output to the Write
window.
on mostAMSMessage MsgChannel1.*
{
mostAMSMessage * msg = { DLC = 1000 };
GetThisMessage(msg, 1000);
write(“Byte 500: %02X”, msg.byte(500));
}
MostGetTimingMode
CAPL Function Overview » MOST » MostGetTimingMode
Parameters channel
1: Timing Master
If the bypass is closed this function returns the mode that would have been set if the
bypass were opened (see MostSetAllBypass).
5.0 • MOST — •
• Not in StopMeasurement
Example
MostGetTxLight
CAPL Function Overview » MOST » MostGetTxLight
Function Queries the Light Status at the Fiber Optical Transmitter (FOR).
Parameters channel
1: Modulated light
2: Constant light
5.1 • MOST — •
• Not in StopMeasurement
Example
MostGetXorFilter
CAPL Function Overview » MOST » MostGetXorFilter
Note
XOR-Filter
Syntax long MostGetXorFilter( long channel, long arb, long targetAdr, long
sourceAdr, long type, byte msg[17], long crc, long ack)
Parameters channel
arb
Arbitration byte
targetAdr
Destination address
sourceAdr
Source address
type
Message type
msg
crc
CRC code
ack
3.2 • MOST — •
• Not in StopMeasurement
Example
| MostGetChannel | MostSetXorFilter |
mostMHPBlockSetTraceColors
CAPL Function Overview » MOST » mostMHPBlockSetTraceColors
Function Sets the text and background color for displaying the MOST event in the Trace window.
The makeRGB function can be used for the colors.
Info
• This function can only be used in measurement setup and is only applied
to the trace window.
• The setting of colors with this function has a higher priority than the
color settings for events in the trace window.
Parameters font
bkgnd
Return values 0: OK
7.5 MOST • —
Example
OnMostMHPConnection (long sourceDevID, long destDevID, long fBlockID, long
instID, long functionID, long opType)
{
mostMHPConnectionSetTraceColors(makeRGB(0, 0, 0), makeRGB(255, 0, 0) );
return 1; // Forward the MHPConnection-Event to the next node in the
measurement setup
}
| traceSetEventColors |
mostMHPConnectionSetTraceColors
CAPL Function Overview » MOST » mostMHPConnectionSetTraceColors
Function Sets the text and background color for displaying the MOST event in the Trace window.
The makeRGB function can be used for the colors.
Info
• This function can only be used in measurement setup and is only applied
to the trace window.
• The setting of colors with this function has a higher priority than the
color settings for events in the trace window.
Parameters font
bkgnd
Return values 0: OK
7.5 MOST • —
Example
OnMostMHPConnection (long sourceDevID, long destDevID, long fBlockID, long
instID, long functionID, long opType)
{
mostMHPConnectionSetTraceColors(makeRGB(0, 0, 0), makeRGB(255, 0, 0) );
return 1; // Forward the MHPConnection-Event to the next node in the
measurement setup
}
| traceSetEventColors |
mostMHPConnectionSetTraceColors
CAPL Function Overview » MOST » mostMHPConnectionSetTraceColors
Function Sets the text and background color for displaying the MOST event in the Trace window.
The makeRGB function can be used for the colors.
Info
• This function can only be used in measurement setup and is only applied
to the trace window.
• The setting of colors with this function has a higher priority than the
color settings for events in the trace window.
Parameters font
bkgnd
Return values 0: OK
7.5 MOST • —
Example
OnMostMHPError (long sourceDevID, long destDevID, long fBlockID, long
instID, long functionID, long opType)
{
mostMHPErrorSetTraceColors(makeRGB(0, 0, 0), makeRGB(255, 0, 0) );
return 1; // Forward the MHPError-Event to the next node in the
measurement setup
}
| traceSetEventColors |
mostMHPPacketSetTraceColors
CAPL Function Overview » MOST » mostMHPPacketSetTraceColors
Function Sets the text and background color for displaying the MOST event in the Trace window.
The makeRGB function can be used for the colors.
Info
• This function can only be used in measurement setup and is only applied
to the trace window.
• The setting of colors with this function has a higher priority than the
color settings for events in the trace window.
Parameters font
bkgnd
Return values 0: OK
7.5 MOST • —
Example
OnMostMHPPacket (long sourceDevID, long destDevID, long fBlockID, long
instID, long functionID, long opType)
{
mostMHPPacketSetTraceColors(makeRGB(0, 0, 0), makeRGB(255, 0, 0) );
return 1; // Forward the MHPPacket to the next node in the measurement
setup
}
| traceSetEventColors |
MostMsgDecodeRLE
CAPL Function Overview » MOST » MostMsgDecodeRLE
Function MostMsgDecodeRLE() decodes the data area of a message and saves the function IDs in a
list. Run Length Encoding in accordance with MOST Specification 2.4 Para. 2.3.9 is used.
This function is suitable for evaluating messages of the FBlock.FktIds.Status type.
Parameters msg
Message
fktIds[]
Destination buffer
buffersize
6.0 MOST • •
Example
| MostMsgEncodeRLE | MostMsgSet |
MostMsgEncodeRLE
CAPL Function Overview » MOST » MostMsgEncodeRLE
Function MostMsgEncodeRLE() encodes a list of function IDs and saves it in the data area of a
message. Run Length Encoding in accordance with MOST Specification 2.4 Para. 2.3.9 is
used. This function is suitable for compiling messages of the FBlock.FktIds.Status type.
Parameters msg
fktIds[]
size
6.0 MOST • •
Example
| MostMsgDecodeRLE | MostMsgSet |
MostMsgGetSymbols
CAPL Function Overview » MOST » MostMsgGetSymbols
Function Determining the symbolic Names of the function block, the function and the Optype from
an AMS or control message using the XML function catalog.
Parameters msg
fblock
function
optype
bufferSize
6.0 MOST • •
Example
| General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters |
MostMsgSet
CAPL Function Overview » MOST » MostMsgSet
Function Populating an AMS message using the syntax from the MOST specification and the
description in the XML function catalog.
Parameters msg
Message to be populated
destAdr
Destination address
symbolicMessage
FBlock.InstanceId.Function.OpType
FBlock.Function.OpType(Parameterlist)
FBlock.Function.OpType
InstId
5.2 MOST • •
Example
MostNBSetAbilityToWake
CAPL Function Overview » MOST » MostNBSetAbilityToWake
Note
If this flag is set to "Off", the connected MOST interface must not wake up the ring.
Parameters wakestatus
0: Off
1: On
2: Critical
5.2 • MOST — •
• While Application Socket is
active
Example
MostNwmFiEnableRingScan
CAPL Function Overview » MOST » MostNwmFiEnableRingScan
Function Can be called to change the ring scan behavior of CANoe’s Network Master.
The function is available for CAPL programs assigned to the Network Master block in the
simulation setup.
Parameters mode
7.2 MOST — •
Example
MostNwmFiSetConfigState
CAPL Function Overview » MOST » MostNwmFiSetConfigState
Function Forces the network configuration status to be set in CANoe’s Network Master.
Use the function with care since the state machine of the Network Master is not
guaranteed to work properly afterwards. (A shutdown of the network will reset the
Network Master’s state machine.)
The function is available for CAPL programs assigned to the Network Master block in the
simulation setup.
Parameters state
0: ConfigNotOk
1: ConfigOK
sendConfigStatusMsg
7.2 MOST — •
Example
MostNwmFiSetParameter, MostNwmFiGetParameter
CAPL Function Overview » MOST » MostNwmFiSetParameter, MostNwmFiGetParameter
Use the function with care since the state machine of the Network Master is not
guaranteed to work properly afterwards.
Refer to the MOST specification for a detailed description of the timing parameters and
the Network Master state machine.
The function is available for CAPL programs assigned to the Network Master block in the
simulation setup.
Parameters paramID
value
MostNwmFiGetParameter
7.2 MOST — •
Example
// set the timer value for tDelayCfgRequest2 to 15 s
MostNwmFiSetParameter(5, 15000);
output
CAPL Function Overview » MOST » output
Return values —
3.1 MOST • •
Example
OutputMostEthPkt
CAPL Function Overview » MOST » OutputMostEthPkt
Parameters channel
destMacAdr
dataLen
Data
Info
At least two bytes have to be sent (Ethernet Type Field). In case more than
1502 Bytes should be sent, the VLAN Tag has to be set in the first two data
bytes (0x81, 0x00).
prio
Info
The value "-1" is also valid and used as wildcard to set the default priority
(0x07).
retryCount
Number of retries.
Info
The value "-1" is also valid and used as wildcard to set the number of retries
configured for the asynchronous channel (s. MostSetRetryParamater()).
sourceMacAdr
Info
It is possible to set another source MAC address as the own one. The value "-
1" is also valid and is used as wildcard to set the own MAC address.
Return values —
Example
| MostSetMasterMode | MostGenerateBusloadEthPkt |
OutputMostEthPktThis
CAPL Function Overview » MOST » OutputMostEthPktThis
Note
Function Passes the Ethernet packet on to the next node in the nodal sequence.
Parameters —
Return values —
Example
| output | OutputMostEthPkt |
OutputMostPkt
CAPL Function Overview » MOST » OutputMostPkt
Parameters channel
Channel number
destadr
Destination address
pktdatalen
pktdata[]
Useful data
5.0 • MOST • •
• After measurement
start
Example
| output | OutputMostPktThis |
OutputMostPktThis
CAPL Function Overview » MOST » OutputMostPktThis
Note
Syntax OutputMostPktThis()
Function Passes the packet on to the next node in the nodal sequence.
Parameters —
Return values —
5.0 • MOST — •
• After measurement
start
Example
| output | OutputMostPkt |
MostParamGet
CAPL Function Overview » MOST » MostParamGet
Function Query of a parameter value from an AMS message using the parameter name from the XML
function catalog.
Info
Example
mostAmsMessage AudioDiskPlayer.MediaInfo.Status msg;
int arraySize;
mostParamSet(msg, "Pos", 0x0200); // second array element
selected
arraySize = mostParamGet(msg, "Data"); // Return value '0'
Info
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 run
time 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.
Parameters msg
paramAdr
arrayIndex
Parameter index in arrays or sequences. This declaration overwrites the indexing in the
brackets of <paramAdr>.
5.2 MOST • •
Example
MostParamGetData
CAPL Function Overview » MOST » MostParamGetData
Function Query of parameters of the String type or RawStream from an AMS message using the
parameter name from the XML function catalog.
With strings, the coding and scheduling in the message are taken into account.
Info
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 run
time 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.
Parameters msg
paramAdr
arrayIndex
Parameter index in arrays or sequences. This declaration overwrites the indexing in the
brackets of <paramAdr>.
buffer
buffersize
5.2 MOST • •
Example
MostParamGetString
CAPL Function Overview » MOST » MostParamGetString
Function Query of parameters of the String type from an AMS message using the parameter name
from the XML function catalog.
Info
Info
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 run
time 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.
Parameters msg
paramAdr
arrayIndex
Parameter index in arrays or sequences. This declaration overwrites the indexing in the
brackets of <paramAdr>.
buffer
buffersize
5.2 MOST • •
Example
MostParamGetStringAscii
CAPL Function Overview » MOST » MostParamGetStringAscii
Function Query of parameters of the String type from an AMS message and decode to ASCII format
using the parameter name from the XML function catalog. Unsupported characters are
ignored.
Info
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 run
time 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.
Parameters msg
paramAdr
arrayIndex
Parameter index in arrays or sequences. This declaration overwrites the indexing in the
brackets of <paramAdr>.
buffer
bufferSize
Maximum number of copied ASCII string parameter bytes (can be specified with
(elcount(buffer))).
7.2 MOST • •
Example
on mostAmsMessage AmFmTuner.RadioText.Status
{
char buffer[200];
long dataLen;
// get string parameter data
datalen = mostParamGetStringAscii(this, "TextA", buffer,
elcount(buffer));
if(datalen >= 0)
{
write("Radiotext: %s", buffer);
}
}
MostParamIsAvailable
CAPL Function Overview » MOST » MostParamIsAvailable
Function Check whether a described parameter with the parameter name from the XML function
catalog is in an AMS message.
This function can be used to prevent erroneous access to messages that can be first
identified at run time of a CAPL program.
Parameters msg
paramAdr
arrayIndex
Parameter index in arrays or sequences. This declaration overwrites the indexing in the
brackets of <paramAdr>.
5.2 MOST • •
Example
MostParamSet
CAPL Function Overview » MOST » MostParamSet
Function Setting of a parameter value in an AMS message using the parameter name from the XML
function catalog.
For parameters of the 'Enum' type, the numeric value can be specified. The
mostParamSetString function can be used to set the symbolic value.
Info
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 run time! Array size can only be set if Pos selects all array
elements.
Info
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 run
time 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.
Parameters msg
paramAdr
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.
5.2 MOST • •
Example
MostParamSetData
CAPL Function Overview » MOST » MostParamSetData
Function Setting of parameters of the String type or RawStream in an AMS message using the
parameter name from the XML function catalog.
When writing a string parameter with mostParamSetData 'data' has to include the coding
byte and terminator character (mostParamSetString can be used for ASCII coding).
Info
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 run
time 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.
Parameters msg
paramAdr
arrayIndex
Parameter index in arrays or sequences. This declaration overwrites the indexing in the
brackets of <paramAdr>.
buffer
datalen
5.2 MOST • •
Example
MostParamSetString
CAPL Function Overview » MOST » MostParamSetString
Function Setting of parameters of the String type (for ASCII-coded strings only) or of the 'Enum'
type in an AMS message using the parameter name from the XML function catalog.
Info
Info
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 run
time 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.
Parameters msg
paramAdr
arrayIndex
Parameter index in arrays or sequences. This declaration overwrites the indexing in the
brackets of <paramAdr>.
value
5.2 MOST • •
Example
MostParamSetStringEnc
CAPL Function Overview » MOST » MostParamSetStringEnc
Function Encoding and setting of parameters of the String type (for ASCII-coded strings only) in an
AMS message using the parameter name from the XML function catalog. Only ASCII-coded
strings are supported.
Info
The parameter description must go with the message content. The compiler
is not able to validate this here. Errors only appear at run time of the CAPL
program, if applicable. This function is primarily used to access messages,
whose content was previously limited explicitly, e.g. by the declaration. The
message must be populated in the order of its parameters particularly for
messages with StreamCases. If the parameter is not part of the message or
not the expected type, an error message it output in the Write window and
the measurement stops.
Parameters msg
paramAdr
arrayIndex
Parameter index in arrays or sequences. This declaration overwrites the indexing in the
brackets of <paramAdr>.
enconding
0x03 RDS
0x04 DAB Charset 0001
0x05 DAB Charset 0010
0x06 DAB Charset 0011
0x07 SHIFT_JIS
asciiStr
7.2 MOST • •
Example
mostAmsMessage AmFmTuner.RadioText.Status msg;
mostParamSetString(msg, "TextA", 0x00, "abc");
mostPktSetTraceColors
CAPL Function Overview » MOST » mostPktSetTraceColors
Function Sets the text and background color for displaying the MOST event in the Trace window.
The makeRGB function can be used for the colors.
Info
• This function can only be used in measurement setup and is only applied
to the trace window.
• The setting of colors with this function has a higher priority than the
color settings for events in the trace window.
Parameters font
bkgnd
Return values 0: OK
7.5 MOST • —
Example
OnMostPkt (long pktlen)
{
mostPktSetTraceColors(makeRGB(0, 0, 0), makeRGB(255, 0, 0) );
OutputMostPktThis(); // Forwards this packet to the node in the
measurement setup
}
| traceSetEventColors |
MostPMSetOverTemperature, MostPMResetOverTemperature
CAPL Function Overview » MOST » MostPMSetOverTemperature, MostPMResetOverTemperature
long MostPMResetOverTemperature ()
Function MostPMSetOverTemperature notifies the PowerMaster in its own device that an over
temperature of the device will be simulated. When setting the "over temperature status",
the PowerMaster is prompted to not wake up the ring after it has been shut down, if a
MOST signal is detected at the Rx-FOT.
MostPMResetOverTemperature signals the PowerMaster that the device has again reached
operating temperature.
Info
No message that triggers the shutdown of the ring due to overheating is sent
by setting the "overview temperature status"
(NetBlock.Shutdown.Result(0x03)). If the "over temperature status" is reset,
the ring is not automatically woken up by the PowerMaster. This must be
performed by the application, if necessary.
Parameters —
5.2 • MOST — •
• While Application
Socket is active
• Only in device with
Power Master
Example
MostPMShutDownCancel
CAPL Function Overview » MOST » MostPMShutDownCancel
Parameters —
5.0 • MOST — •
• While Application Socket is
active
• Only in device with Power
Master
Example
MostPMShutDownStart
CAPL Function Overview » MOST » MostPMShutDownStart
Function Initiates a shutdown of the system by the Power Master (see MOST Specification 2.2).
Parameters —
5.0 • MOST — •
• While Application Socket is
active
• Only in device with Power
Master
Example
MostPMTempShutdownWakeupTimeout
CAPL Function Overview » MOST » MostPMTempShutdownWakeupTimeout
Info
Parameters timeout
Timeout in [ms].
6.0 • MOST — •
• While Application Socket
is active
• Only in device with
Power Master
Example
MostPrepareReport
CAPL Function Overview » MOST » MostPrepareReport
The destination address of the report message is set to the source address of the
command message. The parameters FBlockId, InstId and FunctionId in msgReport are set
as given by the msgCommand. Any wildcard InstId in msgCommand is transferred to a
concrete value in msgReport with the help of the device’s Local FBlock list.
According to the MOST specification, the OpTypes are converted by the command into the
associated report OpType:
For Properties:
GetInterface Interface
For Methods:
GetInterface Interface
Abort Error
AbortAck ErrorAck
Messages with Ack-OpTypes contain a sender handle in the first two data bytes. This
sender handle is also set in the first two data bytes of the report message.
Parameters msgCommand
msgReport
Return values —
5.2 MOST — •
Example
MostRcvSpyMessagesOnly
CAPL Function Overview » MOST » MostRcvSpyMessagesOnly
Note
Syntax mostRcvSpyMessagesOnly ()
Function The MOST message handling routines of this node are only called if the message was
received by the Spy of the bus interfaces.
This mode is especially useful for nodes that act as pure observers or – with the help of
the Spy – are used to perform cross-node analyses.
Queries such as "if (!this.MOST_IsSpy) return;" have been eliminated in the message
handling routines, because the message handling routines are no longer called by node
and Spy messages.
Parameters —
Return values —
5.0 MOST — •
Example
MostReadReg
CAPL Function Overview » MOST » MostReadReg
Note
Syntax long MostReadReg(long channel, long chip, DWORD offset, long regdatalen)
Parameters channel
chip
Number of the chip in the MOST hardware (1 = OS8104; other chips cannot be accessed
yet).
offset
regdatalen
5.0 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
| MostWriteReg | OnMostReg |
MostSendError
CAPL Function Overview » MOST » MostSendError
(Suitable for error codes: 0x01, 0x02, 0x03, 0x05, 0x0B, 0x40, 0x41, 0x42, 0x43)
Function Generates and sends an error message directly based on a received command message.
The various signatures make it easy to transfer the most common error codes with their
ancillary information.
Any wildcard InstId in the command message is transferred to a concrete value in the
error message with the help of the device’s Local FBlock list.
Parameters msgcmd
code
byte1
byte2
word1
data
datalen
Return values —
5.2 MOST — •
Example
MostSetAllBypass
CAPL Function Overview » MOST » MostSetAllBypass
Function This command can be used to close the MOST hardware bypass (bypassmode=1) or open it
(bypassmode=0). If the bypass is closed the MOST device is invisible to other devices in
the ring.
For the functionality of the AllBypass see also the description for the /ABY bit in the
Transceiver Control Register of the OS8104.
Parameters channel
5.0 • MOST — •
• Not in StopMeasurement
Example
MostSetAndFilter
CAPL Function Overview » MOST » MostSetAndFilter
Note
AND-Filter
Syntax long MostSetAndFilter( long channel, long arb, long targetAdr, long
sourceAdr, long type, byte msg[17], long crc, long ack)
Function Effects the Optolyzer only when in spy mode. See the online help of the OptoControl help
file for information about how AND and XOR filter masks work together. The there
described mask string is assembled appropriately from the parameters of the function
‘MostSetAndFilter’.
Parameters channel
arb
Arbitration byte
targetAdr
Destination address
sourceAdr
Source address
type
Message type
msg
crc
CRC code
ack
3.2 • MOST — •
• Not in StopMeasurement
Example
| MostGetChannel |MostGetAndFilter |
MostSetClockSource
CAPL Function Overview » MOST » MostSetClockSource
Note
Function Sets the clock source for the MOST timing master. The function has no effect if the bus
interface is configured as MOST timing slave.
Parameters channel
source
0 Internal oscillator.
1 Synchronizes the timing master clock to the S/PDIF input signal. The bus interface
must be configured as S/PDIF timing slave (refer to MostSetSyncSpdifMode()).
6.0 MOST — •
Example
Use case: External S/PDIF source device connected to the S/PDIF In connector of the
VN2610
Typically the internal oscillator is used as clock source, since most S/PDIF source devices
do not generate a S/PDIF signal with the same clock as the MOST clock (44,1 / 48 kHz).
// use internal oscillators timing master clock
on key 's'
{
long channel = 1;
In some special cases, e.g. for testing purpose it is possible to synchronize the timing
master clock to S/PDIF input signal.
// synchronize the timing master clock to the S/PDIF input signal
on key 's'
{
long channel = 1;
More S/PDIF examples see CANoe online help MOST Access to Digital Audio Channels
(S/PDIF In and Out).
MostSetCorrectStartupSBC
CAPL Function Overview » MOST » MostSetCorrectStartupSBC
Note
Function During the next start-up phase of the ring, this function activates or deactivates the
correct setting of the "Synchronous Bandwidth Control" register (SBC) in the MOST chip
(e.g. at the next wake up of the ring).
Info
Parameters channel
mode
0 inactive
1 active
Return values
Example
mostSetEclGlitchFilter
CAPL Function Overview » MOST » mostSetEclGlitchFilter
Note
Function Configures the timing of the glitch filter for the ECL. For pulses which are shorter than
the given time durationus the callback <OnMostEcl> will not be called, neither will those
pulses appear in a Trace window.
Parameters channel
durationus
Example
MostSetEcl, MostGetEcl
CAPL Function Overview » MOST » MostSetEcl, MostGetEcl
Note
Function MostSetEcl switches the Electrical Control Line which can be used for wake-up and
diagnosis purposes.
Parameters channel
eclState
0: low
1: high
MostGetEcl
Example
MostSetEclTermination, MostGetEclTermination
CAPL Function Overview » MOST » MostSetEclTermination, MostGetEclTermination
Note
Function Sets and gets the state of the termination resistor of the Electrical Control Line.
Parameters channel
eclTermination
MostGetEclTermination
Example
MostSetMacAdr, MostGetMacAdr
CAPL Function Overview » MOST » MostSetMacAdr, MostGetMacAdr
Note
This function is only available with MOST hardware VN2640 and OptoLyzer G2 3150o
(firmware version V1.2 is required).
Parameters channel
macAdr
MostGetMacAdr:
7.2 MOST150 — •
Example
// Set MAC address on channel MOST 1 to 01:02:03:04:05:06
MostSetMacAdr(1, 0x010203040506LL);
MostSetMasterMode, MostGetMasterMode
CAPL Function Overview » MOST » MostSetMasterMode, MostGetMasterMode
Note
This function is only available with MOST hardware VN2640 and OptoLyzer G2 3150o
(firmware version V1.2 is required).
Function Configures the timing master as static or non-static master. A non-static master shuts the
network down if there is for example no signal at its optical input, whereas a static
master keeps the network running independently from the input signal.
Parameters channel
mode
0: static master
1: non-static master
MostGetMasterMode:
7.2 MOST150 — •
Example
// configure bus interface as non-static timing master
MostSetMasterMode(1, 1);
MostSetTimingMode(1, 1);
| MostGetChannel |
MostSetRetryParameter, MostGetRetryParameter
CAPL Function Overview » MOST » MostSetRetryParameter, MostGetRetryParameter
Function The functions provide access to the transceiver chip parameters for message transmission.
The number of low-level transmission attempts and delay between attempts can be set
and retrieved.
Parameters channel
id
value
Value to be set.
MostGetRetryParameter:
Example
// configure MOST transceiver for 5 low-level transmission attempts on
Control channel
MostSetRetryParameter(1, 0, 5);
MostSetShutDownFlagUsage, MostGetShutDownFlagUsage
CAPL Function Overview » MOST » MostSetShutDownFlagUsage, MostGetShutDownFlagUsage
Note
Parameters channel
mode
MostGetShutDownFlagUsage:
7.2 MOST150 — •
Example
MostSetStressNodeParameter, MostGetStressNodeParameter
CAPL Function Overview » MOST » MostSetStressNodeParameter, MostGetStressNodeParameter
Note
This function is only available with MOST hardware VN2640 and OptoLyzer G2 3150o
(firmware version V1.2 is required).
Function VN2640:
OptoLyzer G2 3150o:
The OptoLyzer G2 3150o for MOST150 provides stress functionality through an additional
network interface controller (NIC). For a set of stress functions (MostSetRxBufferCtrl,
MostSyncAlloc) the NIC is required to be visible in the network (bypass open).
With MostSetStressNodeParameter the MOST node parameters of this additional NIC can
be configured.
Parameters channel
id
Parameter identification:
OptoLyzer G2 3150o
G2 3150o: OptoLyzer
Specifies the delay between two G2 3150o
messages:
1 means 10 ms delay,
2 means 20 ms delay and so on.
0: as fast as possible
2:
FBlockID: 0x01
InstID: 0x00
FuncID: 0x000
OpType: 0x1
16:
custom message (to specify
custom message use function
mostConfigureBusloadCtrl)
OptoLyzer
G2 3150o
value
MostGetStressNodeParameter:
7.2 MOST150 — •
Example VN2640
See MostConfigureBusloadCtrl
Example G2 3150o
// configure stress controller as visible network node with logical address
0x123
MostSetSystemLockFlagUsage, MostGetSystemLockFlagUsage
CAPL Function Overview » MOST » MostSetSystemLockFlagUsage, MostGetSystemLockFlagUsage
Note
Parameters channel
mode
MostGetSystemLockFlagUsage:
7.2 MOST150 — •
Example
MostSetHWFilter
CAPL Function Overview » MOST » MostSetHWFilter
Note
Filter Mode
mode = 1 HW filter on
Parameters channel
3.2 • MOST — •
• Not in StopMeasurement
Example
| MostGetChannel | MostGetHWFilter |
Function These functions set the node address, group address or alternative packet address of the
MOST hardware to the specified values.
Parameters channel
nodeadr
groupadr
Group address
altpktadr
nodeposadr
3.2 • MOST — •
• Not in
StopMeasurement
5.0: • MOST — •
MostSetAltPktAdr
• Not in
StopMeasurement
Example
mostSetRxBufferAsync
CAPL Function Overview » MOST » mostSetRxBufferAsync
Note
Function Starts or stops draining of the asynchronous receive buffer and thereby allows to provoke
low level retries.
The node may receive a varying number of packets (MDP or MEP) before it eventually
provokes low level retries. The number depends on the size of the packets and is limited
either to 3 kByte of data or 255 packets.
After enabling the draining of the Rx buffer again, a number of packets received during
the stress mode may be shown in the Trace with time stamps close to the time of re-
enabling the draining.
Parameters channel
buffermode
Return values 0
Example
| MostSetRxBufferCtrl |
MostSetRxBufferCtrl
CAPL Function Overview » MOST » MostSetRxBufferCtrl
Note
• VN2640
• VN2600/VN2610
• Optolyzer (MOST25)
• OptolyzerOL3150o (firmware version >= V1.5.3)
• OptolyzerOl3050e (firmware version >= V1.5)
Function Disables or enables the Rx buffer for messages of the control channel.
In case the parameter mode is set to '0' or '1' the result is reported by means of the
callback function OnMostStress().
Disabling the Rx buffer means that exactly one more message is accepted. Afterwards the
buffer is no longer enabled, i.e. further messages are rejected with "RxBuffer full" (see
status flags of Tx acknowledgment).
VN2640:
Disabling the Rx buffer means that up to four control messages will be accepted, before
the buffer is disabled and low level retries on the bus are provoked.
OptolyzerOL3150o:
The stress network interface controller (NIC) must have its bypass opened (see
MostSetStressNodeParameter ).
Only messages addressed to the StressNIC will be blocked.
Parameters channel
mode
5.1 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
| MostGetChannel | mostSetRxBufferAsync |
MostSetSBC
CAPL Function Overview » MOST » MostSetSBC
Function This function sets the "Synchronous Bandwidth Control (SBC) Register" of the MOST
hardware chip to the given value.
The function is only practically applicable if the hardware connected to the channel is in
master mode.
The newly set value is only accepted once a "DeAllocate" message re-releases all
synchronous channel assignments.
Parameters channel
sbcvalue
Return values
5.2 • MOST — •
• Not in StopMeasurement
Example
Function Spy mode is activated (mode = 1) or deactivated (mode = 0) for the Control,
Asynchronous or Ethernet transmission channel using these functions.
Parameters channel
mode
0 Spy inactive
1 Spy active
For MOST hardware interfaces that do not support a Spy mode the error code
kMostWrongHWType is returned.
The Optolyzer Box supports Control Spy mode only with a closed bypass, i.e. if it is open
the bypass must be closed with MostSetAllBypass(channel, 1).
5.0 • MOST — •
• Not in StopMeasurement
Example
MostSetSyncAudio
CAPL Function Overview » MOST » MostSetSyncAudio
Function The function programs the routing engine for the audio input or output of the bus
interface. The functions works independently of whether the synchronous channels are
reserved. The user must ensure the reservation, e.g. by sending an Alloc message to the
timing master.
MOST50 / MOST150: The function performs the routing of audio input or output of the
bus interface. At completion of the routing operation the event procedure
OnMostSyncAudio() will be called.
Info
This function is only available if the connected hardware interface has its
bypass opened.
Parameters channel
channels
device = 0 Synchronous channels on which the Line input signal should be routed to.
device = 1 Synchronous channels from which the data should be routed to the
Line output.
The transferred array must always have four entries. Unused channels must be assigned
0xF8. The four channels have the following mapping to the audio data:
Info
device
mode
label
Connection label. In case of Line-In routing (device=0; mode=1) the label parameter has
no meaning.
width
5.2 • MOST • •
• Not in Stopmeasurement
Example
See CANoe online help MOST Access to Analog Audio Channels (Line In/ Headphone Out).
MostSetSyncMute
CAPL Function Overview » MOST » MostSetSyncMute
Function Activates or deactivates the audio input or output of the bus interface.
Parameters channel
device
0 Line-In
1 Line-Out
mute
5.2 • MOST — •
• Not in StopMeasurement
Example
See CANoe online help MOST Access to Analog Audio Channels (Line In/ Headphone Out).
MostSetSyncSpdif
CAPL Function Overview » MOST » MostSetSyncSpdif
Note
This function is only available with MOST hardware VN2610 for MOST25, Optolyzer G2
3050e for MOST50 and VN2640/Optolyzer G2 3150o for MOST150.
Function The function programs the routing engine for S/PDIF input or output of the bus interface.
The function works independently of whether the synchronous channels are reserved. The
user must ensure the reservation, e.g. by sending an Alloc message to the timing master.
MOST50 / MOST150: The function performs the routing of S/PDIF input or output of the
bus interface. At completion of the routing operation the event procedure
OnMostSyncSpdif() will be called.
Info
Parameters channel
channels
S/PDIF In Synchronous channels on which the S/PDIF input signal should be routed
to.
S/PDIF Out Synchronous channels from which the data should be routed to the
S/PDIF output.
The transferred array must always have eight entries. Unused channels must be assigned
0xF8. The eight channels have the following mapping to the S/PDIF data:
Info
device
1 S/PDIF out: Synchronous channel signals are grabbed for S/PDIF output.
mode
label
Connection label. In case of S/PDIF-In routing (device=0; mode=1) the label parameter has
no meaning.
width
6.0 MOST — •
Example
See CANoe online help MOST Access to Digital Audio Channels (S/PDIF In and Out).
MostSetSyncSpdifLock
CAPL Function Overview » MOST » MostSetSyncSpdifLock
Note
Function The function locks the internal S/PDIF timing generator on the S/PDIF input data stream.
Unlock the timing generator if frame synchronization is not possible due to a closed loop
configuration. A closed loop means that the S/PDIF input signal is locked through an
external S/PDIF device on the S/PDIF output of the bus interface.
Parameters channel
mode
0 Separates the timing generator from the S/PDIF input data stream.
6.0 MOST — •
Example
Use Cases:
External S/PDIF source device connected to the S/PDIF In connector of the VN2610
In this case the VN2610 is S/PDIF Slave (set by MostSetSyncSpdifMode()). In case the
VN2610 is configured as TimingSlave it automatically locks the internal S/PDIF timing
generator on the S/PDIF input data stream. As TimingMaster the there are two
possibilities for configuring the VN2610: Please refer to the example given for
MostSetClockSource()).
External S/PDIF source and sink device connected to the S/PDIF In and Out connector
of the VN2610
This is not the tyical use case but in case of synchronization problems (mentioned above)
the timing generator has to be separated from the S/PDIF input data stream.
on key 's'
{
long channel = 1;
MostSetSyncSpdifLock( channel, 0 );
}
More S/PDIF examples see CANoe online help MOST Access to Digital Audio Channels
(S/PDIF In and Out).
MostSetSyncSpdifMode
CAPL Function Overview » MOST » MostSetSyncSpdifMode
Note
Parameters channel
mode
0 S/PDIF slave.
1 S/PDIF master.
6.0 MOST — •
Example
Use Cases:
External S/PDIF sink device connected to the S/PDIF Out connector of the VN2610
In this case the VN2610 is S/PDIF Master and the S/PDIF mode has to be set accordingly
(mode = 1).
on key 's'
{
long channel = 1;
MostSetSyncSpdifMode( channel, 1 );
}
External S/PDIF source device connected to the S/PDIF In connector of the VN2610
In this case the VN2610 is S/PDIF Slave and the S/PDIF mode has to be set accordingly
(mode = 0).
on key 's'
{
long channel = 1;
MostSetSyncSpdifMode( channel, 0 );
}
More S/PDIF examples see CANoe online help MOST Access to Digital Audio Channels
(S/PDIF In and Out).
MostSetSyncVolume
CAPL Function Overview » MOST » MostSetSyncVolume
Function Sets the volume of the audio input or output of the bus interface.
Parameters channel
device
0 Line-In
1 Line-Out
volume
5.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
See CANoe online help MOST Access to Analog Audio Channels (Line In/ Headphone Out).
MostSetTimingMode
CAPL Function Overview » MOST » MostSetTimingMode
Function This function configures the MOST hardware as a Timing Master (mode = 1) or Timing
Slave (mode = 0).
MOST25: For further information on Master/Slave switchover functionality see also the
description of the MTR bit in the Transceiver Control Register of the OS8104.
MOST50/150: Switching from Slave to non-static Master does not wake the network
automatically. Use MostWakeup to start the network.
Info
Parameters channel
mode
0 Slave
1 Master
5.0 • MOST — •
• Not in StopMeasurement
Example
MostSetTxLight
CAPL Function Overview » MOST » MostSetTxLight
Note
• VN2600/VN2610
• Optolyzer (MOST25)
• OptolyzerOL3150o (firmware version >= V1.5.3)
Function Sets the Light Status at the Fiber Optical Transmitter (FOT).
Parameters channel
txlight
For OptolyzerOL3150o:
The stress network interface controller (NIC) must have its bypass opened ( see
MostSetStressNodeParameter ).
5.1 • MOST — •
• Not in StopMeasurement
Example
MostSetTxLightPower
CAPL Function Overview » MOST » MostSetTxLightPower
Note
Function Sets the intensity of the light at the Fiber Optical Transmitter (FOT).
Parameters channel
power
valid values:
5.1 • MOST — •
• Not in StopMeasurement
Example
MostSetXorFilter
CAPL Function Overview » MOST » MostSetXorFilter
Note
XOR-Filter
Syntax long MostSetXorFilter( long channel, long arb, long targetAdr, long
sourceAdr, long type, byte msg[17], long crc, long ack)
Function Set the XOR filter. Effects the Optolyzer only when in spy mode.
Parameters channel
arb
Arbitration byte
targetAdr
Destination address
sourceAdr
Source address
type
Message type
msg
crc
CRC code
ack
3.2 • MOST — •
• Not in StopMeasurement
Example
| MostGetChannel | MostGetXorFilter |
MostShutDown
CAPL Function Overview » MOST » MostShutDown
Parameters channel
7.2 MOST150 — •
Example
MostStrictChannelMapping
CAPL Function Overview » MOST » MostStrictChannelMapping
Note
Syntax MostStrictChannelMapping ()
Function The MOST sending and receiving behavior of the node is strictly based on the
configuration in the Simulation Setup:
• MOST messages and events are only received on channels that have been connected
to the node in the Simulation Setup.
• By default the node sends MOST messages on the channel to which it is connected in
the Simulation Setup.
Both Node messages and Spy messages continue to be received, provided that both types
are generated by the connected hardware.
This mode is especially useful for nodes that are only connected to one MOST channel in
the Simulation Setup. In this mode queries such as the following are omitted in the
message handling routines "if (this.MsgChannel!=XY) return;" or else the channel is
specified in defining the message handling routines e.g. "on mostMessage
MsgChannel1.*".
In many cases the user does not need to allocate the specific channel before sending a
message. When a message is created the channel is allocated by a wildcard (0xFFFF)
which is mapped to the channel that is connected in the Simulation Setup for sending in
this mode. This makes the CAPL code channel-independent, and it is easier to re-use the
code.
Parameters —
Return values —
5.0 MOST — •
Example
MostStringToAscii
CAPL Function Overview » MOST » MostStringToAscii
Function Convert MOST string to ASCII string. Unsupported characters in the input data are ignored.
Info
Supported encodings:
0x03 RDS
0x04 DAB Charset 0001
0x05 DAB Charset 0010
0x06 DAB Charset 0011
0x07 SHIFT_JIS
Parameters sourceData
sourceDataLen
buffer
bufferSize
Maximum number of copied ASCII string bytes (can be specified with (elcount(buffer))).
7.2 MOST • •
Example
byte data[9] = {0x00,0x00,0x61,0x00,0x62,0x00,0x63,0x00,0x00);
char buffer[200];
if(0 < mostStringToAscii(data, elcount(data), buffer, elcount(buffer)))
write("ASCII: %s", buffer);
Output:
ASCII: abc
MostSyncAlloc
CAPL Function Overview » MOST » MostSyncAlloc
Function MOST25:
This function reserves synchronous bandwidth by sending an Alloc system message to the
MOST TimingMaster.
Info
The service can only process one request at a time. After MostSyncAlloc()
or MostSyncDealloc() is called, the next request cannot be made until the
result of the current request is returned – asynchronously.
MOST150:
Info
Parameters numChannels
6.0 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
Callback function:
Function This function is called on completion of the allocation of channels triggered by the call of
the function.
Whether the allocation was successful and if so, which channels were allocated, is
indicated in the parameters described below.
Parameters allocResult
kBusy = 0x02 The channels were not reserved, because the TimingMaster is busy
processing another request
kDeny = 0x03 The channels were not reserved, because there are no more
channels available
kUnknown = 0xFF Unspecified error (e.g. a timeout while waiting for the
TimingMaster to respond)
numChannels
channels[]
The values contained in this parameter are valid for allocResult = 0x01 only. It passes
numChannels channel numbers reserved via MostSyncAlloc(). The value in channels[0]
designates the label used for administration of the reserved channels.
Return values —
MOST — •
Example
MostSyncDealloc
CAPL Function Overview » MOST » MostSyncDealloc
Function MOST25:
This function releases reserved bandwidth for synchronous channels by sending a Dealloc
system message to the TimingMaster.
Info
• The service can only process one request at a time. After MostSyncAlloc
or MostSyncDealloc is called, the next request cannot be made until the
result of the current request is returned – asynchronously.
• OnMostSyncDeallocResult() is only called for channel labels reserved
via MostSyncAlloc.
• OnMostSyncDeallocResult() is also called for each reserved label if
release of all channels is requested (DeallocAll).
Most150:
Info
Parameters label
Channel label.
6.0 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
Callback function:
Function This function is called on completion of the deallocation of channels triggered by the call
of the function.
Whether the deallocation was successful and if so, which channels were deallocated, is
indicated in the parameters described below.
Parameters deallocResult
kBusy = 0x02 The channels were not reserved, because the TimingMaster is busy
processing another request
kUnknown = 0xFF Unspecified error (e.g. a timeout while waiting for the
TimingMaster to respond)
label
Return values —
MOST — •
Example
MostWakeup
CAPL Function Overview » MOST » MostWakeup
Function The function wakes up the MOST loop optically by switching on the light on the output of
the connected MOST hardware for the maximum duration.
Parameters channel
duration
5.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
MostTwinklePowerLed
CAPL Function Overview » MOST » MostTwinklePowerLed
Note
Parameters channel
5.2 • MOST — •
• After measurement start
• Not in Stopmeasurement
Example
| MostGetChannel | MostGetHWCapability |
MostWriteReg
CAPL Function Overview » MOST » MostWriteReg
Note
The registers of the OS8104 chip are distributed among pages. It is not possible to
perform read or write actions on register pages. The offset is calculated as follows: offset
= page << 8 + address
Syntax long MostWriteReg(long channel, long chip, DWORD offset, long regdatalen,
byte regdata[])
Parameters channel
chip
Number of the MOST hardware chip (1 = OS8104; other chips cannot be accessed yet)
offset
regdatalen
Number of registers to be written (maximum 16; for the Optolyzer Interface Box
maximum 1)
regdata[]
5.0 • MOST — •
• After measurement start
• Not in StopMeasurement
Example
OnMostAllBypass(long mode)
CAPL Function Overview » MOST » OnMostAllBypass(long mode)
Function The event procedure OnMostAllBypass is called if the bypass of the MOST chip was
opened or closed. The variable mode contains the new state.
Controller events are passed through CAPL nodes. Please use the Multibus filter or MOST
filter to filter these events in node chains.
Parameters mode
Return values —
5.1 MOST • •
Example
| MostSetAllBypass | MostGetAllBypass |
OnMostAllocTable
CAPL Function Overview » MOST » OnMostAllocTable
Note
Syntax OnMostAllocTable()
Function OnMostAllocTable is called as soon as the hardware interface detects a change in the
MOST allocation table. The allocation table contains the reservation status of the
synchronous MOST channels.
Controller events are passed through CAPL nodes. Please use the Multibus filter or MOST
filter to filter these events in node chains.
Parameters —
Return values —
5.1 MOST • •
| MostGetAllocTable |
on mostAMSMessage
CAPL Function Overview » MOST » on mostAMSMessage
Syntax on mostAMSMessage
Function The event procedure on mostAMSMessage is called when a message is received from the
Application Message Service (AMS).
The key word this and the message selectors are available within event procedures to
permit access to the data of the message just received. The output(this) command serves
to pass the message in a nodal sequence.
The same modes of the event procedure as for on mostMessage may be used to prefilter
messages.
Parameters —
Return values —
5.0 MOST • •
Example
The following examples show various modes of the event procedure on mostAMSMessage:
• on mostAMSMessage AudioPlayer.TimePosition.Set
React to message AudioPlayer.TimePosition.Set defined in a XML function
catalog.
• on mostAMSMessage AudioPlayer_TimePosition_Set
React to message AudioPlayer_TimePosition_Set defined in a CANdb database.
• on mostAMSMessage *
React to all MOST messages
• on mostAMSMessage 0x312010
React to message 0x312010 (function block 0x31, function 0x201, operation 0x0)
• on mostAMSMessage MsgChannel1.*
React to all messages received by channel 1.
• on mostAMSMessage MsgChannel1.0x312010
React to message 0x312010 if it is received by channel 1.
• on mostAMSMessage 0x22104C,0x312010-0x31201F
React to messages 0x22104C and 0x31201c through 0x31201F.
OnMostApInstID
CAPL Function Overview » MOST » OnMostApInstID
Syntax OnMostApInstID()
Function If the InstID of the associated function block changes, the CAPL node is informed by the
event procedure OnMostApInstID (only with an active MOST Application Socket). If the
functional address {FBlockID, InstID} occurs more than once in the network a change to
the InstID is initiated by the Network Master (Message:
NetBlock.FBlockIDs.SetGet(FBlockID, OldInstID, NewInstID)).
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
In the Simulation Setup event procedures are only called if the event occurs on the
channel allocated to the CAPL node.
Parameters —
Return values —
5.0 MOST — •
Example
OnMostAsRegistry(long regsel)
CAPL Function Overview » MOST » OnMostAsRegistry(long regsel)
Syntax OnMostAsRegistry()
Function When the Local FBlockList or Bus Registry is changed the event procedure
OnMostAsRegistry() is called.
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
In the Simulation Setup event procedures are only called if the event occurs on the
channel allocated to the CAPL node.
Parameters regsel
Return values —
5.0 MOST — •
Example
In the following example whenever a registry changes its contents are output to the Write
window.
OnMostAsRegistry(long regsel)
{
long size, i;
long rxtxlog, fblockid, instid;
// display registry type
if(regsel == 1)
write("Local Registry:");
else if(regsel == 2)
write("Bus Registry:");
// get registry size
size = MostAsRgGetSize(regsel);
// print the whole registry
write("Adr FBlock InstID");
for(i = 0; i < size; ++i)
{
rxtxlog = MostAsRgGetRxTxLog(regsel,i);
fblockid = MostAsRgGetFBlockID(regsel,i);
instid = MostAsRgGetInstID(regsel,i);
write("%04X %02X %02X", rxtxlog, fblockid, instid);
}
}
Bus Registry:
Adr FBlock InstID
0100 02 00
0100 04 01
0100 C0 01
0101 C1 01
0101 C5 01
OnMostCriticalUnlock
CAPL Function Overview » MOST » OnMostCriticalUnlock
Syntax OnMostCriticalUnlock()
Function A "Critical Unlock" was detected on one of the configured MOST channels. This event
occurs if the lock status of the connected MOST hardware does not exhibit a "Lock" (see
MOST Spec 2V3 - 3.2.2 NetInterface) after a "Stable Lock" for at least t_Unlock (see MOST
Spec 2V3 – 3.9 Timing Definitions).
The relevant channel or time stamp of this event can be called up with the
MostEventChannel, MostEventTime and MostEventOrigTime functions.
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
Parameters —
Return values —
5.2 MOST • •
Example
OnMostEcl
CAPL Function Overview » MOST » OnMostEcl
Note
Function The event procedure is called when the state of the Electrical Control Line has changed.
Parameters eclState
0: Low
1: High
Return values —
Example
OnMostEthPkt
CAPL Function Overview » MOST » OnMostEthPkt
Function When an Ethernet packet is received over the Packet Data Channel the OnMostEthPkt
event procedure is called.
• long MostEventChannel()
• long MostEventTime()
• float MostEventTimeNs()
• long MostEventOrigTime()
Returns the hardware generated time stamp of the event (Units: 10 µs).
• long MostEthPktDir()
• long MostEthPktDlc()
Tries to copy cnt data bytes to a provided buffer. Returns the actual number of
copied bytes.
Tries to copy cnt data bytes starting at byte position 'begin' to a provided buffer.
Returns the actual number of copied bytes.
• long MostEthPktIsSpy()
Returns 1 if the packet was received over the Spy of the Packet Data Channel,
otherwise 0.
• long MostEthPktAck()
• long mostEthPktPAck()
• dword MostEthPktCRC()
• long MostEthPktCAck()
In nodal sequences (Measurement Setup) a received packet can be passed to the next
node by the OutputMostEthPktThis command.
Parameters pktDataLen
Return values —
Example
OnMostEthPktFragment
CAPL Function Overview » MOST » OnMostEthPktFragment
Function The event procedure OnMostEthPktFragment is called when the spy detects an
incomplete Ethernet packet transmission.
• long MostEventChannel()
• long MostEventTime()
• float MostEventTimeNs()
• long MostEventOrigTime()
Returns the hardware generated time stamp of the event (Units: 10 µs).
• long MostEthPktFragmentDlc()
Tries to copy cnt data bytes to a provided buffer. Returns the actual number of copied
bytes.
Info
Due to performance reasons only the first transmitted data bytes are
stored in the fragment event.
All following functions return -1 if the corresponding data field is invalid (i.e. event was
too short to contain the information).
• long MostEthPktFragmentAck()
• long MostEthPktFragmentPAck()
Returns the preemptive acknowledge from the potential packet receiver(s) to the
packet transmitter.
• dword MostEthPktFragmentCRC()
• long MostEthPktFragmentCAck()
• long MostEthPktFragmentAnnouncedDlc()
Returns the announced data length at start of transmission. In general, the announced
length is not equal to the actual number of transmitted data bytes for fragments.
In nodal sequences (Measurement Setup) a fragment can be passed to the next node by
the OutputMostEthPktFragmentThis command.
Parameters —
Return values —
Example
OnMostFiAmsPreReceive
CAPL Function Overview » MOST » OnMostFiAmsPreReceive
Function When fault injection is active, this function is called before the simulation node (CAPL
program or node layer module) receives the AMS message. This allows incoming messages
to be manipulated in order to emulate faulty application behavior.
The message can be suppressed (return value 0), forwarded (return value 1), or forwarded
as an altered message (use of MostFiAmsReceive).
Info
Parameters msg
This variable contains the AMS message of the simulation node to be received.
The number of transmitted data can be up to 65535 bytes for a mostAmsMessage. For
reasons of efficiency, only the first 200 bytes are copied to the msg variable. To facilitate
access to all the message's user data, the message can be assigned to an AMS message
declared with a sufficient size (see example below).
Return values The return value can be used to control whether or not the message is to be received by
the simulation node.
7.2 MOST — •
Example
// change all Set operations to SetGet operations
// before the simulation node receives the message
long OnMostFiAmsPreReceive(mostAmsMessage * msg)
{
// The following if statement prevents this code from being called
recursively
// e.g. by ignoring the Tx acknowledgements
if((msg.OpType == 0x0) && (msg.dir == Rx)) // Set message
{
// make a copy
mostAmsMessage * modMsg = {DLC = 1000}; // buffer for 1000 data bytes
modMsg = msg; // at most 1000 data bytes are copied here
// modify OpType
modMsg.OpType = 0x2;
// forward modified message to simulation node
MostFiAmsReceive(modMsg);
}
else
{
// forward the original message
return 1;
}
}
| OnMostFiAmsPreSend |
OnMostFiAmsPreSend
CAPL Function Overview » MOST » OnMostFiAmsPreSend
Function When fault injection is active, this function is called before the AMS send request of a
CAPL program or node layer module is issued on the bus. This allows outgoing messages to
be manipulated in order to emulate faulty application behavior.
Parameters msg
The number of transmitted data can be up to 65535 bytes for a mostAmsMessage. For
reasons of efficiency, only the first 200 bytes are copied to the msg variable. To facilitate
access to the entire message's user data, the message can be assigned to an AMS message
declared with a sufficient size (see example below).
Return values The return value can be used to control whether or not the message is sent.
7.2 MOST — •
Example
// change all Status messages a simulated node tries to send to error
messages
long OnMostFiAmsPreSend(mostAmsMessage * msg)
{
if(msg.OpType == 0xC) // Status or Result message
{
// make a copy
mostAmsMessage * modMsg = {DLC = 1000}; // buffer for 1000 data bytes
modMsg = msg; // at most 1000 data bytes are copied here
// modify OpType
modMsg.OpType = 0xF;
// keep message length and data
// but change the first byte
modMsg.byte(0) = 0x0B; // set ErrorCode=Device malfunction
// send modified message
output(modMsg);
| OnMostFiAmsPreReceive |
OnMostGroupAdr(long groupadr)
CAPL Function Overview » MOST » OnMostGroupAdr(long groupadr)
Function The group address of the hardware interface to the MOST bus has changed. The value of
the new group address is in the groupadr parameter.
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
Parameters groupadr
Return values —
5.0 MOST • •
Example
| MostSetGroupAdr | MostGetGroupAdr |
on mostLightLockError
CAPL Function Overview » MOST » on mostLightLockError
Syntax on mostLightLockError
If the event procedure should only react to events on channel 1 this is defined as follows:
on MsgChannel1.mostLightLockError
Parameters —
Return values —
4.0 MOST • •
Example
OnMostMacAdr
CAPL Function Overview » MOST » OnMostMacAdr
Function The MAC address (48 bit) of the hardware interface to the MOST bus has changed.
CAPL nodes are transparent to the controller events. Please use the MOST application
filter, to filter these events in nodal sequences.
Parameters macAdr
Return values —
Example
| MostSetMacAdr | OutputMostEthPkt |
on mostMessage
CAPL Function Overview » MOST » on mostMessage
Syntax on mostMessage
Function The event procedure on mostMessage is called on the receipt of a function catalog
conform MOST frame (RType=Normal).
The key word this and the message selectors (see Selectors) are available within the
event procedures, to access the data of the message that has just been received. The
command output(this) can be used for forwarding the message in a node chain.
Parameters —
Return values —
4.0 MOST • •
Example
The following examples show various modes of the event procedure on mostMessage:
• on mostMessage AudioPlayer.TimePosition.Set
React to message AudioPlayer.TimePosition.Set defined in a XML function
catalog.
• on mostMessage AudioPlayer_TimePosition_Set
React to message AudioPlayer_TimePosition_Set defined in a CANdb database.
• on mostMessage *
React to all MOST messages
• on mostMessage 0x312010
React to message 0x312010 (function block 0x31, function 0x201, operation 0x0)
• on mostMessage MsgChannel1.*
React to all messages received by channel 1.
• on mostMessage MsgChannel1.0x312010
React to message 0x312010 if it is received by channel 1.
• on mostMessage 0x22104C,0x312010-0x31201F
React to messages 0x22104C and 0x31201c through 0x31201F.
OnMostMHPBlock
CAPL Function Overview » MOST » OnMostMHPBlock
Note
OnMostMHPBlock can only be used in the measurement setup and should be inserted
under the item "Callback function".
For simulation of a MOST High connection sender and receiver in CAPL the MOST High DLL
can be used. The DLL is located in the Exec32 folder of the MOST High Demos.
Function The event procedure is called up as soon as a block from a MOST High connection has
been fully transmitted.
• long MostMHPBlockIsSpy()
• long MostMHPBlockNumberOfFrames()
• long MostMHPBlockNumberOfFramesIndicated()
Provides the number of Data Frames of the block that it should has according to the 0
frame.
Parameter:
None
Returns:
Number of Data Frames
• long MostMHPBlockSize()
• long MostMHPBlockTransportMode()
• long MostMHPBlockCnt()
• long MostMHPBlockOptions()
• long MostMHPBlockSegID()
Parameters sourceDevID
destDevID
fBlockID
instID
functionID
opType
Return values The return value determines whether the MHP block event is relayed to the next function
block in the measurement setup (e.g. a Trace window).
0: No relay
1: relay
6.0 MOST • —
Example
The example shows how the data of a block can be written to a file. The file (fileHandle
variable) must be opened in advance. The block event is relayed by the "return 1"
instruction to the next function block in the measurement setup.
const long blockBufferSize = 64*1024;
long OnMostMHPBlock (long sourceDevID, long destDevID, long fBlockID, long
instID,
long functionID, long opType)
{
//Prepare a data buffer
byte buffer[blockBufferSize];
long byteCount;
//Get data of the MHPBlock
mostMHPBlockGetData(buffer, blockBufferSize);
//Write data to the file
byteCount = (mostMHPBlockSize() < blockBufferSize) ?
mostMHPBlockSize() :
blockBufferSize;
fileWriteBinaryBlock(buffer, byteCount, fileHandle);
//Forward MHPBlock to the next CAPL node
return 1;
}
OnMostMHPConnection
CAPL Function Overview » MOST » OnMostMHPConnection
Note
For simulation of a MOST High connection sender and receiver in CAPL the MOST High DLL
can be used. The DLL is located in the Exec32 folder of the MOST High Demos.
Function The event procedure is called up as soon as a MOST High connection version 2.2 or higher
is terminated.
• long MostMHPOnMostMHPConnectionIsSpy()
• long MostMHPOnMostMHPConnectionVersion()
• long MostMHPOnMostMHPConnectionNegAcks()
• long MostMHPOnMostMHPConnectionFrameRequests()
• long MostMHPPOnMostMHPConnectionBlockRequests()
• long MostMHPOnMostMHPConnectionWarnings()
• long MostMHPOnMostMHPConnectionErrors()
Indicates the number of MHP Observer errors. Errors indicate MOST High Protocol
violations.
Parameter:
None
Returns:
Number of Observer errors
• long MostMHPConnectionPackets()
Parameters sourceDevID
destDevID
fBlockID
instID
functionID
opType
Return values The return value determines whether the MHP connection event is relayed to the next
function block in the measurement setup (e.g. a Trace window).
0: No relay
1: relay
7.1 MOST • —
Example
OnMostMHPError
CAPL Function Overview » MOST » OnMostMHPError
Note
OnMostMHPError can only be used in the measurement setup and should be inserted
under the item "Callback function".
For simulation of a MOST High connection sender and receiver in CAPL the MOST High DLL
can be used. The DLL is located in the Exec32 folder of the MOST High Demos.
Function The event procedure is called up as soon as a MOST High protocol violation is observed.
• long MostMHPErrorCode()
Indicates the MHP observer error number. See possible MHP observer error codes.
Parameter:
None
Returns:
Observer error number
• long MostMHPErrorValue()
• long MostMHPErrorExpectedValue()
• long MostMHPErrorIsWarning()
Parameters sourceDevID
destDevID
fBlockID
instID
functionID
opType
Return values The return value determines whether the MHP error event is relayed to the next function
block in the measurement setup (e.g. a Trace window).
0: No relay
1: relay
6.0 MOST • —
Example
| OnMostMHPBlock | OnMostMHPPacket | mostMHPErrorSetTraceColors | MOST High Observer Error Codes | MOST High Observer and
Combiner | MOST High Protocol: Simulation of Sender and Receiver |
OnMostMHPPacket
CAPL Function Overview » MOST » OnMostMHPPacket
Note
OnMostMHPPacket can only be used in the measurement setup and should be inserted
under the item "Callback function".
For simulation of a MOST High connection sender and receiver in CAPL the MOST High DLL
can be used. The DLL is located in the Exec32 folder of the MOST High Demos.
Function The event procedure is called up as soon as a MOST High packet is finished.
• long MostMHPPacketIsSpy()
• long MostMHPPacketVersion()
• long MostMHPPacketNegAcks()
• long MostMHPPacketFrameRequests()
• long MostMHPPacketBlockRequests()
• long MostMHPPacketWarnings()
• long MostMHPPacketErrors()
Indicates the number of MHP Observer errors. Errors indicate MOST High Protocol
violations.
Parameter:
None
Returns:
Number of Observer errors
Parameters sourceDevID
destDevID
fBlockID
instID
functionID
opType
Return values The return value determines whether the MHP packet event is relayed to the next
function block in the measurement setup (e.g. a Trace window).
0: No relay
1: relay
6.0 MOST • —
Example
| OnMostMHPBlock | OnMostMHPError | mostMHPPacketSetTraceColors | MOST High Observer and Combiner | MOST High
Protocol: Simulation of Sender and Receiver |
OnMostMPR(long value)
CAPL Function Overview » MOST » OnMostMPR(long value)
Function A change is made to the Maximum Position Register of the MOST chip, i.e. the number of
devices in the MOST ring. The value parameter contains the new value of the Maximum
Position Register.
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
Parameters value
Return values —
5.0 MOST • •
Example
| MostGetMPR |
OnMostMPRDelayed(long mpr)
CAPL Function Overview » MOST » OnMostMPRDelayed(long mpr)
Function The value of the maximum position register in the MOST chip has not changed since the
last network change event (NCE) for t_MPRDelayed (see MOST Spec 2V3 – 3.9 Timing
Definitions). The mpr parameter indicates the value of the maximum position register.
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
Parameters mpr
Return values —
5.2 MOST • •
Example
| OnMostMPR | MostGetNceType |
OnMostMsgFragment
CAPL Function Overview » MOST » OnMostMsgFragment
Function The event procedure OnMostMsgFragment is called when the spy detects an incomplete
transmission on the Control channel.
• long MostEventChannel()
• long MostEventTime()
• float MostEventTimeNs()
• long MostEventOrigTime()
Returns the hardware generated time stamp of the event (Units: 10 µs).
• long MostMsgFragmentDlc()
Tries to copy cnt data bytes to a provided buffer. Returns the actual number of
copied bytes.
Info
Due to performance rea-sons only the first transmitted data bytes are
stored in the fragment event.
All following functions return -1 if the corresponding data field is invalid (i.e. event was
too short to contain the information).
• long MostMsgFragmentAck()
• long MostMsgFragmentPAck()
Returns the preemptive acknowledge from the potential packet receiver(s) to the
packet transmitter.
• long MostMsgFragmentPriority()
• long MostMsgFragmentPIndex()
Returns the packet index. The packet index increments by one per message from a
node.
• dword MostMsgFragmentCRC()
• long MostMsgFragmentCAck()
• long MostMsgFragmentAnnouncedDlc()
Returns the announced data length at start of transmission. In general, the announced
length is not equal to the actual number of transmitted data bytes for fragments.
In nodal sequences (Measurement Setup) a fragment can be passed to the next node by
the OutputMostMsgFragmentThis command.
Parameters —
Return values —
Example
OnMostNetOn / OnMostInitReady
CAPL Function Overview » MOST » OnMostNetOn / OnMostInitReady
Syntax OnMostNetOn
OnMostInitReady
Function The NetOn event (first "Stable Lock" after the loop has been woken up) has occurred on
one of the configured MOST channels. The relevant channel or time stamp of this event
can be called up with the MostEventChannel, MostEventTime and MostEventOrigTime
functions.
Info
In the MOST Specification 3V0 the NetOn event was renamed to InitReady.
However, the meaning is still the same. The Trace window displays this
information in the disassembly column and the detail view. In CAPL there is
an additional event procedure OnMostInitReady (since version 7.2). To
assure the correct operation of existing CAPL programs, the event handler
OnMostNetOn is still called.
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
Parameters —
Return values —
5.2 MOST • •
Example
| OnMostStableLock |
Function The OnMostNetState() event procedure is called when the network status is changed.
oldstate and newstate pass the previous and current network status respectively.
The following network states are defined based on the MOST Specification 2.3.
Info
Each device or each MOST hardware forms its own network state from the
perspective of a node in the MOST ring.
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
In the Simulation Setup event procedures are only called if the event occurs on the
channel allocated to the CAPL node.
Parameters oldstate
newstate
Return values —
5.0 MOST • •
Example
OnMostNodeAdr(long nodeadr)
CAPL Function Overview » MOST » OnMostNodeAdr(long nodeadr)
Function The node address of the hardware interface to the MOST bus has changed. The value of
the new node address is in the nodeadr parameter.
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
Parameters nodeadr
Return values —
5.0 MOST • •
Example
| MostGetNodeAdr | MostSetNodeAdr |
OnMostNPR(long value)
CAPL Function Overview » MOST » OnMostNPR(long value)
Function The Node Position Register of the MOST chip, i.e. the position of the device in the MOST
ring, has changed. The parameter value contains the new value of the Node Position
Register.
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
Parameters npr
Return values —
5.0 MOST • •
Example
| MostGetNPR |
OnMostPkt(long pktdatalen)
CAPL Function Overview » MOST » OnMostPkt(long pktdatalen)
Function When a packet is received over the Asynchronous Channel the OnMostPkt() event
procedure is called.
• long MostPktMsgChannel()
Returns the channel of the packet event.
• long MostPktMsgTime()
Returns the time stamp of the event (Units: 10 µs).
• float MostPktMsgTimeNs()
Returns the time stamp of the event (Units: 1 ns).
• long MostPktOrigTime()
Returns the hardware generated time stamp of the event (Units: 10 µs).
• long MostPktSrcAdr(), long MostPktDestAdr()
Returns the source or destination address
• long MostPktDir()
Returns the direction of transmission (Rx=0, Tx=1, TxRequest=2)
• long MostPktArbitration()
Returns the packet arbitration value
• long MostPktDlc()
Number of transported data bytes (= Source address + Number of used quadlets = 2 +
N*4; N = 0,1,2...)
• long MostPktGetData(BYTE[] buffer, long cnt)
Tries to copy cnt data bytes to a provided buffer. Returns the actual number of
copied bytes.
• long MostPktGetSelData(BYTE[] buffer, long begin, long cnt)
Tries to copy cnt data bytes starting at byte position 'begin' to a provided buffer.
Returns the actual number of copied bytes.
• long MostPktTelID()
Returns the TelID of the packet (upper four bits of data byte 4)
• long MostPktTelLen()
Returns the TelLen of the packet (comprised of data bytes 4 and 5)
• long MostPktIsSpy()
Returns 1 if the packet was received over the Spy of the asynchronous channel,
otherwise 0.
• long MostPktAck()
Returns the acknowledge code (MOST150 only).
• long MostPktPAck
Returns the preemptive acknowledge from the potential packet receiver(s) to the
packet transmitter (for MostEthPktIsSpy()=1 and MOST150).
(0x00: No Response; 0x01: Buffer full; 0x04: OK)
• long MostPktCRC
Returns the CRC value (for MostPktIsSpy()=1 and MOST150).
• long MostPktCAck()
Returns the CRC acknowledge code (for MostPktIsSpy()=1 and MOST150).
(0x00: No Response; 0x01: CRC error; 0x04: OK)
In nodal sequences (Measurement Setup) a received packet can be passed to the next
node by the OutputMostPktThis command.
Parameters pktdatalen
Return values —
5.0 MOST • •
OnMostPktFragment
CAPL Function Overview » MOST » OnMostPktFragment
Function The event procedure OnMostPktFragment is called when the spy detects an incomplete
transmission on the Packet Data channel.
• long MostEventChannel()
• long MostEventTime()
• float MostEventTimeNs()
• long MostEventOrigTime()
Returns the hardware generated time stamp of the event (Units: 10 µs).
• long MostPktFragmentDlc()
Tries to copy cnt data bytes to a provided buffer. Returns the actual number of
copied bytes.
Info
Due to performance rea-sons only the first transmitted data bytes are
stored in the fragment event.
All following functions return -1 if the corresponding data field is invalid (i.e. event was
too short to contain the information).
• long MostPktFragmentAck()
• long MostPktFragmentPAck()
Returns the preemptive acknowledge from the potential packet receiver(s) to the
packet transmitter.
• long MostPktFragmentPIndex()
Returns the packet index. The packet index increments by one per message from a
node.
• dword MostPktFragmentCRC()
• long MostPktFragmentCAck()
• long MostPktFragmentAnnouncedDlc()
Returns the announced data length at start of transmission. In general, the announced
length is not equal to the actual number of transmitted data bytes for fragments.
In nodal sequences (Measurement Setup) a fragment can be passed to the next node by
the OutputMostPktFragmentThis command.
Parameters —
Return values —
Example
on mostRawMessage
CAPL Function Overview » MOST » on mostRawMessage
Syntax on mostRawMessage
Function on mostRawMessage is called on the receipt of MOST frames whose type isn't Normal.
These are RemoteRead, RemoteWrite, Alloc, Dealloc and GetSource. See Selectors for
the applicable selectors. The command output(this) can be used for forwarding the
message in a node chain.
If the event procedure should only react to messages on channel 1 this is defined as
follows:
on MsgChannel1.mostRawMessage
Parameters —
Return values —
4.0 MOST • •
Example
OnMostReg
CAPL Function Overview » MOST » OnMostReg
Syntax OnMostReg()
• long MostRegChip()
Returns the identifier of the chip whose registers are transported with this event ( see
MostReadReg)
• long MostRegOffset()
Returns the start address of the register.
• long MostRegDataLen()
Returns the number of bytes transported with this event (maximum of 16).
• void MostRegGetData(byte buffer[], long buffersize)
The register values may be copied to a byte buffer with the function
MostRegGetData(). It must be assured that the buffer has the specified size
(buffersize). A maximum of 16 bytes are transported with the MostReg event.
• long MostRegGetByteAbs(long chip, long adr)
long MostRegGetWordAbs(long chip, long adr)
Returns the contents of the register 'adr' in the chip 'chip'. If the MostReg event does
not contain this register kMostParameterOutOfRange = -9 is returned.
Parameters —
Return values —
5.0 MOST • •
Example
OnMostReg()
{
byte regData[16];
long i, offset;
// get register contents
MostRegGetData(regData, 16);
// get offset
offset = MostRegOffset();
// output register contents to Write window
write("OnMostReg() called for chip %d on channel %d", MostRegChip(),
MostEventChannel());
write("Map Value");
for(i = 0; i < MostRegDataLen(); i++)
{
write("%04X %02X", offset + i, regData[i]);
}
}
0081 42
0082 16
...
| MostReadReg | MostWriteReg |
OnMostSBC(long value)
CAPL Function Overview » MOST » OnMostSBC(long value)
Function A change is made to the Synchronous Bandwidth Register of the MOST chips, i.e. the
distribution into synchronous/asynchronous transmission bandwidth. The 'value' parameter
contains the new value of the Synchronous Bandwidth Register (see also Datasheet for the
OS8104).
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
Parameters value
Return values —
5.0 MOST • •
Example
| MostGetSBC | MostSetSBC |
OnMostShutdownFlag
CAPL Function Overview » MOST » OnMostShutdownFlag
Function This event procedure is called each time the state of the Shutdown flag changes.
Parameters oldstate
newstate
Example
| MostSetShutDownFlagUsage |
OnMostStableLock
CAPL Function Overview » MOST » OnMostStableLock
Syntax OnMostStableLock()
Function A "Stable Lock" was detected on one of the configured MOST channels. This event occurs if
the lock status of the connected MOST hardware exhibits "Lock" (see MOST Spec 2V3 -
3.2.2 NetInterface) for at least t_Lock (see MOST Spec 2V3 – 3.9 Timing Definitions). The
relevant channel or time stamp of this event can be called up with the MostEventChannel,
MostEventTime and MostEventOrigTime functions.
CAPL nodes are transparent to the controller events. Please use the Multibus filter or
MOST filter, to filter these events in nodal sequences.
Parameters —
Return values —
5.2 MOST • •
Example
Function The event procedure OnMostStress() will be called before the beginning and after the
end of the stress generation.
Parameters mode
7 MostGenerateBypassToggle
8 MostSetSystemLockFlagUsage
9 MostSetShutDownFlagUsage
10 MostGenerateBusloadEthPkt
11 mostSetRxBufferAsync
state
Note:
Note:
Return values —
5.2 MOST • •
Example
OnMostSyncAudio
CAPL Function Overview » MOST » OnMostSyncAudio
Function The event procedure OnMostSyncAudio will be called after routing of audio input or
output of the bus interface (see MostSetSyncAudio).
Parameters label
Connection label.
device
mode
0: Routing canceled.
1: Routing executed.
Return values —
Example
OnMostSyncSpdif
CAPL Function Overview » MOST » OnMostSyncSpdif
Function The event procedure OnMostSyncSpdif will be called after routing of S/PDIF input or
output of the bus interface (see MostSetSyncSpdif).
Parameters label
Connection label.
device
mode
0: Routing cancelled.
1: Routing executed.
Return values —
Example
OnMostSystemLock
CAPL Function Overview » MOST » OnMostSystemLock
Function This event procedure is called each time the state of the System-Lock flag changes.
Parameters oldstate
newstate
Example
| MostSetSystemLockFlagUsage |
OnMostTimingMode(long mode)
CAPL Function Overview » MOST » OnMostTimingMode(long mode)
Function The OnMostTimingMode() event procedure is called if the timing mode of the MOST
hardware has been changed.
Controller events are passed through CAPL nodes. Please use the Multibus filter or MOST
filter to filter these events in node chains.
Parameters mode
0 Timing Slave
1 Timing Master
Return values —
5.1 MOST • •
Example
| MostSetTimingMode | MostGetTimingMode |
OnMostTxLight
CAPL Function Overview » MOST » OnMostTxLight
Note
Function The event procedure is called as soon as the light status of the fibre optical transmitter
(FOT) is switched.
Info
The event procedure is only called if the light status has been switched by
the application (see also MostSetTxLight).
Parameters mode
Return values —
6.1 MOST • •
Example
Selectors
CAPL Function Overview » MOST » Selectors
Most_InstanceID
CAck Returns the CRC acknowledge code 0...0xFF read only, Spy,
MOST150 only
0x00: No
Response
0x01: CRC error
0x04: OK
PAck Returns the preemptive acknowledge code 0...0xFF read only, Spy,
MOST150 only
0x00: No
Response
PIndex PIndex is a node-based counter (1 byte) which 0..0xFF read only, Spy,
increments per message sent. All low-level retries of a MOST150 only
message have the same PIndex.
Example
Press <Ctrl>+<W> or select Signal insertion from MOST function catalog... from the shortcut
menu to open a selection dialog listing all messages and their parameters from the function
catalog for selection.
This includes all non-nested parameters in the user data with constant width and constant
position.
In this context, the parameter name is inserted into the program text as a selector.
mostRawMessage Selectors
5 D2 D2 P0 rsvd rsvd
6 D3 D3 P1 rsvd NPR
7 D4 D4 P2 rsvd rsvd
8 D5 D5 P3 rsvd GA
9 D6 D6 P4 rsvd NAH
10 D7 D7 P5 rsvd NAL
mostLightLockError Selectors
Symbols from MOST function catalogs can be used in CAPL. The most common applications are outlined on
this page.
on mostAmsMessage AudioDiskPlayer.TrackPosition.Status
{
...
}
• Populating simple message parameters with data. This includes all non-nested parameters in the user
data with constant width and constant position.
• Populating complex message parameters with data (parameters with variable length/position, all
nested parameters):
Since the message data is dynamic, the parameter address ("Data.Record[].MediaTitle") cannot be
checked until runtime.
• Symbols from enumeration types can be indicated with the addition of message names and parameter
names.
| General Tips on XML Function Catalog Support in CAPL | Input Assistant | MOST: Symbolic Identification of Messages | MOST:
Symbolic Identification of Parameters | Selectors |
kMostIllegalTime = -3 The function was called in the wrong phase of the measurement.
For example the Optolyzer mode can only be changed in the
‘prestart’ function.
kMostWrongThread = -4 For technical reasons this function may not be called from this area
of CANoe.
Not all functions can be called from CAPL nodes in the analyzing
setup.
kMostWrongHWMode = -5 The hardware interface to the MOST bus is in a state in which the
called function is unavailable.
kMostTxQueueFull = -6 The transmit queue of 256 Messages is full, while trying to send
another message.
kMostParameterOutOfRange = -9 One or more function parameters lie outside of their valid value
ranges.
kMostDriverCallFailed = -10 The MOST hardware driver returned an error. Please make sure
that the driver has been properly installed and that the hardware is
operationally ready.
kMostAsDoubleOp = -22 The function cannot be executed, because its results already apply.
(e.g. a CAPL node has already been registered in the Local
FBlockList)
kMostAsIllegalTime = -23 The function cannot be executed in this phase of the simulation
cycle.
kMostAsInvalidParameter = -29 At least one parameter passed with the function lies outside of its
kMostXML4CAPLUnknownMsg = -31 The specified message cannot be dissolved with the available
function catalogs.
kMostXML4CAPLMsgSizeExceeded = - The function cannot be executed, since the size of the specified
32 message is exceeded.
kMostXML4CAPLParamTypeMismatch The function has attempted to read a value that does not have the
= -35 compatible data type.
kMostXML4CAPLEncodingMismatch = The function cannot read the string or raw data, since the coding
-36 does not match.
Tips for using XML-based CAPL functions for the symbolic description of messages and parameters:
There are two different access formats when using XML function catalogs in CAPL:
Compile time
Examples
mostAmsMessage AudioDiskPlayer.TrackPosition.Status msg;
msg.Track = 3;
Runtime
Examples
mostAmsOutput(1, "AudioDiskPlayer.SourceActivity.StartResult(1,On)", 1);
testWaitForMostAMSMessage("AudioDiskPlayer.TrackPosition.Status(5)", 1, 200);
• Since the symbols are interpreted during runtime, this access format is less efficient.
• Faulty symbols cause the measurement process to be aborted.
• Runtime access is the only possible access format for parameters with variable length/position (e.g.,
strings) and nested parameters (e.g., elements of an array or record).
• For runtime access, symbols have to be enclosed in quotation marks.
| Symbolic Identification of Messages | Symbolic Identification of Parameters | Input Assistance | MOST Database Support in CAPL |
The MOST High Observer observes all messages belonging to the MOST High Protocol (MHP) and uses the
Combiner to combine them. The CAPL event procedures described here allow the reaction to events of the
observer.
• To analyze of data
• To filter the events
• To save the reference data in files
Event procedures:
• OnMostMHPBlock
• OnMostMHPPacket
• OnMostMHPError
• OnMostMHPConnection
Info
These event procedures and their functions are only available for CAPL programs in the
measurement setup.
For simulation of a MOST High connection sender and receiver in CAPL the MOST High DLL can be
used. The DLL is located in the Exec32 folder of the MOST High Demos.
Errors
16 Timeout violation sending NegAck on missing 0-Frame yes (ms) yes (ms)
(T_Frame).
21 Timeout violation between Data Frames (T_AIR_Delay). yes (ms) yes (ms)
23 Timeout violation between END CONNECTION attempts yes (ms) yes (ms)
(T_End).
24 Timeout violation closing the connection (T_Delay_End). yes (ms) yes (ms)
25 Timeout violation between HOLD CONNECTION messages yes (ms) yes (ms)
(T_Hold_Resend).
26 Timeout after last HOLD CONNECTION message yes (ms) yes (ms)
(T_Hold).
29 Timeout violation between Data Frame and NegAck yes (ms) yes (ms)
(T_dwn_NegAck).
30 Illegal value of NDF_Ack: Value must not exceed NDF. yes yes
31 Scale * NDF_Ack exceeds maximum block size. yes (block size) yes (block size)
32 Timeout violation between ADJUST TRANSMISSION RATE yes (ms) yes (ms)
(increase) messages (T_TxSpeedRecovery).
Warnings
mostMessage Variables describe MOST frames which are compliant with the function catalog.
Example
mostRawMessage Variables describe MOST frames which do not fit into the function catalog structure
(e.g., RemRead, RemWrite, Alloc, Dealloc, GetSource).
mostAMSMessage Variables describe Application Message Service (AMS) messages. These messages
comply with the function catalog format and - like mostMessage variables - they can
be identified by an ID.
Example
The default size of mostAMSMessage variables is 200 bytes. To define messages with
larger useful data ranges the desired size must be specified explicitly:
mostAMSMessage * msg = { DLC = 1000 };
Before sending the message with output(msg) the DLC and thereby also the TelLen can
be updated according to the length actually set.
Example
Press <Ctrl>+<M> or select Message entry with MOST function catalog from the shortcut menu
to open an input assistant which displays a data entry field in the current program line listing a
selection of all MOST messages described in the function catalog. The selection takes in all
function catalogs assigned to the CAPL node.
In this context, the input assistant enables the description of messages up to OpType and adds
the resulting description to the program text without quotation marks in the notation separated
by period marks.
Using the MOST input assistance you can enter symbolic messages in the CAPL Browser.
Info
XML function catalogs must be inserted in the simulation setup to use the MOST input
assistance.
The Input assistance can be opened with the Message input with MOST function catalog... shortcut menu
item or by the key combination <Ctrl>+<M>.
You can enter FBlockID, FunctionID and OpType of a MOST message in the opened input assistance window
using a selection list. This list contains the current available information from the XML catalogs.
You can enter the single parts of a function address in numeric or symbolic notation. Depending on the
first entered sign the list view changes:
• When entering characters the list shows the symbol names followed by the hexadecimal IDs in
brackets.
• When entering "0" it is assumed that you want to enter a hexadecimal value. The list shows the
hexadecimal IDs followed by the symbolic names in brackets.
• When entering a digit between 1 and 9 it is assumed that you want to enter the ID in decimal format.
The list shows the decimal IDs followed by the symbolic names in brackets.
Marks an entry of the selection list < ↑>, <↓>, <Page ↑>, < Page
Jumping back or forward within the input filed. <Ctrl> + < →>, <Ctrl> + <←>
Info
The MOST input assistance is also available as an add-in for Visual Studio 2003 .NET and Visual
Studio 2005. The installation program MOST_Function_Catalogue_Setup.msi is located in the
folder Exec32\util_most.
For selected CAPL functions, e.g., mostAmsOutput, MOST messages can be described with the name used
in the XML function catalog.
The symbolic definition of the message essentially follows the syntax that is used in the MOST
specification. All variants are derived from the following basic form:
FBlock.Instance.Function.OpType(Parameter,Parameter,Parameter)
Example
AudioAmplifier.1.Mute.Status(MuteOn)
Essentially it is possible to set raw data for the user data. Accordingly, the parameter bytes have to be set
as hexadecimal values in curly brackets. This facilitates, for example, the sending of messages which do
not comply with the definition in the function catalog.
Example
Diagnosis.1.KeywordRec.Set({AABB11223344})
or pure numerical:
0x06.1.0x050.0x0({AABB11223344})
Example
Press <Ctrl>+<M> or select Message input with MOST function catalog... from the shortcut
menu to open an input assistant which displays a data entry field in the current program line
listing a selection of all MOST messages described in the function catalog. The selection takes in
all function catalogs assigned to the CAPL node.
In this context, the input assistant permits the description of messages up to OpType and adds
the resulting description to the program text without quotation marks in the notation separated
by period marks.
For selected CAPL functions, e.g., mostParamGet, MOST messages can be described with the name used in
the XML function catalog.
The current content of the message to which the CAPL function, e.g., mostParamSet, refers determines
which definition in the function catalog the parameter description is compared with.
With simple parameters, the parameter name is sufficient for identification. With structured parameter
types, the path to the elementary parameter must be specified.
Taking the AudioDiskPlayer(0x31) function block as an example, the parameter descriptions for a number
of parameter types can be explained.
Info
The POS parameter that belongs to the record must be set so that the TrackTime parameter is
part of the message. If this is the case, the parameter value is written to the correct place in
the message, regardless of whether the entire record is a part of the message or only the record
field: TrackTime.
The index of the array element is specified in square brackets and attached to the name of the array
element. The associated POS parameter must be set so that the array element is part of the message. The
parameter is MediaType irrespective of whether the entire array or only an element is part of the
message.
As an alternative, the functions for accessing parameters permit the specification of the parameter index
as an additional parameter inside the brackets of the parameter address instead (see the <arrayIndex>
parameter in MostParamSet). This index declaration overwrites the indexing in the brackets of the
parameter address.
Example
mostAmsMessage AudioDiskPlayer.MediaInfo.Status msg
MostParamSet(msg, "Data", 2); // sets the array size to 2
MostParamSet(msg, "Data.Record[].MediaType", 2, 1); // sets the parameter
'MediaType' in the second array element to 1
The size (number of elements) of arrays can be set or read with MostParamSet() and MostParamGet().
Example
mostAmsMessage AudioDiskPlayer.MediaInfo.Status msg
MostParamSet(msg, "Data", 3);
The size (number of elements) of a sequence can also be set or read with MostParamSet() and
MostParamGet().
Example
mostAmsMessage NetBlock.FBlockIDs.Status msg
MostParamSet(msg, "FBlockIDList", 3);
The "FBlockIDList" parameter now contains 3 elements (here: 3 entries with {FBlockID, InstID}).
Example
Press <Ctrl>+<W> or select Signal insertion from MOST function catalog... from the shortcut
menu to open a selection dialog listing all messages and their parameters from the function
catalog for selection.
In this context the parameter identification is inserted into the program text as a string
enclosed inside quotation marks.
| Symbolic Identification of Messages | Test Feature Set: Symbolic Definition of MOST Messages |
In Option .FlexRay several APIs are provided for receiving and transmitting FlexRay frames:
DLC monitoring
Cycle time
Occurrence of a message
Message distance
Node active
Node inactive
TestCheck::CreateNodeBabbling,
TestCheck::StartNodeBabbling
Signal value
TestCheck::CreateMsgSignalValueRangeViolation,
TestCheck::StartMsgSignalValueRangeViolation
Timeout
FRConfiguration
CAPL Function Overview » FlexRay » FRConfiguration
Function Can be used to create a FlexRay parameter object. The data content of this object is all
protocol parameters relevant to FlexRay in the context of initializing a FlexRay
Communication Controller. The object data can be manipulated or read out by selectors
associated with this object.
Selectors FRBaudrate
gdMacrotick
gMacroPerCycle
gdNIT
gdSampleClockPeriod
gdTSSTransmitter
gPayloadLengthStatic
gdActionPointOffset
gdStaticSlot
gNumberOfStaticSlots
gdMinislotActionPointOffset
gdMinislot
gNumberOfMinislots
gClusterDriftDamping
gListenNoise
gColdstartAttempts
gSyncNodeMay
gOffsetCorrectionStart
gdDynamicSlotIdlePhase
gdSymbolWindow
gdCASRxLowMax
gdCASRxLowMax
gdWakeupSymbolRxIdle
gdWakeupSymbolRxLow
gdWakeupSymbolRxWindow
gdWakeupSymbolTxIdle
gdWakeupSymbolTxLow
gMaxWithoutClockCorrectionFatal
gMaxWithoutClockCorrectionPassive
gNetworkManagementVectorLength
pChannels
pMicroPerCycle
pSamplesPerMicrotick
pPayloadLengthDynMax
pPayloadLengthFIFO
Size of the maximum data length that can be received via the FIFO buffer in 16-bit words.
pLatestTx
pdMaxDrift
pdAcceptedStartupRange
pClusterDriftDamping
pDecodingCorrection
pDelayCompensation_A
pDelayCompensation_B
pOffsetCorrectionOut
pRateCorrectionOut
pExternOffsetCorrection
pExternRateCorrection
pExternCorrectionMode
Defines the addition mode for the external rate and offset correction values:
Value Meaning
Offset Rate
0 Disable Disable
1 Disable Disable
2 Disable —
3 Disable •
4 Disable Disable
5 Disable Disable
6 Disable —
7 Disable •
8 — Disable
9 — Disable
10 — —
11 — •
12 • Disable
13 • Disable
14 • —
15 • •
pMacroInitialOffset_A
pMacroInitialOffset_B
pMicroInitialOffset_A
pMicroInitialOffset_B
pWakeupChannel
pWakeupPattern
pAllowHaltDueToClock
pAllowPassiveToActive
pBGTick
pPhysicalLayer
Value Meaning
0 RS485_0
1 RS485_1
2 FlexRay Electrical
pSingleSlotEnabled
pBGEnable
pDynamicSegmentEnable
pChannelsMTS
pCCVersion
Value Meaning
2 BusDoctor
3 FlexCard Cyclone
4 FlexCard Cyclone II
5 VN
Write protected!
pStrobePointPosition
pdMicrotick
6.1 FlexRay • •
Example
FRFrame
CAPL Function Overview » FlexRay » FRFrame
Uses a symbolic frame name from the database and specifies the send channel/cluster.
Can be used to define the transmission time and channel/cluster without database.
Function Can be used to create a FlexRay send object. The object data can be manipulated by
selectors associated with this object. Other object characteristics can be read out from
selectors.
Objects are then registered using the FRSetSendFrame and are sent using the
FRUpdateStatFrame or FROutputDynFrame functions.
Parameters MsgChannel<num>
<num> must be an integer (e.g. 1, 2, 3, etc.) defining the channel number of the
corresponding FlexRay interface.
<frame name>
The required parameters (<slot ID>, <base cycle>, <cycle repetition> and <channel mask>)
are taken from the corresponding frame definition in the database.
<frame var>
<slot ID>
<base cycle>
This value must be smaller than the repetition factor and lies in the range between 0 and
63.
This value, together with the repetition factor, determines the "Cycle Multiplexing".
<cycle repetition>
The value must be between 1 and 64 and be a multiple of 2 (e.g. 1, 2, 4, 8, 16, 32 or 64).
This value, together with the base cycle, determines the "Cycle Multiplexing".
MsgChannel
The application channel that the FlexRay interface determines, which should send the
frame.
FR_ChannelMask
Identifies the FlexRay channel of the CC. A value of 1 will send the frame to channel A, 2
will send it to channel B and 3 to channels A and B.
FR_SlotID
FR_CycleOffset
FR_CycleRepetition
This value must come from the value set {1, 2, 4, 8, 16, 32, 64}.
FR_PayloadLength
The index is always byte-oriented and counted from 0. Thus, dword(1) returns the double
word from bytes 1...4 and not from bytes 4...7.
If the frame object was initialized via a symbolic name from the database, signal names can
also be used directly as selectors for the data range. The raw value of the signal is retrieved
or set. The physical value can be retrieved or set by <signal name>.Phys.
FR_Flags
Corresponding bits in the flags set or activate special statuses for the frame to be sent:
Only a frame in the static segment may have set this bit.
Caution
If this bit is set, then the sync bit must also be set.
Caution
With static frames, the initial data bytes then contain the local NM vector;
with dynamic frames, the first two bytes then designate the expanded message
ID.
0x80 TX OFF
Flag has only effect on In-Cycle-Repetition frames. Is the flag set (1), then the
frame can be sent in the slot given by the parameter slotID. Is the flag not set
(0 = default), then the frame will be sent in the next slot of any of the slots
that are given by the In-Cycle-Repetition definition in the database.
Caution
FR_Payload
This selector allows the access of the payload array (for using as a byte array parameter in
functions).
If the Frame object is created (e.g. FrFrame (1,0,1) receiveFrame;) for use with the TFS
function TestGetWaitFrFrameData or TestGetWaitFrNullFrameData or
TestGetWaitFrFrameErrorData, then the following selectors can be used to retrieve the
received event information:
Time
The RX time stamp that has been synchronized with the global time base in the PC
(hardware synchronization's reference channel or PC system clock).
The time stamp must be used if time relations should be regarded with events from other
sources.
Note: The Time selector is not available when executing CAPL programs directly on an
interface hardware (CAPL on Board).
Time_ns
The RX time stamp that has been synchronized with the global time base in the PC
(hardware synchronization's reference channel or PC system clock).
The time stamp must be used, if time relations should be regarded with events from other
sources. This time stamp is also output in the Trace window when receiving a frame.
MsgChannel
The application channel that the FlexRay interface determines, which received the frame.
FR_ChannelMask
Identifies the FlexRay channel of the CC. With 1 the frame was received on channel A, with
2 on channel B.
FR_SlotID
FR_Cycle
FR_PayloadLength
Length of the payload that was received in 16 Bit words (data type: word).
The index is always byte-oriented and counted from 0. Thus, dword(1) returns the double
word from bytes 1...4 and not from bytes 4...7.
If the frame object was initialized via a symbolic name from the database, signal names can
also be used directly as selectors for the data range. The raw value of the signal is retrieved
or set. The physical value can be retrieved or set by <signal name>.Phys.
Caution
But be aware that the symbolic declaration of the frame object must match the
received frame. Otherwise the symbolic signal interpretation will be wrong!
FR_Flags
Corresponding bits in the flags mirror specific bits in the FlexRay header of the received
frame:
With static frames, the initial data bytes then contain the local NM vector;
with dynamic frames, the first two bytes then designate the expanded message
ID.
All other bits of the flags are reserved and do not have any meaning.
FR_Payload
This selector allows the access of the payload array (for using as a byte array parameter in
functions).
6.1 FlexRay • •
Example 1
Example 2
void example ()
{
FrFrame (1,0,1) myFrame = { FR_Flags = cFrTTFlag | cFrPPFlag,
FR_ChannelMask = 1, FR_PayloadLength = 2 };
foo (myFrame.FR_Payload, myFrame.FR_PayloadLength * 2);
}
Example 3
void example ()
{
foo (myFrame);
}
Example 4
Caution
FrPDU
CAPL Function Overview » FlexRay » FrPDU
Uses a symbolic PDU name from the database to create a transmission object.
Uses a symbolic PDU name from the database to create a transmission object and
additionally specifies the transmission channnel/cluster.
Creates a receive object, which is available only for use with the TFS function
TestGetWaitFrPDUData (CANoe ≥ 7.0 SP4).
Function This can be used to create a FlexRay PDU object. The object data can be manipulated via
the object's selectors. Additional object properties can be read from the selectors.
The object is then registered using the FrSetSendPDU and transmitted using the
FrUpdatePDU functions.
The parameters needed to uniquely identify the PDU are taken from the corresponding PDU
definition in the database.
<PDU var>
MsgChannel<num>
<num> must be a whole number (e.g. 1, 2, 3, ...) that specifies the channel number of the
corresponding FlexRay interface.
MsgChannel
The application channel that the FlexRay interface determines, which should send the PDU.
Name
Returns the symbolic name of the PDU (data type: char array[]).
Info
This selector is not available for CAPL code execution on interface hardware
(CAPL on Board).
Write protected!
FR_ChannelMask
Identifies the CC's FlexRay channel. With 1, the PDU is transmitted on channel A, with 2 on
channel B, and with 3 on channels A and B.
FR_PDULength
Write protected!
Signal names can also be used directly as selectors for the data range. The raw value of the
signal is retrieved or set. The physical value can be retrieved or set by <signal
name>.Phys.
Write protected!
FR_Payload
This selector allows the access of the payload array (for using as a byte array parameter in
functions).
Write protected!
If the PDU object is created without the symbolic name (e.g. FrPDU receivePDU;) for use
with the TFS function TestGetWaitFrPDUData, then it contains the following selectors:
Time
The RX time stamp that has been synchronized with the global time base in the PC
(hardware synchronization's reference channel or PC system clock).
The time stamp must be used if time relations should be regarded with events from other
sources.
Info
The Time selector is not available when executing CAPL programs directly on an
interface hardware (CAPL on Board).
Write protected!
Time_ns
The RX time stamp that has been synchronized with the global time base in the PC
(hardware synchronization's reference channel or PC system clock).
The time stamp must be used, if time relations should be regarded with events from other
sources. This time stamp is also output in the Trace window when receiving a PDU.
Write protected!
MsgChannel
The application channel that the FlexRay interface determines, which received the PDU.
Write protected!
FR_ChannelMask
Identifies the FlexRay channel of the CC. With 1 the PDU was received on channel A, with 2
on channel B.
Write protected!
FR_SlotID
Write protected!
FR_Cycle
Write protected!
FR_PayloadLength
Length of the payload that is received for the PDU in bytes (data type: word).
Write protected!
Write protected!
FR_Payload
This selector allows the access of the payload array (for using as a byte array parameter in
functions).
Write protected!
6.1 FlexRay • •
Example 1
Example 2
void example ()
{
FrPDU EngineData myPDU;
foo (myPDU.FR_Payload, myPDU.FR_PDULength);
}
Example 3
void example ()
{
foo (myPDU);
}
Example 4
Caution
FRGetConfiguration
CAPL Function Overview » FlexRay » FRGetConfiguration
Function This function copies the FlexRay protocol parameters to <configuration var>.
Parameters channel
<configuration var>
Name of the variable referenced by the configuration object. The variable name was
defined when the object was created using FRConfiguration.
Return values —
6.0 FlexRay — •
7.1 FlexRay • •
Example
The following CAPL function outputs all FlexRay protocol parameters in the Write window.
variables
{
FRConfiguration gFRParams;
}
void printFRConf ()
{
FRGetConfiguration(%CHANNEL%, gFRParams);
Write("%33s = %6d %s", "pCCVersion", gFRParams.pCCVersion, "");
Write("%33s = %6ld %s","FRBaudrate", gFRParams.FRBaudrate, "kBit/s");
Write("%33s = %6f %s", "gdMacrotick", gFRParams.gdMacrotick, "us");
Write("%33s = %6d %s", "gMacroPerCycle", gFRParams.gMacroPerCycle,
"MT");
Write("%33s = %6d %s", "gdNIT", gFRParams.gdNIT, "MT");
Write("%33s = %6f %s", "gdSampleClockPeriod",
gFRParams.gdSampleClockPeriod, "us");
Write("%33s = %6d %s", "gdTSSTransmitter", gFRParams.gdTSSTransmitter,
"Bit");
Write("%33s = %6d %s", "gPayloadLengthStatic",
gFRParams.gPayloadLengthStatic, "Words");
Write("%33s = %6d %s", "gdActionPointOffset",
gFRParams.gdActionPointOffset, "MT");
Write("%33s = %6d %s", "gdStaticSlot", gFRParams.gdStaticSlot, "MT");
| FRSetConfiguration |
FrGetFrameCRC
CAPL Function Overview » FlexRay » FrGetFrameCRC
The Header CRC can be determined with a special selector of the event procedure.
Parameters this
The function can only be used in the context of the following event procedures:
• on FRSlot
• on FRFrame
• on FRNullFrame
• on FRFrameError
The return value is only valid if the frame was received by a Vector FlexRay hardware
interface in asynchronous monitor mode. In any other case 0 will be sent back.
6.1 FlexRay • •
Example
The following example writes the CRC into the write window for all received frames.
on FRFrame *
{
DWORD crc;
crc = FRGetFrameCRC(this);
Write(“Frame %d in Cycle %d has CRC 0x%x”, this.FR_SlotID,
this.FR_Cycle, crc);
output(this); // only required in measurement setup
}
output
CAPL Function Overview » FlexRay » output
Function Outputs the object from the program block of the analysis branch. This function must be
used inside the appropriate event procedure in order to forward the event to the next
block in the analysis branch. If the function is not called, then the event is not forwarded.
Thus, events will be filtered by the CAPL program when omitting this function.
The function must not be used in the simulation setup or transmit branch.
Parameters Msg
Variable of type
• flexraymessage
List of available selectors for this type of objects can be found under on FRFrame
selectors, on FRSlot selectors, on FRNullFrame selectors, and on FRFrameError
selectors.
• flexraystartcycle
List of available selectors for this type of objects can be found under on FRStartCycle
selectors.
• flexraysymbol
List of available selectors for this type of objects can be found under on FRSymbol
selectors.
• flexraypocstate
List of available selectors for this type of objects can be found under on FRPOCState
selectors.
• flexrayerror
List of available selectors for this type of objects can be found under on FRError
selectors.
The parameter variable can be accessed in each event handler by the keyword this.
Return values —
Example
If you react on start of cycle, frame, Null frame or frame error events, then you must
forward the event explicitly to the next node in the measurement setup. Otherwise the
successor node will not receive that event!
on FRFrame *
{
// do something ...
// forward event to next node in measurement setup:
output(this);
}
FROutputDynFrame
CAPL Function Overview » FlexRay » FROutputDynFrame
Function This function updates the FlexRay Communication Controller's (CC) send buffer with the
current data from the send object. This corresponds to a request to send.
Only frames in the dynamic segment can be sent using this function!
Name of the variable referenced by the frame object. The variable name was defined
when the object was created using FrFrame.
Return values —
6.0 FlexRay — •
Example
FlexRayRcvStatusEvent
CAPL Function Overview » FlexRay » FlexRayRcvStatusEvent
Note
The callback occurs when the FlexRay Communication Controller (CC) has synchronized
with the bus or the synchronization fails.
Parameters msgTime
channel
Should be set to 1 by default (since the tool currently only supports one FlexRay CC).
statusType
At the moment only bus synchronization type is available. This means the bits of this mask
define which bit is valid in infomask1.
Type Meaning
infomask1
If statusType == 1:
If statusType == 2:
1 CAS
2 MTS
3 Wakeup
4 Not specified
Example
Info
The bit length is only determined by the BusDoctor and the Vector FlexRay
hardware interfaces in asynchronous mode.
infomask2
If statusType == 1:
Not used.
If statusType == 2:
infomask3
If statusType == 1:
Not used.
If statusType == 2:
Channel mask (A=1 / B=2 / AB = 3): Channel the symbol was received.
Return values —
5.2 FlexRay • •
Example
variables
{
int busIsSynchronized = 0;
}
FlexRayRcvStatusEvent (long msgTime, int channel, long statusType, long
infomask1, long infomask2, long infomask3)
{
if (statusType & 0x00000001)
{
if (infomask1 & 0x00000001)
{
busIsSynchronized = 1;
Write("FR StatusEvent: Bus (channel %d) is synchronized.",
channel);
}
else
{
Write("FR StatusEvent: Bus (channel %d) lost synchronization.",
channel);
if (busIsSynchronized == 1) ResetFlexRayCC(channel);
busIsSynchronized = 0;
}
}
}
FrSendFrame
CAPL Function Overview » FlexRay » FrSendFrame
Note
Note: This symbolic function is not available when executing CAPL programs directly on
an interface hardware (CAPL on Board).
FrSendFrame( int slotId, int channelMask, int len, int cycleStart, int
cycleRepetition, dword flags, byte dataBytes[], int channel );
Function This function generates a FlexRay message and sends it on the bus. The FlexRay
communication controller sends the message at the next possible point in time.
The message must be registered before sending (see FRSetSendFrame function).
slotId
channelMask
1 Channel A
2 Channel B
len
cycleStart
This number designates the base cycle. This value must be smaller than the repetition
factor and lies in the range between 0 and 63.
This value, together with the repetition factor, determines the "Cycle Multiplexing" of the
frame. The slot ID, channel mask, and cycle multiplexing uniquely identify the message in
a FIBEX database.
cycleRepetition
This number designates the cycle repetition factor. The value must be between 1 and 64
and must be a power of 2 (e.g. 1, 2, 4, 8, 16, 32 or 64).
This value, together with the base cycle, determines the "Cycle Multiplexing" of the
frame. The slot ID and the cycle multiplexing (and the cluster allocation of the FlexRay
bus) uniquely identify the message in a FIBEX database.
flags
Corresponding bits in the flags set or activate special states for the frame to be sent:
0x10 Sets the send mode to event triggered (if bit not set then time-triggered
mode).
0x20 Sets the payload preamble bit (with static frames, the initial databytes then
contain the local NM vector; with dynamic frames, the first two bytes then
designate the expanded message ID).
0x80 TX OFF
Flag has only effect on In-Cycle-Repetition frames. Is the flag set (1), then
the frame can be sent in the slot given by the parameter slotID. Is the flag
not set (0 = default), then the frame will be sent in the next slot of any of
the slots that are given by the In-Cycle-Repetition definition in the
database.
databytes
channel
Return values —
5.2 FlexRay — •
Example
variables
{
// Bit mask meaning in flags:
// bit | mask | for
//----------------------------------------------------------------
// 0 | 1 | sync flag (1 == set)
// 1 | 2 | startup flag (1 == set)
FRSendSymbol
CAPL Function Overview » FlexRay » FRSendSymbol
Function This function sends an MTS symbol in the next possible symbol window if the
Communication Controller is in normal mode (synchronized).
Parameters <type>
Not used at this time. Reserved for future expansions. Should always be equal to 0.
<param>
Not used at this time. Reserved for future expansions. Should always be equal to 0.
channel
Return values —
6.0 FlexRay — •
Example
This example sends a MTS symbol when a key is pressed in the next possible cycle.
on key 'm'
{
FrSendSymbol(0 /* not used */, 0 /* not used */, %CHANNEL%);
}
Note
FRSetAutoIncrement
CAPL Function Overview » FlexRay » FRSetAutoIncrement
Note
Syntax void FRSetAutoIncrement (int channel, int slotId, int channelMask, int
cycleStart, int cycleRepetition, dword flags, int increment_size, int
increment_offset);
Function Part of the payload of a frame will be incremented automatically on each transmission.
The number of bytes used can be set to 1, 2 or 4.
The byte offset can also be set. The only format supported is Intel (Little Endian).
Parameters channel
slotId
channelMask
1 Channel A
2 Channel B
3 Channel A+B
cycleStart, cycleRepetition
flags
increment_size
increment_offset
increment_size increment_offset
8 0,1,2,3...
16 0,2,4,6,...
32 0,4,8,...
Return values —
6.0 FlexRay — •
Example
This example sends automatically a frame each second cycle in slot 30 with automatically
incrementing a message counter:
variables
{
// The gMsg2 message for the static segment
// that is sent on channel A only.
FRFrame ( 30, 0, 2) gMsg2;
const BYTE gMsg2Flags = 0; // state-driven for repeated transmission
const BYTE gMsg2Channel = %CHANNEL%; // send on network the CAPL node
is assigned to
const BYTE gMsg2ChanMask = 1; // send on FlexRay channel A
const BYTE gMsg2Len = 32; // 32 byte user data
const int gMsg2IncSize = 16; // 16 bit message counter
const int gMsg2IncOffset = 0; // Byte 0 is first byte of message
counter
}
on preStart
{
// Optionally prepare buffer for message gMsg2:
gMsg2.MsgChannel = gMsg2Channel;
gMsg2.FR_ChannelMask = gMsg2ChanMask;
gMsg2.FR_Flags = gMsg2Flags;
FRSetPayloadLengthInByte(gMsg2, gMsg2Len);
FRSetSendFrame( gMsg2 );
// Define the automatic icrementing message counter:
FRSetAutoIncrement(gMsg2.MsgChannel, gMsg2.FR_SlotID,
gMsg2.FR_ChannelMask, gMsg2.FR_CycleOffset, gMsg2.FR_CycleRepetition, 1,
gMsg2IncSize, gMsg2IncOffset);
}
FRSetConfiguration
CAPL Function Overview » FlexRay » FRSetConfiguration
Note
Function This function writes the FlexRay protocol parameters from the configuration object to the
FlexRay interface's Communication Controller.
The values must previously have been set in the configuration object in compliance with
the FlexRay specification.
The new protocol parameters will only be applied when the Communication Controller is
reset!
Parameters channel
<configuration var>
The variable name was defined when the object was created using FRConfiguration.
Return values —
6.0 FlexRay — •
Example
The following CAPL program reconfigures the FlexRay Communication Controller with new
FlexRay protocol parameters.
variables
{
FRConfiguration gFRParams;
}
void setFRConf1 ()
{
FRGetConfiguration(%CHANNEL%, gFRParams);
gFRParams.FRBaudrate = 10000; // "kBit/s"
gFRParams.gdMacrotick = 1; // "us"
gFRParams.gMacroPerCycle = 5000; // "MT"
gFRParams.gdNIT = 100; // "MT"
//gFRParams.gdSampleClockPeriod = 0.0; // "us"
gFRParams.gdTSSTransmitter = 10; // "Bit"
gFRParams.gPayloadLengthStatic = 2; // "Words"
gFRParams.gdActionPointOffset = 9; // "MT"
gFRParams.gdStaticSlot = 35; // "MT"
gFRParams.gNumberOfStaticSlots = 60; // "#"
gFRParams.gdMinislotActionPointOffset = 4; // "MT"
gFRParams.gdMinislot = 10; // "MT"
gFRParams.gNumberOfMinislots = 276; // "#"
//gFRParams.gClusterDriftDamping = 0; // ""
gFRParams.gListenNoise = 10; // ""
gFRParams.gColdStartAttempts = 20; // "#"
gFRParams.gSyncNodeMax = 4; // "#"
gFRParams.gOffsetCorrectionStart = 4931; // "MT"
gFRParams.gdDynamicSlotIdlePhase = 1; // "MS"
FRSetConfiguration(%CHANNEL%, gFRParams);
ResetFlexRayCC(%CHANNEL%); // in order to apply the new values
}
FrSetKeySlot
CAPL Function Overview » FlexRay » FrSetKeySlot
Note
Syntax void FrSetKeySlot (long channel, long channelMask, long keySlotIndex, long
keySlotId, long keySlotUsage)
Function Configures one of two possible key slots that are to be sent for a FlexRay bus.
The change will be applied with the next reset of the interface hardware (e.g. by
ResetFlexRayCC or ResetFlexRayCCEx).
Parameters channel
channelMask
1 Channel A
2 Channel B
3 Channel A+B
kyeSlotIndex
keySlotId
keySlotUsage
Value Meaning
0 Off
2 Sync
3 Startup/Sync
Return values —
7.2 FlexRay — •
Example
FRSetMode
CAPL Function Overview » FlexRay » FRSetMode
Note
The function is only supported by FlexCard Cyclone II or the Vector FlexRay hardware
interface.
Function This function initializes the FlexRay bus drivers. Essentially, it defines whether the drivers
are set to normal mode or sleep mode.
Info
If the transceivers had been disabled (sleep mode), and a wakeup pattern is
received (see on FRPOCState), then the transceivers must explicitly be
activated again!
Parameters channel
channelMask
1 Channel A
2 Channel B
3 Channel A+B
mode
Mode Meaning
0x0000 Normal mode, when starting the Communication Controller a Wakeup will be
sent if this is defined in the hardware configuration dialog.
0x0002 Normal mode, when starting the Communication Controller no Wakeup will be
sent.
Return values —
6.0 FlexRay — •
Example 1
The following CAPL program deactivates or activates the physical drivers according to key
presses.
on key 'd'
{
// suspend physical layers:
FRSetMode(%CHANNEL%, 3, 1);
Write("FlexRay physical layers of channel %d are offline (sleep mode).",
%CHANNEL%);
}
on key 'a'
{
// activate physical layers (with optional wakeup):
FRSetMode(%CHANNEL%, 3, 0);
Write("FlexRay physical layers of channel %d are going online (with
optional wakeup to send).", %CHANNEL%);
}
on key 'q'
{
// activate physical layers without any wakeup:
FRSetMode(%CHANNEL%, 3, 2);
Write("FlexRay physical layers of channel %d are going online.",
%CHANNEL%);
}
Example 2
The following CAPL program deactivates or activates the physical drivers according to the
clusters synchronisation state and reception of a wakeup symbol.
variables
{
const int cFrChanMask = 3; // for channel A+B
const int cFrModeGoSleep = 1;
const int cFrModeGoNormal = 2;
int gClusterSync = -1;
int gCntWakeups = 0;
}
on FRPocState
{
if (this.MsgChannel != %CHANNEL%) return;
if (((gClusterSync == -1) || (gClusterSync == 1)) && ((this.FR_POCState
== 4) || (this.FR_PocState == -2))) // FlexRay interface is async
{
// ResetFlexRayCC(%CHANNEL%);
gClusterSync = 0;
write("FR: Lost Sync Time: %.6f", timenowns()/1000000000.0);
gotoSleep();
}
else if (((gClusterSync == -1) || (gClusterSync == 0)) &&
(this.FR_POCState == 2)) // Synchronous again
{
gClusterSync = 1;
write("FR: Get Sync Time: %.6f", timenowns()/1000000000.0);
write("FR: received %d Wakeup Symbols", gCntWakeups);
gCntWakeups = 0;
}
if (this.FR_Info2 == 7)
{ // generated by VN interface
receiveWakeup();
}
}
on start
{
gotoNormal();
}
on FRSymbol
{
if (this.MsgChannel != %CHANNEL%) return;
if (this.FR_Symbol == 3) // Wakeup symbol
{ // generated by FlexCard Cyclone II interface
receiveWakeup();
}
}
void gotoSleep ()
{
FRSetMode( %CHANNEL%, cFrChanMask, cFrModeGoSleep);
write("FR: Sleep Time: %.6f", timenowns()/1000000000.0);
}
void gotoNormal ()
{
FRSetMode( %CHANNEL%, cFrChanMask, cFrModeGoNormal);
write("FR: Wakeup Time: %.6f", timenowns()/1000000000.0);
}
void receiveWakeup ()
{
gotoNormal();
gCntWakeups++;
}
FRSetPayloadLengthInByte
CAPL Function Overview » FlexRay » FRSetPayloadLengthInByte
Function This function sets the payload (data length) of the object in bytes. In the event of an
uneven value, the length of the buffer will be set to the next even value.
The payload length can also be set using the FR_PayloadLength frame variables selector.
However, in this case, the length is set in 16-bit words.
The data length can only be manipulated for frames sent in the dynamic segment!
Name of the variable referenced by the frame object. The variable name was defined
when the object was created using FrFrame.
<dlc>
Return values —
6.0 FlexRay • •
Example
FrSetPOCState
CAPL Function Overview » FlexRay » FrSetPOCState
Note
Function This function puts the FlexRay Communication Controller (CC) into the desired Protocol
Operation Mode (POC state). The function is non-blocking. That means, the function will
return before the CC has reached the desired POC-state.
All E-Ray POC-state changes can be monitored with the status- or POC-state-events. A
status event is generated as soon as the second CC has reached the desired POC-state.
The diagram shows the several states and the corresponding transitions in the protocol
operation control process:
Parameters Channel
ccNumber
1: E-Ray
2: Second Startup Controller/Coldstart helper (Fujitsu)
pocState
0 wakeup
1 normal active
2 halt
3 ready
Return values 0: Error (wrong parameter, or the POC state can not be reached)
1: No error
Availability Since Version Restricted to Measurement Setup Simulation / Test
Setup
7.1 FlexRay — •
Example
FrSetSendFrame
CAPL Function Overview » FlexRay » FrSetSendFrame
Note
This function is not available when executing CAPL programs directly on an interface
hardware (CAPL on Board).
FrSetSendFrame( int slotId, int channelMask, int len, int cycleStart, int
cycleRepetition, dword flags, int channel );
If a FRFrame object was created with FRFrame, with this function the object can be
registered for sending.
The call must take place in the On PreStart routine in the simulation setup /
transmission branch.
slotId
channelMask
1 Channel A
2 Channel B
3 Channel A+B
len
cycleStart
This number designates the base cycle. This value must be smaller than the repetition
factor and lie in the range between 0 and 63.
This value together with the repetition factor determines the "Cycle Multiplexing" of the
frame. The slot ID and the cycle multiplexing (and the cluster allocation of the FlexRay
cycleRepetition
This number designates the cycle repetition factor. The value must be between 1 and 64
and be a multiple of 2 (e.g. 1, 2, 4, 8, 16, 32 or 64).
This value, together with the base cycle, determines the "Cycle Multiplexing" of the
frame. The slot ID and the cycle multiplexing (and the cluster allocation of the FlexRay
bus) uniquely identify the message in a FIBEX database.
flags
Corresponding bits in the flags set or activate special statuses for the frame to be sent:
Only a frame in the static segment may have set this bit.
Caution
If this bit is set, then the sync bit must also be set.
Caution
With static frames, the initial data bytes then contain the local NM vector;
with dynamic frames, the first two bytes then designate the expanded
message ID.
When a TX Ack is received, its cycle number is compared with that of the
transmission time.
If the TX Ack is not received until the next but one cycle or even later, an
error message is output in the Write window.
Example
A frame is sent in cycle 7, the TX Ack contains cycle 9. The cycle interval
increases accordingly for frames with a cycle repetition > 1.
Caution
channel
Return values —
5.2 FlexRay — •
Example
FrSetSendGroup
CAPL Function Overview » FlexRay » FrSetSendGroup
Note
If you would like to use this function, canrtk.dll must be integrated as a CAPL DLL.
Syntax void frSetSendGroup (int slotId, int channelMask, int groupNo, int
cycleStart, int cycleRepetition, long flags, int channel);
Function Grouped frames, which are transmitted in a CAPL handler (e.g., on FrFrame, on timer,
etc.), are not written to the CC send buffer until it has been ensured that frames with a
payload that has not yet been modified and frames with a modified payload have not
been mixed together during a FlexRay cycle.
In other words, all frames in the group are sent in the current cycle, or all frames are not
sent until the next possible cycle.
Restrictions
The number of frames per group is restricted to four per FlexRay channel (A, B).
Parameters slotId
channelMask
1 Channel A
2 Channel B
3 Channel A+B
cycleStart, cycleRepetition
groupNo
flags
Reserved, must be 0
channel
Return values —
6.0 FlexRay — •
Example
The frames in slots 8 and 40 are registered as a group. The frames are sent in on FrFrame
(10, 0, 1).
The frame in slot 40 was able to be sent in the current CC cycle, but not the other frame.
Therefore, the TX buffers of all frames of the group are not written until slot 40 has been
expired.
variables
{
FRFrame MsgChannel1.( 8, 0, 1) gSta1Msg;
FRFrame MsgChannel1.(40, 0, 1) gSta2Msg;
int flags = 16; // event-driven
int channelMask = 1;
int payloadlength = 4;
FrSetSendPDU
CAPL Function Overview » FlexRay » FrSetSendPDU
If a FrPDU object was created using FrPDU, it can be submitted for transmission with this
function.
This submission must take place in the OnPreStart routine in the transmit branch.
Return values —
6.1 FlexRay — •
Example
FrSetTrigger
CAPL Function Overview » FlexRay » FrSetTrigger
Note
Function This function activates the Trigger output of the selected VN interface. The VN interfaces
provide three different trigger ports. The ports can be set separately.
Parameters channel
FlexRay channel (cluster number). The channel number identifies the VN interfaces in
case several interfaces are active.
portNo
1-3: Number of corresponding trigger output. The PIN assignment is defined in the manual
of the hardware interface.
1: Ok
Availability Since Version Restricted to Measurement Setup Simulation / Test Setup
7.1 FlexRay — •
Example
FrUpdatePDU
CAPL Function Overview » FlexRay » FrUpdatePDU
Function This function updates the PDU payload in the assigned FlexRay frames.
The variable name was defined via FrPDU when the object was created.
flags
updateCounter
Value Meaning
6.1 FlexRay — •
Example
The following example assumes that the database defines a PDU that is named
PDU_CNT_02 and that this PDU contains a signal that is named counter.
This program sends the PDU once every 64 cycles. The update is made on the beginning of
cycle 0.
variables
{
FRPDU MsgChannel%CHANNEL%.PDU_CNT_02 gPDU1;
BYTE gCycle; // remember current FlexRay cycle
}
on preStart
{
// Optionally prepare buffer for PDU gPDU1:
FRSetSendPDU(gPDU1);
}
on FRStartCycle 0
{
if (this.MsgChannel != %CHANNEL%) return;
gCycle = this.FR_Cycle;
gPDU1.counter = gCycle;
FRUpdatePDU(gPDU1, 1, 1); // set update bit and send only once
Info
When the appropriate TX buffers are declared by the TX buffer list of the hardware
configuration dialog, then the function FrSetSendPDU in on preStart is obsolete.
Is the update time close to the sending slot (e.g. update of slot 2 just after the start of a
cycle), then with high probability the update will be too late for the current cycle and the
frame is sent in the next possible cycle! Thus, updates should be made early enough
before the sending slot of the PDU.
FRUpdateStatFrame
CAPL Function Overview » FlexRay » FRUpdateStatFrame
Function This function updates the FlexRay Communication Controller's (CC) send buffer with the
current data from the send object. This corresponds to a request to send.
Only frames in the static segment can be sent using this function!
Name of the variable referenced by the frame object. The variable name was defined
when the object was created using FrFrame.
Return values —
6.0 FlexRay — •
Example
The following CAPL program sends a startup/sync frame in slot 60 in every cycle. The
calculation of the payload and the TX buffer update is synchronously executed to every
start of a cycle.
variables
{
// The gMsg1 message is a startup/sync message for the static segment
// that is sent on both channels.
Info
Instead of giving the parameters in brackets the message object can be declared by using
a symbolic name from the FIBEX database. In this case those parameters are taken from
the database and you can directly access the signals of the frame by its symbolic name
instead of accessing its bytes.
Is the frame located in a slot of the dynamic segment, you must use the function
FROutputDynFrame instead of FRUpdateStatFrame. A dynamic frame must not be a
startup or sync frame. A dynamic frame must also not be sent redundantly on both
channels A + B with a channel mask 3.
When the appropriate TX buffer is declared by the TX buffer list of the hardware
configuration dialog, then the function FrSetSendFrame in on preStart is obsolete. It
can still be used for overriding settings in the TX buffer list.
Is the update time close to the sending slot (e.g. update of slot 2 just after the start of a
cycle), then with high probability the update will be too late for the current cycle and the
frame is sent in the next possible cycle! Thus, updates should be made early enough
before the sending slot.
MessageTimeNS
CAPL Function Overview » FlexRay » MessageTimeNS
Function This function returns the receive time of the frame or slot in nanoseconds.
Parameters this
The function can only be used in the context of the following event procedures:
• on FRFrame
• on FRNullFrame
• on FRFrameError
• on FRSlot
• on FRStartCycle
6.0 FlexRay • •
Example
ResetFlexRayCC
CAPL Function Overview » FlexRay » ResetFlexRayCC
Note
The resetting of the FlexRay communication controller takes considerable time (approx.
up to 100 ms). During this time the complete execution of (CANoe including any remaining
bus simulation) is halted/suspended. Also bus events from other busses are not
recognized. Therefore this function should only be used in one channel configurations. For
an alternative functionality see Example II.
Function This function initializes the FlexRay Communication Controller (CC) and begins a new
startup phase for the cluster or a new integrations phase in the cluster - depending on
whether a startup frame is to be sent or not.
Parameters channel
Return values —
5.2 FlexRay — •
Example I
The following program resets the FlexRay interface of the attached channel, when key 'r'
is pressed.
on key 'r'
{
ResetFlexRayCC(%CHANNEL%);
Write("Reset FlexRay CC on channel %d.", %CHANNEL%);
}
Example II
In order to prevent the suspension during the call of ResetFlexRayCC the reset can be
executed asynchronously by manipulating the Protocol Operation Control (POC) state
machine of the FlexRay Communication Controller directly.
ResetFlexRayCCEx
CAPL Function Overview » FlexRay » ResetFlexRayCCEx
Note
The resetting of the FlexRay communication controller takes considerable time (approx.
up to 100 ms). During this time the complete execution of CANoe (including any remaining
bus simulation) is halted/suspended. Also bus events from other busses are not
recognized. Therefore this function should only be used in one channel configurations. For
an alternative functionality see Example II.
Syntax ResetFlexRayCCEx (int channel, int wuChMask, int wuCount, int wuTxIdle, int
wuTxLow, char[] cfg);
Function This function initializes the FlexRay Communication Controller (CC) and generates the
specified wakeup pattern before reintegration in the cluster or the startup.
Parameters channel
wuChMask
1 Channel A
2 Channel B
wuCount
wuTxIdle
wuTxLow
cfg
Return values —
5.2 FlexRay — •
Example I
The following program resets the FlexRay interface of the attached channel and sends a
wakeup (if network is idle), when key ‘w’ is pressed.
on key 'w'
{
int wuChMask = 3; // send wakeup on both channels
int wuCount = 4; // send symbol 2 times (range 2-63)
int wuTxIdle = 180; // idle time of symbol in bit (range 0-255)
int wuTxLow = 60; // low time of symbol in bit (range 0-63)
CHAR cfg[1]; // <cfg> -> not used yet
ResetFlexRayCCEx(%CHANNEL%,wuChMask,wuCount,wuTxIdle,wuTxLow,cfg);
Write("FlexRay CC %d is reseted and sending a wakeup.", %CHANNEL%);
}
Example II
In order to prevent the suspension during the call of ResetFlexRayCCEx the reset can be
executed asynchronously by manipulating the Protocol Operation Control (POC) state
machine of the FlexRay Communication Controller directly.
on FRError
CAPL Function Overview » FlexRay » on FRError
Syntax on FRError
Function The event procedure is called in the event of a general error being detected on the FlexRay
bus.
Parameters —
The error time stamp that has been synchronized with the global time base in the PC (CAN
hardware or PC system clock).
The time stamp must be used if time relations should be regarded with events from other
sources. This time stamp is also output in the Trace window when receiving a symbol.
Unit:10 microseconds
Write protected!
msgChannel
Write protected!
FR_HWTag
0 HW independent
1 Invalid
2 FlexCard Cyclone I
3 BusDoctor
4 FlexCard Cyclone II
Write protected!
FR_Code
-1 Unknown error
0 NO error
1 FlexCard Overflow
6 Parity Error
11 Syntax Error
12 Content Error
26 Wrong Frame
28 CHI Error
30 Symbol Received
Write protected!
FR_Data0
Not used.
Write protected!
FR_Data1
Write protected!
FR_Data2
Write protected!
FR_Data3
Write protected!
FR_Data4
Write protected!
Example
The following program reacts on bus errors and prints them in the Write window, Trace
window, and logging.
variables
{
const int cWriteTextSize = 512;
char writeTxt[cWriteTextSize];
const int cWriteTextSize2 = 40;
char writeTxt2[cWriteTextSize2];
const int writeSink_Trace = -3;
const int writeSink_Logging = -2;
const int writeSeverity_Information = 1;
}
on FRError
{
getFRErrorName(this.FR_Code, cWriteTextSize2, writeTxt2);
snprintf(writeTxt, cWriteTextSize, "%10.6f: on FRError %3d (%-32s) on
channel %2d with HW Type %2d, Data0 0x%02x, Data1 0x%02x, Data2 0x%02x, Data3
0x%02x, Data4 0x%02x.", getTime(0), this.FR_Code, writeTxt2,
(int)this.MsgChannel, this.FR_HWTag, this.FR_Data0, this.FR_Data1,
this.FR_Data2, this.FR_Data3, this.FR_Data4);
myprint(writeTxt);
output(this); // only required in measurement setup
}
float getTime (float time)
{
return TimeNowNS() / 1000000000.0;
}
void myprint(char text[])
{
write("%s", text);
writeLineEx(writeSink_Trace, writeSeverity_Information, "%s", text);
writeLineEx(writeSink_Logging, writeSeverity_Information, "%s", text);
}
int getFRErrorName (word code, word nameSize, char name[])
{
int r = -1;
if (code == 0) {
snprintf(name, nameSize, "No Error");
r = code;
} else if (code == 1) {
snprintf(name, nameSize, "FlexCard Overflow");
r = code;
} else if (code == 2) {
snprintf(name, nameSize, "POC Error Mode Change");
r = code;
} else if (code == 3) {
snprintf(name, nameSize, "Sync Frames Below Minimum");
r = code;
} else if (code == 4) {
snprintf(name, nameSize, "Sync Frame Overflow");
r = code;
} else if (code == 5) {
snprintf(name, nameSize, "Clock Correction Failure");
r = code;
} else if (code == 6) {
snprintf(name, nameSize, "Parity Error");
r = code;
} else if (code == 7) {
snprintf(name, nameSize, "Receive FIFO Overrun");
r = code;
} else if (code == 8) {
snprintf(name, nameSize, "Empty FIFO Access");
r = code;
} else if (code == 9) {
snprintf(name, nameSize, "Illegal Input Buffer Access");
r = code;
} else if (code == 10) {
snprintf(name, nameSize, "Illegal Output Buffer Access");
r = code;
} else if (code == 11) {
snprintf(name, nameSize, "Syntax Error");
r = code;
} else if (code == 12) {
snprintf(name, nameSize, "Content Error");
r = code;
} else if (code == 13) {
snprintf(name, nameSize, "Slot Boundary Violation");
r = code;
} else if (code == 14) {
snprintf(name, nameSize, "Transmission Across Boundary A");
r = code;
} else if (code == 15) {
snprintf(name, nameSize, "Transmission Across Boundary B");
r = code;
} else if (code == 16) {
snprintf(name, nameSize, "Latest Transmit Violation A");
r = code;
} else if (code == 17) {
snprintf(name, nameSize, "Latest Transmit Violation B");
r = code;
} else if (code == 18) {
snprintf(name, nameSize, "Error Detection on A");
r = code;
} else if (code == 19) {
snprintf(name, nameSize, "Error Detection on B");
r = code;
} else if (code == 20) {
snprintf(name, nameSize, "Message Handler Constraints Flag Error");
r = code;
} else if (code == 21) {
snprintf(name, nameSize, "NIT SENA");
r = code;
} else if (code == 22) {
snprintf(name, nameSize, "NIT SBNA");
r = code;
} else if (code == 23) {
snprintf(name, nameSize, "NIT SENB");
r = code;
} else if (code == 24) {
snprintf(name, nameSize, "NIT SBNB");
r = code;
} else if (code == 25) {
snprintf(name, nameSize, "Internal Error Overflow");
r = code;
} else if (code == 26) {
snprintf(name, nameSize, "Wrong Frame");
r = code;
} else if (code == 27) {
snprintf(name, nameSize, "Bus Guardian Error");
r = code;
} else if (code == 28) {
snprintf(name, nameSize, "CHI Error");
r = code;
} else if (code == 29) {
snprintf(name, nameSize, "Error Handling Level Changed");
r = code;
} else if (code == 30) {
snprintf(name, nameSize, "Symbol Received");
r = code;
} else {
snprintf(name, nameSize, "Unknown");
r = -1;
}
return r;
}
on FRFrame
CAPL Function Overview » FlexRay » on FRFrame
Note
This event procedure is only used for the reception of valid frames.
To receive null frames and erroneous frames, please use the on FRNullFrame or on on
FRFrameError event procedures.
Syntax on FRFrame *
This procedure is always called when the frame definitions below do not apply. This means
that for a certain frame either this function or one of the functions below is called.
Function This event procedure is called after a valid data frame has been received in the specified
slot and cycle.
If two valid data frames are received in the according slot (on channel A and on B) then the
event procedure is called up twice (once for each frame).
An optional channel parameter for event filtering can be assigned to all handlers:
Example I
In this example, the event procedure is only called for frames whose application
channel is 2 and its ID is 5.
on FRFrame MsgChannel2.(5,0,1)
Example II
In this example, the event procedure is only called for specific frames from the
application channel that is named "network" in the simulation setup (only
available for CANoe).
on FRFrame network.<frame name>
Parameters *
Specifies the default procedure. This procedure is called up on all received frames for which
no explicit event procedure exists.
<frame name>
<slot ID>
<base cycle>
<cycle repetition>
Selectors Time
The RX time stamp that has been synchronized with the global time base in the PC
(hardware synchronization's reference channel or PC system clock).
The time stamp must be used if time relations should be regarded with events from other
sources.
Info
The Time selector is not available when executing CAPL programs directly on an
interface hardware (CAPL on Board).
Write protected!
Time_ns
The RX time stamp that has been synchronized with the global time base in the PC
(hardware synchronization's reference channel or PC system clock).
The time stamp must be used, if time relations should be regarded with events from other
sources. This time stamp is also output in the Trace window when receiving a frame.
Write protected!
MsgChannel
The application channel that the FlexRay interface determines, which received the frame.
Write protected!
FR_ChannelMask
Identifies the FlexRay channel of the CC. With 1 the frame was received on channel A, with
2 on channel B.
Write protected!
FR_SlotID
Write protected!
FR_Cycle
Write protected!
FR_PayloadLength
Write protected!
If the event procedure was initialized via a symbolic name from the database, signal names
can also be used directly as selectors for the data range. The raw value of the signal is
retrieved. The physical value can be retrieved by <signal name>.Phys.
Write protected!
FR_Flags
Provides more detailed status information from the frame header, if necessary.
Possible values:
0x80 —
0x100 —
0x200 Only with TX frames: The TX cycle is not the expected one.
0x1000 —
0x2000 —
0x10000 —
0x20000 —
0x40000 —
0x80000 —
0x400000 —
Write protected!
FR_HeaderCRC
Write protected!
FR_Segment
Value Meaning
0 Frame belongs to the static segment
Write protected!
FR_Status
Caution
The value is hardware dependant according to the selected interface type. The
selected interface type can be determined by calling FRGetConfiguration.
0x0004 Slot Boundary Slot Boundary Content Error (CERR) Header CRC Error
Violation (BVIOL) Violation (HCRCERR)
(BVIOL)
0x0008 Empty Slot Empty Slot Syntax Error (SERR) Frame CRC Error
(SLEMPTY) (SLEMPTY) (FCRCERR)
0x0020 Valid Frame (VAL) Valid Frame NULL Frame Symbol (SYMB)
(VAL) Indication (NULLF,
NF)
Available from
CANoe 7.2.
Write protected!
DIR
Value Meaning
TX Message was sent by this node.
Write protected!
SIMULATED
Value Meaning
0 Not simulated
1 Simulated
Write protected!
FR_Payload
This selector allows the access of the payload array (for using as a byte array parameter in
functions).
Write protected!
Example
The following program reacts on received frames and prints them in the Write window.
variables
{
const int cWriteTextSize = 512;
char writeTxt[cWriteTextSize];
}
float getTime (float time)
{
// convert NS to SEC:
return time / 1000000000.0;
}
void myprint(char text[])
{
write("%s", text);
}
on FRFrame *
{
snprintf(writeTxt, cWriteTextSize, "%10.6f: on FRFrame in slot %2d in
cycle %2d on channel %2d with mask %d with Type %2d, Flags 0x%02x, Status
0x%02x, Simulated %d.", getTime(messageTimeNS(this)), this.FR_SlotID,
this.FR_Cycle, (int)this.MsgChannel, this.FR_ChannelMask, this.Type,
this.FR_Flags, this.FR_Status, this.Simulated);
myprint(writeTxt);
output(this); // only required in measurement setup
}
on FRFrameError
CAPL Function Overview » FlexRay » on FRFrameError
Syntax on FRFrameError *
This procedure is always called whenever the frame definitions below do NOT occur. In
other words, for a specific frame, only this function or the formats below will be called!
This event procedure is called after a frame has been received in slot <slot ID> and a cycle
corresponding to the Cycle Multiplexing has been received erroneously. Potential frames are
received from the <z> cycles that conform to the following formula:
Function The event procedure is called if an erroneous frame is received in the specified slot and
cycle.
If two erroneous frames are received in the corresponding slot (on channel A and on B), then
the event procedure is called twice (once for each frame).
An optional channel parameter for event filtering can be assigned to all handlers:
Example I
In this example, the event procedure is only called for erroneous frames whose
application channel is 2 and its ID is 5.
on FRFrameError MsgChannel2.(5,0,1)
Example II
In this example, the event procedure is only called for erroneous frames from
the application channel that is named "network" in the simulation setup (only
available for CANoe).
on FRFrameError network.<frame name>
Parameters *
Specifies the default procedure. This procedure is called for all received erroneous frames
for which there is no explicit event procedure.
<frame name>
The required parameters (<slot ID>, <base cycle> and <cycle repetition>) are taken from
the corresponding frame definition in the database.
<slot ID>
<base cycle>
<cycle repetition>
Example
The following program reacts on frame errors and prints them in the Write window.
variables
{
const int cWriteTextSize = 512;
char writeTxt[cWriteTextSize];
}
float getTime (float time)
{
return time / 1000000000.0;
}
void myprint(char text[])
{
write("%s", text);
}
on FRFrameError *
{
snprintf(writeTxt, cWriteTextSize, "%10.6f: on FRFrameError in slot %2d in
cycle %2d on channel %2d with mask %d with Type %2d, Flags 0x%02x, Status
0x%02x, Simulated %d.", getTime(messageTimeNS(this)), this.FR_SlotID,
this.FR_Cycle, (int)this.MsgChannel, this.FR_ChannelMask, this.Type,
this.FR_Flags, this.FR_Status, this.Simulated);
myprint(writeTxt);
output(this); // only required in measurement setup
}
on FRNullFrame
CAPL Function Overview » FlexRay » on FRNullFrame
Syntax on FRNullFrame *
This procedure is always called whenever the frame definitions below do NOT occur. In
other words, for a specific frame, only this function or the formats below will be called!
This event procedure is called after a frame has been received in slot <slot ID> along with a
cycle corresponding to the Cycle Multiplexing. Potential frames are received from the <z>
cycles that conform to the following formula:
Function The event procedure is called if a null frame is received in the specified slot and cycle.
If two null frames are received in the corresponding slot (on Channel A and on B), then the
event procedure is called twice (once for each frame).
An optional channel parameter for event filtering can be assigned to all handlers:
Example I
In this example, the event procedure is only called for Null frames whose
application channel is 2 and its ID is 5.
on FRNullFrame MsgChannel2.(5,0,1)
Example II
In this example, the event procedure is only called for specific Null frames from
the application channel that is named "network" in the simulation setup (only
available for CANoe).
on FRNullFrame network.<frame name>
Parameters *
This procedure is called for all received null frames for which there is no explicit event
procedure.
<frame name>
<slot ID>
<base cycle>
<cycle repetition>
Example
The following program reacts on Null frames and prints them in the Write window.
variables
{
const int cWriteTextSize = 512;
char writeTxt[cWriteTextSize];
}
float getTime (float time)
{
return time / 1000000000.0;
}
void myprint(char text[])
{
write("%s", text);
}
on FRNullFrame *
{
snprintf(writeTxt, cWriteTextSize, "%10.6f: on FRNullFrame in slot %2d in
cycle %2d on channel %2d with mask %d with Type %2d, Flags 0x%02x, Status
0x%02x, Simulated %d.", getTime(messageTimeNS(this)), this.FR_SlotID,
this.FR_Cycle, (int)this.MsgChannel, this.FR_ChannelMask, this.Type,
this.FR_Flags, this.FR_Status, this.Simulated);
myprint(writeTxt);
output(this); // only required in measurement setup
}
on FrPDU
CAPL Function Overview » FlexRay » on FrPDU
on FrPDU *
This procedure is always called when the PDU definition above does not apply. This means
that for a certain PDU either this function or the function above is called.
Caution
The asterisk form is allowed only in the analysis branch in order to forward the
received PDU event to the next CAPL program by calling "output(this);".
The PDUs that are handled by this event procedure cannot be distinguished,
because there does not exists any unique selector.
Function This procedure is called when a PDU with the corresponding name is received.
An optional channel parameter for event filtering can be assigned to all handlers:
Example I
In this example, the event procedure is only called for PDUs whose application
channel is 2 and its name is <PDU name>.
on FrPDU MsgChannel2.<PDU name>
Example II
In this example, the event procedure is only called for specific PDUs from the
application channel that is named "network" in the simulation setup (only
available for CANoe).
on FrPDU network.<PDU name>
The RX time stamp that has been synchronized with the global time base in the PC
(hardware synchronization's reference channel or PC system clock).
The time stamp must be used, if time relations should be regarded with events from other
sources. The time stamp (Time_ns) is also output in the Trace window when receiving a
frame.
Note: The Time selector is not available when executing CAPL programs directly on an
interface hardware (CAPL on Board).
Write protected!
UpdateBit
The flag contains the current value of the update bit. The configuration of the PDU behavior
must be taken into consideration here (see Options).
Write protected!
MsgChannel
The application channel that the FlexRay interface determines, which received the PDU.
Write protected!
FR_ChannelMask
Identifies the FlexRay channel of the CC. With 1 the PDU's frame was received on channel A,
with 2 on channel B.
Write protected!
FR_SlotID
Write protected!
FR_Cycle
Write protected!
FR_PayloadLength
Write protected!
If the event procedure was initialized via a symbolic name from the database, signal names
can also be used directly as selectors for the data range. The raw value of the signal is
retrieved. The physical value can be retrieved by <signal name>.Phys.
Write protected!
FR_Flags
Provides more detailed status information from the frame header, if necessary.
Possible values:
0x1 —
0x4 —
0x8 —
0x10 —
0x20 —
0x40 —
0x80 —
0x100 —
0x200 —
0x400 —
0x800 —
0x1000 —
0x2000 —
0x10000 It is a PDU!
0x40000 —
0x80000 —
Write protected!
FR_HeaderCRC
Write protected!
FR_Segment
Value Meaning
0 PDU belongs to the static segment
Write protected!
FR_Status
Additional status information about the frame's reception buffer of the CC. See on FRFrame.
Write protected!
DIR
Value Meaning
TX Message was sent by this node.
Write protected!
SIMULATED
Value Meaning
0 Not simulated
1 Simulated
Write protected!
FR_Payload
This selector allows the access of the payload array (for using as a byte array parameter in
functions).
Write protected!
6.1 FlexRay • •
Example
The following program reacts on PDUs and prints them in the Write window.
on FRPOCState
CAPL Function Overview » FlexRay » on FRPOCState
Syntax on FRPOCState
Function The event procedure is called whenever there is a change of state on the FlexRay
Communication Controller's protocol operation state machine.
Parameters —
The transition time stamp that has been synchronized with the global time base in the PC
(CAN hardware or PC system clock).
The time stamp must be used if time relations should be regarded with events from other
sources. This time stamp is also output in the Trace window when receiving a symbol.
Note: The Time selector is not available when executing CAPL programs directly on an
interface hardware (CAPL on Board).
Write protected!
MsgChannel
Write protected!
FR_POCState
The POC state of the E-Ray and the cold-start helper CC can be changed with the function
FrSetPocState (only valid for the Vector VN interfaces). If the desired POC-state is reached,
then this event is generated.
Identifies the new state of the POC state machine (data type LONG):
-1 255 UNKNOWN
1 257 READY
4 260 HALT
15 262 CONFIG
Write protected!
Type
0 HW Independent
1 Invalid
2 FlexCard Cyclone I
3 BusDoctor
4 FlexCard Cyclone II
5 VN
Write protected!
FR_Info1
If Type == 1:
3 Unknown
Write protected!
FR_Info2
0 WAKEUP UNDEFINED
6 WAKEUP TRANSMITTED
Write protected!
FR_Info3
Write protected!
FR_Info4
FR_POCState is set to -1 and FR_Info4 is set to 1, when the trigger input of the VN
Write protected!
FR_Cycle
Write protected!
Example
The following program reacts on Protocol Operation Control state changes in the FlexRay
interface and prints them in the Write window, Trace window, and logging.
variables
{
const int cWriteTextSize = 512;
char writeTxt[cWriteTextSize];
const int cWriteTextSize2 = 40;
char writeTxt2[cWriteTextSize2];
const int writeSink_Trace = -3;
const int writeSink_Logging = -2;
const int writeSeverity_Information = 1;
int gClusterIsAsync = -1;
}
on FRPocState
{
getPOCStateName(this.FR_POCState, cWriteTextSize2, writeTxt2);
snprintf(writeTxt, cWriteTextSize, "%10.6f: on FRPOCState %2d (%-32s) in
cycle %3d on channel %2d with HW Type %2d, Info1 0x%02x, Info2 0x%02x, Info3
0x%02x, Info4 0x%02x.", getTime(0), this.FR_POCState, writeTxt2,
this.FR_Cycle, (int)this.MsgChannel, this.Type, this.FR_Info1, this.FR_Info2,
this.FR_Info3, this.FR_Info4);
myprint(writeTxt);
output(this); // only required in measurement setup
if ((this.FR_POCState != -1) && (this.FR_POCState < 100)) {
if (((gClusterIsAsync == -1) || (gClusterIsAsync == 0)) &&
((this.FR_POCState == 4) || (this.FR_POCState == -2))) {
gClusterIsAsync = 1;
write("gClusterIsAsync = 1");
}
if (((gClusterIsAsync == -1) || (gClusterIsAsync == 1)) &&
(this.FR_POCState == 2)) {
gClusterIsAsync = 0;
write("gClusterIsAsync = 0");
}
}
}
on FRSlot
CAPL Function Overview » FlexRay » on FRSlot
Syntax on FRSlot *
This procedure is always called if the slot definition as described below not apply. This
means that for a certain slot either this function or the form below is called.
on FRSlot signalname
This function is only called for the slot containing the signal indicated.
This function is called for any slot containing one of the signals indicated.
This function is called for the last slot in the cycle among those slots containing one of the
signals indicated.
All signals in the list must belong to either the static segment of a cycle or to the same
message on the dynamic segment of a cycle.
Function This event procedure is called up in each cycle after the slot is past. The event procedure is
only called for slots in the static segment.
The event procedure is also called up if no frame is received in the specified slot.
Thus it will synchronously be executed to the FlexRay cycle. Therefore it cannot be used in
the measurement setup or the analysis branch.
If any frame is not received in the slot, then the event procedure is called with the next slot
that contains a frame or at the latest when the next cycle begins. For the VN interfaces it
will be called approx. 500 microseconds after the slot.
If two frames are received in slot <slot ID> (on channel A and B), then the event procedure
is called up just once (and in fact, with the frame contents of channel A).
The selectors always reference the contents of the Slot. The FrameType selector should be
evaluated before further processing.
Value range for n: 1 <= <slot ID> <= max. static slot ID of the cluster configuration.
An optional channel parameter for event filtering can be assigned to all functions.
Example
In the example, the event procedure is only called for frames whose FlexRay
channel 2 ID is 35.
on FrSlot MsgChannel2.35
Parameters *
Specifies the default procedure. This procedure is called for all slots for which no explicit
<slot ID>
This number describes a certain slot. The value must be in the following range: 1 to
<maximum static slot ID>.
signalname
Signal name
The Slot N time stamp that has been synchronized with the global time base in the PC (CAN
hardware or PC system clock).
The time stamp must be used if time relations should be regarded with events from other
sources. This time stamp is also output in the Trace window when receiving a frame in Slot
n.
Note: The Time selector is not available when executing CAPL programs directly on an
interface hardware (CAPL on Board).
Write protected!
msgChannel
Write protected!
FR_ChannelMask
Identifies the FlexRay channel of the CC. With 1 the frame was received on channel A, with
2 on channel B. If a frame is received on each channel, the only the frame from channel A is
returned.
Write protected!
FR_SlotID
Write protected!
FR_Cycle
Write protected!
Type
Identifies the type of frame (=data type: int) and whether a frame has even been received.
Possible values:
Important:
Write protected!
FR_PayloadLength
Write protected!
msg
Write protected!
FR_Flags
Provides more detailed status information from the frame header, if necessary.
Possible values:
0x100 The frame is a dummy frame and was not received by the bus.
0x200 Only with TX frames: The Tx cycle is not the expected one.
0x1000 —
0x2000 —
0x10000 It is a PDU!
Write protected!
FR_HeaderCRC
Write protected!
FR_Segment
This selector always returns Static since this event procedure is only permissible for static
slots.
Possible values:
Write protected!
FR_Status
Delivers additional status information about the reception buffer of the CC, if necessary.
Write protected!
Write protected!
SIMULATED
0 Not simulated
1 Simulated
Write protected!
Example
The following program executes an action always when the static slot 60 is expired.
on FRSlot 60
{
// slot 60 is over ... do action ...
// Remark: The handler is called even if any frame
// is not received in this slot!
if (this.Type == 1) // valid Frame was received in this slot
{
on FRStartCycle
CAPL Function Overview » FlexRay » on FRStartCycle
Note
Syntax on FRStartCycle *
This procedure is always called if one of the cycle definitions below does not apply.
This means that for a certain cycle either this function or one of the two functions below is
called.
on FRStartCycle <cycle>
This function is called for all cycles that comply with the defined cycle multiplexing
(FR_Cycle modulo <cycle repetition> = <base cycle>).
this procedure must not describe any cycle that has already been described by a procedure
of the form "on FRStartCycle <cycle>".
Function This event procedure can be generated by FlexRay at the beginning of each communication
cycle and contains the NM vector valid for this cycle.
An optional channel parameter for event filtering can be assigned to all functions.
Example
In the example, the event procedure is only called for the 16 cycles of FlexRay
channel 2.
on FRStartCycle MsgChannel2.16
Parameters *
Specifies the default procedure. This procedure is called on every cycle start for which no
explicit event procedure exists.
<cycle>
<base cycle>
This number describes the base cycle. The value has to be less than the repetition factor;
the value range is 0...63.
Together with the repetition factor this value determines the "Cycle Multiplexing".
<cycle repetition>
This number describes the cycle repetition factor. The value has to be between 1 and 64
and has to be a power of 2 (1, 2, 4, 8, 16, 32 or 64).
Together with the base cycle this value determines the "Cycle Multiplexing".
The StartCycle event time stamp that has been synchronized with the global time base in
the PC (CAN hardware or PC system clock).
The time stamp must be used if time relations should be regarded with events from other
sources. This time stamp is also output in the Trace window.
The Time selector is not available when executing CAPL programs directly on an Interface
hardware.
Write protected!
MsgChannel
Write protected!
FR_Cycle
Write protected!
FR_nmLength
Write protected!
FR_nmVector
Write protected!
FR_correctionOffset
Provides the signed correction value for the synchronization offset of the previous cycle.
Unit: Microticks
Write protected!
FR_correctionRate
Provides the signed correction value for the synchronization rate of the previous cycle.
Unit: Microticks
Write protected!
FR_correctionFailedCounter
Indicates the number of continuous previous cycles in which synchronization was not
possible.
Write protected!
FR_passiveToActiveCounter
If the CC is in passive mode, this counter will indicate the number of continuous previous
cycles in which clock synchronization was possible.
Write protected!
Example
The following program reacts on every start of a cycle and prints info in the Write window.
variables
{
const int cWriteTextSize = 512;
char writeTxt[cWriteTextSize];
}
void myprint(char text[])
{
write("%s", text);
}
float getTime (float time)
{
// convert NS to SEC:
return time / 1000000000.0;
}
on FRStartCycle *
{
snprintf(writeTxt, cWriteTextSize, "%10.6f: SOC %2d on FR%d!",
getTime(messageTimeNS(this)), this.FR_Cycle, this.MsgChannel);
myprint(writeTxt);
output(this); // only required in measurement setup
}
on FRSymbol
CAPL Function Overview » FlexRay » on FRSymbol
Syntax on FRSymbol
Function The event procedure is called whenever a symbol (wakeup, CAS, MTS) is received.
Parameters —
The symbol time stamp that has been synchronized with the global time base in the PC (CAN
hardware or PC system clock).
The time stamp must be used if time relations should be regarded with events from other
sources. This time stamp is also output in the Trace window when receiving a symbol..
Unit:10 microseconds
Write protected!
msgChannel
Write protected!
FR_ChannelMask
Identifies the FlexRay channel of the CC. With 1 the symbol was received on channel A, with
2 on channel B.
Write protected!
FR_Symbol
0 unknown
1 CAS
2 MTS
3 Wakeup
4 Undefined (used with VN interfaces in asynchronous mode and with the BusDoctor)
Caution
Any wakeup symbol will only be received, if the wakeup was initiated
externally. Thus, if CANoe initiates a wakeup procedure, then use the handler
on FRPOCState in order to observe the wakeup pattern transmission!
Write protected!
FR_Length
Indicates the length (data type: WORD) of the symbol in bit times.
Write protected!
FR_Cycle
Write protected!
Example
The following program reacts on received symbols and prints them in the Write window,
Trace window, and logging.
variables
{
const int cWriteTextSize = 512;
char writeTxt[cWriteTextSize];
const int cWriteTextSize2 = 40;
char writeTxt2[cWriteTextSize2];
const int writeSink_Trace = -3;
const int writeSink_Logging = -2;
const int writeSeverity_Information = 1;
}
on FRSymbol
{
getFRSymbolName(this.FR_Symbol, cWriteTextSize2, writeTxt2);
snprintf(writeTxt, cWriteTextSize, "%10.6f: on FRSymbol %2d (%-32s) in
cycle %3d on channel %2d with Mask %d, Length %d.", getTime(0),
this.FR_Symbol, writeTxt2, this.FR_Cycle, (int)this.MsgChannel,
this.FR_ChannelMask, this.FR_Length);
myprint(writeTxt);
output(this); // only required in measurement setup
}
float getTime (float time)
{
return TimeNowNS() / 1000000000.0;
}
void myprint(char text[])
{
write("%s", text);
writeLineEx(writeSink_Trace, writeSeverity_Information, "%s", text);
writeLineEx(writeSink_Logging, writeSeverity_Information, "%s", text);
}
int getFRSymbolName (word symbol, word nameSize, char name[])
{
int r = -1;
if (symbol == 0) {
snprintf(name, nameSize, "Unknown");
r = symbol;
} else if (symbol == 1) {
snprintf(name, nameSize, "CAS");
r = symbol;
} else if (symbol == 2) {
snprintf(name, nameSize, "MTS");
r = symbol;
} else if (symbol == 3) {
snprintf(name, nameSize, "Wakeup Symbol");
r = symbol;
} else {
snprintf(name, nameSize, "Unspecified");
r = -1;
}
return r;
}
The ISO TP node-layer DLL for Vector DENoe.FlexRay implements the transport protocol to allow nodes
simulated by DENoe to interact with hardware nodes attached to a FlexRay network.
A detailed description of the ISO 10681-2 TP for FlexRay and the implemented CAPL functions can be
found in the FlexRayISOTP_Manual.pdf (DOC installation folder).
The following functions are implemented in the DLL and can be called in CAPL programs:
The following functions are available with the CANoe Inteaction Layer (CANoe IL):
ILDeactivateClamp15
ILActivateClamp15, ILDeactivateClamp15
CAPL Function Overview » CANoe IL » ILActivateClamp15, ILDeactivateClamp15
long ILDeactivateClamp15();
Function Forwards the appropriate state (active/deactive) of clamp 15 to the NM simulation (if
present).
Parameters —
7.0 SP3 — — •
Example
ILControlInit
CAPL Function Overview » CANoe IL » ILControlInit
This function may only be used in on preStart to prevent the IL autostart function.
Parameters —
5.1 — — •
Example
ILControlResume
CAPL Function Overview » CANoe IL » ILControlResume
Parameters —
5.1 — — •
Example
ILControlSimulationOff
CAPL Function Overview » CANoe IL » ILControlSimulationOff
Function The simulation of the IL is stopped. After that no other function to control the IL has an
effect to the IL.
Parameters —
7.0 — — •
Example
| ILControlSimulationOn |
ILControlSimulationOn
CAPL Function Overview » CANoe IL » ILControlSimulationOn
Function Start the simulation of the IL. The IL is in the same state as it was before stopping it by
the function ILControlSimulationOff.
Parameters —
7.0 — — •
Example
| ILControlSimulationOff |
ILControlStart
CAPL Function Overview » CANoe IL » ILControlStart
Parameters —
5.1 — — •
Example
ILControlStop
CAPL Function Overview » CANoe IL » ILControlStop
Parameters —
5.1 — — •
Example
ILControlWait
CAPL Function Overview » CANoe IL » ILControlWait
Parameters —
5.1 — — •
Example
ILErrno
CAPL Function Overview » CANoe IL » ILErrno
Parameters —
5.1 — — •
Example
| ILSetResultString |
ILFaultInjectionDisableMsg
CAPL Function Overview » CANoe IL » ILFaultInjectionDisableMsg
Function Disables the sending of the message except by calling the function ILSetMsgEvent.
Parameters msg
-100: Signal or message was not found in the database or is not mapped to this node.
7.0 — — •
Example
ILFaultInjectionEnableMsg
CAPL Function Overview » CANoe IL » ILFaultInjectionEnableMsg
Parameters msg
-100: Signal or message was not found in the database or is not mapped to this node.
7.0 — — •
Example
ILFaultInjectionResetAllFaultInjections
CAPL Function Overview » CANoe IL » ILFaultInjectionResetAllFaultInjections
Function Resets the fault injection settings for all messages of the node.
Parameters —
7.0 — — •
Example
ILFaultInjectionResetMsgCycleTime
CAPL Function Overview » CANoe IL » ILFaultInjectionResetMsgCycleTime
Function Resets the cycle time of the message to the database cycle time, after having
manipulated the cycle time with ILFaultInjectionSetMsgCycleTime.
Parameters msg
-100: Signal or message was not found in the database or is not mapped to this node.
7.0 — — •
Example
ILFaultInjectionResetMsgDlc
CAPL Function Overview » CANoe IL » ILFaultInjectionResetMsgDlc
Function Resets the DLC of the message to the database DLC, after having manipulated the DLC
with ILFaultInjectionSetMsgDlc.
Parameters msg
-100: Signal or message was not found in the database or is not mapped to this node.
7.0 SP4 — — •
Example
ILFaultInjectionSetMsgCycleTime
CAPL Function Overview » CANoe IL » ILFaultInjectionSetMsgCycleTime
Function Assigns a new cycle time to the message. To set the cycle time back to its original value,
use ILFaultInjectionResetMsgCycleTime.
Parameters msg
value
-100: Signal or message was not found in the database or is not mapped to this node.
7.0 — — •
Example
ILFaultInjectionSetMsgDlc
CAPL Function Overview » CANoe IL » ILFaultInjectionSetMsgDlc
Function Assigns a new DLC to the message. To set the DLC back to its original value, use
ILFaultInjectionResetMsgDlc.
Parameters msg
dlc
-100: Signal or message was not found in the database or is not mapped to this node.
7.0 SP4 — — •
Example
ILSetEvent
CAPL Function Overview » CANoe IL » ILSetEvent
Function Sends the transferred signal directly to the bus if the network is active.
Parameters sig
-100: Signal or message was not found in the database or is not mapped to this node
5.1 — — •
Example
| ILSetMsgEvent |
ILSetMsgEvent
CAPL Function Overview » CANoe IL » ILSetMsgEvent
Function Sends the transferred message directly to the bus if the network is active.
Parameters msg
-100: Signal or message was not found in the database or is not mapped to this node.
5.1 — — •
Example
| ILSetEvent |
ILSetResultString
CAPL Function Overview » CANoe IL » ILSetResultString
Parameters aResult
aText
Char array.
aLenText
5.1 — — •
Example
| ILErrno |
ILSetSignal
CAPL Function Overview » CANoe IL » ILSetSignal
Note
If a signal should be set on measurement start and it is not allowed to modify the initial
value of the signal in the database, the function SetSignal has to be used in the on start
procedure instead of the function ILSetSignal.
Parameters sig
value
-100: Signal or message was not found in the database or is not mapped to this node.
-101: The maximum possible value range was exceeded (no sending on the bus).
5.1 — — •
Example
| ILSetSignalRaw | ILSetSignalRawField |
ILSetSignalRaw
CAPL Function Overview » CANoe IL » ILSetSignalRaw
Parameters sig
value
-100: Signal or message was not found in the database or is not mapped to this node.
-101: The maximum possible value range was exceeded (no sending on the bus).
5.1 — — •
Example
| ILSetSignal | ILSetSignalRawField |
ILSetSignalRawField
CAPL Function Overview » CANoe IL » ILSetSignalRawField
Syntax long ILSetSignalRawField (dbSignal sig, const char *pData, long aDataLen)
Parameters sig
pData
aDataLen
-100: Signal or message was not found in the database or is not mapped to this node.
-101: The maximum possible value range was exceeded (no sending on the bus).
5.1 — — •
Example
| ILSetSignal | ILSetSignalRaw |
DiagGetLastResponse Saves the last response received (for the specified request) in the output
object.
DiagGetLastResponseCode Returns the code of the last received response (for the specified request).
DiagGetObjectName Writes the language dependent name of the diagnostics object into the
buffer.
DiagGetObjectPath Delivers the qualifier path of the object that must be specified upon
generation.
DiagGetResponseCode Returns the code of the specified response (for the specified request).
DiagGetRespPrimitiveByte Reads one byte of the response stored for the request.
DiagGetRespPrimitiveSize Returns the byte length of the response stored for the request.
DiagInterpretAs Treats the data of the response object as the specified primitive.
DiagInterpretRespAs Treats the data of the request's response as the specified primitive.
DiagIsRawResp Returns if the response stored for the request is stored as raw data or can be
interpreted.
DiagResize Adjusts the size of the diagnostics object to the desired number of repetitions
of the complex parameters.
DiagSetRespPrimitiveByte Writes one byte of the response stored for the request.
DiagGetComplexParameter The behavior of this CAPL function depends on the used parameters.
DiagGetComplexRespParameter The behavior of this CAPL function depends on the used parameters.
DiagGetParameter The behavior of this CAPL function depends on the used parameters.
DiagGetParameterPath Return the qualifier path of the parameter at the given position in
the primitive.
DiagGetRespParameter The behavior of this CAPL function depends on the used parameters.
DiagIsParameterDefault Returns <> 0 if the parameter in the object has its default value.
DiagSetParameter The behavior of this CAPL function depends on the used parameters.
DiagGetP2Timeout Returns the time P2 in milliseconds, which is set by the CDD or the
configuration.
DiagSendFunctional Send a request to the functional group defined for the current target.
DiagSendPositiveResponse Sends the response object back to the tester. Can only be called in the
ECU simulation.
DiagSendNegativeResponse Sends a negative response to the tester, whereby the specified value is
transmitted as error code.
DiagSendResponse Sends the response object back to the tester. Can only be called in the
ECU simulation.
DiagSetP2Timeouts Changes the P2 and P2ex timeout values at the CANdelaLib diagnostics
channel.
DiagSetTarget Sets the ECU with which the tester should communicate from now on.
May not be called in an ECU simulation node.
DiagSetTimeoutHandler Sets the timeout callback for a request, or default timeout callback
function.
DiagSetEcuAbsent No more attempt is made to send Network Requests to the specified or current
ECU.
DiagSetEcuPresent Accepts this ECU back into the group of ECUs to be addressed.
DiagCheckObjectMatch Checks if the response is a valid (positive or negative) response for the
request.
DiagCheckValidNegResCode Checks if the given negative response code is defined for the object.
DiagCheckValidPrimitive Checks if the given object matches its specification in the CDD.
DiagCheckValidRespPrimitive Checks if the response received for the request matches its specification
in the CDD.
TestReportWriteDiagObject Writes a test step with a textual interpretation of the specified request or
response object into the test report.
TestReportWriteDiagResponse Writes a test step with a textual interpretation of the received response
for the specified request object into the test report.
TestWaitForDiagRequestSent Waits until the previously sent request has been sent to the ECU.
TestWaitForDiagResponseStart Waits for the arrival of the response to a sent request, e.g. the so-called
"First Frame" in ISO TP transmissions.
To use the CAPL callback interface, you have to implement the following CAPL functions:
_Diag_DataRequest With this function CANoe triggers the CAPL interface to transmit
data.
_Diag_SetChannelParameters This function will be called after measurement start (in ECU
simulations) or after DiagSetTarget() (in test nodes) and enables the
CAPL program to configure the transport protocol.
_Diag_SetupChannelReq With this function the CAPL program of a tester implementation will
be requested to open a channel to the ECU.
Diag_DataCon Tells the diagnostic layer, via the count parameter, how many
bytes of data were transmitted successfully.
Diag_DataInd Passes count bytes of the transmitter address sender from the
rxBuffer buffer to the diagnostic layer.
DiagGetFunctionalGroupId Determines the CAN ID on which functional requests are sent by the
diagnostic tester.
DiagGetFunctionalGroupIdMask Determines the CAN ID mask in order to be able to filter out CAN
messages sent by the diagnostic tester as functional requests.
Info
With the DoIP CAPL API you can simulate a DoIP node or DoIP gateway in CAPL.
For the implementation of a (DoIP) tester the following functions are not stringently necessary.
DoIP_DataInd Is called from the DoIP layer when new data is received.
DoIP_DataCon Is called from the DoIP layer when data was sent.
DoIP_SetAliveCheckTimeout Sets the alive check timeout parameter of the DoIP layer.
DoIP_SetGenericTimeout Sets the generic inactivity timeout parameter of the DoIP layer.
DoIP_SetInitialTimeout Sets the initial inactivity timeout parameter of the DoIP layer.
Further functions
Event Procedures
Access to the data of the corresponding event is possible in event procedures through this.
The procedures are sub-divided into different events; the first matching event procedure (top-down) is
called.
on diagRequestSent Is called when a diagnostics request has been sent by the tester.
DiagCheckObjectMatch
CAPL Function Overview » Diagnostics » DiagCheckObjectMatch
Function Checks if the response is a valid (positive or negative) response for the request.
Parameters request
Diagnostics request
response
Diagnostics response
Error code
Example
DiagRequest AirbaContr_Read req;
DiagResponse AirbaContr_Read resp;
DiagCheckValidNegResCode
CAPL Function Overview » Diagnostics » DiagCheckValidNegResCode
diagResponse.CheckValidNegResCode(DWORD negResCode);
diagResponse.CheckValidNegResCode();
Function The functions return 1 if the given negative response code is defined for the object. It
returns 0 if the code is not valid, and <0 for an error.
Parameters obj
negResCode
Error code
Example
DiagCheckValidPrimitive
CAPL Function Overview » Diagnostics » DiagCheckValidPrimitive
Method diagRequest.CheckValidPrimitive();
diagRequest.CheckValidPrimitive(DWORD reasonOut[]);
diagResponse.CheckValidPrimitive();
diagResponse.CheckValidPrimitive(DWORD reasonOut[]);
diagResponse.CheckValidPrimitive(char primitiveQualifier[]);
Function Returns 1 if the response received for the request matches its specification in the
diagnostics description. If a primitive qualifier is given, the definition of that primitive at
the object's service is used as specification.
If the primitive is not valid, 0 is returned and the optional parameter reasonOut[0] is set
to the precise reason why the check failed (see below).
Info
Parameters obj
reasonOut
primitiveQualifier
0: Primitive does not match its specification. In this case, reasonOut[0] will indicate the
problem:
Example
long ConformsToKnownPrimitives( diagResponse * response)
{
if( 1 == response.CheckValidPrimitive( "ServiDefauD")
|| 1 == response.CheckValidPrimitive( "ServiEcu1PR"))
return 1;
return 0;
}
DiagCheckValidRespPrimitive
CAPL Function Overview » Diagnostics » DiagCheckValidRespPrimitive
Method diagRequest.CheckValidRespPrimitive();
diagRequest.CheckValidRespPrimitive(DWORD reasonOut[]);
Function Returns 1 if the response received for the request matches its specification in the
diagnostics description.
If the primitive is not valid, 0 is returned and the optional parameter reasonOut[0] is set
to the precise reason why the check failed (see below).
Info
Parameters obj
reasonOut
primitiveQualifier
0: Primitive does not match its specification. In this case, reasonOut[0] will indicate the
problem:
Example
if( 1 == request.CheckValidRespPrimitive( "ServiDefauD"))
TestStepPass( "Is default response");
else
TestStepFail( "Not default response");
Diag_ClosedChannelInd
CAPL Function Overview » Diagnostics » Diag_ClosedChannelInd
Function This function communicates to CANoe that the communication channel is not longer
available, e.g. the tester closed the channel or a non reparable error occurred.
The CAPL program first has to call Diag_SetupChannelCon before further data can be sent.
Parameters —
Example
Diag_DataCon
CAPL Function Overview » Diagnostics » Diag_DataCon
Function Tells the diagnostic layer, via the count parameter, how many bytes of data were
transmitted successfully.
This function is typically called within a transport layer callback. Once the diagnostic
layer has initiated the transmission of a message via _Diag_DataRequest() and the
transport layer has sent this message in its entirety, using several message segments if
needed, the diagnostic layer's transport layer uses this function to indicate that the
message was sent successfully.
Parameters count
Return values —
Example
Diag_DataInd
CAPL Function Overview » Diagnostics » Diag_DataInd
Syntax void Diag_DataInd (byte rxBuffer [], long count, long sender);
Function Passes count bytes of the transmitter address sender from the rxBuffer buffer to the
diagnostic layer.
This function is typically called in a transport layer callback after a message, which may
be segmented, has been received in its entirety. The transport layer removes all protocol
information (segmentation, flow control, etc.) and forwards only the payload data (e.g.
the ECU's diagnostic response starting at the service ID and including all response
parameters) to the diagnostic layer.
Parameters rxBuffer
sender
Address of the transmitter from which the diagnostic message was received.
count
Return values —
Example
_Diag_DataRequest
CAPL Function Overview » Diagnostics » _Diag_DataRequest
Function With this function CANoe triggers the CAPL interface to transmit data.
Parameters data
The data of the diagnostics primitive (byte stream of request or response) that the node
should transmit on the bus. This may be several hundred or thousand bytes, therefore a
suitable transport protocol has to be used here to forward the data.
count
furtherSegments
other reserved
Return values —
Example
Diag_ErrorInd
CAPL Function Overview » Diagnostics » Diag_ErrorInd
This function is typically called within a transport layer callback. The transport layer uses
it to report errors to the diagnostic layer.
If, for example, TestWaitForDiagResponse() is used in a test module to wait for receipt of
a response and Diag_ErrorInd() reports an error, the test function returns an error and
stops waiting.
Parameters error
Error number.
This number is valid only in the context of the concrete transport protocol
implementation used. It is recommended to forward error numbers reported by the
protocol layer. For example, the OSEKTL API for the ISO TP on CAN implementation found
in OSEK_TP.DLL reports errors in the callback function OSEKTL_ErrorInd (cf.
DOC/OSEK_TP_E.pdf, section 3.2).
The error number reported here can simply be forwarded to the diagnostics layer:
OSEKTL_ErrorInd( int error)
{
Diag_ErrorInd( error);
}
Return values —
Example
Diag_FirstFrameInd
CAPL Function Overview » Diagnostics » Diag_FirstFrameInd
Function Indicates the start of a diagnostics data reception to the diagnostics layer.
This function is typically called from a transport layer callback. For example, the ISO TP
protocol on CAN indicates the reception of a "First Frame" to the application.
In the diagnostics layer of a tester, a call to this function will stop the timer started after
the request has been sent, i.e. even a very long data reception will not time out. If the
tester has called TestWaitForDiagResponseStart, that call will now be continued.
Parameters source
target
length
Return values —
Example
The OSEKTL API for the ISO TP on CAN implementation found in OSEK_TP.DLL reports
FirstFrames in the callback function OSEKTL_FirstFrameInd (see OSEK_TP_E.pdf, DOC
installation folder). The arguments can simply be forwarded in this case:
OSEKTL_FirstFrameIndication( long source, long target, long length)
{
Diag_FirstFrameInd(source, target, length);
}
DiagGenerateKeyFromSeed
CAPL Function Overview » Diagnostics » DiagGenerateKeyFromSeed
Parameters seedArray
seedArraySize
securityLevel
variant
ipOption
keyArray
maxKeyArraySize
keyActualSize
Return values At success 0 will be returned, otherwise an error code will be returned.
For further error analyses you can use the callback function _Diag_GetError.
Example
This example shows schematically the use of DiagGenerateKeyFromSeed and the Callback
function in a CAPL test module.
Variables
{
…
//actual size of Seed and Key Arrays depend on ECU
byte gSeedArray[2];
int gSeedArraySize = 2;
int gSecurityLevel = 0x20;
char gVariant[200] = "Variant1";
char gOption[200] = "option";
byte gKeyArray[255];
int gMaxKeyArraySize = 255;
DWORD gActualSize = 0;
char gDebugBuffer[2000];
diagRequest SecurityAccess::SecuritySeed::Request gSeedReq;
diagResponse SecurityAccess::SecuritySeed::Request gSeedResp;
diagRequest SecurityAccess::SecurityKey::Send gKeyReq;
…
}
//Unlock ECU by calling customer specific SeedKey DLL (e.g. in a CAPL test
module)
{
…
//Request seed from ECU
DiagSendRequest(gSeedReq);
//Wait for response and write seed from response parameter to array
TestWaitForDiagResponse(gSeedReq, 1000)
DiagGetLastResponse (gSeedReq, gSeedResp);
DiagGetParameterRaw (gSeedResp, "Seed", gSeedArray, elcount(SeedArray));
//Calculate key
DiagGenerateKeyFromSeed (gSeedArray, gSeedArraySize, gSecurityLevel,
gVariant, gOption, gKeyArray, gMaxKeyArraySize, gActualSize);
//Write result to diagnostic request
DiagSetParameterRaw(gKeyReq, "Key", gKeyArray, gActualSize);
//Send Key to unlock ECU
TestWaitForDiagRequestSent(gKeyReq);
…
}
//Callback function for error handling (optional)
_Diag_GetError (char buffer[])
{
//called if error in DiagGenerateKeyFromSeed occurs
snprintf(gDebugBuffer,elcount(gDebugBuffer),"%s", buffer);
write("CALLBACK %s", gDebugBuffer);
}
DiagGetCommParameter
CAPL Function Overview » Diagnostics » DiagGetCommParameter
Function Finds the value of a numeric communication parameter of the interface that was selected
for the description in the configuration dialog.
Parameter qualifiers are defined in the CDDT and depend on the manufacturer or
concrete template.
Parameters qualifier
The following qualifiers can be used in addition to the CDD interface parameters:
0: Normal
1: Extended
2: NormalFixed
3: Mixed
<0: No ISO TP
Info
The parameter values are each determined from the viewing angle of the
corresponding node. Therefore, in an ECU simulation with normal addressing,
the TxId represents the RxId, which is included in the tester node.
Qualifier Description
CANoe.Padding
Values
rest reserved
CANoe.UseAllFC
Values
CANoe.UseFFPrio
Values
CANoe.FixedFrameLength 0..8: All CAN frames should have at least this many
bytes.
index
Set to 0.
buffer
size
Example
DiagGetCommParameter
CAPL Function Overview » Diagnostics » DiagGetCommParameter
Note
Function Finds the value of a numeric communication parameter of the interface that was selected
for the description in the configuration dialog.
Parameters qualifier
In the AUTOSAR and OEM add-on packages there is a reference implementation of the
CAPL Callback Interface for Diagnostics. Please call our support for further information:
+49 711 80670-200.
Qualifier Description
0 AUTOSAR 2.x
rest reserved for future extensions
Values
FlexRay.RemoteAddress Address of the target node, i.e. ECU address in tester nodes,
tester address in ECU simulation.
Values
1 Unicast
2 Acknowledged Unicast
rest reserved
Info
Values
1 ISO
2 ISO6
3 L16M
4 L4G
rest reserved
Info
Info
Info
Qualifier Description
Example
DiagGetComplexParameter
CAPL Function Overview » Diagnostics » DiagGetComplexParameter
Possible scenarios:
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
iteration
subParameter
Output
Output field
mode
Access mode
Example
On diagResponse ReadListOfDTCs
{
char DTCasText[100];
DWORD i;
// Iterate over the list of DTCs and retrieve the numeric DTC value
until an error occurs
i = 0;
while( 0 <= DiagGetComplexParameter( this, "ListOfDTCs", i, "DTC",
DTCasText, elcount( DTCasText))
{
long DTCnumeric;
DTCnumeric = DiagGetComplexParameter( this, 0, "ListOfDTCs", i,
"DTC"); // mode == numeric
write( "%d DTC %06x \"%s\"", i, DTCnumeric, DTCasText);
++i;
}
}
Function Returns the symbolic value of a complex parameter. This is possible for all parameters.
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
iteration
subParameter
buffer
Output buffer
buffersize
Buffer size
Example
On diagResponse ReadListOfDTCs
{
char DTCasText[100];
DWORD i;
// Iterate over the list of DTCs and retrieve the numeric DTC value
until an error occurs
i = 0;
while( 0 <= DiagGetComplexParameter( this, "ListOfDTCs", i, "DTC",
DTCasText, elcount( DTCasText))
{
long DTCnumeric;
DTCnumeric = DiagGetComplexParameter( this, 0, "ListOfDTCs", i,
DiagGetComplexParameterRaw, DiagSetComplexParameterRaw
CAPL Function Overview » Diagnostics » DiagGetComplexParameterRaw, DiagSetComplexParameterRaw
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
iteration
subParameter
buffer
Output buffer
buffersize
Buffer size
Example
DiagGetComplexRespParameter
CAPL Function Overview » Diagnostics » DiagGetComplexRespParameter
Possible scenarios:
Parameters req
Request
parameterName
Parameter qualifier
iteration
subParameter
output
Output field
mode
Access mode
Example
Function Returns the symbolic value of a complex parameter. This is possible for all parameters.
Parameters req
Request
parameterName
Parameter qualifier
iteration
subParameter
buffer
Output buffer
bufferLen
Buffer size
Example
Parameters req
Request
parameterName
Parameter qualifier
iteration
subParameter
mode
Access mode
Example
DiagGetComplexRespParameterRaw
CAPL Function Overview » Diagnostics » DiagGetComplexRespParameterRaw
Parameters req
Request
parameterName
Parameter qualifier
iteration
subParameter
buffer
Output buffer
bufferLen
Buffer size
Example
DiagGetConfiguredVariant
CAPL Function Overview » Diagnostics » DiagGetConfiguredVariant
Function Retrieves the qualifier of the variant that is configured for the current target.
Retrieve the qualifier of the variant that is configured for the current or given target in
the Diagnostics configuration dialog. It is possible to provide this qualifier to the
automatic variant identification algorithm.
Parameters ecuQualifier
ECU the identification algorithm should run for, not the currently selected one. If given,
DiagSetTarget does not have to be called.
configuredVariantOut
bufferLen
Especially:
-94: No target was selected
Example
DiagGetCurrentEcu
CAPL Function Overview » Diagnostics » DiagGetCurrentEcu
Parameters qualifier
Output buffer
bufferLen
Example
DiagGetFunctionalGroupExt
CAPL Function Overview » Diagnostics » DiagGetFunctionalGroupExt
Function Returns the value of the "address extension" byte (extended address information for ISO
TP "extended addressing mode").
If the functional group is not specified, the destination set with DiagSetTarget is used.
Parameters groupQualifier
[0, 255]:
Others: Reserved
Availability Since Version Restricted to Measurement Setup Simulation / Test Setup
Example
DiagGetFunctionalGroupId
CAPL Function Overview » Diagnostics » DiagGetFunctionalGroupId
Function Determines the CAN ID on which functional requests are sent by the diagnostic tester.
If the functional group is not specified, the destination set with DiagSetTarget is used.
Parameters groupQualifier
Return values CAN ID of the requests, or 0xFFFFFFFF if no functional group has been set.
Example
DiagGetFunctionalGroupIdMask
CAPL Function Overview » Diagnostics » DiagGetFunctionalGroupIdMask
Function Determines the CAN ID mask in order to be able to filter out CAN messages sent by the
diagnostic tester as functional requests.
If the functional group is not specified, the destination set with DiagSetTarget is used.
Parameters groupQualifier
Return values The value returned must be logically ANDed with the ID of a received CAN message. If the
result is the same as the Group ID, this is a functional request.
Example
DiagGetIdentifiedVariant
CAPL Function Overview » Diagnostics » DiagGetIdentifiedVariant
Function Retrieve the qualifier of the variant that has been identified by the last successful run of
the automatic variant identification algorithm for given target, or the current target if no
target is given. The function can also be used to determine whether the algorithm has
finished.
Parameters ecuQualifier
ECU the identification algorithm should run for, not the currently selected one. If given,
DiagSetTarget does not have to be called.
identifiedVariantOut
bufferLen
Especially:
-99: The algorithm is still running, try again later
-98: No variant was identified, e.g. the algorithm was not started or failed
Example
DiagGetLastResponse
CAPL Function Overview » Diagnostics » DiagGetLastResponse
Note
The output object must first be declared with any desired qualifier path, however after
use in this function it may correspond to any desired diagnostic service. Therefore extra
caution should be exercised when accessing the object’s parameters.
diagResponse.GetLastResponse ();
Function Saves the last response received (for the specified request) in the output object.
Parameters req
Request
respOut
Example
DiagGetNegCode
CAPL Function Overview » Diagnostics » DiagGetNegCode
Function Returns the error code for a KWP2000 mnemonic, e.g. 0x10 for "GR" ("General Reject").
Parameters mnemonic
Example
DiagGetObjectName
CAPL Function Overview » Diagnostics » DiagGetObjectName
Function Writes the language dependent name of the diagnostics object into the buffer. For ODX
descriptions, this is the "long name".
Parameters obj
Diagnostics object
nameBufferOut
Output buffer
nameBufferLen
Example
DiagRequest AirbaContr_Read req;
char name[100];
DiagGetObjectName( req, name, elcount( name));
DiagGetObjectPath
CAPL Function Overview » Diagnostics » DiagGetObjectPath
Function Delivers the qualifier path of the object that must be specified upon generation.
Parameters obj
Diagnostics object
buffer
Input/output buffer
buffersize
Buffer size
Example
DiagGetP2Extended, DiagSetP2Extended
CAPL Function Overview » Diagnostics » DiagGetP2Extended, DiagSetP2Extended
Note
Function Returns the "P2 extended" timeout, or sets it to the specified value.
Parameters timeout
Example
| TestWaitForDiagResponse |
DiagGetP2Timeout
CAPL Function Overview » Diagnostics » DiagGetP2Timeout
Function Returns the time P2 in milliseconds, which is set by the CDD or the configuration.
P2: Time between sending of the request and arrival of the response.
Parameters —
Example
DiagGetParameter
CAPL Function Overview » Diagnostics » DiagGetParameter
Possible scenarios:
Function Returns the value of the numeric parameter, either in an output field or as return value
(without the possibility of checking the correct function).
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
Output
Output field
mode
Access mode
Return values Error code or value of the parameter or 0.0 if this could not be acquired.
Example
Function Returns the symbolic value of the parameter. This functions for all parameters. The
values received can be used for setting the parameter.
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
buffer
Output field
buffersize
Example
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
Return values
Example
DiagGetParameterName
CAPL Function Overview » Diagnostics » DiagGetParameterName
Parameters obj
Diagnostics object
paramNo
buffer
Output buffer
buffersize
Buffer size
Example
DiagGetParameterPath, DiagGetRespParameterPath
CAPL Function Overview » Diagnostics » DiagGetParameterPath, DiagGetRespParameterPath
Function Return the qualifier path of the parameter at the given position in the primitive.
Parameters object
Diagnostics object
paramNo
buffer
Input/output buffer
bufferSize
Buffer size
Example
DiagGetParameterSizeCoded
CAPL Function Overview » Diagnostics » DiagGetParameterSizeCoded
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
Example
DiagGetParameterSizeRaw
CAPL Function Overview » Diagnostics » DiagGetParameterSizeRaw
Function Returns the length of the raw parameter in bits (raw stream) including leading size byte,
terminating zeros etc.
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
Example
DiagGetParameterType, DiagGetRespParameterType
CAPL Function Overview » Diagnostics » DiagGetParameterType, DiagGetRespParameterType
Parameters object
Diagnostics object
qualifier
Parameter qualifier
buffer
Input/output buffer
bufferSize
Buffer size
Example
DiagGetParameterUnit
CAPL Function Overview » Diagnostics » DiagGetParameterUnit
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
buffer
Output buffer
buffersize
Buffer size
Example
DiagGetPendingRequests
CAPL Function Overview » Diagnostics » DiagGetPendingRequests
Info
0 means that there are no outstanding responses and another network request can be sent
out.
Parameters —
Example
DiagGetPrimitiveByte
CAPL Function Overview » Diagnostics » DiagGetPrimitiveByte
Parameters request
Request
response
Response
bytePos
Example
DiagGetPrimitiveData, DiagSetPrimitiveData
CAPL Function Overview » Diagnostics » DiagGetPrimitiveData, DiagSetPrimitiveData
Function Reads/sets the raw data of the complete service primitive (all data that is transmitted via
the transport protocol).
Parameters objxt
Diagnostics object
buffer
Input/output buffer
buffersize
Buffer size
Example
// Print the length and first byte of a diagnostics request object
PrintDiagRequestBytes( diagRequest * req)
{
BYTE primitiveRaw[4095];
long size;
size = DiagGetPrimitiveData( req, primitiveRaw, elcount( primitiveRaw));
if( size > 0)
write( "Request = (%d)[%02x ...]", size, primitiveRaw[0]);
else
write( "Request: error %d", size);
}
DiagGetPrimitiveSize
CAPL Function Overview » Diagnostics » DiagGetPrimitiveSize
Method diagRequest.GetPrimitiveSize();
diagResponse.GetPrimitiveSize();
Parameters request
Request
response
Response
Example
DiagGetResponseCode, DiagGetLastResponseCode
CAPL Function Overview » Diagnostics » DiagGetResponseCode, DiagGetLastResponseCode
Method diagResponse.GetResponseCode();
diagRequest.GetLastResponseCode();
Function Returns the code of the specified response or last received response (for the specified
request).
Parameters resp
Response
req
Request
Return values -1: The response was positive, i.e. there is no error code.
Example
DiagGetRespParameter
CAPL Function Overview » Diagnostics » DiagGetRespParameter
Possible scenarios:
Function Returns the value of the numeric parameter, either in an output field or as return value
(without the possibility of checking the correct function).
Parameters req
Request
parameterName
Parameter qualifier
output
Output field
mode
Access mode
Example
Function Returns the symbolic value of the parameter. This functions for all parameters. The
values received can be used for setting the parameter.
Parameters req
Request
parameterName
Parameter qualifier
buffer
Output field
bufferLen
Example
Parameters req
Request
parameterName
Parameter qualifier
mode
Access mode
Example
DiagGetRespParameterRaw
CAPL Function Overview » Diagnostics » DiagGetRespParameterRaw
Function This function offers access to parameters contained in a received response object,
whereby the function is addressed directly by the request. This eliminates the need to
generate a separate response object. If no response is available yet for the request, an
error is reported.
Parameters req
Request
parameterName
Parameter qualifier
buffer
Output field
bufferLen
Return values 0 if bytes were copied, otherwise <0 for an error code
Example
DiagGetRespPrimitiveByte
CAPL Function Overview » Diagnostics » DiagGetRespPrimitiveByte
Function Reads one byte of the response stored for the request.
Parameters request
Request
bytePos
Example
DiagGetRespPrimitiveSize
CAPL Function Overview » Diagnostics » DiagGetRespPrimitiveSize
Method diagRequest.GetRespPrimitiveSize();
Function Returns the byte length of the response stored for the request.
Parameters request
Request
Example
DiagGetSendingMode
CAPL Function Overview » Diagnostics » DiagGetSendingMode
Note
The sending as UUDT is activated via CDD and only available for special manufacturers.
Method diagResponse.GetSendingMode ()
Parameters response
Response
Return values Returns 0 if the answer should be sent "physically", returns 1 if the answer should be sent
as UUDT.
Example
DiagGetSuppressResp, DiagSetSuppressResp
CAPL Function Overview » Diagnostics » DiagGetSuppressResp, DiagSetSuppressResp
Function Under UDS (Unified Diagnostics Services), in certain requests it is possible to set the
"suppressPosRspMsgIndicationBit" ("suppress positive response message indication bit").
This means that the receiver must not send any positive response. These two functions
make it possible to poll and set this bit.
Parameters req
Request
flag
Example
DiagGetTargetCount
CAPL Function Overview » Diagnostics » DiagGetTargetCount
Function Returns the number /n/ of possible diagnostics targets configured. For indices /i/ with 0 ≤
i ≤ n you can retrieve the target qualifier with DiagGetTargetQualifier.
Info
Parameters —
Example
long i;
char ecuQual[100];
i = DiagGetTargetCount();
while( i-- > 0)
{
DiagGetTargetQualifier( i, ecuQual, elcount(ecuQual));
write( "Target %d: %s", i, ecuQual);
}
DiagGetTargetQualifier
CAPL Function Overview » Diagnostics » DiagGetTargetQualifier
Function Writes the target qualifier for the diagnostics target at given index into the buffer. If
successful, the qualifier can be used in DiagSetTarget.
Parameters index
bufferOut
bufferSize
Return values Error code or number of characters copied into the buffer. Note that an error is returned
if the buffer is too small for the qualifier.
Example
long i;
char ecuQual[100];
i = DiagGetTargetCount();
while( i-- > 0)
{
DiagGetTargetQualifier( i, ecuQual, elcount(ecuQual));
write( "Target %d: %s", i, ecuQual);
}
DiagGetTesterPresentState
CAPL Function Overview » Diagnostics » DiagGetTesterPresentState
DiagGetTesterPresentState()
Function Returns the state of autonomous/cyclical Tester Present requests from CANoe to the
specified or current ECU.
Info
This function only returns the correct state if in the calling CAPL node no
CAPL Callback interface for diagnostics is used.
Status:
Parameters ecuQualifier
Qualifier of the ECU as specified in the diagnostic configuration dialog, for which the
Tester Present state shall be queried.
Example
| DiagStartTesterPresent | DiagStopTesterPresent |
DiagInitialize
CAPL Function Overview » Diagnostics » DiagInitialize
Function Reinitializes the object for the given service or primitive. Diagnostics request will be
initialized with the default request parameters of the service, while diagnostics responses
will be initialized with the default parameters of the first or specified primitive of the
service. If the service is not defined, or the primitive is not defined at the given service,
nothing happens and an error code is returned.
Attention
Info
Parameters object
serviceQualifier
primitiveQualifier
Example
In an ECU simulation, initialize a response object with a specific primitive before sending
it.
on diagRequest Servi
{
diagResponse this response; // will be initialized with first primitive
response.Initialize( "Servi", "ServiEcu1PR"); // Force initialization
with specific primitive
response.SetParameter( "Voltage", 28.0); // Access primitive specific
parameter
response.SendResponse();
}
DiagInterpretAs
CAPL Function Overview » Diagnostics » DiagInterpretAs
Function Treats the data of the response object as the specified primitive. This will cause a
reinterpretation of the data, but the data will not be changed.
Info
The specified primitive must be defined for the service the response
currently refers to! Please refer to Diagnostics descriptions with overloaded
responses for details.
Parameters response
Diagnostics object
primitiveQualifier
Example
his function determines the actual response primitive by trying to set the interpretation
of the argument to the defined variations. 0 is returned if interpretation is possible.
long FindCorrectInterpretation( diagResponse * response)
{
if( !response.InterpretAs( "ServiPR"))
return 0; // no error -> interpretation OK
if( !response.InterpretAs( "ServiEcu1PR"))
return 0; // no error -> interpretation OK
if( !response.InterpretAs( "ServiDefauD"))
return 0; // no error -> interpretation OK
// None of the known primitives matches, so return failure
return -1; // not found
}
DiagInterpretRespAs
CAPL Function Overview » Diagnostics » DiagInterpretRespAs
Function Treats the data of the request's response as the specified primitive. This will cause a
reinterpretation of the data, but the data will not be changed.
Info
The specified primitive must be defined for the service the response
currently refers to! Please refer to Diagnostics descriptions with overloaded
responses for details.
Parameters request
Request that has to contain a response object received by waiting for a response.
primitiveQualifier
Example
DiagIsMarked
CAPL Function Overview » Diagnostics » DiagIsMarked
Parameters qualifier
ECU identifier
Example
DiagIsNegativeResponse
CAPL Function Overview » Diagnostics » DiagIsNegativeResponse
Method diagResponse.IsNegativeResponse ()
Parameters obj
Diagnostics object
Example
DiagIsParameterConstant, DiagIsRespParameterConstant
CAPL Function Overview » Diagnostics » DiagIsParameterConstant, DiagIsRespParameterConstant
diagRequest.IsParameterConstant(char[] qualifier)
diagRequest.IsRespParameterConstant(char[] qualifier)
Parameters object
Diagnostics object
qualifier
Parameter qualifier
Example
DiagIsParameterDefault
CAPL Function Overview » Diagnostics » DiagIsParameterDefault
Function Returns <> 0 if the parameter in the object has its default value.
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
Example
DiagIsPositiveResponse
CAPL Function Overview » Diagnostics » DiagIsPositiveResponse
Method diagResponse.IsPositiveResponse ()
Parameters obj
Diagnostics object
Example
DiagIsPresent
CAPL Function Overview » Diagnostics » DiagIsPresent
Parameters qualifier
ECU identifier
Example
DiagIsRaw
CAPL Function Overview » Diagnostics » DiagIsRaw
Method diagRequest.IsRaw();
diagResponse.IsRaw();
Parameters request
Request
response
Response
Example
DiagIsRawResp
CAPL Function Overview » Diagnostics » DiagIsRawResp
Method diagRequest.IsRawResp();
Function Returns if the response stored for the request is stored as raw data or can be interpreted.
Parameters request
Request
Example
DiagIsValidValue
CAPL Function Overview » Diagnostics » DiagIsValidValue
Function Returns 1 if the parameter in the response object is valid, otherwise 0 is returned and the
level of the problem (error or warning) is set in the output parameter field.
Parameters response
parameterQualifier
errorLevelOut
errorLevelOut[0]:
0: Value is valid
1: Warning
2: Error
Example
on DiagResponse Example_Service
{
long errorLevelOut[1];
long status;
status = DiagIsValidValue( this, "MyParameter", errorLevelOut);
if( status == 1)
{
write( "Parameter value OK");
} else if( status == 0)
{
if( errorLevelOut[0] == 1)
write( "Warning.");
else if( errorLevelOut[0] == 2)
write( "ERROR!");
} else
{
write( "Error %d checking parameter value!", status);
}
}
DiagMarkEcu
CAPL Function Overview » Diagnostics » DiagMarkEcu
long DiagMarkEcu()
Parameters qualifier
ECU identifier
Example
DiagResetParameter
CAPL Function Overview » Diagnostics » DiagResetParameter
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
Example
DiagResize
CAPL Function Overview » Diagnostics » DiagResize
Method diagResponse.Resize()
diagRequest.Resize()
Function Adjusts the size of the diagnostics object to the desired number of repetitions of the
complex parameters. For this, the counting parameter must be set first in case the
number of repetitions is coded explicitly (iteration).
If the number of repetitions is acquired via the length of the transmitted data, then the
length of the object can be set directly.
Parameters Texobjt
Diagnostics object
length
Example
DiagResize
CAPL Function Overview » Diagnostics » DiagResize
Method diagResponse.Resize()
diagRequest.Resize()
Function Adapt size of a diagnostics object to match specified parameter iterations, or set size of
bus message to given number of byte.
Parameters obj
Diagnostics object
byteCount
Example
DiagSendFunctional
CAPL Function Overview » Diagnostics » DiagSendFunctional
Info
• This function does not work with the CAPL Callback Interface!
• If one or more "Functional Group Request" descriptions are defined at the network,
this function does not work too.
In this case, set the FGR description as target and communicate using the appropriate
means.
Method diagRequest.SendFunctional()
Function Send a request to the functional group defined for the current target. The configuration
of the functional transport protocol settings in the description configuration dialog must
be present and consistent.
Info
• Only responses from the current target are received, responses from
other ECUs are ignored.
• The reception channels for ALL ECUs that are member of the same
functional group are opened to make sure that they do not run into
transport protocol errors. Note that the Tester Present is NOT activated
if those channels were not open before! It might be necessary to activate
it when a different target is selected.
When used together with the built-in K-Line diagnostic channel, also the
channel will be initialized to use functional addressing i.e. a functional
startCommunication service will be put on the K-Line (Bit 6 & 7 of format
byte set to 1) when the first request is sent. All subsequent requests sent
with this function to the same target ECU will also carry the use functional
addressing information.
Parameters request
Example
DiagSendFunctional( request1);
DiagSendMarked
CAPL Function Overview » Diagnostics » DiagSendMarked
Method diagRequest.SendMarked()
Parameters request
Example
DiagSendNegativeResponse
CAPL Function Overview » Diagnostics » DiagSendNegativeResponse
Function Sends a negative response to the tester, whereby the specified value is transmitted as
error code.
Parameters obj
Diagnostics object
code
Error code (can, for example, be acquired with DiagGetNegCode from the mnemonic).
Example
DiagSendNetwork
CAPL Function Overview » Diagnostics » DiagSendNetwork
Method diagRequest.SendNetwork()
Parameters request
Example
DiagSendRequest
CAPL Function Overview » Diagnostics » DiagSendRequest
Method diagRequest.SendRequest()
Parameters obj
Diagnostics object
Example
DiagSendResponse, DiagSendPositiveResponse
CAPL Function Overview » Diagnostics » DiagSendResponse, DiagSendPositiveResponse
Method diagResponse.SendResponse ()
diagResponse.SendPositiveResponse()
Function Sends the response object back to the tester. Can only be called in the ECU simulation.
Parameters obj
Diagnostics object
Example
_Diag_SetChannelParameters
CAPL Function Overview » Diagnostics » _Diag_SetChannelParameters
Function This function will be called after measurement start (in ECU simulations) or after
DiagSetTarget() (in test nodes) and enables the CAPL program to configure the transport
protocol.
Parameters —
Return values —
Example
DiagSetComplexParameter
CAPL Function Overview » Diagnostics » DiagSetComplexParameter
Function Sets one of the sub-parameters within a complex parameter to the specified (numeric or
symbolic) value.
For this first the complex parameter, that is, the name of the iteration, must be
specified; then the number of repetitions of the sub-parameter list that is the goal, and
then the sub-parameter in the iteration itself.
Parameters obj
Diagnostics object
parameterName
Complex parameter
iteration
subParameter
Sub parameter
numValue
symbValue
valueIn
mode
Access mode
Example
DiagSetCurrentEcu
CAPL Function Overview » Diagnostics » DiagSetCurrentEcu
Parameters qualifier
ECU identifier
Example
Diag_SetDataSegmentation
CAPL Function Overview » Diagnostics » Diag_SetDataSegmentation
Note
This function is only available with the implementation of the generic CAPL callback
interface!
Parameters mode
Mode:
maxSegmentSize
segmentSeparationTime
Example
DiagSetEcuAbsent
CAPL Function Overview » Diagnostics » DiagSetEcuAbsent
long DiagSetEcuAbsent ()
Function No more attempt is made to send Network Requests to the specified or current ECU.
Parameters qualifier
ECU identifier
Example
DiagSetEcuPresent
CAPL Function Overview » Diagnostics » DiagSetEcuPresent
Function Accepts this ECU back into the group of ECUs to be addressed.
Network Requests are sent to it again.
Parameters qualifier
ECU identifier
Example
DiagSetP2Timeouts
CAPL Function Overview » Diagnostics » DiagSetP2Timeouts
Function Changes the P2 and P2ex timeout values at the CANdelaLib diagnostics channel.
Parameters newP2timeout_ms
The CANdelaLib channel will use this P2 timeout (in milliseconds) from now on.
newP2exTimeout_ms
Example
DiagSetParameter
CAPL Function Overview » Diagnostics » DiagSetParameter
Possible scenarios:
Info
With 7.6 SP2 the function behavior was changed. The parameter will no
longer be set to its default value.
Parameters obj
Diagnostics object
parameterName
newValue
mode
Access mode
Example
Function Sets a parameter to the symbolically-specified value. This is possible for all parameters,
also numeric ones.
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
newValue
Symbolic value
Example
DiagSetParameterRaw, DiagGetParameterRaw
CAPL Function Overview » Diagnostics » DiagSetParameterRaw, DiagGetParameterRaw
Function Sets or specifies the value of a (complex) parameter directly via uncoded data bytes.
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
buffer
Input/output buffer
buffersize
Buffer size
Return values 0 if bytes were copied, otherwise <0 for an error code
Example
DiagSetPrimitiveByte
CAPL Function Overview » Diagnostics » DiagSetPrimitiveByte
Parameters request
Request
response
Response
bytePos
newValue
Example
DiagSetRequestInterval
CAPL Function Overview » Diagnostics » DiagSetRequestInterval
Parameters value
Example
DiagSetRespPrimitiveByte
CAPL Function Overview » Diagnostics » DiagSetRespPrimitiveByte
Function Writes one byte of the response stored for the request.
Parameters request
Request
bytePos
newValue
Example
DiagSetTarget
CAPL Function Overview » Diagnostics » DiagSetTarget
Function Sets the target ECU with which the tester shall communicate from now on and
configures/establishes the communication channel to that ECU.
Info
This function is only to be used inside a CAPL tester node and must not be
called from inside a CAPL ECU node which simulates diagnostics.
In case you are implementing a diagnostic ECU simulator node, assign the
diagnostics database to the node by selecting the ECU’s name in the
Function/Node combo box of the Diagnostics configuration dialog /
Assigments tab.
After calling the function in the tester, the following actions are executed:
• From now on the tester will interpret and use all diagnostics objects in the CAPL code
of this node as defined in the respective diagnostic description file.
• From now on the tester will use the SeedKey DLL defined for this target in the
diagnostic configuration dialog when computing a security key with
DiagGenerateKeyFromSeed().
• All diagnostic objects (requests/responses) defined in the CAPL code are re-initialized
for the given target. If DiagSetTarget() was called for the same or a different target
before, the request/response objects will no longer keep modifications made in a
previous session with a previous target ECU.
• DiagSetTarget shall not be called in the "on prestart" handler of a test module, since
it would be called only once when the measurement starts. It is recommended to call
it in the "preparation" phase of an XML test module, or to make sure
programmatically that it is called before any test case using diagnostics is executed.
• The communication layer is configured:
• In case of a CAPL Callback interface (CCI) being used, the function
_Diag_SetChannelParameters is called to configure the parameters of the underlying
TP nodelayer DLL. For details on CAPL Callback Interfaces for diagnostics please see
AN-IND-1-012_CAPL_Callback_Interface.pdf (DOC installation folder).
• If no CCI is implemented, a built-in diagnostic channel is configured according to
the network type to which the diagnostics database is attached and according to
the communication parameters of the selected diagnostic interface. For
connection oriented transport protocols (like e.g. VW TP 2.0) furthermore not
only the parameters of the connection are configured, but a communication
channel is actually established between tester and ECU.
Parameters ecuName
Qualifier of the ECU as set in the diagnostic configuration dialog for the respective
diagnostic description (CDD/ODX).
Example
on start
{
//In this example the DiagSetTarget(<ECU>) is simply called in the
//‘on start’ handler of a test node, as this tester only needs to access
//one dedicated ECU named LightControl_LF
//In case a test module needs to diagnose different ECUs, the function
could be
//called e.g. in the first / initializing test case of a test group for
each specific //ECU
…
}
DiagSetTimeout
CAPL Function Overview » Diagnostics » DiagSetTimeout
Parameters timeout
Timeout in ms
Default: 1000 ms.
Example
DiagSetTimeoutHandler
CAPL Function Overview » Diagnostics » DiagSetTimeoutHandler
Function Sets the timeout callback for a request, or default timeout callback function. This
function will be called if no response arrives at the tester within the timeout specified
with DiagSetTimeout().
Parameters obj
Diagnostics object
callbackName
Callback name
Example
Diag_SetupChannelCon
CAPL Function Overview » Diagnostics » Diag_SetupChannelCon
Function This function communicates to CANoe, that a communication channel is available to the
communication partner and data can be sent.
For connectionless transport protocols this function can be called out of the callback
_Diag_SetupChannelReq.
Parameters —
Example
_Diag_SetupChannelReq
CAPL Function Overview » Diagnostics » _Diag_SetupChannelReq
Note
Function With this function the CAPL program of a tester implementation will be requested to open
a channel to the ECU. After opening the channel the CAPL program can call the function
Diag_SetupChannelCon.
Parameters —
Return values —
Example
DiagStartTesterPresent
CAPL Function Overview » Diagnostics » DiagStartTesterPresent
DiagStartTesterPresent()
Function Starts sending autonomous/cyclical Tester Present requests from CANoe to the specified
or current ECU.
Parameters ecuQualifier
Qualifier of the ECU as specified in the diagnostic configuration dialog, for which the
Tester Present service shall be started.
If no parameter is provided, sending of Tester Present requests is started for the current
diagnostic target (set by DiagSetTarget(char ecuQualifier[]).
Info
This function will only start the Tester Present service if in the calling CAPL
node no CAPL Callback interface for diagnostics is used.
Example
| DiagGetTesterPresentState | DiagStopTesterPresent |
DiagStartVariantIdentification
CAPL Function Overview » Diagnostics » DiagStartVariantIdentification
Function Start the automatic variant identification algorithm for the given target, or the currently
selected one if none is given. The algorithm will communicate via the CANdelaLib
channel, i.e. the CAPL callback functions are not used for the identification.
A tester module may wait for the completion of the algorithm with
TestWaitForDiagVariantIdentificationCompleted, or query the status of the identification
with DiagGetIdentifiedVariant.
Parameters ecuQualifier
ECU the identification algorithm should run for, not the currently selected one. If given,
DiagSetTarget does not have to be called.
Example
DiagStopTesterPresent
CAPL Function Overview » Diagnostics » DiagStopTesterPresent
DiagStopTesterPresent ()
Function Stops sending autonomous/cyclical Tester Present requests from CANoe to the specified
or current ECU.
Parameters ecuQualifier
Qualifier of the ECU as specified in the diagnostic configuration dialog, for which the
Tester Present service shall be stopped.
If no parameter is provided, sending of Tester Present requests is stopped for the current
diagnostic target (set by DiagSetTarget(char ecuQualifier[]).
Info
This function will only stop the Tester Present service if in the calling CAPL
node no CAPL Callback interface for diagnostics is used.
Example
| DiagGetTesterPresentState | DiagStartTesterPresent |
DiagUnmarkAllEcus
CAPL Function Overview » Diagnostics » DiagUnmarkAllEcus
Parameters —
Example
DiagUnmarkEcu
CAPL Function Overview » Diagnostics » DiagUnmarkEcu
Parameters qualifier
ECU identifier
Example
DoIP_AddECU
CAPL Function Overview » Diagnostics » DoIP_AddECU
Parameters address
Logical DoIP address of an ECU. You must set at least one logical ECU address (e.g. the
logical DoIP address of the DoIP entity).
Return values —
7.1 SP4 — — •
Example
DoIP_AddECU( 0x200);
DoIP_AddECU( 0x201);
DoIP_AddTester
CAPL Function Overview » Diagnostics » DoIP_AddTester
Parameters address
Logical DoIP address of a tester. You must set at least one valid logical tester address.
Return values —
7.1 SP4 — — •
Example
dword address;
address = DiagGetCommParameter( “DoIP.TESTER_LogicalAddress")
DoIP_AddTester(address);
| DiagGetCommParameter |
DoIP_DataCon
CAPL Function Overview » Diagnostics » DoIP_DataCon
Callback This callback is called from the DoIP layer when data was sent.
Parameters count
Return values —
7.1 SP4 — — •
Example
void DoIP_DataCon( dword count)
{
// pass up to the diagnostics layer
Diag_DataCon( count);
}
| Diag_DataCon |
DoIP_DataInd
CAPL Function Overview » Diagnostics » DoIP_DataInd
Syntax void DoIP_DataInd( byte buffer[], dword count, word address, dword
reserved)
Callback This callback is called from the DoIP layer when new data is received.
Parameters buffer
count
address
reserved
Reserved parameter.
Always 0.
Return values —
7.1 SP4 — — •
Example
void DoIP_DataInd( byte buffer[], dword count,
word address, dword reserved)
{
// gateway processing here…
// pass data up to the diagnostics layer
Diag_DataInd( buffer, count, 0);
}
| Diag_DataInd |
DoIP_DataReq
CAPL Function Overview » Diagnostics » DoIP_DataReq
Syntax void DoIP_DataReq( byte buffer[], dword count, dword address, dword
reserved)
Parameters buffer
count
address
reserved
Reserved parameter.
Set to 0.
Return values —
7.1 SP4 — — •
Example
_Diag_DataRequest( BYTE data[], DWORD count,
long furtherSegments)
{
// send data via DoIP
DoIP_DataReq( data, count, gDoIPAddress, 0);
}
| _Diag_DataRequest |
DoIP_ErrorInd
CAPL Function Overview » Diagnostics » DoIP_ErrorInd
Callback This callback is called from the DoIP layer when an error occurred.
Parameters error
Return values —
Example
void DoIP_ErrorInd( int error)
{
// pass up to the diagnostics layer
Diag_ErrorInd( error);
}
| Diag_ErrorInd |
DoIP_SetAliveCheckTimeout
CAPL Function Overview » Diagnostics » DoIP_SetAliveCheckTimeout
Function Sets the alive check timeout parameter (T_TCP_Alive_Check) of the DoIP layer. This
function must be called in on preStart.
Parameters Timeout
Return values —
7.1 SP4 — — •
Example
// Set T_TCP_Alive_Check to 3s
DoIP_SetAliveCheckTimeout( 3000);
DoIP_SetGenericTimeout
CAPL Function Overview » Diagnostics » DoIP_SetGenericTimeout
Function Sets the generic inactivity timeout parameter (T_TCP_Generic_Inactivity) of the DoIP
layer. This function must be called in on preStart.
Parameters Timeout
Return values —
7.1 SP4 — — •
Example
// Set T_TCP_Generic_Inactivity to 30s
DoIP_SetGenericTimeout( 30000);
DoIP_SetInitialTimeout
CAPL Function Overview » Diagnostics » DoIP_SetInitialTimeout
Function Sets the initial inactivity timeout parameter (T_TCP_Initial_Inactivity) of the DoIP layer.
This function must be called in on preStart.
Parameters Timeout
Return values —
7.1 SP4 — — •
Example
// Set T_TCP_Initial_Inactivity to 3s
DoIP_SetInitialTimeout( 3000);
DoIP_SetTesterUdpPort
CAPL Function Overview » Diagnostics » DoIP_SetTesterUdpPort
Function Sets the UDP port (UDP_TEST_EQUIPMENT_LISTEN) to be used by the DoIP layer. This
function must be called in on preStart.
Parameters port
Return values —
7.1 SP4 — — •
Example
dword port;
port = DiagGetCommParameter( "DoIP.TESTER_UDP_Data");
// Set the tester UDP port
DoIPSetTesterUdpPort( port);
| DiagGetCommParameter |
DoIP_SetVehicleAddress
CAPL Function Overview » Diagnostics » DoIP_SetVehicleAddress
Function Sets the address to be used by the DoIP layer. The address may be used to identify the
DoIP entity from the tester equipment. The function might be used to either set a VIN, an
IP address or a MAC address. In the current implementation only the VIN is supported.
This function must be called in on preStart.
Parameters address
Return values —
7.1 SP4 — — •
Example
// Set the vehicle ‘address’
char buffer[256];
DiagGetCommParameter( "DoIP.VEHICLE_Address",
0, buffer, elcount( buffer));
DoIP_SetVehicleAddress( buffer);
| DiagGetCommParameter |
DoIP_SetVehicleInterface
CAPL Function Overview » Diagnostics » DoIP_SetVehicleInterface
Function Sets the network interface to be used by the DoIP layer. This function must be called in
on preStart.
Parameters interface
Return values —
7.1 SP4 — — •
Example
// Set the network interface
char buffer[256];
DiagGetCommParameter( "DoIP.VEHICLE_Interface",
0, buffer, elcount( buffer));
DoIP_SetVehicleInterface( buffer);
| DiagGetCommParameter |
DoIP_SetVehicleTcpPort
CAPL Function Overview » Diagnostics » DoIP_SetVehicleTcpPort
Function Sets the TCP port (TCP_DATA) to be used by the DoIP layer. This function must be called
in on preStart.
Parameters port
Return values —
7.1 SP4 — — •
Example
dword port;
port = DiagGetCommParameter( "DoIP.VEHICLE_TCP_Data");
// Set the vehicle TCP port
DoIP_SetVehicleTcpPort( port);
| DiagGetCommParameter |
DoIP_SetVehicleUdpPort
CAPL Function Overview » Diagnostics » DoIP_SetVehicleUdpPort
Function Sets the UDP port (UDP_VEHICLE_LOCAL) to be used by the DoIP layer. This function must
be called in on preStart.
Parameters port
Return values —
7.1 SP4 — — •
Example
dword port;
port = DiagGetCommParameter( "DoIP.VEHICLE_UDP_Data");
// Set the vehicle UDP port
DoIP_SetVehicleUdpPort( port);
| DiagGetCommParameter |
TestReportWriteDiagObject, TestReportWriteDiagResponse
CAPL Function Overview » Diagnostics » TestReportWriteDiagObject, TestReportWriteDiagResponse
These test steps are subject to the common test step report filtering as configured in the
Test Module Configuration dialog.
Parameters req
Request
resp
Response
Example
TestWaitForDiagRequestSent
CAPL Function Overview » Diagnostics » TestWaitForDiagRequestSent
Note
Function Waits until the previously sent request has been sent to the ECU.
This might be triggered by a call of the function Diag_DataCon() at the CAPL Callback
Interface.
Parameters request
Sent request
timeout [ms]
Return values <0: An internal error occurred, e.g. a faulty configuration of the Diagnostic Layer.
0: The timeout was reached, i.e. the event of interest did not occur within the specified
time.
1: The event occurred.
Availability Since Version Restricted to Measurement Setup Simulation / Test Setup
Example
DiagRequest SerialNumber_Read req;
long result;
DiagSetTarget("Door");
req.SendRequest();
// waits until request is completely sent
if (TestWaitForDiagRequestSent(req, 2000)== 1)
TestStepPass("Request was sent successfully!");
else
TestStepFail("Request could not be sent!");
TestWaitForDiagResponse(req, 2000)
TestWaitForDiagResponse
CAPL Function Overview » Diagnostics » TestWaitForDiagResponse
Note
Function Waits for the arrival of the response to the given request.
The function will return immediately after a positive or negative reponse - other than
"responsePending" - was received within the configured protocol (P2/P2*) timings.
Intermediate "responsePending" NRCs from the target ECU will automatically prolong the
wait timer of the tester in P2* increments until maximally <timeout> [ms]. If by then no
response has been received from the ECU target, the function will return with value <0,
timeoutReached>.
In case the tester node implements a "CAPL callback interface for diagnostics" (CCI), but
has no further provisions to handle NRCs on its own right, the behaviour is equivalent to
the one described above (automated "responsePending" handling).
If the tester implements a CCI and handles "responsePending" messages by itself - calling
DiagSetP2Extended(-1) beforehand on the CCI - then this function will also treat
"reponsePending" as a regular negative reponse code and will return immediately after
having received such a negative response.
Parameters request
Sent request
timeout [ms]
Return values <0: An internal error occurred, e.g. a faulty configuration of the Diagnostic Layer.
0: The timeout was reached, i.e. the event of interest did not occur within the specified
time.
1: The event occurred.
Example
TestWaitForDiagResponseStart
CAPL Function Overview » Diagnostics » TestWaitForDiagResponseStart
Note
Function Waits for the arrival of the response to a sent request, e.g. the so-called "First Frame" in
ISO TP transmissions.
One way this function might be triggered is by Diag_FirstFrameInd() at the CAPL
Callback Interface, but only if this has been implemented suitably. When other protocols
or interfaces are used this call might be omitted. Then the function rolls back after the
response has been fully received.
Parameters request
Sent request
timeout [ms]
Return values <0: An internal error occurred, e.g. a faulty configuration of the Diagnostic Layer.
0: The timeout was reached, i.e. the event of interest did not occur within the specified
time.
1: The event occurred.
Example
DiagRequest SerialNumber_Read req;
long result;
DiagSetTarget("Door");
req.SendRequest();
// waits for the start of the response reception
if (TestWaitForDiagResponseStart(req, 2000)== 1)
TestStepPass("Starting response reception!!");
else
TestStepFail("No response!");
TestWaitForDiagResponse(req, 2000)
TestWaitForDiagVariantIdentificationCompleted
CAPL Function Overview » Diagnostics » TestWaitForDiagVariantIdentificationCompleted
Function Wait for the completion of the automatic variant identification algorithm. If the qualifier
of an expected variant is given, an error is returned if a different variant is identified.
Parameters expectedVariant
Example
on diagRequest
CAPL Function Overview » Diagnostics » on diagRequest
Syntax on diagRequest
Function The procedure is sub-divided into the following events; the first matching event procedure
(top-down) is called:
• on diagRequest <service>
• (1)
on diagRequest <class>::<instance>::<service>
Is called when a request is received in the ECU simulation that belongs to the
indicated diagnostics service.
• (1)
on diagRequest <class>::<instance>::*
Is called when the service of the request received belongs to the specified class and
instance.
• on diagRequest <class>::*
Is called when the service of the request received belongs to the specified class.
• on diagRequest *
(1) While the CANdela process knows the concept of a "diagnostics instance", ODX does not. Starting with CANoe 7.0
it is possible to use new unique service qualifiers, while CAPL programs for earlier CANoe versions might indicate
the equivalent long qualifier path.
7.0 SP3 — — •
Example
on diagRequestSent
CAPL Function Overview » Diagnostics » on diagRequestSent
Syntax on diagRequestSent
Function The procedure is sub-divided into the following events; the first matching event procedure
(top-down) is called:
• on diagRequestSent <service>
Is called when a request is received in the ECU simulation that belongs to the
indicated diagnostics service.
Is called when the service of the request received belongs to the specified class.
• on diagRequest <class>::*
Is called when the service of the request received belongs to the specified class.
• on diagRequestSent *
7.5 — — •
Example
on diagRequestSent *
{
// A request was sent, therefore on LIN the schedule has to be changed
linChangeSchedTable( cSchedulingTableForDiagResponse);
}
on diagRequestSent ECU_SoftReset
{
// The ECU will perform a reset for some time, so inform the rest of the
CAPL program
gECUisResetting = 1;
}
on diagResponse
CAPL Function Overview » Diagnostics » on diagResponse
Syntax on diagResponse
Function The procedure is sub-divided into the following events; the first matching event procedure
(top-down) is called:
• on diagResponse <ECU>.<service>
• (1)
on diagResponse <ECU>.<class>::<instance>::<service>
Is called when a response from the indicated ECU (specified with its ECU qualifier) is
received in the tester that belongs to the indicated diagnostics service.
This is especially useful in situations where the tester program communicates with more
than one diagnostics targets, e.g. sending functional requests.
• on diagResponse <service>
• (1)
on diagResponse <class>::<instance>::<service>
Is called when a response is received in the tester that belongs to the indicated
diagnostics service.
• (1)
on diagResponse <ECU>.<class>::<instance>::*
• (1)
on diagResponse <class>::<instance>::*
Is called when the service of the response received belongs to the specified class and
instance. If an ECU qualifier is given, the procedure is called only when the response was
sent by this ECU.
• on diagResponse <ECU>.<class>::*
• on diagResponse <class>::*
Is called when the service of the response received belongs to the specified class. If an
ECU qualifier is given, the procedure is called only when the response was sent by this
ECU.
• on diagResponse <ECU>.*
• on diagResponse *
Is called when no other event procedure matches. If an ECU qualifier is given, the
procedure is called only when the response was sent by this ECU.
(1) While the CANdela process knows the concept of a "diagnostics instance", ODX does not. Starting with CANoe 7.0
it is possible to use new unique service qualifiers, while CAPL programs for earlier CANoe versions might indicate
the equivalent long qualifier path.
7.0 SP3 — — •
Example
1 physical: Access to the value calculated from the transmitted numerical value (is also displayed
symbolical as text).
2 coded: Immediate transformation into a numeric type (up to 32 bit), i.e. floating point values will also
be provided in their internal description (bit form).
Preparation:
On the configuration dialog of the diagnostics observer, a description must be assigned to the simulation
node!
Example
The CAPL program waits for requests from the tester and can then send a response:
on diagRequest CALIBRATION::Parametrierung::Lesen {
DiagResponse CALIBRATION::Parametrierung::Lesen resp;
DiagSetParameter( resp, "Parameter1", 0.37);
DiagSendResponse( resp);
}
Here the method which qualifier path has the longest match with that of the object will be
called.
Info
The length of the elements of a qualifier path from the CANdela description file is limited to 50
characters in the CAPL Compiler. Longer names may exceed this limit, but the CAPL program
cannot be compiled. Nevertheless, it is possible to specify the qualifier path as a text string in
quotation marks: "<Qualifier Path>". In this case the qualifier path may be up to 255 characters
in length.
| Connection of the Communication Layer | Basic CAPL Procedure for a Tester Implementation | Expanded Functions in CAPL |
Example
DiagSendRequest(req);
Info
The length of the elements of a qualifier path from the CANdela description file is limited to 50
characters in the CAPL Compiler. Longer names may exceed this limit, but the CAPL program
cannot be compiled. Nevertheless, it is possible to specify the qualifier path as a text string in
quotation marks: "<Qualifier Path>". In this case the qualifier path may be up to 255 characters
in length.
| Connection of the Communication Layer | Basic CAPL Procedure for an ECU Implementation | Expanded Functions in CAPL |
The diagnostics commands in CAPL allow access to the diagnostics services and data using symbols that
were defined in the CANdela description file. For communication, this data must be transmitted, where
two ways are available:
• In a tester node or test module, a call to DiagSetTarget suffices. It will connect the tester to the ECU
via the so called CANdelaLib channel provided by CANoe.
• In an ECU simulation it is necessary to implement the CAPL callback interface. This interface consists
of a set of functions implemented in CAPL that are called by CANoe to trigger actions, and special
CAPL functions implemented by CANoe that forward transport protocol events to CANoe.
This interface may also be used in tester nodes and test modules if direct access to the transport protocol
is necessary, e.g. to perform fault injection.
Depending on the transport protocol implementation used, the events the CAPL program receives have to
be forwarded to CANoe.
Please refer to these functions for details:
• Diag_DataInd
• Diag_ErrorInd
• Diag_DataCon
• Diag_FirstFrameInd
The following code fragments show a possible implementation of this interface for CAN or LIN using the
ISO transport protocol. These fragments may be used inside simulation nodes, test nodes, test modules
(CAPL) and test case libraries. Within CANoe transport protocol functions are provided as nodelayer DLL
OSEK_TP.dll and LINtp.dll respectively.
For special applications in the course of ECU test and development those functions may be modified e.g.
for inducing transmission errors for robustness tests (see OSEK_TP_EN.pdf (DOC installation folder)
"Appendix: Fault injection support").
The implementation of the generic CAPL callback interface for the OSEK_TP.DLL which follows here can
be found as CCI_Implementation.cin file in the demo folder Demo_CAN_CN\Diagnostics\UDSSim\Nodes.
You can find the file location in the Options dialog (Application Settings|File Locations).
You can include the CCI_Implementation.cin file directly into your simulations program.
_Diag_SetChannelParameters()
{
long value;
// Close a possible database connection to make sure that this module has full
control over the // settings
if( CanTpGetDBConnection() > 0)
{
CanTpCloseConnection( CanTpGetDBConnection());
}
switch( value)
{
case 0: // Normal addressing
gHandle = CanTpCreateConnection(0);
CanTpSetTxIdentifier( gHandle, DiagGetCommParameter( "CANoe.TxId"));
CanTpSetRxIdentifier( gHandle, DiagGetCommParameter( "CANoe.RxId"));
writeDbgLevel(1, "%s: Normal [0x%x, 0x%x]", gECU, DiagGetCommParameter(
"CANoe.TxId"), DiagGetCommParameter( "CANoe.RxId"));
break;
default:
write( "%s: Unsupported addressing mode!", gECU);
}
if( cIsTester)
{
CanTpSetTargetAddress( gHandleFunctional, (value >> 8) & 0xFF);
CanTpSetEcuAddress( gHandleFunctional, value & 0xFF);
}
else
{
CanTpSetEcuAddress( gHandleFunctional, (value >> 8) & 0xFF);
}
}
}
}
}
'gSendNextRequestFunctionally = 0;
return;
}
// Send physically
writeDbgLevel(1, "%s: DataRequest %d byte: %02x ...",gECU, count, data[0]);
_Diag_SetupChannelReq()
{
// This callback function is mandatory in tester nodes
// If used in simulation nodes it is not called
Diag_SetupChannelCon();
}
Diag_ErrorInd( error);
}
diag_FirstFrameInd( 0, 1, length);
}
_Diag_SetChannelParameters()
{
gNodeAddress = diagGetCommParameter("CANoe.AddrExt");
write( "%s: _Diag_SetChannelParameters: node address is %d"
, gECU, gNodeAddress);
}
_Diag_SetupChannelReq()
{
write( "%s: _Diag_SetupChannelReq", gECU);
Diag_SetupChannelCon();
}
LINtp_GetRxData(data, count);
Diag_DataInd(data, count, 0);
}
| Expanded Functions in CAPL | Basic CAPL Procedure for an ECU Implementation | Basic CAPL Procedure for a Tester
Implementation |
Introduction
ODX allows the specification of more than one positive response primitive for a diagnostics service (also
for negative responses). A diagnostics client (i.e. tester) cannot know which one of the valid primitives the
ECU will respond a request with. Therefore it may have to try all primitives of the service until finding one
that matches the received data.
Use Cases
• Interpretation of diagnostics data: If a primitive exists that matches the data without error, this
primitive is displayed in the trace. Otherwise one of the primitives is used to interpret the data, and
errors are indicated at the respective parameters.
• Accessing the parameters in the response primitive in the tester: Upon reception of the response data,
CANoe will automatically use a primitive that matches without error. If no such primitive exists,
CANoe will use one of the available primitives for interpretation. In this case, not all parameters may
be available to the CAPL program.
• Forcing CANoe to use a specific primitive for interpretation: The program can ask CANoe to interpret
the data in the response object using a specific existing primitive. Parameters matching the primitive
definition will be available symbolically afterwards. The following functions are available for this:
• DiagInterpretAs
• DiagInterpretRespAs
• Check if the response received conforms to the definition for one specific primitive:
• DiagCheckValidPrimitive
• DiagCheckValidRespPrimitive
• Initializing a diagnostics object using a specific primitive definition: In CAPL you can initialize
diagnostics objects by specifying a service qualifier. This will initialize the object with the first
primitive defined, i.e. if the service defines several primitives, the program has to select one of them
explicitly. This can be achieved by using this function:
• DiagInitialize
0 No error, success.
-100 The input provided on The arguments provided to Check the arguments provided to the
function call is not a CAPL function call are not function call.
consistent or sufficient. usable.
-99 The object's response is The diagnostics object is Delay the operation until the object is no
pending, therefore still in use, therefore the longer accessed.
cannot delete it. operation is not possible.
-98 The handle is not A diagnostics object was • Check that the initialization of the
assigned to a referred to that does not object worked, i.e. DiagSetTarget
diagnostics object. (no longer) exist, or there is was successful.
no target with the given
Invalid diagnostics • Make sure that the object is valid in
qualifier.
object handle the current target's context, i.e. the
encountered! service it is declared with is defined
in the target's description.
No diagnostics
• When accessing the last response
description for ECU
stored at a request, make sure that a
qualifier '...' found!
response has been received for the
request.
-97 The parameter does not An operation on a • Make sure that the parameter exists
exist in this object, or is parameter is not possible, in the diagnostics object. Some
constant. because it cannot be found primitives may hold different
or is not accessible. parameters depending on their data.
Parameter '...' not
found or has wrong • If a parameter is declared constant
type! in the description, its value cannot
be changed.
Parameter '...' is
• If the type of a parameter does not
declared constant!
allow the operation specified, this
Error accessing complex error will be given.
parameter: '...', sub-
parameter '...' not
found or constant.
-95 Accessing CANdelaLib An operation performed on • The details in the warning will
lead to error '...' for '...' the diagnostics objects
-94 Diagnostics was not The operation is not • Make sure DiagSetTarget is called
initialized for the node, possible because and sets an existing target
i.e. no SetEcu/Target DiagSetTarget has not been successfully. A network description
called. called in a tester yet, or has to be selected in order to use
there is no diagnostics certain network request functions.
Diagnostics not description assigned to the
initialized! A tester • Assign a diagnostics description to
simulation node (for
must call the ECU simulation node.
diagnostics server
DiagSetTarget() e.g. simulation).
Network request
interface not found!
-92 There was an error on The transport protocol (TP) Check the Write window for further
TP level. layer has reported a information. Check the communication
transmission error. sequence in the Trace window for
possible problems.
-91 Only one It is possible to send only Make sure that the processing of the
request/response can one diagnostics object at a previous object is finished.
be sent at a time! time, i.e. while the object
is processed for sending, no
other object can be sent.
-90 Test function outside Some functionality is only Requests can only be sent from nodes
TestCase, or Tester-only available in a tester or a configured as tester, i.e. DiagSetTarget
function called in ECU, test case in a test module. must have been called successfully.
or vice-versa.
Responses can only be sent from nodes
configured to be diagnostics server
simulations, i.e. a diagnostics description
must have been assigned to them.
-89 No seed and key library No seed&key dll was Configure a seed&key DLL.
was specified. specified in the diagnostic
configuration.
-88 The seed and key The seed&key dll does not Configure a seed&key DLL.
library did not contain a contain a valid seed&key
matching seed and key function.
function.
-87 The seed and key Ensure that the correct seed&key path
library couldn't be and filename is configured.
loaded.
-85 The seed array size is Decrease the seed array size.
too large.
As of CANoe 5.0 it is possible to access CANdela Studio diagnostics descriptions within CAPL programs:
• With the configuration of the diagnostics observer, a description can be assigned to a simulation node.
The CAPL program of this node is then regarded as an implementation of the diagnostics functionality
of this ECU (ECU implementation) and thus all defined services are recognized.
• For the implementation of a diagnostics tester it is possible to select the target ECU in the CAPL
program, i.e. to choose the corresponding diagnostics description.
• Request and response objects can be generated using their qualifier.
• In the CAPL program, diagnostics services, parameters, and parameter values can be accessed
symbolically.
• The arrival of requests and responses can be processed via event procedures.
• The connection to the communication layer occurs via CAPL callbacks, whereby the full control over
the communication is retained for development and test. For standard applications, corresponding
implementations are already available.
• Usage in Test modules: Effective with CANoe 5.0 SP3 it is possible within test modules to wait on
diagnostics events. After sending a request you can wait for a response without programming a state
machine. You have access to the response of the ECU.
Starting with CANoe 7.5 it is also possible to access basic diagnostics ECUs from within CAPL. Only
functions for the diagnostic tester side are supported, simulation of basic diagnostics ECUs is not
supported. Details whether a function is supported for Basic Diagnostics can be found in the
documentation of each function.
Limitations
• Presently, a node can only implement the diagnostics functions of one ECU. The tester node cannot
communicate in parallel with several ECUs simultaneously (it is, however, possible to work with
different ECUs one after the other or to use several tester nodes).
Additional Remarks
• To specify a service its qualifier path from the CANdela diagnostics description is used. You can find
and compose the qualifier path in CANdelaStudio under Properties (right mouse key for "class",
"instance" and "service") or you can determine it in CANoe/DENoe with the following procedure:
• Open the diagnostics console of the diagnostics description in which the searched service is
defined.
• Choose the wished service out of the tree view.
• Take over the shown qualifier path in a CAPL program.
Info
The qualifier of a simple or complex parameter can be found in CANdelaStudio with the Properties of
the parameter.
Info
Do not confuse the identifier with the language-dependent name of the object since then the
object cannot be identified!
• In order to assign an object with a variable number of parameters, proceed as follows: if the
parameter list is defined in CANdelaStudio as iterative parameters with a number, then first this
parameter (e.g. "NUMBER_OF_DTC") must be set. Then call DiagResize( response), which makes
space for the actual parameters. These can be set with the DiagSetComplexParameter functions.
If, however, the number of sub-parameters is not set via an individual parameter but instead from the
length of the transmitted TP message, then the resulting size of the object must be transmitted in
bytes when calling DiagResize.
Info
The length of the elements of a qualifier path from the CANdela description file is limited to 50
characters in the CAPL Compiler. Longer names may exceed this limit, but the CAPL program
cannot be compiled. Nevertheless, it is possible to specify the qualifier path as a text string in
quotation marks: "<Qualifier Path>". In this case the qualifier path may be up to 255 characters
in length.
This test case checks if the identified variant matches the configured one.
// This test case checks if the variant found by the identification
// algorithm is the configured one
testcase IdentifyConfiguredVariant()
{
char configuredVariant[50];
char identifiedVariant[50];
long status;
// Select ECU the variant identification should work on
DiagSetTarget( "ECU");
// Retrieve the qualifier of the configured variant
DiagGetConfiguredVariant(configuredVariant, elcount( configuredVariant));
TestStep( "Expected:", configuredVariant);
// Start variant identification
status = DiagStartVariantIdentification();
if( 0 == status)
{
TestStepPass( "Variant Identification was started!");
} else if( status == -97)
{
TestStepFail( "Variant identification not defined in diagnostics description");
} else
{
TestStepFail( "Variant identification could not be started");
}
// Wait explicitly
status = TestWaitForDiagVariantIdentificationCompleted( configuredVariant);
// Evaluate the result
switch( status)
{
case 1:
TestStepPass( "Configured variant identified.");
break;
case 0:
TestStepFail( "Variant identification ran into timeout!");
break;
case -100:
TestStepFail( "Variant identification not running!");
break;
case -98:
TestStepFail( "Variant identification algorithm not successfull!");
break;
case -90:
TestStepFail( "TestWaitFor... functions are only possible in tester modules!");
break;
case -83:
DiagGetIdentifiedVariant( identifiedVariant, elcount(identifiedVariant));
TestStep( "Found:", identifiedVariant);
TestStepFail( "Identified variant is not the expected one!");
break;
default:
TestStepFail( "Variant identification failed!");
break;
}
}
With CANoe 5.1 SP2 an updated CAPL callback interface is available that makes no assumptions of the
used transport protocol and supports connection oriented and segmented transmissions easier.
Interface configuration
It is now possible, with two (ECU simulations) or three functions (test simulations or test modules) to
extensively configure the TP layer.
To do this, the DiagGetCommParameter function was introduced, which makes set parameters for a
diagnostic description accessible in CAPL programs, whereby the parameter qualifiers are identical for all
CDDS and manufacturers.
An ECU simulation can respond to functional diagnostic requests sent in an individual CAN message by the
tester.
To implement such a response, proceed as follows:
Example Implementation
variables
{
[...]
DWORD gFunctionalRequestId = 0;
DWORD gFunctionalRequestIdMask = 0;
long gFunctionalRequestExt = -1;
long gCANchannel = -1;
}
_Diag_SetChannelParameters()
{
[...]
// Configure functional request ids
gCANchannel = DiagGetCommParameter( "CANoe.ChannelNumber");
gFunctionalRequestId = DiagGetFunctionalGroupId();
if( gFunctionalRequestId != -1)
{
gFunctionalRequestIdMask = DiagGetFunctionalGroupIdMask();
gFunctionalRequestExt = DiagGetFunctionalGroupExt();
}
}
on message *
{
int i, dataStart, requestLength;
BYTE requestData[7];
// Check if the message received has the functional request id,
// and if extended addresses are used, if the extension matches
if( gCANchannel != this.can
|| (this.id & gFunctionalRequestIdMask) != gFunctionalRequestId
|| gFunctionalRequestExt >= 0 && this.byte(0) != gFunctionalRequestExt)
return;
// This is a functional request, so indicate the data to the diagnostics
layer.
// The length of the data is found in the first byte of data
dataStart = (gFunctionalRequestExt >= 0) ? 1 : 0;
requestLength = this.byte(dataStart);
++dataStart;
writeDbgLevel(1, "%s: Functional request received, %d byte: %02x...",
gECU, requestLength, this.byte( dataStart));
for( i = 0; i < requestLength; ++i)
{
requestData[ i] = this.byte( dataStart + i);
}
Diag_DataInd( requestData, requestLength, gFunctionalRequestExt);
}
Info
Waiting for diagnostic events is only possible in test modules! Conventional CAPL nodes continue
to operate, but only by the event-driven principle.
After basic configuration of a diagnostic test module has been completed (the Target ECU can be selected
in the MainTest function, for example), waiting for diagnostic events may be executed within the test
module.
After a request has been sent the following phases are run through:
1. The request is sent to the ECU. Execution of the TestCase can be synchronized to the entire sending of
the request using the function
TestWaitForDiagRequestSent( diagRequest request, dword timeout);
2. The ECU begins to send a response to the tester, i.e. a "FirstFrame" (ISO TP) announces the arrival of
the Response Primitive. Waiting for this event is executed using the function
TestWaitForDiagResponseStart(diagRequest request, dword timeout);
TestWaitForDiagResponseStart( dword timeout)
This function is also called if the entire response has arrived at once, i.e. a "SingleFrame" (ISO TP)
contains the entire response.
3. The entire response has arrived at the tester, i.e. transmission of the entire response primitive has
been completed. The function
TestWaitForDiagResponse( diagRequest request, dword timeout);
TestWaitForDiagResponse( dword timeout);
returns.
Info
CANoe assumes the automatic handling of "Response Pending" (negative response with error
code 0x78) responses of the ECU, i.e. this function does not return until another negative or
positive response arrives, or until the timeout expires.
• <0: An internal error occurred, e.g. faulty configuration of the Diagnostic Layer.
• 0: The timeout was reached, i.e. the specific event did not occur within the specified time.
• 1: The event occurred. This may also be a negative response while waiting for a response from the
ECU!
To evaluate the ECU’s response the request can be used to access the last received response:
• It is possible to determine whether a positive response was received, or else which negative response
was received. The function
long DiagGetLastResponseCode( diagRequest req);
long DiagGetLastResponseCode();
returns the error code of the last response received (for the specified request), whereby -1 stands for
a positive response ("No error code").
• The parameters of the response can be accessed indirectly via the request object; i.e. no additional
response object is needed. The following functions are available for this purpose; their functionality is
analogous to those access functions that do not have "Resp" in their names:
long DiagGetRespParameter( diagRequest req, char parameterName[], double output[]); double
DiagGetRespParameter( diagRequest req, char parameterName[]);
Finally, there are yet other functions that simplify the development of test cases for diagnostics:
• It is possible to write a diagnostic object to the test report. This involves calling the function:
TestReportWriteDiagObject( diagRequest req);
TestReportWriteDiagObject( diagResponse resp);
TestReportWriteDiagResponse( diagRequest req);
The object’s contents are written to the XML file if this was activated. The message then appears in
the HTML file in the form of a table.
• The P2 timer that was defined in the Diagnostic Description can be polled by the function:
long DiagGetP2Timeout();
• Other communication parameters of the configured interface can be polled by the function:
long DiagGetCommParameter( char name[]);
If no parameter is found with the specified qualifiers, then -98 ("Object not found") is returned.
• It is possible to copy the contents of the last received response (for a specific request) to a response
object.
Attention:
This may result in a change to the "Type" of the object (its qualifier path) and the number of its
parameters!
long DiagGetLastResponse( diagRequest req, diagResponse respOut);
long DiagGetLastResponse( diagResponse respOut);
The following test case shows the values of all possible states that may occur after a request is
sent.
TestCase Test1()
{
// Send Request and react to all possible cases.
diagRequest IDENTIFICATION::SgIdentifikation::Lesen idReq;
DiagSendRequest( idReq);
switch( TestWaitForDiagResponse( idReq, 200))
{
case 0: // Timeout: The ECU did not respond within 200 ms.
write("No answer from ECU!");
TestStepFail("Read ID", "No answer from ECU!");
break;
case 1: // response received
TestReportWriteDiagResponse(idReq); // write response to report
if( DiagGetLastResponseCode(idReq) == -1)
{
// A positive response was received
write("ECU Diagnostics Identification: %d",
(long)DiagGetRespParameter(idReq,"Diagnostic_Identification"));
TestStepPass("Read ID", "Positiv response received!");
}
else // A negative response was received
{
write( "ECU Diagnostics Identification failed: 0x%x",
DiagGetLastResponseCode( idReq));
TestStepFail("Read ID", "Negative response received");
}
break;
default: // internal or setup error
TestStepFail("Read ID", "Error in TestCase! Verdict unreliable.");
}
}
Info
Wait instructions for messages are available for the bus systems CAN, LIN, FlexRay and MOST.
For the formulation of tests the following CAPL functions are available:
testGetWaitEventEnvVarData Retrieves the environment variable value that has led to the
resume of a joined wait statement.
TestGetWaitEventSysVarData Retrieves the system variable value that has led to the resume of
a joined wait statement.
TestGetWaitFrFrameData If a valid FlexRay frame is the last event that triggers a wait
instruction, the frame’s content can be called up.
TestGetWaitFrFrameErrorData If a FlexRay frame error is the last event that triggers a wait
instruction, the event’s content can be called up.
TestGetWaitFrPDUData If a valid FlexRay PDU is the last event that triggers a wait
instruction, the PDU’s content can be called up.
TestGetWaitFrStartCycleData If a FlexRay start cycle is the last event that triggers a wait
instruction, the event’s content can be called up.
TestGetWaitFrSymbolData If a FlexRay symbol event is the last event that triggers a wait
instruction, the event’s content can be called up.
TestGetWaitLinWakeupData
TestGetWaitEventMostMsgData
TestJoinAuxEvent Completes the current set of "joined events" with the transmitted
event.
TestJoinEnvVarEvent
Events: auxiliary event, system variable, environment variable,
message, message ID, text, signal (or system or environment
TestJoinMessageEvent variable) with value condition
TestJoinSysVarEvent
TestJoinTextEvent
TestJoinSignalInRange
TestJoinSignalOutsideRange
TestJoinSignalMatch
TestWaitForAnyJoinedEvent
TestJoinFrFrameErrorEvent Completes the current set of "joined events" with the transmitted
event.
TestJoinFrFrameEvent
Events: FlexRay frame error, FlexRay frame, FlexRay null frame,
FlexRay PDU, change of state on the FlexRay Communication
TestJoinFrNullFrameEvent Controller's protocol operation state machine, FlexRay start cycle
and FlexRay symbol.
TestJoinFrPDUEvent
TestJoinFrPOCState
TestJoinFrStartCycleEvent
TestJoinFrSymbolEvent
TestJoinMostAMSMessageEvent Completes the current set of "joined events" with the transmitted
event.
TestJoinMostAMSReportEvent
Events: MOST AMS message, MOST AMS response message, MOST AMS
Spy message, MOST AMS spy response message, MOST message, MOST
TestJoinMostAMSSpyMessageEvent response message, MOST Spy message, MOST Spy response message
TestJoinMostAMSSpyReportEvent
TestJoinMostMessageEvent
TestJoinMostReportEvent
TestJoinMostSpyMessageEvent
TestJoinMostSpyReportEvent
TestJoinLinHeaderEvent Completes the current set of "joined events" with the transmitted
event.
TestJoinLinReceiveErrorEvent
Events: frame, frame ID (header, receive error, transmission error)
TestJoinLinTransmErrorEvent
TestJoinLinWakeupEvent
TestRemoveCondition Removes an event object or an event text that was added as a condition.
TestRemoveConstraint Removes an event object or an event text that was added as a constraint.
TestReportWriteDiagObject Writes the specified object in the test report as a HTML table.
TestReportWriteDiagResponse Writes the received response of the request in the test report as a HTML
table.
TestWaitForDiagRequestSent Waits until the previously sent request has been sent to the ECU.
TestDisableMsg Prevents all sending of the message except the sending by calling the
function testSetMsgEvent.
TestDisableMsgAllTx Prevents all sendings of tx messages of the node except the sending with
testSetMsgEvent.
TestResetMsgCycleTime Resets the cycle time of the message to the database cycle time.
TestResetMsgDlc Resets the Dlc of the message to the Dlc of the database.
Info
These functions are not available for all OEM packages, the availability depends on the CANoe
Interaction Layer.
TestDisableUpdateBit Disables the standard behaviour of the update bit and sets the value of
the update bit to a constant value.
checkSignalInRange Checks the value of the signal, the system variable or the environment
variable against a condition.
testValidateSignalInRange
testValidateSignalOutsideRange
CheckSignalMatch Checks a given value against the value of the signal, the system
variable or the environment variable.
TestValidateSignalMatch
getSignalTime Gets the time point when the signal value has been changed to the
current value.
RegisterSignalDriver Registers the given callback as a 'signal driver' for the signal.
TestResetNamespaceSysVarValues Resets all system variables of the given namespace (and all sub-
namespaces) to their initial value.
Test Controlling
Test Report
TestCaseComment Within a test case a commentary can be taken over into the report.
TestReportAddEngineerInfo Information pairs of name and description can be taken up into the report
in the areas TestEngineer, TestSetUp, and device (SUT).
TestReportAddSetupInfo
TestReportAddSUTInfo
TestReportAddExtendedInfo Takes over information into the protocol that is not subject to processing
by CANoe.
TestReportAddImage Takes over the reference to a file that contains an image into the
protocol.
TestReportAddMiscInfoBlock Generates a new information block for additional information pairs in the
report.
TestReportFileName Sets the name of the report file using the user interface.
Test Structuring
TestCaseDescription Writes a description text for a test case into the report.
TestCaseTitle The title of a test case is acquired automatically from the test case name in the
CAPL program.
TestModuleDescription Writes a description text for the test module into the report.
TestModuleTitle The title of the test module is acquired automatically from the name of the test
node in the simulation structure.
TestStepWarning Describes a test case that was executed without errors but whose result could
contribute to a problem later on.
Transmission Commands
Verdict Interaction
TestGetVerdictLastTestCase Returns the verdict of the last elapsed or current test case.
Visualization
Wait Instructions
Info
Wait instructions for messages are available for the bus systems CAN, LIN and MOST.
TestWaitForAuxEvent Waits for the signaling of the specified auxiliary event from a
connected NodeLayer module.
TestWaitForSignalInRange Checks if the signal, the system or the environment variable value is
within or outside a defined value range.
TestWaitForSignalOutsideRange
TestWaitForSignalMatch Checks if a given value matches the value of the signal, the system
variable or the environment variable.
TestWaitForStringInput Creates a dialog window in which the tester can enter a text.
TestWaitForTextEvent Waits for the signaling of the specified textual event from the
individual test module.
TestWaitForValueInput Creates a dialog window in which the tester can enter a number.
TestWaitForSignalAvailable Tests the availability of a specific signal and waits if necessary until its
availability.
TestWaitForSignalsAvailable Tests the availability of all the send signals of a node and waits if
necessary until all the send signals of the node are available.
TestWaitForFrFrame Waits for the occurrence of the valid specified FlexRay frame.
TestWaitForFrNullFrame Waits for the occurrence of the specified FlexRay null frame.
TestWaitForFrPDU Waits for the occurrence of the valid specified FlexRay PDU event.
TestWaitForFrStartCycle Waits for the occurrence of the specified FlexRay start cycle event.
TestWaitForLinCSError Waits for a checksum error for the specified amount of time.
TestWaitForLinETFSingleResponse Waits for the occurrence of a LIN Event-triggered frame with a single
response for the specified associated frame.
TestWaitForLinHeader Waits for the Header occurrence of the specified LIN frame.
TestWaitForSignal Tests the availability of a specific signal and waits if necessary until its
availability.
TestMostReadReg Reads one or several MOST chip registers and waits for the result.
TestMostWriteReg Writes one or several MOST chip registers and waits for the result.
TestWaitForMostAMSReport Waits for specific AMS report message (OpType > 8).
TestWaitForMostAMSSpyReport Waits for specific AMS spy report message (OpType > 8).
TestWaitForMostLightOff Waits for the occurrence of a LightLock event indicating a no light &
no lock state.
TestWaitForMostReport Waits for specific CMS report message (OpType > 8).
TestWaitForMostShortUnlock Waits for the occurrence of a LightLock event indicating a light & no
lock state.
TestWaitForMostSpyReport Waits for specific CMS spy report message (OpType > 8).
Scope functions
checkSignalInRange
CAPL Function Overview » Test Feature Set / Signal Access » checkSignalInRange
Note
Function Checks the signal value or the environment variable value or the system variable value
against the condition:
Parameters aSignal
EnvVarName
aSysVar
aLowLimit
aHighLimit
0: If the condition is violated or the signal is unavailable, i.e. was not on the bus yet
-2: Type of the environment or system variable is not valid – only float or integer are valid
- or invalid limits of the given range.
5.1 — — •
6.0: form 2 — — •
7.0: form 3 — — •
Example
// checks if the value of the signal is in the given range
long result;
result = checkSignalInRange(Node_SUT::Velocity, 60, 100);
if (result != 1)
TestStepFail("Value of signal is not in the allowed range!");
CheckSignalMatch
CAPL Function Overview » Test Feature Set » CheckSignalMatch
Function Checks the given value against the value of signal, the system or the environment
variable. The resolution of the signal is considered.
Parameters aSignal
aEnvVar
aSysVar
aCompareValue
0: If the condition is violated or the signal is unavailable, i.e. was not on the bus yet
7.2 — — •
7.5: form 2, 3 — — •
Example
// checks if the value of the signal matches a specified value
long result;
result = CheckSignalMatch(Node_SUT::Velocity, 80);
if (result != 1)
TestStepFail("Value of signal matches not the value ‘80’!");
getSignal
CAPL Function Overview » Test Feature Set / Signal Access » getSignal
Note
Info
Parameters aSignal
Return values —
5.1 — — •
You have to use at minimum one more object to identify the signal uniquely. It could be
any object from the list of possible objects.
float value;
value = getSignal(OnOff);
Special Use Case: Signal is not known before Measurement Start (form 2)
Info
It is recommended to use this form only in special cases, because the signal
object is determined during runtime which influences the performance.
Parameters signalName
Signal Ambiguity
You have to use further objects to identify the signal uniquely. They are:
channel, database name (alias), node name and message name.
The order and completeness of the objects from right to left is important
(see example).
Return values Value of the signal; 0.0 if the signal is not found.
7.1 — • •
getSignalTime
CAPL Function Overview » Test Feature Set / Signal Access » getSignalTime
Note
Function Gets the time point relative to the measurement start at which the signal was last sent on
the bus.
Parameters aSignal
Return values Time point or 0 if the signal was not sent yet.
5.1 — — •
Example
dword timePoint;
timePoint = getSignalTime(Node_SUT::CrashDetected);
RegisterSignalDriver
CAPL Function Overview » Test Feature Set » RegisterSignalDriver
Function Registers the given callback as a 'signal driver' for the signal.
Parameters aSignal
DB signal to be queried.
aCallbackFunction
5.1 — — •
Example
SetSignal
CAPL Function Overview » Test Feature Set / Signal Access » SetSignal
Note
If no suitable signal driver exists and thus no signal can be stimulated, then in the test
module the verdict of the test module is set to "fail". In the simulation module the
measurement is stopped and an error message is displayed.
Info
Parameters aSignal
Signal to be set.
aValue
Return values —
You have to use at minimum one more object to identify the signal uniquely. It could be
any object from the list of possible objects.
//Node and signal
setSignal(LightSwitch::OnOff, 1.0)
Special Use Case: Signal is not known before Measurement Start (form 2)
If no suitable signal driver exists and thus no signal can be stimulated, then in the test
module the verdict of the test module is set to "fail". In the simulation module the
measurement is stopped and an error message is displayed.
Info
It is recommended to use this form only in special cases, because the signal
object is determined during runtime which influences the performance.
Parameters signalName
Signal Ambiguity
You have to use further objects to identify the signal uniquely. They are:
channel, database name (alias), node name and message name.
The order and completeness of the objects from right to left is important
(see example).
aValue
7.1 — — •
setSignal("CAN1::PowerTrain::LightSwitch::LightState::OnOff", 1.0);
TestAcquireStatusLED
CAPL Function Overview » Test Feature Set » TestAcquireStatusLED
Function Can be used in standalone mode to assign the test module state to an LED.
States:
Parameters ledBitMask
The LED that wants to be used. Available bit masks under xlAcquireLED.
The LED’s Keypad S1 and Keypad S2 cannot be used for test modules.
>0: error, function failed. Check whether your device supports this function and you have
an appropriate driver installed on the device.
Example
TestAddCondition
CAPL Function Overview » Test Feature Set » TestAddCondition
Function Adds an event object or an event text as a condition. Checks from the Test Service
Library are suitable as event objects.
This function can be used within a test case and also on the main test level.
Parameters aAuxHandle
Event object, for example a check from the TestService Library. Specified is the handle
that is returned when a check is created.
aEventText
Textual name of an event whose occurrence should be monitored. This event can be
triggered with the function TestSupplyTextEvent.
aBehavior
Normally in case of a constraint injury, only a corresponding entry is made in the test
protocol and the verdict of the active test case is set to "fail". In exceptional cases, this
behavior can be set otherwise:
0 Default behavior, entry in test protocol and setting of the verdict to "fail"
1 Only an entry in the test protocol is made, the verdict remains unchanged
2, 3 reserved
Example 1
// analysis of check
numCheckEvents = ChkQuery_NumEvents(checkId);
if (numCheckEvents > 0)
TestStepFail("Error Frame occurred!");
// destroy check
ChkControl_Destroy(checkId);
Example 2
TestAddConstraint
CAPL Function Overview » Test Feature Set » TestAddConstraint
Function Adds an event object or an event text as a constraint. Checks from the Test Service
Library are suitable as event objects.
This function can be used within a test case and also on the main test level.
Parameters aAuxHandle
Event object, for example a check from the TestService Library. Specified is the handle
that is returned when a check is created.
aEventText
Textual name of an event whose occurrence should be monitored. This event can be
triggered with the function TestSupplyTextEvent.
aBehavior
Normally in case of a constraint injury, only a corresponding entry is made in the test
protocol and the verdict of the active test case is set to "fail". In exceptional cases, this
behavior can be set otherwise:
0 Default behavior, entry in test protocol and setting of the verdict to "fail"
1 Only an entry in the test protocol is made, the verdict remains unchanged
2, 3 reserved
4 In addition to the entry in the test protocol and the setting of the verdict to
"fail," the current waiting point is also aborted. This behavior was introduced
for reasons of compatibility with Version 5.0 and should only be selected in
exceptional cases since here after each waiting point a corresponding query
must be inserted.
Example 1
// analysis of check
numCheckEvents = ChkQuery_NumEvents(checkId);
if (numCheckEvents > 0)
TestStepFail("Error Frame occurred!");
// destroy check
ChkControl_Destroy(checkId);
Example 2
TestCaseComment
CAPL Function Overview » Test Feature Set » TestCaseComment
Function With this function within a test case a commentary can be taken over into the report.
This comment can relate to a message that can also be output in the report.
Parameters aComment
aMsg
CAN-, GMLAN-, LIN-, MOST-, MOST-AMS- or MOST system message to be taken over into
the report.
aRawString
Here you may enter any ASCII characters. They will be added to the comment in the
following way: <Hex value of the given character>(<ASCII display of the given charcter>).
In ASCII display special characters will be replaced by '.'.
Return values —
Example
testcase CheckLockingOnCrash ()
{
TestCaseTitle("TC 1.0", "Check unlock of central locking system on
crash");
TestCaseDescription("This test case simulates a crash during drive. The
central locking system has to be unlocked on crash!");
// Initialization of signals
$CrashDetected = 0;
$LockState = Locked;
TestWaitForTimeout(200);
TestCaseDescription
CAPL Function Overview » Test Feature Set » TestCaseDescription
Function With this function, a description test for a test case can be written into the report. The
function can be called several times in a row, the transmitted texts are then added to
one another without additional separation. The function may only be called within a test
case and relates then to the respective test case.
To obtain line breaks (in form of <br /> tags) in the HTML test report, "\n" may be
inserted at any place. The required replacement takes place during the transformation of
the XML test protocol into an HTML file by means of an XSLT style sheet, where it can also
be deactivated.
Return values —
Example 1
// add description with line break to report
TestCaseDescription("In this test case\nthe occurrence of error frames is
tested.");
Example 2
Example 3
testcase CheckLockingOnCrash ()
{
TestCaseTitle("TC 1.0", "Check unlock of central locking system on
crash");
TestCaseDescription("This test case simulates a crash during drive. The
central locking system has to be unlocked on crash!");
// Initialization of signals
$CrashDetected = 0;
$LockState = Locked;
TestWaitForTimeout(200);
| TestCaseTitle |
TestCaseFail
CAPL Function Overview » Test Feature Set » TestCaseFail
Syntax TestCaseFail ()
Function You can set the verdict of the current test case to fail. This function can only be used
within a test case. It is not possible to set the verdict of this test case back to pass.
Parameters —
Return values —
Example
// checks if the value of the signal is in the given range
testcase CheckSignalValue()
{
long result;
result = checkSignalInRange(Node_SUT::Velocity, 60, 100);
if (result != 1)
TestCaseFail();
}
| TestStepFail | TestGetVerdictLastTestCase |
TestCaseSkipped
CAPL Function Overview » Test Feature Set » TestCaseSkipped
Function This function can be used to mark a test case as unexecuted. This will then appear as a
"skipped" Test Case in the Test Report.
The verdict of the Test Module is not affected. This function may only be called in the
context of the MainTest function.
Parameters ident
title
Return values —
Possible errors This function must not be called within a Test Case.
Example
TestCaseTitle
CAPL Function Overview » Test Feature Set » TestCaseTitle
Note
Function The title of a test case is acquired automatically from the test case name in the CAPL
program. It can also be set explicitly together with a test case identifier with the help of
this function. The function may only be called within a test case and relates then to the
respective test case.
Return values —
Example 1
testcase CheckLockingOnCrash ()
{
TestCaseTitle("TC 1.0", "Check unlock of central locking system on
crash");
TestCaseDescription("This test case simulates a crash during drive. The
central locking system has to be unlocked on crash!");
// Initialization of signals
$CrashDetected = 0;
$LockState = Locked;
TestWaitForTimeout(200);
Example 2
| TestCaseDescription |
TestCheckCondition
CAPL Function Overview » Test Feature Set » TestCheckCondition
This function can be used both within a test case and also on test module level.
Parameters aAuxHandle
Event object, for example a check from the TestService Library. Specified is the handle
that is returned on creation of a check. This function can be used both within a test case
and also on the test module level.
aEventText
Textual name of an event whose occurrence should be monitored. This event can be
triggered with the function TestSupplyTextEvent.
< 0: The function cannot be executed because, for example, the specified condition does
not exist
Example 1
Example 2
{
TestSupplyTextEvent("ErrorFrameReceived");
}
| TestAddCondition | TestSupplyEvent |
TestCheckConstraint
CAPL Function Overview » Test Feature Set » TestCheckConstraint
This function can be used both within a test case and also on test module level.
Parameters aAuxHandle
Event object, for example a check from the Test Service Library. Specified is the handle
that is returned on creation of a check. This function can be used both within a test case
and also on the test module level.
aEventText
Textual name of an event whose occurrence should be monitored. This event can be
triggered with the function TestSupplyTextEvent.
< 0: The function cannot be executed because, for example, the specified condition does
not exist
Example 1
Example 2
on errorFrame
{
TestSupplyTextEvent("ErrorFrameReceived");
}
| TestAddConstraint | TestSupplyTextEvent |
TestCheck::CreateFlexRayFrameErrorOccurrenceCount,
TestCheck::StartFlexRayFrameErrorOccurrenceCount,
TestCheck::CreateNodeFlexRayFrameErrorsOccurrenceCount,
TestCheck::StartNodeFlexRayFrameErrorsOccurrenceCount
CAPL Function Overview » Test Service Library » Checks » TestCheck::CreateFlexRayFrameErrorOccurrenceCount,
TestCheck::StartFlexRayFrameErrorOccurrenceCount, TestCheck::CreateNodeFlexRayFrameErrorsOccurrenceCount,
TestCheck::StartNodeFlexRayFrameErrorsOccurrenceCount
Function Checks the absence of erroneous frames for the specified frame/slot on the bus. An
event is created if more than aMaxCount of the specified erroneous frames were sent.
Parameters slotID
cycleOffs
This value must be smaller than the repetition factor and lies in the range between 0
and 63.
This value, together with the repetition factor, determines the "Cycle Multiplexing" of a
FlexRay frame.
cycleRep
This value, together with the base cycle, determines the "Cycle Multiplexing" of a
FlexRay frame.
channelMask
Identifies the FlexRay channel of the communication controller. A value of 1 will check
the frame on channel A, 2 will check it on channel B and 3 on any channel (A/B).
aNode
aMaxCount
The maximum number of message that may be sent without the check to fail.
aMessage
aCaplCallbackFunction
Check-specific ChkQuery_EventMessageId
queries
7.2 FlexRay — •
Example
variables
{
const dword cTesttime = 640; // [ms] per check
testcase GoodCheckFlexRayFrameErrorOccurrenceCount_1 ()
{
TestCheck c;
long cMaxCount = 0;
c = TestCheck::CreateFlexRayFrameErrorOccurrenceCount(
frame10.FR_SlotID, frame10.FR_CycleOffset, frame10.FR_CycleRepetition,
frame10.FR_ChannelMask, cMaxCount);
TestAddCondition(c);
c.start();
TestWaitForTimeout(cTesttime);
TestRemoveCondition(c);
}
TestCheck::CreateFlexRayNullFrameOccurrenceCount,
TestCheck::StartFlexRayNullFrameOccurrenceCount,
TestCheck::CreateNodeFlexRayNullFramesOccurrenceCount,
TestCheck::StartNodeFlexRayNullFramesOccurrenceCount
CAPL Function Overview » Test Service Library » Checks » TestCheck::CreateFlexRayNullFrameOccurrenceCount,
TestCheck::StartFlexRayNullFrameOccurrenceCount, TestCheck::CreateNodeFlexRayNullFramesOccurrenceCount,
TestCheck::StartNodeFlexRayNullFramesOccurrenceCount
Function Checks the absence of Null frames for the specified frame/slot on the bus. An event is
created if more than aMaxCount of the specified Null frames were sent.
Parameters slotID
cycleOffs
This value must be smaller than the repetition factor and lies in the range between 0
and 63.
This value, together with the repetition factor, determines the "Cycle Multiplexing" of a
FlexRay frame.
cycleRep
This value, together with the base cycle, determines the "Cycle Multiplexing" of a
FlexRay frame.
channelMask
Identifies the FlexRay channel of the communication controller. A value of 1 will check
the frame on channel A, 2 will check it on channel B and 3 on any channel (A/B).
aMaxCount
The maximum number of message that may be sent without the check to fail.
aNode
aMessage
aCaplCallbackFunction
Check-specific ChkQuery_EventMessageId
queries
7.2 FlexRay — •
Example
variables
{
const dword cTesttime = 640; // [ms] per check
testcase GoodCheckFlexRayNullFrameOccurrenceCount_1 ()
{
TestCheck c;
long cMaxCount = 0;
c = TestCheck::CreateFlexRayNullFrameOccurrenceCount( frame10.FR_SlotID,
frame10.FR_CycleOffset, frame10.FR_CycleRepetition,
frame10.FR_ChannelMask, cMaxCount);
TestAddCondition(c);
c.start();
TestWaitForTimeout(cTesttime);
TestRemoveCondition(c);
}
TestCheck::CreateMsgSendCountViolation,
TestCheck::StartMsgSendCountViolation,
TestCheck::CreateNodeMsgSendCountViolation,
TestCheck::StartNodeMsgSendCountViolation
CAPL Function Overview » Test Service Library » Checks » TestCheck::CreateMsgSendCountViolation,
TestCheck::StartMsgSendCountViolation, TestCheck::CreateNodeMsgSendCountViolation,
TestCheck::StartNodeMsgSendCountViolation
Function Monitors the bus and reports if at least aMinCount and at most aMaxCountfor each of
the defined messages occurred within a specified time interval aInterval.
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters slotID
cycleOffs
This value must be smaller than the repetition factor and lies in the range between 0
and 63.
This value, together with the repetition factor, determines the "Cycle Multiplexing" of a
FlexRay frame.
cycleRep
This value, together with the base cycle, determines the "Cycle Multiplexing" of a
FlexRay frame.
channelMask
Identifies the FlexRay channel of the communication controller. A value of 1 will check
the frame on channel A, 2 will check it on channel B and 3 on any channel (A/B).
aMinCount
The minimum number of message that must be sent without the check to fail.
aMaxCount
The maximum number of message that may be sent without the check to fail. ('0' means
infinite number.)
aInterval
Defines the cyclic repeating time period in which the minimum and maximum number
of defined messages must occur without the check failing.
aNode
aMessage
aCaplCallbackFunction
Return values 0: Check could not be created and may not be referenced.
CheckId [dword] > 0: Check was created successfully and can be referenced with the help of the
returned (Handle) value.
Check-specific —
queries
7.2 FlexRay — •
Example
variables
{
const dword cTesttime = 640; // [ms] per check
// Frames that are sent by node Controller_Node_1:
FrFrame MsgChannel1.Sync_Message_1_Ch_A frame2;
FrFrame MsgChannel1.Sync_Message_1_Ch_B frame2b;
FrFrame MsgChannel1.TimeSync_Message_1_Ch_A frame15;
testcase GoodCheckNodeMsgSendCountViolation_1 ()
{
TestCheck c;
dword cMinCount = 1;
dword cMaxCount = 0; // ignore
dword cInterval = 320; // [ms]
c = TestCheck::CreateNodeMsgSendCountViolation( Controller_Node_1,
cMinCount, cMaxCount, cInterval );
TestAddCondition(c);
c.start();
TestWaitForTimeout(cTesttime);
TestRemoveCondition(c);
}
TestDisableCRCCalculation
CAPL Function Overview » Test Feature Set » TestDisableCRCCalculation
Note
This function is not available for all OEM packages - depends on the CANoeIL.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
aMessageId
aMessageName
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
Example
// disables the CRC calculation of message ‚MsgToManipulate’ for 2000 ms
TestDisableCRCCalculation(MsgToManipulate);
TestWaitForTimeout(2000);
TestEnableCRCCalculation(MsgToManipulate);
| TestEnableCRCCalculation |
TestDisableMsg
CAPL Function Overview » Test Feature Set » TestDisableMsg
Function Disables the sending of the message except by calling the function TestSetMsgEvent. Use
TestEnableMsg to re-enable the message.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
aMessageId
aMessageName
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
Example
// send a message event for the disabled message ‘MsgToManipulate’
TestDisableMsg(MsgToManipulate);
TestWaitForTimeout(5000);
TestSetMsgEvent(MsgToManipulate);
TestWaitForTimeout(5000);
TestEnableMsg(MsgToManipulate);
TestDisableMsgAllTx
CAPL Function Overview » Test Feature Set » TestDisableMsgAllTx
Function Disables the sending of all tx messages of the node except the sending with
testSetMsgEvent.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aNode
Example
// send a message event for a message which is disabled by
TestDisableMsgAllTx
TestDisableMsgAllTx(NodeToManipulate);
TestWaitForTimeout(5000);
TestSetMsgEvent(MsgToManipulate);
TestWaitForTimeout(5000);
TestEnableMsgAllTx(NodeToManipulate);
| TestEnableMsgAllTx |
TestDisableMsgSequenceCounter
CAPL Function Overview » Test Feature Set » TestDisableMsgSequenceCounter
Note
This function is not available for all OEM packages - depends on the CANoeIL.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
aMessageId
aMessageName
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
Example
// disables the message sequence counter of message ‚MsgToManipulate’ for
2000ms
TestDisableMsgSequenceCounter(MsgToManipulate);
TestWaitForTimeout(2000);
TestEnableMsgSequenceCounter(MsgToManipulate);
| TestEnableMsgSequenceCounter |
TestDisableUpdateBit
CAPL Function Overview » Test Feature Set » TestDisableUpdateBit
Note
This function is not available for all OEM packages - depends on the CANoeIL.
Function Disables the standard behaviour of the update bit and sets the value of the update bit to
a constant value.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aSignal
aValue
Example
// disables the update bit of signal ‘DoorStatus_UB’ for 1000 ms
TestDisableUpdateBit(DoorStatus_UB, 0);
TestWaitForTimeout(1000);
TestEnableUpdateBit(DoorStatus_UB);
| TestEnableUpdateBit |
TestEnableCRCCalculation
CAPL Function Overview » Test Feature Set » TestEnableCRCCalculation
Note
This function is not available for all OEM packages - depends on the CANoeIL.
Function Re-enables the calculation of the CRC, after it has been disabled with
TestDisableCRCCalculation.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
aMessageId
aMessageName
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
Example
// resets the CRC calculation of message ‚MsgToManipulate’ to default
behaviour after a break of 2000 ms
TestDisableCRCCalculation(MsgToManipulate);
TestWaitForTimeout(2000);
TestEnableCRCCalculation(MsgToManipulate);
TestEnableMsg
CAPL Function Overview » Test Feature Set » TestEnableMsg
Function Re-enables the sending of the message after having disabled it with TestDisableMsg.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
aMessageId
aMessageName
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
Example
// send a message event for the disabled message ‘MsgToManipulate’
TestDisableMsg(MsgToManipulate);
TestWaitForTimeout(5000);
TestSetMsgEvent(MsgToManipulate);
TestWaitForTimeout(5000);
TestEnableMsg(MsgToManipulate);
TestEnableMsgAllTx
CAPL Function Overview » Test Feature Set » TestEnableMsgAllTx
Function Re-enables the sending of all tx messages of the node after having disabled it with
TestDisableMsgAllTx.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aNode
Example
// send a message event for a message which is disabled by
TestDisableMsgAllTx
// and re-enable the sending of all tx messages of node ‚NodeToManipulate’
TestDisableMsgAllTx(NodeToManipulate);
TestWaitForTimeout(5000);
TestSetMsgEvent(MsgToManipulate);
TestWaitForTimeout(5000);
TestEnableMsgAllTx(NodeToManipulate);
TestEnableMsgSequenceCounter
CAPL Function Overview » Test Feature Set » TestEnableMsgSequenceCounter
Note
This function is not available for all OEM packages - depends on the CANoeIL.
Function Re-enables the message sequence counter, after it has been disabled with
TestDisableMsgSequenceCounter.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
aMessageId
aMessageName
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
Example
// disables the message sequence counter of message ‚MsgToManipulate’ for
2000ms
// and re-enables the message sequence counter afterwards
TestDisableMsgSequenceCounter(MsgToManipulate);
TestWaitForTimeout(2000);
TestEnableMsgSequenceCounter(MsgToManipulate);
TestEnableUpdateBit
CAPL Function Overview » Test Feature Set » TestEnableUpdateBit
Note
This function is not available for all OEM packages - depends on the CANoeIL.
Function Re-enables the standard behaviour of the update bit, after it has been disabled with
TestDisableUpdateBit.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aSignal
Example
// disables the update bit of signal ‘DoorStatus_UB’ for 1000 ms
TestDisableUpdateBit(DoorStatus_UB, 0);
TestWaitForTimeout(1000);
TestEnableUpdateBit(DoorStatus_UB);
TestFRILControlResume
CAPL Function Overview » Test Feature Set » TestFRILControlResume
Note
This function is not available for all OEM packages - depends on the CANoeIL.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aNodeName
Name of the node that should restart its the Interaction Layer.
Example
// stops the interaction layer of ECU A for 2000ms.
TestFRILControlWait (“ECU_A”);
TestWaitForTimeout(2000);
TestFRILControlResume ((“ECU_A”);
TestFRILControlWait
CAPL Function Overview » Test Feature Set » TestFRILControlWait
Note
This function is not available for all OEM packages - depends on the CANoeIL.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aNodeName
Example
// stops the interaction layer of ECU A for 2000 ms
TestFRILControlWait (“ECU_A”);
TestWaitForTimeout(2000);
TestFRILControlResume ((“ECU_A”);
TestFRILDisturbChecksum
CAPL Function Overview » Test Feature Set » TestFRILDisturbChecksum
Note
This function is not available for all OEM packages - depends on the CANoeIL.
Function This function modifies the checksum. Different fault injections are possible.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aPDUName
aSigGroupName
Some systems assign a counter to signal group. With this variant you can apply the
disturbance to a dedicated signal group within a PDU.
checksumType
The possible values are described in the corresponding OEM Package manual.
disturbanceMode
disturbanceCount
-1 Infinite
n Number of disturbances
disturbanceValue
Example
TestFRILDisturbCounter
CAPL Function Overview » Test Feature Set » TestFRILDisturbCounter
Note
This function is not available for all OEM packages - depends on the CANoeIL.
Function This function modifies the counter. Different fault injections are possible.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aPDUName
aSigGroupName
Some systems assign a counter to signal group. With this variant you can apply the
disturbance to a dedicated signal group within a PDU.
counterType
The possible values are described in the corresponding OEM Package manual.
disturbanceMode
disturbanceCount
-1 Infinite
n Number of disturbances
disturbanceValue
continueMode
Defines the behavior of the counter after the disturbances are finished.
1 LastValidCounter The counters next value bases on the last value before the
disturbance has started.
2 LastValue The counter incremets the last counter value (last disturbance
value).
Example 1
Example 2
TestFRILDisturbPduUpdateBit
CAPL Function Overview » Test Feature Set » TestFRILDisturbPduUpdateBit
Note
This function is not available for all OEM packages - depends on the CANoeIL.
Function This function modifies the update bit of a PDU. Different fault injections are possible.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aPDUName
aSignalName
disturbanceCount
-1 Infinite
n Number of disturbances
updateBit
Example
// set the signal update bit of the signal “Signal_A” in PDU “PDU_A” for
100times to 1.
TestFRILDisturbSignalUpdateBit(“PDU_A”, Signal_A , 0, 100, 1);
TestFRILDisturbSignalUpdateBit
CAPL Function Overview » Test Feature Set » TestFRILDisturbSignalUpdateBit
Note
This function is not available for all OEM packages - depends on the CANoeIL.
Function This function modifies the update bit of a signal. Different fault injections are possible.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aPDUName
aSignalName
disturbanceMode
disturbanceCount
-1 Infinite
n Number of disturbances
disturbanceValue
Example
// set the signal update bit of the signal “Signal_A” in PDU “PDU_A” for
100times to 1.
TestFRILDisturbSignalUpdateBit(“PDU_A”, Signal_A , 0, 100, 1);
TestGetLastWaitElapsedTimeNS
CAPL Function Overview » Test Feature Set » TestGetLastWaitElapsedTimeNS
Function Indicates the period of time for which the last wait function executed had to wait until
being triggered.
Parameters —
Example
TestGetLastWaitResult
CAPL Function Overview » Test Feature Set » TestGetLastWaitResult
Function Makes available the last occurred return value of a TestWait instruction once again.
Parameters —
Example
TestWaitForTimeout(100);
Write("Waiting Result = %d", TestGetLastWaitResult());
TestGetStringInput
CAPL Function Overview » Test Feature Set » TestGetStringInput
Parameters aAnswer
aAnswerLen
Return values <0: General error, e.g. by calling outside of a test sequence or through no previously
performed call of TestWaitForStringInput.
Example
// ask for the users name and report it in the Write window
char answer[100];
if (1== TestWaitForStringInput("Please enter your name", 5000))
{
TestGetStringInput(answer, 100);
Write("name = %s", answer);
}
TestGetValueInput
CAPL Function Overview » Test Feature Set » TestGetValueInput
Parameters —
Return values = 0.0: Possible error during the last call of TestWaitForValueInput.
This can mean that the entry could not be correctly converted to a numeric value. This
value is also returned if no previous call of TestWaitForValueInput occurred.
But it is also possible that the user actually entered "0". This can be determined by
checking the entry in text form which can be obtained via TestGetStringInput.
Note that this value can only be the desired entry from the user if it was preceded by a
successful call of TestWaitForValueInput, i.e. with the return value "1".
Example
// ask for the test ID and report it in the Write window
TestWaitForValueInput("Please enter the test ID", 5000);
Write("Test ID = %f", TestGetValueInput());
TestGetVerdictLastTestCase
CAPL Function Overview » Test Feature Set » TestGetVerdictLastTestCase
Function Returns the verdict of the last elapsed or current test case.
Parameters —
0: Passed
Example 1
// gets the verdict of last test case and report it in the Write window
void MainTest()
{
MyTestCase();
if (TestGetVerdictLastTestCase() == 1)
Write("MyTestCase failed.");
else
Write("MyTestCase passed.");
}
Example 2
| TestGetVerdictModule |
TestGetVerdictModule
CAPL Function Overview » Test Feature Set » TestGetVerdictModule
Parameters —
0: Passed
Example
// gets the verdict of the test module and report it in the Write window
void MainTest()
{
MyTestCase();
if (TestGetVerdictModule() == 1)
Write("State of Test Module: failed.");
else
Write("State of Test Module: passed.");
}
| TestGetVerdictLastTestCase |
testGetWaitEventEnvVarData
CAPL Function Overview » Test Feature Set » testGetWaitEventEnvVarData
Function Retrieves the environment variable value that has led to the resume of a joined wait
statement.
Parameters value
The variable will be filled with the current value of the environment variable value.
length
Length of the char or byte filled. Used for environment variables of type string and data.
index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a message event
Example
// add envVar event to the current set of “joined events” and get the
envVar value
dword index = 0;
float evValue = 0;
TestJoinEnvVarEvent(MyEnvVar);
// ... other join events
index = TestWaitForAnyJoinedEvent(2000);
TestGetWaitEventEnvVarData(index, evValue);
|TestWaitForEnvVar | TestJoinEnvVarEvent |
TestGetWaitEventMostAMSMsgData
CAPL Function Overview » Test Feature Set » TestGetWaitEventMostAMSMsgData
Function If the last event was a MOST AMS message that resolved a wait construction, with the first
function the content of the message can be called.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin…") is here being used as an index.
Parameters aMessage
index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access cannot be executed, the last event was no message event
-3: aMessage is not long enough to store the data of the received message.
Remedy:
Explicit setting of a sufficient size when defining the variable, e.g. MostAMSMessage *
msg = {DLC = 2000};
Example
TestGetWaitEventMostMsgData
CAPL Function Overview » Test Feature Set » TestGetWaitEventMostMsgData
Function If the last event was a MOST message (MOST control message or MOST spy message) that
resolved a wait construction, with the first function the content of the message can be
called.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters aMessage
index
Number of the "joined event" corresponds with the return value of "testJoin…".
-1: Data access cannot be executed, the last event was no message event.
Example
TestGetWaitEventMostPkt
CAPL Function Overview » Test Feature Set » TestGetWaitEventMostPkt
Function If the last (single) wait condition was resolved by a MOST packet event, the first function
makes the packet data accessible by the packet API functions normally used within the
OnMostPkt() event handler, such as MostPktSrcAdr(), MostPktDestAdr(), MostPktGetData()
etc.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Once another wait condition is set up in the current test sequence, access to the packet
data will be no longer available.
Parameters aIndex
Number of the “joined event” that was resumed by a MOST packet event. The number
corresponds to return value of the "testJoin..." function call, by which the event was
added to a joined condition.
-1: Data access can’t be executed, since the last wait condition was not resolved by a
MOST packet event.
7.1 • MOST — •
• Test nodes
Example
TestGetWaitEventMostRawMsgData
CAPL Function Overview » Test Feature Set » TestGetWaitEventMostRawMsgData
Function If the last (single) wait condition was resolved by a MOST control message, the function
copies the data of that message into the provided CAPL variable.
The second signature can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Info
Parameters aMessage
aIndex
Number of the "joined event" that was resumed by a MOST (raw) control message. The
number corresponds to return value of the "testJoin..." function call, by which the
event was added to a joined condition.
-1: Data access can’t be executed, since the last wait condition was not resolved by a
MOST message event.
7.1 • MOST — •
• Test nodes
Example
|TestWaitForMostRawSpyMessage | TestSendMostRawMessage |
TestGetWaitEventMsgData
CAPL Function Overview » Test Feature Set » TestGetWaitEventMsgData
Function If a message event is the last event that triggers a wait instruction, the message content
can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters aMessage
index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a message event
Example
// add msg event to the current set of “joined events” and fill the msg
data to message ‘eventMessage’
dword index = 0;
TestJoinMessageEvent(VehicleMotion);
// ... other join events
index = TestWaitForAnyJoinedEvent(2000);
TestGetWaitEventMsgData(index, eventMessage);
| TestWaitForMessage | TestJoinMessageEvent |
TestGetWaitEventSysVarData
CAPL Function Overview » Test Feature Set » TestGetWaitEventSysVarData
Function Retrieves the system variable value that has led to the resume of a joined wait
statement.
Parameters value
The variable will be filled with the current value of the system variable value.
length
Length of the char or float array. Used for system variables of type string, integer array or
float array.
index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a system variable event
Example
// add sysVar event to the current set of “joined events” and get the
sysVar value
dword index = 0;
float sysValue = 0;
TestJoinSysVarEvent(MySysVar);
// ... other join events
index = TestWaitForAnyJoinedEvent(2000);
TestGetWaitEventSysVarData(index, sysValue);
| TestWaitForSysVar | TestJoinSysVarEvent |
TestGetWaitFrFrameData
CAPL Function Overview » Test Feature Set » TestGetWaitFrFrameData
Function If a valid FlexRay frame is the last event that triggers a wait instruction, the frame’s
content can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters aFrame
Index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a FlexRay frame event
Example
| TestWaitForFrFrame | TestJoinFrFrameEvent |
TestGetWaitFrFrameErrorData
CAPL Function Overview » Test Feature Set » TestGetWaitFrFrameErrorData
Function If a FlexRay frame error is the last event that triggers a wait instruction, the event’s
content can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters aFrameError
Index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a FlexRay error frame event
Example
| TestWaitForFrFrameError | TestJoinFrFrameErrorEvent |
TestGetWaitFrNullFrameData
CAPL Function Overview » Test Feature Set » TestGetWaitFrNullFrameData
Function If a FlexRay Null-Frame is the last event that triggers a wait instruction, the frame’s
content can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters aNullFrame
Index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a FlexRay null frame event
Example
For an example see function TestWaitForFrFrame and replace all FrFrame by FrNullFrame.
| TestWaitForFrNullFrame | TestJoinFrNullFrameEvent |
TestGetWaitFrPDUData
CAPL Function Overview » Test Feature Set » TestGetWaitFrPDUData
Function If a valid FlexRay PDU is the last event that triggers a wait instruction, the PDU’s content
can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters aPDU
PDU variable of type FrPDU that should be filled in with this function.
Index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a FlexRay PDU event
Example
| TestWaitForFrPDU | TestJoinFrPDUEvent |
TestGetWaitFrPOCStateData
CAPL Function Overview » Test Feature Set » TestGetWaitFrPOCStateData
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters aPOCState
Event structure that should be filled in with this function (see selectors of event
procedure on FrPOCState).
Index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a FlexRay POC event
Example
| TestWaitForFrPOCState | TestJoinFrPOCState |
TestGetWaitFrStartCycleData
CAPL Function Overview » Test Feature Set » TestGetWaitFrStartCycleData
Function If a FlexRay start cycle is the last event that triggers a wait instruction, the event’s
content can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters aFrStartCycleText
Flexray Start Cycle variable that should be filled in with this function.
Index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a FlexRay start cycle event
Example
| TestWaitForFrStartCycle | TestJoinFrStartCycleEvent |
TestGetWaitFrSymbolData
CAPL Function Overview » Test Feature Set » TestGetWaitFrSymbolData
Function If a FlexRay symbol event is the last event that triggers a wait instruction, the event’s
content can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters aSymbol
Event structure that should be filled in with this function (for selectors see event
procedure on FRSymbol).
Index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a FlexRay POC event
7.2 • FlexRay — •
• Test nodes
Example
| TestWaitForFrPOCState | TestJoinFrSymbolEvent |
TestGetWaitLinCSErrorData
CAPL Function Overview » Test Feature Set » TestGetWaitLinCSErrorData
Function Retrieves the data of a checksum error triggered by the last wait instruction.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters apEvent
index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access failed – the last wait function was not triggered by a checksum error
Example
testcase tcTFS_linCSError ()
{
linCSError linCSErrorData;
if (testWaitForLinCSError(5000) == 1)
{
if (testGetWaitLinCSErrorData(linCSErrorData) == 0)
{
testStep("Evaluation", "LIN CS Error event occurred for
FrameId=0x%X", linCSErrorData.ID);
}
}
}
| TestJoinLinCSErrorEvent | TestWaitForLinCSError |
TestGetWaitLinETFSingleResponseData
CAPL Function Overview » Test Feature Set » TestGetWaitLinETFSingleResponseData
Function If LIN Event-triggered frame with a single response for the specified associated frame is
the last event that triggers a wait instruction, the event content can be called up with
this function.
When the triggering event is a part of a wait instruction for joined events, the index
parameter has to correspond to the return value of "testJoin..." function.
Parameters apEvent
Event variable that is filled with current data from the bus.
index
Index of the joined event. It corresponds to the return value of "testJoin..." function.
-1: Data access could not be executed, the last event was not an awaited event
Example
testcase tcTFS_linETFSingleResponse ()
{
linMessage 0 linETFSingleResponseData;
if (testWaitForLinETFSingleResponse(0x3A, 0x36, 5000) == 1)
{
if (testGetWaitLinETFSingleResponseData(linETFSingleResponseData) ==
0)
{
testStep("Evaluation", "LIN Event-triggered frame with a single
response occurred for FrameId=0x%X", linETFSingleResponseData.ID);
}
}
}
| TestWaitForLinETFSingleResponse | TestJoinLinETFSingleResponseEvent |
TestGetWaitLinHdrData
CAPL Function Overview » Test Feature Set » TestGetWaitLinHdrData
Function If LIN Header event is the last event that triggers a wait instruction, the header content
can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters aHeader
index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not a LIN header event
Example
testcase tcTFS_linHdrEvent ()
{
linheader linHeaderData;
if (testWaitForLinHeader(5000) == 1)
{
if (TestGetWaitLinHdrData(linHeaderData) == 0)
{
testStep("Evaluation", "LIN Header event occurred for
FrameId=0x%X", linHeaderData.ID);
}
}
}
| TestWaitForLinHeader | TestJoinLinHeaderEvent |
TestGetWaitLinReceiveErrData
CAPL Function Overview » Test Feature Set » TestGetWaitLinReceiveErrData
Function If LIN Receive Error event is the last event that triggers a wait instruction, the error
content can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters apEvent
index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not an awaited event
Example
testcase tcTFS_linReceiveErrorEvent ()
{
linReceiveError linReceiveErrorData;
if (testWaitForLinReceiveError(5000) == 1)
{
if (TestGetWaitLinReceiveErrData(linReceiveErrorData) == 0)
{
testStep("Evaluation", "LIN Receive Error event occurred for
FrameId=0x%X", linReceiveErrorData.ID);
}
}
}
| TestWaitForLinReceiveError | TestJoinLinReceiveErrorEvent |
TestGetWaitLinSyncErrorData
CAPL Function Overview » Test Feature Set » TestGetWaitLinSyncErrorData
Function Retrieves the data of a synchronisation error that triggered the last wait instruction.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters apEvent
Data structure that will be filled with the synchronisation error data.
index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access failed – the last wait function was not triggered by a synchronisation error
Example
testcase tcTFS_linSyncErrorEvent ()
{
linSyncError linSyncErrorData;
if (testWaitForLinSyncError(5000) == 1)
{
if (testGetWaitLinSyncErrorData(linSyncErrorData) == 0)
{
testStep("Evaluation", "LIN Sync Error event occurred.
SyncBreak=%d ns; SyncDel=%d ns", linSyncErrorData.breaklen,
linSyncErrorData.delimiterlen);
}
}
}
| TestJoinLinSyncErrorEvent | TestWaitForLinSyncError |
TestGetWaitLinTransmErrData
CAPL Function Overview » Test Feature Set » TestGetWaitLinTransmErrData
Function If LIN Transmission Error event is the last event that triggers a wait instruction, the error
content can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters apEvent
index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not an awaited event
Example
testcase tcTFS_linNoResponseEvent ()
{
linTransmError linTransmErrorData;
if (testWaitForLinTransmError(5000) == 1)
{
if (testGetWaitLinTransmErrData(linTransmErrorData) == 0)
{
testStep("Evaluation", "LIN No-Response event occurred for
FrameId=0x%X", linTransmErrorData.ID);
}
}
}
| TestWaitForLinTransmError | TestJoinLinTransmErrorEvent |
TestGetWaitLinWakeupData
CAPL Function Overview » Test Feature Set » TestGetWaitLinWakeupData
Function If LIN Wakeup frame is the last event that triggers a wait instruction, the frame content
can be called up with the first function.
The second function can only be used for "joined events". The number of the "joined
event" (return value of "testJoin...") is here being used as an index.
Parameters apEvent
index
Number of the "joined event" corresponds with the return value of "testJoin...".
-1: Data access could not be executed, the last event was not an awaited event
Example
testcase tcTFS_linWakeupEvent ()
{
linWakeupFrame linWakeupData;
if (testWaitForLinWakeupFrame(5000) == 1)
{
if (testGetWaitLinWakeupData(linWakeupData) == 0)
{
testStep("Evaluation", "LIN Wakeup event occurred. Signal length
is %d ns", linWakeupData.length_ns);
}
}
}
| TestWaitForLinWakeupFrame | TestJoinLinWakeupEvent |
testGetWaitScopeEventData
CAPL Function Overview » Scope » testGetWaitScopeEventData
Function Retrieves the data of CANoe Scope event triggered by the last wait instruction.
Parameters aScopeEvent
-1: Data access could not be executed, the last event was not an awaited event.
Example
void WaitForAnyScopeEvent(enum ScopeEventType expectedEventType)
{
long res;
int expected;
int received;
ScopeEvent scopeEventData;
if ((res = testWaitForScopeEvent(8000)) != 1)
{
testStepFail("","testWaitForScopeEvent (any) failed res=%d", res);
return;
}
res = testGetWaitScopeEventData(scopeEventData);
if (res != 0)
{
testStepFail("","testGetWaitScopeEventData failed res=%d", res);
return;
}
if (scopeEventData.Type != expectedEventType)
{
expected = expectedEventType;
received = scopeEventData.Type;
testStepFail("","testGetWaitScopeEventData delivers not expected
event type: expected = %d, received = %d", expected, received);
return;
}
testStepPass("", "Scope event received. Data: type=%d, DataId=%d,
Time=%I64d", (int)scopeEventData.Type, (int)scopeEventData.DataID,
scopeEventData.Time);
}
| ScopeEvent Seletors |
TestGroupBegin
CAPL Function Overview » Test Feature Set » TestGroupBegin
Function A test group is opened with this function. It may only be called in a test module, but not
in a test case. All test cases and test groups that are executed before call of the
corresponding function TestGroupEnd are part of this test group. If a test group is not
closed with TestGroupEnd, then at the end of the test module, a warning is written in the
write window and the test group is closed automatically.
To obtain line breaks (in form of <br /> tags) in the HTML test report, "\n" may be
inserted at any place. The required replacement takes place during the transformation of
the XML test protocol into an HTML file by means of an XSLT style sheet, where it can also
be deactivated.
Return values —
Example
| TestGroupEnd |
TestGroupEnd
CAPL Function Overview » Test Feature Set » TestGroupEnd
Syntax TestGroupEnd ()
Function The function closes a test group opened with TestGroupBegin. If several test groups were
opened, then the last-opened and not yet closed test group is closed.
Parameters —
Return values —
Example
| TestGroupBegin |
TestJoinAuxEvent
CAPL Function Overview » Test Feature Set » TestJoinAuxEvent
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aAuxEventId
Example
// wait is resumed on check event
dword index = 0;
dword checkId = 0;
checkId = ChkStart_Timeout(1000);
TestJoinAuxEvent(checkId);
// … other join events
TestJoinEnvVarEvent(MyEnvVar);
TestJoinSignalInRange(Velocity, 80, 100);
TestJoinTextEvent("ErrorFrame occurred!");
index = TestWaitForAnyJoinedEvent(2000);
TestJoinDiagResponseFromEcu
CAPL Function Overview » Test Feature Set » TestJoinDiagResponseFromEcu
Function Adds an event of type diagnostics response reception to the set of joined events. This is a
non-blocking function.
Info
Please be aware that the tester will only receive responses from the selected
ECU target! Therefore if an event for ECU1 is added to the set of joined
events, but ECU2 is set as target before the response from ECU1 arrives, the
response from ECU1 will NOT be processed, i.e. the wait function does not
continue.
Parameters ecuQualifier
If given, only a response from the indicated ECU will fire the event.
Return values -3: Error while adding the specified event to the set of joined events
Example
// waits for a diagnostics response
// wait is resumed on check event
dword index = 0;
TestJoinDiagResponseFromEcu();
// … other join events
TestJoinEnvVarEvent(MyEnvVar);
TestJoinSignalInRange(Velocity, 80, 100);
TestJoinTextEvent("ErrorFrame occurred!");
Index = TestWaitForAnyJoinedEvent(2000);
| TestWaitForDiagResponse |
TestJoinEnvVarEvent
CAPL Function Overview » Test Feature Set » TestJoinEnvVarEvent
Note
If the value of an environment variable is changed before a wait instruction that waits for
a change to an environment variable, then the wait instruction rolls back, i.e. there is no
waiting. The reason for this is that the change to the environment variable does not take
effect in a CAPL program until the next wait point. In this case the change to the
environment variable occurs at the same time as waiting for the change, and this causes
the wait point to be discontinued immediately.
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aEnvVar
Example 1
putValue (evMyEnvVar, 1);
TestJoinEnvVarEvent (evMyEnvVar);
TestWaitForAnyJoinedEvent (1000); // Does not wait, is immediately
discontinued by an environment variable change!
Example 2
// add envVar event to the current set of “joined events” and get the
envVar value
dword index = 0;
float evValue = 0;
TestJoinEnvVarEvent(MyEnvVar);
// ... other join events
TestJoinSignalInRange(Velocity, 80, 100);
TestJoinTextEvent("ErrorFrame occurred!");
index = TestWaitForAnyJoinedEvent(2000);
TestGetWaitEventEnvVarData(index, evValue);
TestJoinFrFrameErrorEvent
CAPL Function Overview » Test Feature Set » TestJoinFrFrameErrorEvent
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aFrame
aSlotId
aBaseCycle
Numeric base cycle. This value must be less than the repetition factor. Together with the
repetition factor this value determines the "Cycle Multiplexing".
aCycleRepetition
Cycle repetition factor. Together with the base cycle this value determines the "Cycle
Multiplexing".
aChannelMask
Values:
1 Channel A
2 Channel B
3 Channel A+B
Example
TestJoinFrFrameEvent
CAPL Function Overview » Test Feature Set » TestJoinFrFrameEvent
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aFrame
aSlotId
aBaseCycle
Numeric base cycle. This value must be less than the repetition factor. Together with the
repetition factor this value determines the "Cycle Multiplexing".
aCycleRepetition
Cycle repetition factor. Together with the base cycle this value determines the "Cycle
Multiplexing".
aChannelMask
Values:
1 Channel A
2 Channel B
3 Channel A+B
Example
TestJoinFrNullFrameEvent
CAPL Function Overview » Test Feature Set » TestJoinFrNullFrameEvent
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aFrame
aSlotId
aBaseCycle
Numeric base cycle. This value must be less than the repetition factor. Together with the
repetition factor this value determines the "Cycle Multiplexing".
aCycleRepetition
Cycle repetition factor. Together with the base cycle this value determines the "Cycle
Multiplexing".
aChannelMask
Values:
1 Channel A
2 Channel B
3 Channel A+B
Example
For an example see function TestWaitForFrFrame and replace all FrFrame by FrNullFrame.
TestJoinFrPDUEvent
CAPL Function Overview » Test Feature Set » TestJoinFrPDUEvent
long TestJoinFrPDUEvent ()
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aPDU
Example
TestJoinFrPOCState
CAPL Function Overview » Test Feature Set » TestJoinFrPOCState
Function Completes the current set of "joined events" with the transmitted event.
Parameters aPOCState
The POC state the function will wait for (see selector 'FR_POCState' in event procedure on
FrPOCState).
If set to '-1' in combination with a 'WUState' the function will wait only for a Wakeup state
(any POC state will be accepted).
aWUState
The Wakeup state the function will wait for (see selector 'FR_Info2' in event procedure on
FrPOCState).
Example
TestJoinFrStartCycleEvent
CAPL Function Overview » Test Feature Set » TestJoinFrStartCycleEvent
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aCycle
aBaseCycle
Numeric base cycle. This value must be less than the repetition factor. Together with the
repetition factor this value determines the "Cycle Multiplexing".
aCycleRepetition
Cycle repetition factor. Together with the base cycle this value determines the "Cycle
Multiplexing".
Example
TestJoinFrSymbolEvent
CAPL Function Overview » Test Feature Set » TestJoinFrSymbolEvent
Function Completes the current set of "joined events" with the FlexRay symbol event.
Parameters aSymbolType
0 unknown
1 CAS
2 MTS
3 Wakeup
aChannelMask
Identifies the FlexRay channel of the communication controller. A value of 1 will wait for
the symbol on channel A, 2 will wait for it on channel B and 3 on any channel (A/B).
7.2 • FlexRay — •
• Test nodes
Example
TestJoinLinCSErrorEvent
CAPL Function Overview » Test Feature Set » TestJoinLinCSErrorEvent
Function Adds an event of type checksum error to the set of joined events. This is a non-blocking
function.
Parameters apDBMsg
Symbolic message
aFrameId
Frame identifier
Return values -3: Error while adding the specified event to the set of joined events
5.2 • LIN — •
• Test nodes
Example
testcase tcTFS_waitForLINResponse(int frameId)
{
long eventIndex;
testJoinMessageEvent(frameId);
testJoinLinReceiveErrorEvent(frameId);
testJoinLinCSErrorEvent(frameId);
testJoinLinTransmErrorEvent(frameId);
eventIndex = testWaitForAnyJoinedEvent(5000);
switch (eventIndex)
{
case 1: // valid frame
testStepPass("Validation", "IUT has responded correctly");
break;
default:
testStepFail("Validation", "Internal error! Unexpected event (return
TestJoinLinETFSingleResponseEvent
CAPL Function Overview » Test Feature Set » TestJoinLinETFSingleResponseEvent
Function Adds an event of type LIN Event-triggered Frame Single Response to the set of joined
events. This is a non-blocking function.
Parameters aETFFrameId
aAssocFrameId
Frame identifier of a LIN unconditional frame associated with the awaited event-triggered
frame.
6.0 • LIN — •
• Test nodes
Example
testcase tcTFS_waitForLinETFSingleResponse(int etfFrameId)
{
long eventIndex;
testJoinLinETFSingleResponseEvent(etfFrameId, linGetProtectedID(0x36));
testJoinLinETFSingleResponseEvent(etfFrameId, linGetProtectedID(0x34));
eventIndex = testWaitForAnyJoinedEvent(5000);
switch (eventIndex)
{
case 1:
testStepPass("Validation", "ETF single frame response occurred.
FrameId=0x36");
break;
case 2:
testStepPass("Validation", "ETF single frame response occurred.
FrameId=0x34");
break;
default:
testStepFail("Validation", "ETF single frame response not
occurred");
}
}
TestJoinLinHeaderEvent
CAPL Function Overview » Test Feature Set » TestJoinLinHeaderEvent
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aFrame
aFrameId
5.1 • LIN — •
• Test nodes
Example
testcase tcTFS_waitForLINHeader(int frameId)
{
long eventIndex;
testJoinLinHeaderEvent(frameId);
testJoinLinWakeupEvent();
testJoinLinSyncErrorEvent();
eventIndex = testWaitForAnyJoinedEvent(5000);
switch (eventIndex)
{
case 1:
testStepPass("Validation", "LIN Header for FrameId=0x%X occurred",
frameId);
break;
case 2:
testStepFail("Validation", "LIN Wakeup signal occurred");
break;
case 3:
testStepFail("Validation", "LIN Sync error occurred");
break;
default:
testStepFail("Validation", "Internal error! Unexpected event
(return code %d) on waiting for any LIN event", eventIndex);
}
}
TestJoinLinReceiveErrorEvent
CAPL Function Overview » Test Feature Set » TestJoinLinReceiveErrorEvent
long TestJoinLinReceiveErrorEvent ()
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aFrameId
5.1 • LIN — •
• Test nodes
Example
testcase tcTFS_waitForLINResponse(int frameId)
{
long eventIndex;
testJoinMessageEvent(frameId);
testJoinLinReceiveErrorEvent(frameId);
testJoinLinCSErrorEvent(frameId);
testJoinLinTransmErrorEvent(frameId);
eventIndex = testWaitForAnyJoinedEvent(5000);
switch (eventIndex)
{
case 1: // valid frame
testStepPass("Validation", "IUT has responded correctly");
break;
TestJoinLinSyncErrorEvent
CAPL Function Overview » Test Feature Set » TestJoinLinSyncErrorEvent
Function Adds an event of type synchronisation error to the set of joined events. This is a non-
blocking function.
Parameters —
Return values -3: error while adding the specified event to the set of joined events
5.2 • LIN — •
• Test nodes
Example
testcase tcTFS_waitForLINHeader(int frameId)
{
long eventIndex;
testJoinLinHeaderEvent(frameId);
testJoinLinWakeupEvent();
testJoinLinSyncErrorEvent();
eventIndex = testWaitForAnyJoinedEvent(5000);
switch (eventIndex)
{
case 1:
testStepPass("Validation", "LIN Header for FrameId=0x%X occurred",
frameId);
break;
case 2:
testStepFail("Validation", "LIN Wakeup signal occurred");
break;
case 3:
testStepFail("Validation", "LIN Sync error occurred");
break;
default:
testStepFail("Validation", "Internal error! Unexpected event
(return code %d) on waiting for any LIN event", eventIndex);
}
}
TestJoinLinTransmErrorEvent
CAPL Function Overview » Test Feature Set » TestJoinLinTransmErrorEvent
long TestJoinLinTransmErrorEvent ()
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aFrameId
5.1 • LIN — •
• Test nodes
Example
testcase tcTFS_waitForLINResponse(int frameId)
{
long eventIndex;
testJoinMessageEvent(frameId);
testJoinLinReceiveErrorEvent(frameId);
testJoinLinCSErrorEvent(frameId);
testJoinLinTransmErrorEvent(frameId);
eventIndex = testWaitForAnyJoinedEvent(5000);
switch (eventIndex)
{
case 1: // valid frame
testStepPass("Validation", "IUT has responded correctly");
break;
default:
testStepFail("Validation", "Internal error! Unexpected event
(return code %d) on waiting for response", eventIndex);
}
}
TestJoinLinWakeupEvent
CAPL Function Overview » Test Feature Set » TestJoinLinWakeupEvent
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters —
5.1 • LIN — •
• Test nodes
Example
testcase tcTFS_waitForLINHeader(int frameId)
{
long eventIndex;
testJoinLinHeaderEvent(frameId);
testJoinLinWakeupEvent();
testJoinLinSyncErrorEvent();
eventIndex = testWaitForAnyJoinedEvent(5000);
switch (eventIndex)
{
case 1:
testStepPass("Validation", "LIN Header for FrameId=0x%X occurred",
frameId);
break;
case 2:
testStepFail("Validation", "LIN Wakeup signal occurred");
break;
case 3:
testStepFail("Validation", "LIN Sync error occurred");
break;
default:
testStepFail("Validation", "Internal error! Unexpected event
(return code %d) on waiting for any LIN event", eventIndex);
}
}
TestJoinMessageEvent
CAPL Function Overview » Test Feature Set » TestJoinMessageEvent
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aMessage
aMessageId
Example
// add msg event to the current set of “joined events” and fill the msg
data to message ‘eventMessage’
dword index = 0;
TestJoinMessageEvent(VehicleMotion);
// ... other join events
TestJoinEnvVarEvent(MyEnvVar);
TestJoinSignalInRange(Velocity, 80, 100);
TestJoinTextEvent("ErrorFrame occurred!");
index = TestWaitForAnyJoinedEvent(2000);
TestGetWaitEventMsgData(index, eventMessage);
TestJoinMostAMSMessageEvent
CAPL Function Overview » Test Feature Set » TestJoinMostAMSMessageEvent
Function Completes the current set of "joined events" with the transmitted event, a MOST AMS
message. This function does not wait.
Parameters aDBMsg
aSourceAddress
Source address
aDestinationAddress
Target address
aFBlockId
aInstanceId
aFunctionId
aOpType
Info
aSymbolicMessage
• FBlock.InstanceId.Function.OpType(Parameterliste)
• FBlock.InstanceId.Function.OpType
• FBlock.Function.OpType(Parameterliste)
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestJoinMostAMSReportEvent
CAPL Function Overview » Test Feature Set » TestJoinMostAMSReportEvent
Function Completes the current set of "joined events" with the transmitted event, a MOST AMS
response message (Report, OpType > 8). This function does not wait.
Parameters aFBlockId
aInstanceId
aFunctionId
Info
aSymbolicMessage
• FBlock.InstanceId.Function
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestJoinMostAMSSpyMessageEvent
CAPL Function Overview » Test Feature Set » TestJoinMostAMSSpyMessageEvent
TestJoinMostAMSSpyMessageEvent(char[] aSymbolicMessage)
Function Completes the current set of "joined events" with the transmitted event, a MOST AMS
Spymessage. This may deal with individual frames transmissions (TelID=0) or segmented
transmissions. In the case of segmented transmissions, the last control message of a
correct transmission triggers the wait condition.
Parameters aDBMsg
aSourceAddress
Source address
aDestinationAddress
Target address
aFBlockId
aInstanceId
aFunctionId
aOpType
Info
aSymbolicMessage
• FBlock.InstanceId.Function.OpType(Parameterliste)
• FBlock.InstanceId.Function.OpType
• FBlock.Function.OpType(Parameterliste)
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestJoinMostAMSSpyReportEvent
CAPL Function Overview » Test Feature Set » TestJoinMostAMSSpyReportEvent
Function Completes the current set of "joined events" with the transmitted event, a MOST AMS spy
response message (Report, OpType > 8).
Parameters aFBlockId
aInstanceId
aFunctionId
Info
aSymbolicMessage
• FBlock.InstanceId.Function
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.2 • MOST — •
• Test nodes
Example
TestJoinMostMessageEvent
CAPL Function Overview » Test Feature Set » TestJoinMostMessageEvent
Function Completes the current set of "joined events" with the transmitted event, a MOST message
(MOST control message or MOST spy message). This function does not wait.
Parameters aDBMsg
aSourceAddress
Source address
aDestinationAddress
Target address
aFBlockId
aInstanceId
aFunctionId
aOpType
Info
aSymbolicMessage
• FBlock.InstanceId.Function.OpType(Parameterliste)
• FBlock.InstanceId.Function.OpType
• FBlock.Function.OpType(Parameterliste)
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestJoinMostPktEvent
CAPL Function Overview » Test Feature Set » TestJoinMostPktEvent
Function Adds an event condition for MOST packets to the current set of joined event conditions.
Info
Note, that the first and third signatures are exclusively suited to set up wait
condition events for packets having function catalog format, whereas the
other signatures also allow the definition of raw packet events.
Parameters aSourceAddress
Source address
aDestinationAddress
Target address
aPktDataDesc
String containing a symbolic or numeric description of the packet data. Following formats
are allowed:
For a detailed description of the allowed syntax, see Definition of MOST packets.
aInstanceId
Return values -6: Parse Error; on specification of a packet description string, that can’t be resolved with
the XML function catalog or that is flawed.
7.1 • MOST — •
• Test nodes
Example
TestJoinMostReportEvent
CAPL Function Overview » Test Feature Set » TestJoinMostReportEvent
Function Completes the current set of "joined events" with the transmitted event, a MOST response
message (Report, OpType > 8, MOST control message or MOST spy message). This function
does not wait.
Parameters aFBlockId
aInstanceId
aFunctionId
Info
aSymbolicMessage
• FBlock.InstanceId.Function
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestJoinMostSpyMessageEvent
CAPL Function Overview » Test Feature Set » TestJoinMostSpyMessageEvent
TestJoinMostSpyMessageEvent(char[] aSymbolicMessage)
Function Completes the current set of "joined events" with the transmitted event, a MOST Spy
message.
The first arriving control message, which fulfills the specified conditions, resolves the
wait point, irregardless of whether it is part of a segmented transmission. TelId is not
included in this process.
Parameters aDBMsg
aSourceAddress
Source address
aDestinationAddress
Target address
aFBlockId
aInstanceId
aFunctionId
aOpType
Info
aSymbolicMessage
• FBlock.InstanceId.Function.OpType(Parameterliste)
• FBlock.InstanceId.Function.OpType
• FBlock.Function.OpType(Parameterliste)
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestJoinMostSpyPktEvent
CAPL Function Overview » Test Feature Set » TestJoinMostSpyPktEvent
Function Adds an event condition for MOST spy packets to the current set of joined event
conditions.
The first and third signatures are exclusively suited to set up wait condition events for spy
packets having function catalog format, whereas the other signatures also allow the
definition of raw spy packet events.
Info
Spy packets, but also node packets (with any direction) will resolve a wait
condition set up by this function, since CANoe does not double an incoming
packet on a channel that has asynchronous spy activated.
Parameters aSourceAddress
Source address
aDestinationAddress
Target address
aPktDataDesc
String containing a symbolic or numeric description of the packet data. Following formats
are allowed:
For a detailed description of the allowed syntax, see Definition of MOST packets.
aInstanceId
Return values -6: Parse Error; on specification of a packet description string, that can’t be resolved with
the XML function catalog or that is flawed
7.1 • MOST — •
• Test nodes
Example
TestJoinMostSpyReportEvent
CAPL Function Overview » Test Feature Set » TestJoinMostSpyReportEvent
Function Completes the current set of "joined events" with the transmitted event, a MOST Spy
response message (Report, OpType > 8).
The first arriving control message, which fulfills the specified conditions, resolves the
wait point, irregardless of whether it is part of a segmented transmission. TelId is not
included in this process.
Parameters aFBlockId
aInstanceId
aFunctionId
Info
aSymbolicMessage
• FBlock.InstanceId.Function
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestJoinSignalInRange
CAPL Function Overview » Test Feature Set » TestJoinSignalInRange
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aSignal
Signal that should be awaited with a value inside or equal the limits.
aEnvVar
Environment variable that should be awaited with a value inside or equal the limits.
aSysVar
System variable that should be awaited with a value inside or equal the limits.
aLowLimit
aHighLimit
-2: Type of the system / environment variable is not valid – only float or integer are valid
– or signal is not valid or invalid limits of the given range.
Example
// waits until the value of signal ‚Velocity’ is in the given range
long result;
dword index = 0;
result = TestJoinSignalInRange(Velocity, 30, 50);
// ... other join events
TestJoinEnvVarEvent(MyEnvVar);
TestJoinTextEvent("ErrorFrame occurred!");
index = TestWaitForAnyJoinedEvent(2000);
TestJoinSignalMatch
CAPL Function Overview » Test Feature Set » TestJoinSignalMatch
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aSignal
Signal that should be awaited with a value to which the given value matches.
aEnvVar
Environment variable that should be awaited with a value to which the given value
matches.
aSysVar
System variable that should be awaited with a value to which the given value matches.
aCompareValue
Example
// waits until signal ‘Velocity’ matches to a specific value
long result;
dword index = 0;
result = TestJoinSignalMatch(Node_SUT::Velocity, 80);
// ... other join events
TestJoinEnvVarEvent(MyEnvVar);
TestJoinTextEvent("ErrorFrame occurred!");
index = TestWaitForAllJoinedEvents(500);
| TestWaitForSignalMatch |
TestJoinSignalOutsideRange
CAPL Function Overview » Test Feature Set » TestJoinSignalOutsideRange
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aSignal
Signal that should be awaited with a value outside the given range.
aEnvVar
Environment variable that should be awaited with a value outside the given range.
aSysVar
System variable that should be awaited with a value outside the given range.
aLowLimit
aHighLimit
-2: Type of the system / environment variable is not valid – only float or integer are valid
– or signal is not valid or invalid limits of the given range.
Example
// waits until the value of signal ‚Velocity’ is outside the given range
long result;
dword index = 0;
result = TestJoinSignalOutsideRange(Velocity, 30, 50);
// ... other join events
TestJoinEnvVarEvent(MyEnvVar);
TestJoinTextEvent("ErrorFrame occurred!");
index = TestWaitForAnyJoinedEvent(2000);
TestJoinSysVarEvent
CAPL Function Overview » Test Feature Set » TestJoinSysVarEvent
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aSysVar
Example
// add sysVar event to the current set of “joined events” and get the
sysVar value
dword index = 0;
float sysValue = 0;
TestJoinSysVarEvent(MySysVar);
// … other join events
TestJoinEnvVarEvent(MyEnvVar);
TestJoinSignalInRange(Velocity, 80, 100);
TestJoinTextEvent("ErrorFrame occurred!");
index = TestWaitForAnyJoinedEvent(2000);
TestGetWaitEventSysVarData(index, sysValue);
TestJoinTextEvent
CAPL Function Overview » Test Feature Set » TestJoinTextEvent
Function Completes the current set of "joined events" with the transmitted event. This function
does not wait.
Parameters aText
Example
// waits for a specified text event
long result;
dword index = 0;
result = TestJoinTextEvent("ErrorFrame occurred!");
// ... other join events
TestJoinEnvVarEvent(MyEnvVar);
TestJoinSignalInRange(Velocity, 80, 100);
index = TestWaitForAnyJoinedEvent(2000);
// on ErrorFrame handler
on errorFrame
{
TestSupplyTextEvent("ErrorFrame occurred!");
}
TestModuleDescription
CAPL Function Overview » Test Feature Set » TestModuleDescription
Function With this function, a description text for the test module can be written into the report.
The function can be called several times in a row, the transmitted texts are then added
to one another without additional separation.
To obtain line breaks (in form of <br /> tags) in the HTML test report, "\n" may be
inserted at any place. The required replacement takes place during the transformation of
the XML test protocol into an HTML file by means of an XSLT style sheet, where it can also
be deactivated.
Return values —
Example
| TestModuleTitle |
TestModuleTitle
CAPL Function Overview » Test Feature Set » TestModuleTitle
Function The title of the test module is acquired automatically from the name of the test node in
the simulation structure. It can also be set explicitly with this function.
Return values —
Example
| TestModuleDescription |
TestMostReadReg
CAPL Function Overview » Test Feature Set » TestMostReadReg
Function Reads one or several chip registers in the MOST hardware and waits for the result. If the
operation is successful, the written register values can be read out using
TestMostRegGetData.
Parameters aChannel
aChip
aOffset
aRegDataLen
aTimeout
Return values -101 bis -129: Error codes like for MostReadReg, MostWriteReg
5.2 • MOST — •
• Test nodes
Example
| TestMostWriteReg | TestMostRegGetData |
TestMostRegGetData
CAPL Function Overview » Test Feature Set » TestMostRegGetData
Function The TestMostRegGetData() function is used together with the TestMostReadReg and
TestMostWriteReg functions.
After initiating one of these two functions, the resulting register value can be copied into
a byte buffer. Ensure that the buffer size is as specified. A maximum of 16 bytes are
transported with the MostReg result.
Note that the register values are only held ready for call-up until the next wait condition
in the test program.
Parameters aBuffer[]
aBufferSize
5.2 • MOST — •
• Test nodes
Example
| TestMostReadReg | TestMostWriteReg |
TestMostWriteReg
CAPL Function Overview » Test Feature Set » TestMostWriteReg
Function Writes one or several chip registers in the MOST hardware and waits for the result. If the
operational is successful, the written register values can be read out using
TestMostRegGetData.
Parameters aChannel
aChip
aOffset
aRegDataLen
Number of registers to be read (maximum 1 byte with the Optolyzer Interface box;
maximum 16 bytes with VN2600/VN2610).
aRegData[]
aTimeout
5.2 • MOST — •
• Test nodes
Example
| TestMostReadReg | TestMostRegGetData |
TestRemoveCondition
CAPL Function Overview » Test Feature Set » TestRemoveCondition
Note
Conditions can only be removed in the test case or on the test module level on which they
were also added. If a test case is abandoned, then the constraints created in this test
case are removed automatically. Similarly, with the end of a test module, all constraints
are removed automatically.
Function Removes an event object or an event text that was added as a condition.
This function can be used both within a test case and also on the test module level.
Parameters aAuxHandle
Event object, for example a check from the TestService Library. Specified is the handle
that is returned when a check is created.
aEventText
Textual name of an event whose occurrence should be monitored. This event can be
triggered with the function TestSupplyTextEvent.
Example
dword checkId;
dword numCheckEvents;
// analysis of check
numCheckEvents = ChkQuery_NumEvents(checkId);
if (numCheckEvents > 0)
TestStepFail("Error Frame occurred!");
// destroy check
ChkControl_Destroy(checkId);
TestRemoveConstraint
CAPL Function Overview » Test Feature Set » TestRemoveConstraint
Note
Conditions can only be removed in the test case or on the test module level on which they
were also added. If a test case is abandoned, then the constraints created in this test
case are removed automatically. Similarly, with the end of a test module, all constraints
are removed automatically.
Function Removes an event object or an event text that was added as a constraint.
This function can be used both within a test case and also on the test module level.
Parameters aAuxHandle
Event object, for example a check from the TestService Library. Specified is the handle
that is returned when a check is created.
aEventText
Textual name of an event whose occurrence should be monitored. This event can be
triggered with the function TestSupplyTextEvent.
Example
dword checkId;
dword numCheckEvents;
// analysis of check
numCheckEvents = ChkQuery_NumEvents(checkId);
if (numCheckEvents > 0)
TestStepFail("Error Frame occurred!");
// destroy check
ChkControl_Destroy(checkId);
TestReportAddEngineerInfo, TestReportAddSetupInfo,
TestReportAddSUTInfo
CAPL Function Overview » Test Feature Set » TestReportAddEngineerInfo, TestReportAddSetupInfo, TestReportAddSUTInfo
Function With these functions, information pairs of name and description (e.g. "serial number" and
"S012345AB") can be taken up into the report in the areas TestEngineer, TestSetUp, and
device (SUT) to be tested. The three areas named must not be created; they are
automatically available in the report. In the course of the test execution, any number of
information pairs can be written.
The format string has the same meaning as with the write function and is described there.
Return values —
Example
TestReportAddExtendedInfo
CAPL Function Overview » Test Feature Set » TestReportAddExtendedInfo
Function With this function, it is possible to take over information into the protocol that is not
subject to processing by CANoe. This way, for example, any HTML code can be copied
directly into the protocol. A corresponding type specification specifies the type of
information (e.g. HTML).
Parameters type
text
Information text
The format string has the same meaning as with the write function and is described there.
Return values —
Example
TestReportAddExternalRef
CAPL Function Overview » Test Feature Set » TestReportAddExternalRef
Function Adds an external reference to the report (URL, DOORS or eASEE link), which appears as a
link in the HTML report.
Can be used in test cases (testcase functions), test groups or in MainTest functions.
Parameters type
"url" for any kinds of URLs, "doors" for links to DOORS, "easee" for links to eASEE.
title
Text with which the link generated in the HTML report is displayed. If not indicated the
URL indicated in ref is used.
ref
owner
Return values —
Example
testcase tc_1_1()
{
TestCaseTitle("tc_1_1", "Test Case 1.1");
TestReportAddExternalRef("url", "Requirement",
"doors://doorssrv:36677/?version=1,prodID=0,dbid=42d2481361dc551c,containe
r=00004600,object=19");
...
}
| TestGetVerdictModule |
TestReportAddImage
CAPL Function Overview » Test Feature Set » TestReportAddImage
Note
The image should be in JPEG, GIF or PNG format since during the transformation to HTML
only the reference to the file is written in the HTML file and the common HTML browsers
generally only support these file formats for images.
Function With this function the reference to a file that contains an image can be taken over into
the protocol. This command can be used in the context of the test module and also in the
context of a test case.
To ensure that the image is displayed in all common browsers, the file name must be
given as a UNC path. Should an image from a local drive be displayed, the file:/// prefix
must precede the normal path.
If backslashes are used as separators, a double backslash ('\\') must be used to separate
directories within the path.
The second variant of this function allows to set the width and/or height with which the
image should be displayed in the report. If width or height is specified, the HTML report
will automatically show the picture with a link which opens the picture in full size in a
new window. The width and height parameters are transferred to the HTML report, their
values can be given as pixels or percentage. See an HTML reference for details.
Parameters description
filename
width
height
Return values —
Example
| TestReportAddExtendedInfo |
TestReportAddMiscInfo
CAPL Function Overview » Test Feature Set » TestReportAddMiscInfo
Function With these functions, information pairs of name and description (e.g. "parameter value
V0" and "3.7 V") can be taken up into an additional information area in the report. The
additional information area must be created previously with TestReportAddMiscInfoBlock.
If this function is used and there is no corresponding information area, then a warning will
be generated in the write window and a new information area will be created
automatically. In this information area, any number of information pairs can be written
with this function.
The format string has the same meaning as with the write function and is described there.
Return values —
Example
TestReportAddMiscInfoBlock
CAPL Function Overview » Test Feature Set » TestReportAddMiscInfoBlock
Function The function generates a new information block for additional information pairs in the
report. With the function TestReportAddMiscInfo information pairs can be taken up into
this block. This is possible until a new information block is opened with
TestReportAddMiscInfoBlock, the current test case is ended (if the information block was
opened within the test case) or a test case is called (if the information block was called in
the test module).
Return values —
Example
TestReportAddWindowCapture
CAPL Function Overview » Test Feature Set » TestReportAddWindowCapture
If you want to capture windows during test preparation and completion within the
MainTest function, you must implement these calls as individual testcase functions that
are named e.g. preparation and completion (as with XML test modules). This also lets
you obtain the captured window images in their appropriate time sequence, e.g. at the
beginning and end of a report.
Function Creates a screen capture of a Graphics, Frame Histogram, Data or Trace window.
The test case verdict is not affected. Errors that occur during window capture are logged
in the report as warnings, but do not affect the test case verdict.
Parameters window
Name of the window to be captured (corresponds to the name of the measurement setup
block).
title
Text heading that precedes the captured window image in the test report.
file (optional)
Return values —
Example
testcase tc_1_1()
{
TestCaseTitle("tc_1_1", "Test Case 1.1");
TestReportAddWindowCapture("Trace - Report", "",
"Trace before execution of test case:",
"tc-1.1-trace-before");
if (TestGetVerdictLastTestCase() != 0) {
TestReportAddWindowCapture("Trace - Report", "",
"Testfall failed. Trace am Ende:",
"tc-1.1-trace-after");
}
}
TestReportFileName
CAPL Function Overview » Test Feature Set » TestReportFileName
Function The name of the report file can be set using the user interface. The setting can be
overwritten with this function. To be effective, the function must be called in a test
module before every other CAPL function that relates to the report and executed before
every test case.
Info
This command should only be used if the file name of the test report has to
be assigned dynamically by the test module.
Normally, the name of the test report is assigned in the settings dialog for
the test module. If the test report is assigned the name
testReportFileName, it will not be possible to open it via the CANoe user
interface (test run dialog).
Without path specification, the directory is used in which the configuration file is found.
The extension .xml or. .html is added automatically.
Return values —
Example
void MainTest()
{
// report is written in a file with the name ‚DynamicName’ beside the
configuration
TestReportFileName("DynamicName");
}
TestResetAllFaultInjections
CAPL Function Overview » Test Feature Set » TestResetAllFaultInjections
Parameters aNode
Example
// set some FaultInjections and reset them all
TestDisableMsg(MsgToManipulate1);
TestSetMsgCycleTime(MsgToManipulate2, 200);
TestWaitForTimeout(2000)
TestResetAllFaultInjections(NodeToManipulate);
TestResetEnvVarValue
CAPL Function Overview » Test Feature Set » TestResetEnvVarValue
Function Resets the environment variable to initial value. If no initial value is available, the
environment variable is set to 0 or "".
Parameters aEnvVar
Example
// check reaction of signal “LockState” after crash
@EnvErrorCrashDetected = 1;
TestWaitForTimeout(100);
if ($LockState != Unlocked)
TestStepFail(“Doors are locked after crash is detected!”);
TestResetMsgCycleTime
CAPL Function Overview » Test Feature Set » TestResetMsgCycleTime
Function Resets the cycle time of the message to the database cycle time, after having changed it
with TestSetMsgCycleTime(...).
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
aMessageId
Numeric ID of the message that should get the database cycle time.
aMessageName
Name of the message that should get the database cycle time.
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
Example
// reset the cycle time of message ‘MsgToManipulate’
TestSetMsgCycleTime(MsgToManipulate, 200);
TestWaitForTimeout(2000);
TestResetMsgCycleTime(MsgToManipulate);
TestResetMsgDlc
CAPL Function Overview » Test Feature Set » TestResetMsgDlc
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
Message symbol.
aMessageId
aMessageName
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
Example
// reset the DLC of message ‘MsgToManipulate’
TestSetMsgDLC(MsgToManipulate, 4);
TestWaitForTimeout(2000);
TestResetMsgDLC(MsgToManipulate);
| TestSetMsgDlc |
TestResetNamespaceSysVarValues
CAPL Function Overview » Test Feature Set » TestResetNamespaceSysVarValues
Function Resets all system variables of the given namespace and all sub-namespaces to their initial
value. If no initial value is defined for a system variable, the system variable is not set.
Parameters aNamespace
Example
// check the warning lights
@sysvar::Lights::SysVarWarningLights = 1;
TestWaitForTimeout(100);
if (@sysvar::Lights::SysVarWarningLightsDsp != 1)
TestStepFail(“Warning lights do not flash!”);
TestResetNodeSignalValues
CAPL Function Overview » Test Feature Set » TestResetNodeSignalValues
Function Resets all tx-signals of the given node to their initial value. The sending of the messages
depends on the messages send typ.
The reset-function does not contain a waiting time which guarantees that all signals are
sent out on the bus. If a waiting time is desired, the TestWaitForTimeout function has
additionally been executed.
Parameters aNode
Example
// check reaction of signal “LockState” after crash
$CrashDetected = 1;
TestWaitForTimeout(100);
if ($LockState != Unlocked)
TestStepFail(“Doors are locked after crash is detected!”);
TestResetSignalValue
CAPL Function Overview » Test Feature Set » TestResetSignalValue
Function Resets the signal to initial value. The sending depends on the message send typ.
The reset-function does not contain a waiting time which guarantees that the signal is
sent out on the bus. If a waiting time is desired, the TestWaitForTimeout function has
additionally been executed.
Parameters aSignal
Example
// check reaction of signal “LockState” after crash
$CrashDetected = 1;
TestWaitForTimeout(100);
if ($LockState != Unlocked)
TestStepFail(“Doors are locked after crash is detected!”);
TestResetSysVarValue
CAPL Function Overview » Test Feature Set » TestResetSysVarValue
Function Resets the system variable to initial value. If no initial value is defined, the system
variable is not set.
Parameters aSysVar
Example
// check reaction of signal “LockState” after crash
@sysvar::Error::SysVarCrashDetected = 1;
TestWaitForTimeout(100);
if ($LockState != Unlocked)
TestStepFail(“Doors are locked after crash is detected!”);
TestSendMostAMSMessage
CAPL Function Overview » Test Feature Set » TestSendMostAMSMessage
Function This function immediately sends a symbolically-defined MOST message and waits for the
associated Tx acknowledgement from the recipient. The AckNack bit is evaluated and the
return value specifies whether the creation and sending of the message was successful or
not.
The symbolically-defined messages must be complete, that is, all absolutely necessary
details must be specified explicitly (without the use of wildcards) since a concrete
message will be sent. However, a parameter list may be shorter than specified in the
function catalog in order to be able to generate incomplete messages purposefully.
If possible, the message is always sent using the AMS service. However, if this is not
activated, the message, if short enough, will be sent as a normal control message (with
TelID = 0).
Parameters aDestinationAddressText
Destination address
aSymbolicMessage
• FBlock.Instance.Function.OpType(parameter list)
• FBlock.Instance.Function.OpType
• FBlock.Function.OpType(parameter list)
• FBlock.FunctionId.OpType
aInstanceId
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
-5: The message is too long and had to be sent using the AMS service, but the AMS service
is not activated.
-3: Message was sent, however "not acknowledge" appears in the Tx acknowledgement.
5.1 • MOST — •
• Test nodes
Example
TestSendMostRawMessage
CAPL Function Overview » Test Feature Set » TestSendMostRawMessage
Function This function immediately sends a MOST raw control message with the specified data and
waits for the associated Tx acknowledgement from the recipient. The AckNack bit is
evaluated and the return value specifies whether the creation and sending of the message
was successful or not.
The first signature specifies the message data by a byte array, the second uses a string to
describe the data bytes as a hex dump.
Parameters aDestinationAddress
Target address
aRType
0 Normal
1 RemoteRead
2 RemoteWrite
3 Allocate
4 Deallocate
5 GetSource
aMsgData
Byte array containing the data bytes of the raw message to be send.
aMsgDataLength
Data bytes at positions larger than the value of this parameter will be set to 0
automatically.
aMsgDataDesc
String with hexadecimal values describing the message data bytes of the raw message to
be send, starting at byte position 0, f. e.
"0A 0B 0C 0D 0E 0F 10 11 12 13 FF"
Data bytes at positions beyond the ones described in this parameter will be set to 0
automatically.
aTimeout
Return values -6: Parse Error; on specification of a message data description string that contains other
characters than hexadecimal digits
-3: Message was sent, however "not acknowledged" appears in the Tx acknowledgement.
7.1 • MOST — •
• Test nodes
Example
|TestWaitForMostRawSpyMessage | TestGetWaitEventMostRawMsgData |
TestSetEcuOffline
CAPL Function Overview » Test Feature Set » TestSetEcuOffline
Function Disconnects the ECU from the bus. Messages being sent by the ECU will not be forwarded
to the bus.
With the testSetEcuOnline function the ECU can be reconnected to the bus.
This function interferes with the CAPL program and possible Nodelayer DLLs.
Parameters aNode
aNodeName
• NodeName
• BusName::NodeName
Return values —
Example
// cuts the node ‚SUT’ 5000 ms from the bus
TestSetEcuOffline(SUT);
TestWaitForTimeout(5000);
TestSetEcuOnline(SUT)
TestSetEcuOnline
CAPL Function Overview » Test Feature Set » TestSetEcuOnline
This function interferes with the CAPL program and possible Nodelayer DLLs.
Parameters aNode
aNodeName
• NodeName
• BusName::NodeName
Return values —
Example
// cuts the node ‚SUT’ 5000 ms from the bus
TestSetEcuOffline(SUT);
TestWaitForTimeout(5000);
TestSetEcuOnline(SUT)
TestSetMsgCycleTime
CAPL Function Overview » Test Feature Set » TestSetMsgCycleTime
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
aMessageId
aNewCycleTime
The new cycle time (in milliseconds) that should be assigned to the message.
aMessageName
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
Example
// set the cycle time of message ‘MsgToManipulate’ to a specified value for
2000 ms
TestSetMsgCycleTime(MsgToManipulate, 200);
TestWaitForTimeout(2000);
TestResetMsgCycleTime(MsgToManipulate);
TestSetMsgEvent
CAPL Function Overview » Test Feature Set » TestSetMsgEvent
Function Sends the transferred message directly to the bus if the network is active.
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
aMessageId
aMessageName
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
Example
// send a message event for the disabled message ‘MsgToManipulate’
TestDisableMsg(MsgToManipulate);
TestWaitForTimeout(5000);
TestSetMsgEvent(MsgToManipulate);
TestWaitForTimeout(5000);
TestEnableMsg(MsgToManipulate);
TestSetParseErrorConstraint
CAPL Function Overview » Test Feature Set » TestSetParseErrorConstraint
Function The function sets the behavior of the symbolic variants of TestWaitForMost... and
TestJoinMost... functions on the occurrence of errors during the parsing of the message
definitions.
Depending on whether the function is called within or outside of a test case, the setting
either has an effect on only all subsequent TestWaitForMost... and TestJoinMost...
function calls within the test case or generally on all subsequent calls. Therefore, the
behavior specified within a test case loses its validity with the end of the test case and
will be, if necessary, replaced by a previously externally-set behavior.
Parameters mode
0 The return value of the relevant function call indicates the problem that has
occurred and a corresponding note is entered in the report. This is the pre-set
default behavior.
1 The relevant test case is aborted and the verdict set to "fail". The aborting of the
test case is noted with the error in the report.
2 Measurement will be stopped. The relevant test case is aborted and the verdict set
to "fail". The aborting of the test case is noted with the error in the report.
Return values —
Example
TestSetSendTimeout
CAPL Function Overview » Test Feature Set » TestSetSendTimeout
Function This function sets the timeout up to which the TestSendMostAMSMessage functions wait
for a Tx acknowledgement for the sent message. This value is set to 5000 ms by default.
With the specification of a timeout value of 0, a wait of any length for the Tx
acknowledgement is possible, while the specification of -1 means that the waiting for the
acknowledgement is switched off, that is, there is no wait.
Parameters aTimeout
Return values —
Example
| TestSendMostAMSMessage |
TestSetMsgDlc
CAPL Function Overview » Test Feature Set » TestSetMsgDlc
This function influences a simulation node with an assigned CANoe Interaction Layer.
Parameters aMessage
aMessageId
aMessageName
• MsgName
• BusName::MsgName
• TransmitterName::MsgName
• BusName::TransmitterName::MsgName
dlc
Example
// set the DLC of message ‘MsgToManipulate’ for 2000 ms to a specified
length
TestSetMsgDLC(MsgToManipulate, 4);
TestWaitForTimeout(2000);
TestResetMsgDLC(MsgToManipulate);
| TestResetMsgDlc |
TestSetVerdictModule
CAPL Function Overview » Test Feature Set » TestSetVerdictModule
Function This function sets the verdict of the test module. With this function the automatic verdict
propagation of test cases to the test module can be influenced later.
E.g. this function can be used within the test controlling to conduct a test case "on probe"
and to reset the verdict to "pass" in case "fail".
Parameters aVerdict
0 pass
1 fail
Return values —
Example
| TestGetVerdictModule | TestGetVerdictLastTestCase |
Note
The forms without parameters or with only one parameter description should only be used
in combination with TestStepBegin.
TestStepPass ()
TestStepFail ()
TestStepWarning ()
Function With these functions, test steps can be reported within a test case.
TestStepPass reports a test step that was executed as expected. This is displayed
accordingly in the test report.
TestStepFail describes a test step that causes an error. Also this is displayed
accordingly in the test report. The verdict of the test case is hereby set automatically to
fail.
TestStepWarning describes a test case that was executed without errors but whose
result could contribute to a problem later on. This is represented appropriately in the test
protocol.
Parameters LevelOfDetail
It is possible to identify with a number how important this test step is. In the test
protocol, it is possible that only test steps up to a certain importance will be displayed. 0
means "very important", higher numbers indicate lower degrees of importance.
To obtain line breaks (in form of <br /> tags) in the HTML test report, "\n" may be
inserted at any place. The required replacement takes place during the transformation of
the XML test protocol into an HTML file by means of an XSLT style sheet, where it can also
be deactivated.
The description can also contain values that are read out of variables. For that the
corresponding sequences like the format string of snprintf are inserted in the description.
The corresponding variables are added to the parameter list.
The format string has the same meaning as with the write function and is described there.
Example
TestStepPass("10.2", "Output voltage ok (Uout = %d volts)",
voltage);
Return values —
Example
TestStepBegin
CAPL Function Overview » Test Feature Set » TestStepBegin
Note
Function With these functions, test steps can be logged within a test case. Such a test step is
introduced with TestStepBegin, which is then completed with TestStepPass, TestStepFail
or TestStepWarning. A test step is noted in the test report only with this conclusion.
Parameters Importance
It is possible to identify with a number how important this test step is. In the test report,
it is possible that only test steps up to a certain importance will be displayed. 0 means
"very important", higher numbers indicate lower degrees of importance.
To obtain line breaks (in form of <br /> tags) in the HTML test report, "\n" may be
inserted at any place. The required replacement takes place during the transformation of
the XML test report into an HTML file by means of an XSLT style sheet, where it can also
be deactivated.
Return values —
Example
TestStepBegin (0, „3.1“, „Receipt of response message“);
if (result == 1)
TestStepPass ();
else
TestStepFail („failed because of Timeout“);
TestSupplyTextEvent
CAPL Function Overview » Test Feature Set » TestSupplyTextEvent
Parameters aText
Example
// Signals the occurrence of an Error Frame as a text event
on errorFrame
{
TestSupplyTextEvent("ErrorFrame occurred!")
}
| TestWaitForTextEvent | TestJoinTextEvent |
testValidateSignalInRange
CAPL Function Overview » Test Feature Set / Signal Access » testValidateSignalInRange
Note
Function Checks the value of the signal, the environment variable value or the system variable
value against the condition:
aLowLimit <= Value <= aHighLimit
The test step is evaluated as either passed or failed depending on the results
Parameters aTestStep
aSignal
EnvVarName
aSysVar
aLowLimit
aHighLimit
-2: Type of the environment or system variable is not valid – only float or integer are
valid- or invalid limits of the given range
0: Correct functionality
Example
// validates the value of the signal against the given range
long result;
result = testValidateSignalInRange(Node_SUT::Velocity, 60, 100);
if (result != 0)
TestStepFail("Error occurred!");
TestValidateSignalMatch
CAPL Function Overview » Test Feature Set / Signal Access » TestValidateSignalMatch
Function Checks the given value against the value of the signal, the system variable or the
environment variable. The resolution of the signal is considered.
The test step is evaluated as either passed or failed depending on the results.
Parameters aTestStep
aSignal
aEnvVar
aSysVar
aCompareValue
Example
// validates the value of the signal against the given value
long result;
result = TestValidateSignalMatch(Node_SUT::Velocity, 80);
if (result != 0)
TestStepFail("Error occurred!");
testValidateSignalOutsideRange
CAPL Function Overview » Test Feature Set / Signal Access » testValidateSignalOutsideRange
Note
Function Checks the signal value, the environment variable value or the system variable value
against the condition:
Parameters aTestStep
aSignal
EnvVarName
aSysVar
aLowLimit
aHighLimit
-2: Type of the environment or system variable is not valid – only float or integer are
valid- or invalid limits of the given range
0: Correct functionality
Example
// validates the value of the signal against the given range
long result;
result = testValidateSignalOutsideRange(Node_SUT::Velocity, 60, 100);
if (result != 0)
TestStepFail("Error occurred!");
TestWaitForAllJoinedEvents
CAPL Function Overview » Test Feature Set » TestWaitForAllJoinedEvents
Note
Regardless of how the wait point was discontinued, afterwards the set of "joined events"
is empty. That is, waiting for "joined events" always empties the previously defined set of
"joined events".
Function Waits for the current set of "joined events." The wait condition is resolved if all of the
joined events were signaled.
Should not all events occur before the expiration of the time aTimeout, the wait
condition is resolved nevertheless.
Parameters aTimeout
>0: Resume due to event occurred The return value returns the number of the joined
event that triggered the resolution.
Example
// waits for the fulfillment of all conditions
TestJoinEnvVarEvent(MyEnvVar);
TestJoinSignalInRange(Velocity, 80, 100);
TestJoinTextEvent("ErrorFrame occurred!");
TestWaitForAllJoinedEvents(5000);
TestWaitForAnyJoinedEvent
CAPL Function Overview » Test Feature Set » TestWaitForAnyJoinedEvent
Note
Regardless of how the wait point was discontinued, afterwards the set of "joined events"
is empty. That is, waiting for "joined events" always empties the previously defined set of
"joined events".
Function Waits for the current set of "joined events." Each individual of these events can resolve
the wait state.
Should none of the events occur before the expiration of the time aTimeout, the wait
condition is resolved nevertheless.
Parameters aTimeout
>0: Resume due to event occurred The return value returns the number of the joined
event that triggered the resolution.
Example
// waits for the fulfillment of any condition
TestJoinEnvVarEvent(MyEnvVar);
TestJoinSignalInRange(Velocity, 80, 100);
TestJoinTextEvent("ErrorFrame occurred!");
TestWaitForAnyJoinedEvents(5000);
TestWaitForAuxEvent
CAPL Function Overview » Test Feature Set » TestWaitForAuxEvent
Function Waits for the signaling of the specified auxiliary event from a connected NodeLayer
module.
Should the event not occur before the expiration of the time aTimeout, the wait
condition is resolved nevertheless.
Parameters aAuxEventId
aTimeout
Example
// wait is resumed on check event
long result;
checkId = ChkStart_Timeout(1000);
result = TestWaitForAuxEvent(checked, 2000);
| TestJoinAuxEvent |
TestWaitForEnvVar
CAPL Function Overview » Test Feature Set » TestWaitForEnvVar
Note
If the value of an environment variable is changed before a wait instruction that waits for
a change to an environment variable, then the wait instruction rolls back, i.e. there is no
waiting. The reason for this is that the change to the environment variable does not take
effect in a CAPL program until the next wait point. In this case the change to the
environment variable occurs at the same time as waiting for the change, and this causes
the wait point to be discontinued immediately.
Function Waits for the description of the specified environment variable (aEnvVar or with the
name aEnvVarName). Should the event not occur before the expiration of the time
aTimeout, the wait condition is resolved nevertheless.
Parameters aEnvVar
aEnvVarName
aTimeout
-1: General error, for example, functionality is not available or environment variable with
name aEnvVarName cannot be found
Example
// waiting point is discontinued immediately
long result;
putValue (evMyEnvVar, 1);
result = TestWaitForEnvVar (evMyEnvVar, 1000); // Does not wait, is
immediately discontinued by an environment variable change!
| TestJoinEnvVarEvent |
TestWaitForFrFrame
CAPL Function Overview » Test Feature Set » TestWaitForFrFrame
Function Waits for the occurrence of the valid specified FlexRay frame. Should the frame not occur
before the expiration of the time aTimeout, the wait condition is resolved nevertheless.
When no frame is specified the wait condition is resolved on any valid FlexRay frame.
Parameters aFrame
aSlotId
aBaseCycle
Numeric base cycle. This value must be less than the repetition factor. Together with the
repetition factor this value determines the "Cycle Multiplexing".
aCycleRepetition
Cycle repetition factor. Together with the base cycle this value determines the "Cycle
Multiplexing".
aChannelMask
Values:
1 Channel A
2 Channel B
3 Channel A+B
aTimeout
Example
The following test program waits for the occurrence of one of two frames.
%d)", timeToWait);
// wait for any event
resTestWaitFor = TestWaitForAnyJoinedEvent(timeToWait);
if (resTestWaitFor > 0) // Resume due to event occurred
{
TestStepPass("Call TFS function",
"TestGetWaitFrFrameData(resTestWaitFor=%d, frTest)", resTestWaitFor);
// extract resume event's data
resTestGetData = TestGetWaitFrFrameData(resTestWaitFor, frTest1);
if (0 != resTestGetData)
{
TestStepFail("Data extraction", "resTestGetData = %d, Data access
to data of event %d could not be executed!", resTestGetData,
resTestWaitFor);
}
else
{
TestStepPass("Data extraction", "Data of event %d succefully
extracted. SlotId=%d", resTestWaitFor, frTest1.FR_SlotID);
}
}
else
{
TestStepFail("Wait condition", "resTestWaitFor = %d, Waiting for any
of joined events during %d [ms] failed!", resTestWaitFor, timeToWait);
}
}
| TestGetWaitFrFrameData | TestJoinFrFrameEvent |
TestWaitForFrFrameError
CAPL Function Overview » Test Feature Set » TestWaitForFrFrameError
Function Waits for the occurrence of FlexRay frame error event. Should the event not occur before
the expiration of the time aTimeout, the wait condition is resolved nevertheless.
When no frame is specified the wait condition is resolved on any FlexRay frame error
event.
Parameters aFrame
aSlotId
aBaseCycle
Numeric base cycle. This value must be less than the repetition factor. Together with the
repetition factor this value determines the "Cycle Multiplexing".
aCycleRepetition
Cycle repetition factor. Together with the base cycle this value determines the "Cycle
Multiplexing".
aChannelMask
Values:
1 Channel A
2 Channel B
3 Channel A+B
aTimeout
Example
| TestGetWaitFrFrameErrorData | TestJoinFrFrameErrorEvent |
TestWaitForFrNullFrame
CAPL Function Overview » Test Feature Set » TestWaitForFrNullFrame
Function Waits for the occurrence of the specified FlexRay null frame. Should the event not occur
before the expiration of the time aTimeout, the wait condition is resolved nevertheless.
When no Null-Frame is specified the wait condition is resolved on any FlexRay null frame.
Parameters aFrame
aSlotId
aBaseCycle
Numeric base cycle. This value must be less than the repetition factor. Together with the
repetition factor this value determines the "Cycle Multiplexing".
aCycleRepetition
Cycle repetition factor. Together with the base cycle this value determines the "Cycle
Multiplexing".
aChannelMask
Values:
1 Channel A
2 Channel B
3 Channel A+B
aTimeout
Example
For an example see function TestWaitForFrFrame and replace all FrFrame by FrNullFrame.
| TestGetWaitFrNullFrameData | TestJoinFrNullFrameEvent |
TestWaitForFrPDU
CAPL Function Overview » Test Feature Set » TestWaitForFrPDU
Function Waits for the occurrence of the specified FlexRay PDU. Should the PDU not occur before
the expiration of the time aTimeout, the wait condition is resolved nevertheless.
When no PDU is specified the wait condition is resolved on any FlexRay PDU.
Parameters aPDU
aTimeout
Example
The following test program waits for the occurrence of one of two PDUs.
"TestJoinFrPDUEvent(name=PDU_IN_CYCLE_REPETITION)");
resTestJoin = TestJoinFrPDUEvent(PDU_IN_CYCLE_REPETITION);
if (resTestJoin <= 0)
{
TestStepFail("Join condition", "resTestJoin = %d, Failure on
joining symbolic event", resTestJoin);
return;
}
else
{
TestStepPass("Join condition", "Joining symbolic event ok. Event
number = %d", resTestJoin);
}
TestStepPass("Call TFS function",
"TestJoinFrPDUEvent(name=PDU_NMF_NODE_C)");
resTestJoin = TestJoinFrPDUEvent(PDU_NMF_NODE_C);
if (resTestJoin <= 0)
{
TestStepFail("Join condition", "resTestJoin = %d, Failure on
joining raw event", resTestJoin);
return;
}
else
{
TestStepPass("Join condition", "Joining raw event ok. Event number
= %d", resTestJoin);
}
}
// wait for all events
TestStepPass("Call TFS function",
"TestWaitForAnyJoinedEvent(timeout=%d)", timeToWait);
resTestWaitFor = TestWaitForAnyJoinedEvent(timeToWait);
if (resTestWaitFor > 0) // Resume due to event occurred
{
TestStepPass("Wait condition", "Waiting for any event is ok. Resume
event number = %d", resTestWaitFor);
TestStepPass("Call TFS function", "TestGetWaitFrPDUData(index=%d)",
resTestWaitFor);
| TestGetWaitFrPDUData | TestJoinFrPDUEvent |
TestWaitForFrPOCState
CAPL Function Overview » Test Feature Set » TestWaitForFrPOCState
Function Waits for the occurrence of change of state on the FlexRay Communication Controller's
protocol operation state machine. Should the change not occur before the expiration of
the time aTimeout, the wait condition is resolved nevertheless.
Parameters aTimeout
aPOCState
The POC state the function will wait for (see selector 'FR_POCState' in event procedure on
FrPOCState).
If set to '-1' in combination with a 'WUState' the function will wait only for a Wakeup state
(any POC state will be accepted).
aWUState
The Wakeup state the function will wait for (see selector 'FR_Info2' in event procedure on
FrPOCState).
Example
The following test program waits for the occurrence of one of two different POC state
events.
| TestGetWaitFrPOCStateData | TestJoinFrPOCState |
TestWaitForFrStartCycle
CAPL Function Overview » Test Feature Set » TestWaitForFrStartCycle
Function Waits for the occurrence of the specified FlexRay start cycle event. Should the event not
occur before the expiration of the time aTimeout, the wait condition is resolved
nevertheless.
When no numeric cycle is specified the wait condition is resolved on any FlexRay Start
Cycle event.
Parameters aCycle
aBaseCycle
Numeric base cycle. This value must be less than the repetition factor. Together with the
repetition factor this value determines the "Cycle Multiplexing".
aCycleRepetition
Cycle repetition factor. Together with the base cycle this value determines the "Cycle
Multiplexing".
aTimeout
Example
The following test program waits for the occurrence of one of two different start of
cycles.
{
TestStepPass("Data extraction", "Data of event %d succefully
extracted. CycleId=%d", resTestWaitFor, frStartCycleData.FR_Cycle);
}
}
else
{
TestStepFail("Wait condition", "resTestWaitFor = %d, Waiting for any
joined event failed!", resTestWaitFor);
}
}
| TestGetWaitFrStartCycleData | TestJoinFrStartCycleEvent |
TestWaitForFrSymbol
CAPL Function Overview » Test Feature Set » TestWaitForFrSymbol
Function Waits for the occurrence of a FlexRay symbol on the bus. Should the symbol not occur
before the expiration of the time aTimeout, the wait condition is resolved nevertheless.
Parameters aTimeout
aSymbolType
0 unknown
1 CAS
2 MTS
3 Wakeup
aChannelMask
Identifies the FlexRay channel of the communication controller. A value of 1 will wait for
the symbol on channel A, 2 will wait for it on channel B and 3 on any channel (A/B).
7.2 • FlexRay — •
• Test nodes
Attention
If you want to wait for the reception or transmission of a wakeup pattern, then use
TestWaitForFrPOCState.
Example
The following test program waits for the occurrence of different POC state events and
Attention:
• The test requires two (2) FlexRay interfaces that are connected to one real cluster.
• The nodes of the cluster must implement to receive a special 'sleep' command that is
sent via a dedicated FlexRay frame.
variables
{
char bus1[20] = "FlexRay_1";
char bus2[20] = "FlexRay_2";
msTimer actionTimer;
int gAction = 0;
const int gActionDelay = 52; // [ms]
const int gTimeout = 300; // [ms]
const int gExtTimeout = 2700; // [ms] to be waited additionally after
cluster wakeup
const int cPossibleWakeupDelay = 1500; // [ms] to be waited after
possible cluster wakeup
const int cWakeupDelay = 1500; // [ms] to be waited after cluster wakeup
BYTE gSta1Id = 5; // slot ID for frame to send
BYTE gSta1Flags = 16; // event-triggered
BYTE gSta1Dlc = 4; // bytes
BYTE gSta1Chan = 3; // send on channel A+B
BYTE gSta1Base = 0; // base cycle
BYTE gSta1Rep = 1; // cycle repetition
}
testcase GoodCheckFlexRayWaitForSymbol_1 ()
{
long result;
FrSymbol frSymbolData;
Symbol=%d", frSymbolData.FR_Symbol);
}
}
}
testcase GoodCheckFlexRayWaitForPOC_1 ()
{
long result;
FrPOCState frPOCStateData;
TestStepFail("Constraint Violation");
}
else
{
TestStepPass("FlexRay Interface is online (synced)!");
TestStepPass("Call TFS function",
"TestGetWaitFrPOCStateData(frPOCStateData)");
// Test for data extraction:
result = TestGetWaitFrPOCStateData(frPOCStateData);
if (0 != result)
{
TestStepFail("Data extraction", "result = %d, Data access could not
be executed.", result);
}
else
{
TestStepPass("Data extraction", "Data extraction works fine.
StateCode=%d", frPOCStateData.FR_POCState);
}
}
}
testcase GoodCheckFlexRayWaitForWUS_1 ()
{
long result;
FrPOCState frPOCStateData;
}
else if (result == -2)
{
TestStepFail("Constraint Violation");
}
else
{
TestStepPass("Any Wakeup state received!");
TestStepPass("Call TFS function",
"TestGetWaitFrPOCStateData(frPOCStateData)");
// Test for data extraction:
result = TestGetWaitFrPOCStateData(frPOCStateData);
if (0 != result)
{
TestStepFail("Data extraction", "result = %d, Data access could not
be executed.", result);
}
else
{
TestStepPass("Data extraction", "Data extraction works fine.
WUSCode=%d", frPOCStateData.FR_Info2);
}
}
}
on timer actionTimer
{
if (gAction == 1)
{
FrSendSymbol(0,0,1);
TestStepPass("FlexRay MTS Symbol sent!");
}
else if (gAction == 2)
{
_cmdClusterToSleep(1);
TestStepPass("Cmd 'Cluster to sleep mode' sent!");
}
else if (gAction == 3)
{
_wakeupCluster(1);
TestStepPass("Wakeup pattern sent!");
}
gAction = 0;
}
ResetFlexRayCCEx(channel,wuChMask,wuCount,wuTxIdle,wuTxLow,cfg);
}
void InitBusContext ()
{
dword context;
TestStep("Prepare","Setting bus context..");
context = GetBusNameContext(bus2);
if (context > 0)
setBusContext(context);
else
{
TestStepFail("Bus context cannot be set");
}
}
| TestGetWaitFrSymbolData | TestJoinFrSymbolEvent |
TestWaitForLinCSError
CAPL Function Overview » Test Feature Set » TestWaitForLinCSError
Function Waits for a checksum error for the specified amount of time.
Parameters aTimeout
Timeout in milliseconds
aFrameId
Frame identifier
5.2 • LIN — •
• Test nodes
Example
testcase tcTFS_linCSError ()
{
linCSError linCSErrorData;
if (testWaitForLinCSError(5000) == 1)
{
if (testGetWaitLinCSErrorData(linCSErrorData) == 0)
{
testStep("Evaluation", "LIN CS Error event occurred for
FrameId=0x%X", linCSErrorData.ID);
}
}
}
| TestGetWaitLinCSErrorData | TestJoinLinCSErrorEvent |
TestWaitForLinETFSingleResponse
CAPL Function Overview » Test Feature Set » TestWaitForLinETFSingleResponse
Function Waits for the occurrence of a LIN Event-triggered frame with a single response for the
specified associated frame. Should the event-triggered frame not occur before the
expiration of the specified timeout, the wait condition is resolved nevertheless.
Parameters aETFFrameId
aAssocFrameId
Frame identifier of a LIN unconditional frame associated with the awaited event-triggered
frame
aTimeout
Timeout in milliseconds.
Value 0: no timeout
6.0 • LIN — •
• Test nodes
Example
testcase tcTFS_linETFSingleResponse ()
{
linMessage 0 linETFSingleResponseData;
| TestGetWaitLinETFSingleResponseData | TestJoinLinETFSingleResponseEvent |
TestWaitForLinHeader
CAPL Function Overview » Test Feature Set » TestWaitForLinHeader
Function Waits for the Header occurrence of the specified LIN frame. Should the header not occur
before the expiration of the time aTimeout, the wait condition is resolved nevertheless.
When no frame is specified the wait condition is resolved on any LIN header.
Parameters aFrame
aFrameId
aTimeout
5.1 • LIN — •
• Test nodes
Example
testcase tcTFS_linHdrEvent ()
{
linheader linHeaderData;
if (testWaitForLinHeader(5000) == 1)
{
if (TestGetWaitLinHdrData(linHeaderData) == 0)
{
testStep("Evaluation", "LIN Header event occurred for
FrameId=0x%X", linHeaderData.ID);
}
}
}
TestWaitForLinReceiveError
CAPL Function Overview » Test Feature Set » TestWaitForLinReceiveError
Function Waits for the occurrence of LIN Receive Error event. Should the event not occur before
the expiration of the time aTimeout, the wait condition is resolved nevertheless.
Parameters aFrameId
aTimeout
5.1 • LIN — •
• Test nodes
Example
testcase tcTFS_linReceiveErrorEvent ()
{
linReceiveError linReceiveErrorData;
if (testWaitForLinReceiveError(5000) == 1)
{
if (TestGetWaitLinReceiveErrData(linReceiveErrorData) == 0)
{
testStep("Evaluation", "LIN Receive Error event occurred for
FrameId=0x%X", linReceiveErrorData.ID);
}
}
}
| TestGetWaitLinReceiveErrData | TestJoinLinReceiveErrorEvent |
TestWaitForLinSyncError
CAPL Function Overview » Test Feature Set » TestWaitForLinSyncError
Function Waits for a synchronisation error for the specified amount of time.
Parameters aTimeout
Timeout in milliseconds
5.2 • LIN — •
• Test nodes
Example
testcase tcTFS_linSyncErrorEvent ()
{
linSyncError linSyncErrorData;
if (testWaitForLinSyncError(5000) == 1)
{
if (testGetWaitLinSyncErrorData(linSyncErrorData) == 0)
{
testStep("Evaluation", "LIN Sync Error event occurred.
SyncBreak=%d ns; SyncDel=%d ns", linSyncErrorData.breaklen,
linSyncErrorData.delimiterlen);
}
}
}
| TestGetWaitLinSyncErrorData | TestJoinLinSyncErrorEvent |
TestWaitForLinTransmError
CAPL Function Overview » Test Feature Set » TestWaitForLinTransmError
Function Waits for the occurrence of LIN Transmission Error event. Should the event not occur
before the expiration of the time aTimeout, the wait condition is resolved nevertheless.
Parameters aFrameId
aTimeout
5.1 • LIN — •
• Test nodes
Example
testcase tcTFS_linNoResponseEvent ()
{
linTransmError linTransmErrorData;
if (testWaitForLinTransmError(5000) == 1)
{
if (testGetWaitLinTransmErrData(linTransmErrorData) == 0)
{
testStep("Evaluation", "LIN No-Response event occurred for
FrameId=0x%X", linTransmErrorData.ID);
}
}
}
| TestGetWaitLinTransmErrData | TestJoinLinTransmErrorEvent |
TestWaitForLinWakeupFrame
CAPL Function Overview » Test Feature Set » TestWaitForLinWakeupFrame
Function Waits for the occurrence of LIN Wakeup frame. Should the frame not occur before the
expiration of the time aTimeout, the wait condition is resolved nevertheless.
Parameters aTimeout
5.1 • LIN — •
• Test nodes
Example
testcase tcTFS_linWakeupEvent ()
{
linWakeupFrame linWakeupData;
if (testWaitForLinWakeupFrame(5000) == 1)
{
if (testGetWaitLinWakeupData(linWakeupData) == 0)
{
testStep("Evaluation", "LIN Wakeup event occurred. Signal length
is %d ns", linWakeupData.length_ns);
}
}
}
| TestGetWaitLinWakeupData | TestJoinLinWakeupEvent |
TestWaitForMeasurementEnd
CAPL Function Overview » Test Feature Set » TestWaitForMeasurementEnd
Function Waits for the end of the measurement. As the final command within a test module, this
function can be used to keep the test module and therefore the monitoring of constraints
and conditions active. With measurement end this wait condition can be resolved. The
test result and therefore also the report are not negatively impacted by the end of the
measurement, if the test module does not contain any further wait commands after this
one.
If a timeout time unequal to "0" is entered, the wait point is also resolved when the
specified waiting time expires.
Application:
The test module monitors constraints and conditions. This monitoring process should be
implemented precisely as long as the measurement runs.
Example
// monitoring of condition is active until measurement end
dword checkId;
long result;
checkId = ChkStart_InconsistentDlc(VehicleMotion);
result = TestWaitForMeasurementEnd(5000);
TestWaitForMessage
CAPL Function Overview » Test Feature Set » TestWaitForMessage
Function Waits for the occurrence of the specified message aMessage. Should the message not
occur before the expiration of the time aTimeout, the wait condition is resolved
nevertheless.
Parameters aMessage
aMessageId
aTimeout
Example
// waits for the occurrence of message ‚VehicleMotion’
long result;
result = TestWaitForMessage(VehicleMotion, 2000);
| TestJoinMessageEvent | TestGetWaitEventMsgData |
TestWaitForMostAllBypass
CAPL Function Overview » Test Feature Set » TestWaitForMostAllBypass
Function Use this function to determine whether the bypass on the MOST hardware connected to
the channel has been set to the specified condition within the waiting time. The wait
point is only triggered if a change to this condition takes place.
The following can be entered as possible condition values: 1 for closed bypass and 0 for
open bypass. In the case of a closed bypass, the MOST device can not be seen by the other
devices in the loop.
Parameters aValue
1 Bypass is closed
0 Bypass is opened
aTimeout
5.2 • MOST — •
• Test nodes
Example
TestWaitForMostAMSMessage
CAPL Function Overview » Test Feature Set » TestWaitForMostAMSMessage
Function Waits for the occurrence of the specified MOST AMS message. Should the message not
occur before the expiration of the time aTimeout, the wait condition is resolved
nevertheless.
Parameters aDBMsg
aSourceAddress
Source address
aDestinationAddress
Target address
aFBlockId
aInstanceId
aFunctionId
aOpType
Info
aTimeout
aSymbolicMessage
• FBlock.InstanceId.Function.OpType(Parameterliste)
• FBlock.InstanceId.Function.OpType
• FBlock.Function.OpType(Parameterliste)
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestWaitForMostAMSReport
CAPL Function Overview » Test Feature Set » TestWaitForMostAMSReport
Function Waits for the occurrence of a response message (Report, OpType > 8) of the specified
MOST AMS message. Should the message not occur before the expiration of the time
aTimeout, the wait condition is resolved nevertheless.
Parameters aFBlockId
aInstanceId
aFunctionId
Info
aTimeout
aSymbolicMessage
• FBlock.InstanceId.Function
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestWaitForMostAMSResponse
CAPL Function Overview » Test Feature Set » TestWaitForMostAMSResponse
Function This function immediately sends a symbolically defined MOST message and waits for the
appropriate response message from the receiver. Thus, it combines the functionalities of
TestSendMostAMSMessage and TestWaitForMostAMSReport into one function call. The
response message can be read and evaluated after the return of the wait operation using
TestGetWaitEventMostAMSMsgData.
The symbolically defined messages must be complete, which means all mandatory data
must be specified explicitly (without use of wildcards), because an actual message is
sent. However, a parameter list may be shorter than specified in the function catalog, in
order to be able to generate intentionally incomplete messages.
If possible, the message is always sent via the AMS service. However, if this is not
activated, the message - if short enough - will be sent as a normal control message (with
TelID = 0).
If the message is longer than a control message, the function delivers the return value of -
5 and a wait point is not set up.
Parameters aDestinationAddress
Source address
aInstanceId
aTimeout
aSymbolicMessage
• FBlock.InstanceID.Function.OpType(Parameterliste)
• FBlock.InstanceID.Function.OpType
• FBlock.Function.OpType(Parameterliste)
• FBlock.Function.OpType
An entry without parameter list yields an empty parameter list (see also Symbolic
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed.
-5: The message is too long and had to be sent using the AMS service, but the AMS service
is not activated.
-3: Message was sent, however "not acknowledge" appears in the Tx acknowledgement.
-10: The given MOST message was sent, but the receiver responded with an error message
that contains one of the following error codes:
You can find more information about the error codes in the MOST specification.
-11: The given MOST message was sent, but the receiver responded with an error message
that contains one of the following error codes:
-12: The given MOST message was sent, but the receiver responded with an error message
that contains one of the following error codes:
0x40 Busy
-13: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x42 (Processing Error).
-14: The given MOST message was sent, but the receiver responded with an error message
-15: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x0A (Secondary node).
-16: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x0B (Device malfunction).
-17: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x0C (Segmentation error).
-18: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x43 (Method aborted).
5.2 • MOST — •
• Test nodes
Example
TestWaitForMostAMSResult
CAPL Function Overview » Test Feature Set » TestWaitForMostAMSResult
Function The function immediately sends a symbolically defined MOST message with OpType
'StartResult' or 'StartResultAck' and waits for the reception of the appropriate 'Result' or
'ResultAck' message from the receiver.
Parameters aDestinationAddress
Source address
aSymbolicMessage
• FBlock.Instance.Function.StartResult(parameter list)
• FBlock.Instance.Function.StartResult
• FBlock.Function.StartResult(parameter list)
• FBlock.Function.StartResult
• FBlock.Instance.Function.StartResultAck(SenderHandle, parameter list)
• FBlock.Instance.Function.StartResultAck(SenderHandle)
• FBlock.Function.StartResultAck(SenderHandle, parameter list)
• FBlock.Function.StartResultAck(SenderHandle)
aInstanceId
aTimeoutMaxDuration
Maximum time [ms] to wait for the reception of a 'Result' ('ResultAck') message.
aTimeoutWaitForProcessing1
Maximum time [ms] to wait for the reception of the first 'Processing' ('ProcessingAck') or
immediate 'Result' ('ResultAck') message (tWait-ForProcessing1).
aTimeoutWaitForProcessing2
Maximum time [ms] to wait for the reception of the following 'Processing' ('ProcessingAck')
or 'Result' ('ResultAck') message (tWaitFor-Processing2).
Return values 1: Message was sent successfully and the appropriate response received
-3: Message was sent, however "not acknowledge" appears in the Tx acknowledgement.
-5: The message is too long and had to be sent using the AMS service, but the AMS service
is not activated.
-6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed.
-10: The given MOST message was sent, but the receiver responded with an error message
that contains one of the following error codes:
You can find more information about the error codes in the MOST specification.
-11: The given MOST message was sent, but the receiver responded with an error message
that contains one of the following error codes:
-12: The given MOST message was sent, but the receiver responded with an error message
that contains one of the following error codes:
0x40 Busy
-13: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x42 (Processing Error).
-14: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x20 (Function specific).
-15: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x0A (Secondary node).
-16: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x0B (Device malfunction).
-17: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x0C (Segmentation error).
-18: The given MOST message was sent, but the receiver responded with an error message
that contains the error code 0x43 (Method aborted).
7.0 • MOST — •
• Test nodes
Example
TestWaitForMostAMSSpyMessage
CAPL Function Overview » Test Feature Set » TestWaitForMostAMSSpyMessage
Function Waits for the occurrence of the specified MOST-AMS spy message.
If the message does not occur by the time the aTimeout expires, the wait condition is still
resolved.
Parameters aDBMsg
aSourceAddress
Source address
aDestinationAddress
Target address
aFBlockId
aInstanceId
aFunctionId
aOpType
Info
aTimeout
aSymbolicMessage
• FBlock.InstanceId.Function.OpType(Parameterliste)
• FBlock.InstanceId.Function.OpType
• FBlock.Function.OpType(Parameterliste)
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.2 • MOST — •
• Test nodes
Example
TestWaitForMostAMSSpyReport
CAPL Function Overview » Test Feature Set » TestWaitForMostAMSSpyReport
Function Waits for the occurrence of the spy response message (report, op-type > 8) of the
specified MOST-AMS message.
If the message does not arrive by the time the aTimeout expires, the wait condition is
still resolved.
Parameters aFBlockId
aInstanceId
aFunctionId
Info
aTimeout
aSymbolicMessage
• FBlock.InstanceId.Function
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.2 • MOST — •
• Test nodes
Example
TestWaitForMostApInstID
CAPL Function Overview » Test Feature Set » TestWaitForMostApInstID
Function The function waits for the specified time period for a special application socket change
event, which is triggered as soon as the Fblock InstanceId has changed on its own channel.
Parameters aTimeout
5.2 • MOST — •
• Test nodes
Example
TestWaitForMostAsRegistry
CAPL Function Overview » Test Feature Set » TestWaitForMostAsRegistry
Function The function waits for the specified time period for any change to a registry in the
application socket.
Parameters aRegistry
aTimeout
5.2 • MOST — •
• Test nodes
Example
TestWaitForMostCriticalUnlock
CAPL Function Overview » Test Feature Set » TestWaitForMostCriticalUnlock
Function The function waits until the expiration of the time aTimout for the occurrence of a
LightLock event indicating "critical unlock" state.
A LightLock event with a "critical unlock" state is generated, when a single "light & no
lock" state occurs after a "stable lock" state and lasts longer than tUnlock (see MOST
specification), or several "light, no lock" states occur successively and add up to a
duration longer than tUnlock.
Parameters aTimeout
7.0 • MOST — •
• Test nodes
Example
TestWaitForMostGroupAdr
CAPL Function Overview » Test Feature Set » TestWaitForMostGroupAdr
Function The function waits for the expiration of the time aTimeout for the occurrence of the
MOST event of a change of the own group address.
Parameters aValue
Expected value of the group address that should be in the MOST event.
aTimeout
5.1 • MOST — •
• Test nodes
Example
TestWaitForMostLightOff
CAPL Function Overview » Test Feature Set » TestWaitForMostLightOff
Function The function waits until the expiration of the time aTimout for the occurrence of a
LightLock event indicating "no light & no lock" state.
A LightLock event with a "no light & no lock" state is generated, when the hardware
connected to the channel no longer receives light at the Fiber Optical Receiver (FOR).
Parameters aTimeout
7.0 • MOST — •
• Test nodes
Example
TestWaitForMostMessage
CAPL Function Overview » Test Feature Set » TestWaitForMostMessage
Function Waits for the occurrence of the specified MOST message (MOST control message or MOST
spy message). Should the message not occur before the expiration of the time aTimeout,
the wait condition is resolved nevertheless.
Parameters aDBMsg
aSourceAddress
Source address
aDestinationAddress
Target address
aFBlockId
aInstanceId
aFunctionId
aOpType
Info
aTimeout
aSymbolicMessage
• FBlock.InstanceId.Function.OpType(Parameterliste)
• FBlock.InstanceId.Function.OpType
• FBlock.Function.OpType(Parameterliste)
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestWaitForMostMPR
CAPL Function Overview » Test Feature Set » TestWaitForMostMPR
Function The function waits until the expiration of the time aTimeout for the occurrence of the
MOST event of a change of the Maximum Position Registers (MPR).
Parameters aValue
Expected value of the maximum position register that should be in the MOST event. The
specification -1 (wildcard) stands for any values.
aTimeout
5.1 • MOST — •
• Test nodes
Example
TestWaitForMostNetState
CAPL Function Overview » Test Feature Set » TestWaitForMostNetState
Function The function waits until the expiration of the time aTimeout for a transfer of the MOST
NetState from the state aOldState into the state aNewState.
Parameters aOldState
Expected initial state of the NetState. The following values are allowed:
0 MostNetState_Undefined
2 MostNetState_PowerOff
3 MostNetState_NetInterfaceInit
4 MostNetState_ConfigNotOk
5 MostNetState_ConfigOk
aNewState
Expected new state of the NetState. The value range corresponds to that of aOldState
Parameters.
aTimeout
5.1 • MOST — •
• Test nodes
Example
TestWaitForMostNodeAdr
CAPL Function Overview » Test Feature Set » TestWaitForMostNodeAdr
Function The function waits for the expiration of the time aTimeout for the occurrence of the
MOST event of a change of its own node address.
Parameters aValue
Expected value of the node address that should be in the MOST event. The specification -
1 (wildcard) stands for any values.
aTimeout
5.1 • MOST — •
• Test nodes
Example
TestWaitForMostNPR
CAPL Function Overview » Test Feature Set » TestWaitForMostNPR
Function The function waits for the expiration of the time aTimeout for the occurrence of the
MOST event of a change of the value in the Node Position Register (NPR).
Parameters aValue
Expected value of the NPR that should be in the MOST event. The specification -1
(wildcard) stands for any values.
aTimeout
5.1 • MOST — •
• Test nodes
Example
TestWaitForMostPkt
CAPL Function Overview » Test Feature Set » TestWaitForMostPkt
Function Waits for the occurrence of the specified MOST packet. Should the event not occur before
the expiration of the time aTimeout, the wait condition is resolved nevertheless.
Info
Note, that the first and third signatures are exclusively suited to set up wait
conditions for packets having function catalog format, whereas the other
signatures also allow the definition of raw packets.
Parameters aSourceAddress
Source address
aDestinationAddress
Target address
aPktDataDesc
String containing a symbolic or numeric description of the packet data. Following formats
are allowed:
For a detailed description of the allowed syntax, see Definition of MOST packets.
aInstanceId
Return values -6: Parse Error; on specification of a packet description string, that can’t be resolved with
the XML function catalog or that is flawed
7.1 • MOST — •
• Test nodes
Example
TestWaitForMostRawSpyMessage
CAPL Function Overview » Test Feature Set » TestWaitForMostRawSpyMessage
Function This function waits for the occurrence of the specified MOST raw spy control message.
Should the message not occur before the expiration of the time aTimeout, the wait
condition is resolved nevertheless.
Parameters aSourceAddress
Source address
aDestinationAddress
Target address
aRType
0 Normal
1 RemoteRead
2 RemoteWrite
3 Allocate
4 Deallocate
5 GetSource
aMsgData
Byte array containing the data bytes of the raw message to be matched.
aMsgDataLength
Data bytes at positions larger than the value of this parameter will not be considered
when comparing with incoming messages.
aMsgDataDesc
String with hexadecimal values describing the message data bytes of the raw spy message
to be matched, starting at byte position 0, f. e.
"0A 0B 0C 0D 0E 0F 10 11 12 13 FF"
Data bytes at positions beyond the ones described in this parameter will not be
considered when comparing with incoming messages.
aTimeout
Return values -6: Parse Error; on specification of a message data description string that contains other
characters than hexadecimal digits or wildcards ("_").
7.1 • MOST — •
• Test nodes
Example
| TestSendMostRawMessage| TestGetWaitEventMostRawMsgData |
TestWaitForMostReport
CAPL Function Overview » Test Feature Set » TestWaitForMostReport
Function Waits for the occurrence of a response message (Report, OpType > 8) of the specified
MOST message (MOST control message or MOST spy message). Should the message not
occur before the expiration of the time aTimeout, the wait condition is resolved
nevertheless.
Parameters aFBlockId
aInstanceId
aFunctionId
Info
aTimeout
aSymbolicMessage
• FBlock.InstanceId.Function
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.0 • MOST — •
• Test nodes
Example
TestWaitForMostSBC
CAPL Function Overview » Test Feature Set » TestWaitForMostSBC
Function The function waits for the expiration of the time aTimeout for the occurrence of the
MOST event of a change of the value of the Synchronous Bandwidth Control (SBC)
Register.
Parameters aValue
Expected value of the Synchronous Bandwidth Control Registers that should be in the
MOST event. The specification -1 (wildcard) stands for any values.
aTimeout
5.1 • MOST — •
• Test nodes
Example
TestWaitForMostShortUnlock
CAPL Function Overview » Test Feature Set » TestWaitForMostShortUnlock
Function The function waits until the expiration of the time aTimout for the occurrence of a
LightLock event indicating "light & no lock" state.
A LightLock event with a "light & no lock" state is generated, when there is no
interpretable signal at the Optical Receiver (FOR) of the hardware for a brief moment (<
tUnlock, see also MOST specification) and the ring has been in a "light & lock" state
previously.
Parameters aTimeout
7.0 • MOST — •
• Test nodes
Example
TestWaitForMostSpyMessage
CAPL Function Overview » Test Feature Set » TestWaitForMostSpyMessage
The first arriving control message, which fulfills the specified conditions, resolves the
delay point, irregardless of whether it is part of a segmented transmission. TelId is not
included in this process.
If the message does not occur by the time the aTimeout expires, the wait condition is
still resolved.
Parameters aDBMsg
aSourceAddress
Source address
aDestinationAddress
Target address
aFBlockId
aInstanceId
aFunctionId
aOpType
Info
aTimeout
aSymbolicMessage
• FBlock.InstanceId.Function.OpType(Parameterliste)
• FBlock.InstanceId.Function.OpType
• FBlock.Function.OpType(Parameterliste)
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.2 • MOST — •
• Test nodes
Example
TestWaitForMostSpyPkt
CAPL Function Overview » Test Feature Set » TestWaitForMostSpyPkt
Function Waits for the occurrence of the specified MOST (spy) packet. Should the event not occur
before the expiration of the time aTimeout, the wait condition is resolved nevertheless.
The first and third signatures are exclusively suited to set up wait conditions for packets
having function catalog format, whereas the other signatures also allow the definition of
raw packets.
Info
Spy packets, but also node packets (with any direction) will resolve a wait
condition set up by this function, since CANoe does not double an incoming
packet on a channel that has asynchronous spy activated.
Parameters aSourceAddress
Source address
aDestinationAddress
Target address
aPktDataDesc
String containing a symbolic or numeric description of the packet data. Following formats
are allowed:
For a detailed description of the allowed syntax, see Definition of MOST packets.
aInstanceId
Return values -6: Parse Error; on specification of a packet description string, that can’t be resolved with
the XML function catalog or that is flawed
7.1 • MOST — •
• Test nodes
Example
TestWaitForMostSpyReport
CAPL Function Overview » Test Feature Set » TestWaitForMostSpyReport
Function Waits for the occurrence of the spy response message (report, op-type > 8) of the
specified MOST message.
The first arriving control message, which fulfills the specified conditions, resolves the
wait point, irregardless of whether it is part of a segmented transmission. TelId is not
included in this process.
If the message does not occur by the time the aTimeout expires, the wait condition is still
resolved.
Parameters aFBlockId
aInstanceId
aFunctionId
Info
aTimeout
aSymbolicMessage
• FBlock.InstanceId.Function
• FBlock.Function
• FBlock
Return values -6: Parse Error; on specification of a symbolic message definition that cannot be resolved
with the available XML function catalog or that is flawed
5.2 • MOST — •
• Test nodes
Example
TestWaitForMostStableLock
CAPL Function Overview » Test Feature Set » TestWaitForMostStableLock
Function The function waits until the expiration of the time aTimout for the occurrence of a
LightLock event indicating "stable lock" state.
A LightLock event with a "stable lock" state is generated, when a "light & Lock" state lasts
uninterrupted at the hardware for a period of time equal or longer than tLock (see MOST
specification).
Parameters aTimeout
7.0 • MOST — •
• Test nodes
Example
testWaitForScopeEvent
CAPL Function Overview » Scope » testWaitForScopeEvent
Function Waits for the occurrence of CANoe Scope event. Should the event not occur before the
expiration of the time aTimeout, the wait condition is resolved nevertheless.
Parameters aTimeout
scopeEvent (optional)
If the type of the Scope event is not specified the function will resume on any Scope
event and the exact event type can be queried using testGetWaitScopeEventData()
function.
Supported values:
scopeConnected Occurs when the Connect Scope action initiated with the
scopeConnect() CAPL call is successfully completed.
scopeDisconnected Occurs when the Disconnect Scope action initiated with the
scopeDisconnect() CAPL call is successfully completed.
scopeTriggerActivated Occurs when the Scope trigger activation initiated with the
scopeActivateTrigger() CAPL call is successfully completed.
scopeTriggered Occurs when the Scope triggering action initiated with the
scopeTriggerNow() CAPL call is successfully completed.
Example
long res;
res = scopeTriggerNow();
if (res != 1)
{
testStepFail("Initialization","Call to scopeTriggerNow() failed. Return
code =%d", res);
return;
}
TestWaitForSignalAvailable
CAPL Function Overview » Test Feature Set » TestWaitForSignalAvailable
Info
This function replaces TestWaitForSignal that has been available since version 5.1.
Function Tests the availability of a specific signal and waits if necessary until its availability.
A signal that is received at least once from the bus after the measurement starts is
classified as "available".
This function is useful when you want to assure that single signals are available before
starting a signal-oriented test, i.e. to synchronize the tester with the bus.
Parameters aSignal
aTimeout
Example
// waits for the occurrence of signal ‚EngineRunning’
long result;
result = TestWaitForSignalAvailable(EngineRunning, 2000);
| TestWaitForSignalsAvailable |
TestWaitForSignalInRange
CAPL Function Overview » Test Feature Set » TestWaitForSignalInRange
Function Checks the value of the signal, the system or the environment variable against the
condition:
aLowLimit <= Value <= aHighLimit
If this condition is already met when this function is called, it returns immediately
without waiting.
The test step is evaluated as either passed or failed depending on the results.
Parameters aSysVar
aEnvVar
aSignal
Signal to be queried.
aLowLimit
aHighLimit
aTimeout
-2: Type of the system / environment variable is not valid – only float or integer are valid
— or signal is not valid or invalid limits of the given range.
Example
// waits for a specified value range of signal ‘Velocity’
long result;
result = TestWaitForSignalInRange(Velocity, 80, 100, 2000);
| TestJoinSignalInRange |TestWaitForSignalOutsideRange |
TestWaitForSignalMatch
CAPL Function Overview » Test Feature Set » TestWaitForSignalMatch
Function Checks the given value against the value of the signal, the system variable or the
environment variable. The resolution of the signal is considered.
If this condition is already met when this function is called, it returns immediately
without waiting.
The test step is evaluated as either passed or failed depending on the results.
Parameters aSignal
Signal to be queried.
aEnvVar
aSysVar
aCompareValue
aTimeout
Example
// waits for a specified value of signal ‘Velocity’
long result;
result = TestWaitForSignalMatch(Node_SUT::Velocity, 80, 1000);
| TestJoinSignalMatch |
TestWaitForSignalOutsideRange
CAPL Function Overview » Test Feature Set » TestWaitForSignalOutsideRange
Function Checks the signal, the system or the environment variable value against the condition:
If this condition is already met when this function is called, it returns immediately
without waiting.
Parameters aSysVar
aEnvVar
aSignal
Signal to be queried.
aLowLimit
aHighLimit
aTimeout
-2: Type of the system or environment variable is not valid – only float or integer are valid
— or signal is not valid or invalid limits of the given range.
Example
// waits for a specified value range of signal ‘Velocity’
long result;
result = TestWaitForSignalOutsideRange(Velocity, 80, 100, 2000);
| TestJoinSignalOutsideRange |TestWaitForSignalInRange |
TestWaitForSignalsAvailable
CAPL Function Overview » Test Feature Set » TestWaitForSignalsAvailable
Info
This function replaces TestWaitForSignals that has been available since version 5.1.
Function Tests the availability of all the send signals of a node and waits if necessary until all the
send signals of the node are available. Signals that are received at least once from the
bus after the measurement starts are classified as "available".
This function is useful when you want to assure that all signals are available before
starting a signal-oriented test, i.e. to synchronize the tester with the bus.
Parameters aNode
aTimeout [ms]
0: Wait state is exited due to a timeout; not all signals are available
1: The wait state is exited; all of the node’s send signals are available for further tests
Example
// waits for the availability of all tx signals of node ‘SUT’
long result;
result = TestWaitForSignalsAvailable(SUT, 2000);
| TestWaitForSignalAvailable |
TestWaitForStringInput
CAPL Function Overview » Test Feature Set » TestWaitForStringInput
Function It creates a dialog window which displays the transferred string. The tester can enter a
text in this dialog. This entry can be queried with the command TestGetStringInput after
a successful call, i.e. with the return value "1". It is also possible to enter a comment in
the dialog which is automatically adopted into the test protocol.
The first wait function without timeout waits until the confirmation by the tester. If the
second wait function is used with the timeout, the dialog is automatically closed after the
timeout. Whether the dialog was closed due to a timeout or by the tester, can be
determined by using the return value.
The function TestGetLastWaitResult can be queried after calling the return value of the
function if no other TestWaitForStringInput call occurred in the interim.
Parameters aQuery
Text to be displayed in the entry dialog. Up to 255 characters can be displayed in the
dialog.
aTimeOut
Return values <0: General error, e.g. by calling outside of a test sequence
0: Timeout occurred
Example
// ask for the users name and report it in the Write window
char answer[100];
if (1== TestWaitForStringInput("Please enter your name", 5000))
{
TestGetStringInput(answer, 100);
Write("name = %s", answer);
}
TestWaitForSyscall
CAPL Function Overview » Test Feature Set » TestWaitForSyscall
Note on Exitcode
Windows supplies exitcodes for applications in the range from 0 to 255. 255 is always
supplied for applications which generate internal values outside this range (e.g., negative
values). You might need to take this into account when setting the aExitcode parameter.
If no application directory has been set, the working directory of the external application
is set by default as follows:
Function This function can be used to start an external application and check its exit code. Once
the application has been started successfully the system waits for it to exit at the end of
the specified wait time. The result depends on whether the application's exit code
matches the specified expected value.
You should either use the absolute path to the external application or use the call with
the declaration of the working directory. To keep the configuration independent of
installation paths on a concrete PC you can use <workingdir> alternatively to reference an
environment variable of the target system, e.g. %MYAPP_DIR%.
Parameters aWorkingdir
The working directory for the external application. The directory name may include
spaces.
aCommandline
The command line for the application including any parameters which might be required.
Path names or parameters containing blank spaces must be enclosed in quotation marks
(as an escape sequence \").
aExitcode
The expected exit code for the application. If the application is exited within the wait
time, the result of the call will also depend on whether it was exited with this exit code.
aTimeout [ms]
The maximum wait time at the end of which the application is expected to exit.
Return values 1: The application exited with the expected exit code.
-1: The application could not be started, e.g., due to an error in the command line.
2: The application exited with an exit code other than the one expected.
-999: Waiting aborted due to end of measurement (this does not cause the application to
be aborted).
Example
//starts an external application
long ret;
TestStepBegin("tc1", "syscall");
ret = TestWaitForSyscall("C:\\My Project", "\"My Tester.exe\" 0", 0, 1000);
if (ret != 1) {
TestStepFail("Syscall failed or timed out.");
TestCaseFail();
} else {
TestStepPass("Syscall succeeded.");
}
TestWaitForSysVar
CAPL Function Overview » Test Feature Set » TestWaitForSysVar
Function Waits for the next system variable aSysVar. Should the event not occur before the
expiration of the time aTimeout, the wait condition is resolved nevertheless.
Parameters aSysVar
aTimeout
Example
// waits for the occurrence of SysVar ‚MySysVar’
long result;
result = TestWaitForSysVar(sysvar::Test::MySysVar, 2000);
|TestJoinSysVarEvent |
TestWaitForTesterConfirmation
CAPL Function Overview » Test Feature Set » TestWaitForTesterConfirmation
Function Creates a popup window that presents the given string to the tester. The tester can
acknowledge the window with Yes or No.
The window contains a field for entering a comment that is automatically adopted into
the test protocol.
Even when this function is called by different test modules maximum only one of these
popup windows is active.
The 1st wait function has no timeout so it waits for the confirmation of the tester.
The 2nd wait function has a timeout, i.e. the dialog is automatically terminated after the
timeout expires.
The 3rd wait function has a timeout and can show a resource, i.e. the dialog can show
additional information.
Parameters text
This is shown in the popup window. The maximum length of the string is limited (4096
characters).
timeout
heading
A heading above the dialog text. The maximum length of the string is limited (256
characters).
resource
A URL or file path. The maximum length of the string is limited (512 characters).
Pictures are shown in the dialog itself, for other resources a link is shown. Supported
picture types are: bmp, jpg, png, gif. For arbitrary files, the application registered for
that file type on the computer is used to open it when the user clicks the link. Relative
file paths are based on the configuration or test setup which contains the test module.
resourceCaption
A caption respectively a description for the resource. The maximum length of the string is
limited (256 characters).
Example
// waits for the answer of the user
long result;
result = TestWaitForTesterConfirmation("Any text or question", 10000);
TestWaitForTextEvent
CAPL Function Overview » Test Feature Set » TestWaitForTextEvent
Function Waits for the signaling of the specified textual event from the individual test module. A
signaling from another test module does not effect this wait instruction.
Should this event not occur before the expiration of the time aTimeout, the wait
condition is resolved nevertheless.
Parameters aText
aTimeout
Example
// waits for the occurrence of text event „ErrorFrame occurred!“
long result;
result = TestWaitForTextEvent("ErrorFrame occurred!", 3000);
| TestJoinTextEvent | TestSupplyTextEvent |
TestWaitForTimeout
CAPL Function Overview » Test Feature Set » TestWaitForTimeout
Parameters aTimeout
Example
// waits for 3000 ms
long result;
result = TestWaitForTimeout(3000);
TestWaitForValueInput
CAPL Function Overview » Test Feature Set » TestWaitForValueInput
Function It creates a dialog window which displays the transferred string. The tester can enter a
number in this dialog. The number can be entered in decimal as well as hexadecimal
form. Only characters allowed for numeric values are allowed. Upon closing the dialog, an
additional check of the number entered is performed. If the entry cannot be converted to
a valid number, an error message is generated and the dialog is exited. The entry can be
queried after a successful call with the commands TestGetValueInput (number value) and
TestGetStringInput (entry as String). It is also possible to enter a comment in the dialog
which is automatically adopted into the test protocol.
The first wait function without timeout waits until the confirmation by the tester. If the
second wait function is used with the timeout, the dialog is automatically closed after the
timeout. Whether the dialog was closed due to a timeout or by the tester, can be
determined by using the return value.
The function TestGetLastWaitResult can be queried after calling the return value of the
function if no other TestWaitForValueInput call occurred in the interim.
Only one dialog window is open at a time, even though TestWaitForValueInput is called
by different test modules.
Parameters aQuery
aTimeOut
Return values <0: General error, e.g. by calling outside of a test sequence
0: Timeout occurred
Example
// ask for the test ID and report it in the Write window
TestWaitForValueInput("Please enter the test ID", 5000);
Write("Test ID = %f", TestGetValueInput());
Several Test Feature Set functions for processing MOST packets take a string parameter for the
specification of packet data. This string description must have one of the following formats:
A raw data byte description is always enclosed by curly brackets and may contain only hexadecimal digits,
blanks or the wildcard symbol "_" as a placeholder for a single hexadecimal digit. Additionally, the
wildcard symbol "*" can be used exclusively at the end of a byte description to specify that all data bytes
after the last one specified are ignored in a message to be matched. In other words, if there’s no "*" at the
end of the description, the length of the data to match must exactly match the length of the description,
even if there are single hex digit placeholders at the end. Note, that in most cases it is reasonable to add
a "*" at the end, since packets may be filled up with zero bytes at the end to full quadlets size.
Blanks are always ignored and can be used for formatting in order to gain a better readability.
When using a raw data byte description to specify a raw packet (1. form), the first byte in the string
describes the first byte in the packet data.
Example
// packet must only contain the specified 8 bytes
TestWaitForMostPkt(“{ F0 F1 F2 F3 F4 F5 F6 F7}”, 500);
// packet must begin with specified 8 bytes; Byte at 5th position may have any
value
TestWaitForMostPkt(“{ F0 F1 F2 F3 __ F5 F6 F7 *}”, 500);
FBlock, Instance, Function and OpType can be specified numerically or symbolically based on the function
catalog information available (see also Symbolic definition of MOST messages > Specification of names for
FBlock, Function and OpType).
Example
TestWaitForMostPkt("AudioDiskPlayer.1.DeckStatus.Get", 500);
TestWaitForMostPkt("0x31.0x01.0x200.0x1", 500);
When using FBlock, Instance, Function and OpType in conjunction with a raw data byte description for the
user data bytes, the first data byte in the raw data description corresponds to the first user data byte
(which is the 7. byte in the packet).
Example
TestWaitForMostPkt(“NetBlock.1.FBlockIDList.Status({ 31 01 *})”, 500);
When using a High Protocol frame description to specify the user data bytes of a packet, a set of case-
sensitive key words is offered to specify the different High Protocol frame types. Each key word has a
defined number of allowed parameters that may follow the key word in a bracket-enclosed, comma-
separated list. The meaning of each parameter depends on the frame type and position in the message
data (for a detailed description of the frame types and parameters, please consult the MOST High Protocol
Specification). The following keywords and parameters are recognized:
Example
// Test: Start of MHP transmission
// hexadecimal frame parameter values
TestWaitForMostPkt(“Navigation.Waypoints.Status(REQUEST CONNECTION(0x7f, 0x30,
0x1))”, 100);
// blanks in key words are ignored
TestWaitForMostPkt(“Navigation.Waypoints.Status(READYFORDATA)”, 100);
// decimal frame parameter values
TestWaitForMostPkt(“Navigation.Waypoints.Status(0-FRAME(255, 1, 1, 0))”, 100);
Each parameter in a list can be set to a numerical value (hex or decimal), or to wildcard value by using "*".
Parameters omitted at the end of a list are automatically set to wildcard value.
Example
// Wait for 0-FRAME of 200. block
TestWaitForMostPkt(“Navigation.Waypoints.Status(0-FRAME(*, *, *, 200))”, 100);
It is also possible to insert a raw data byte description instead of a direct numerical value at any
parameter position in the list. In this case however, this must always be last parameter in the list, since
the variable length of a raw byte description prevents any further parameter position matching. In the
special case of the DATA FRAME, the last parameter corresponds to the actual data payload of a data
frame and must always be described via a raw data byte description. Note that the same rules for
wildcards apply here as mentioned above. So if messages longer than specified also should match, it is
required to add a "*" wildcard at the end.
Example
// Wait for 0-Frame of block with 255 frames and BlockCnt == 5
TestWaitForMostPkt(“Navigation.Waypoints.Status(0-FRAME(0xFF, {__ __ 05})”,
100);
// Raw data parameter at first position always starts directly after high
command byte
TestWaitForMostPkt(“Navigation.Waypoints.Status(HOLD CONNECTION Tx({00 83 *})”,
100);
// First three bytes of 6. data frame must be 0x20, 0x21, 0x22
TestWaitForMostPkt(“Navigation.Waypoints.Status(DATA FRAME(0x06, 0xFF, {20 21 22
*})”, 100);
Note, that the TelID also matters for matching incoming packets. DATA FRAME and 0-FRAME specifications
only match packets with TelID = 8, whereas all other frame types only consider packets with TelID = 9.
In many send and wait commands for MOST, MOST messages can be specified symbolically. Here the
relevant MOST message, which under some circumstances can also contain wildcards and parameters, is
defined by a character string. The MOST message is resolved by the incorporated XML function catalog.
The symbolic definition of the message essentially follows the syntax that is used in the MOST
specification. All variants are derived from the following basic form:
FBlock.Instance.Function.OpType(Parameter,Parameter,Parameter)
In some commands, parts of this can be omitted; these are then regarded as "arbitrary". However, not all
conceivable forms are permitted, as this would prevent the specifications being distinguished uniquely
from one another. For information about which forms are permitted, see the description of the relevant
commands.
Essentially it is possible to set raw data for the user data. Accordingly, the parameter bytes have to be set
as hexadecimal values in curly brackets. This facilitates, for example, the sending of messages which do
not comply with the definition in the function catalog.
Example
Diagnosis.1.KeywordRec.Set({AABB11223344})
or pure numerical:
0x06.1.0x050.0x0({AABB11223344})
All characters between separators belong to the specification in question. Blank spaces are also permitted
in symbolic names. Without additional specifications, numeric specifications are decimal numbers; with
leading 0x, they are hexadecimal specifications. The numeric values to be transferred must be specified
here. Information that may be stored in the function catalog about units and conversion factors is not
taken into consideration. String parameters are enclosed in simple quotation marks.
Info
In hexadecimal mode, hexadecimal specifications are displayed in the trace window in the inline
disassembly column without a leading 0x; in decimal mode, they are displayed with a 0x.
Therefore, these lines can be used in decimal mode directly as a message definition
(copy&paste).
FBlock, Function, OpType can each be specified as symbolic names or numeric IDs. The symbolic names
cannot, therefore, completely take on the form of decimal or hexadecimal numbers. By contrast, the form
of partial strings will work. The InstanceID must be a numeric value.
The name * has a special role. It stands for any value (wildcard). Since for the resolution of function
names in the XML function catalog the FBlock must be known, a wildcard for the FBlock is only permitted
if the function is arbitrary or specified numerically. The parameter list contains the parameters of the
message in the sequence they are stored in the message and defined in the XML function catalog. The
parameters are separated by commas. The parameters can represent numeric values or symbolic values
(e.g., in case of enumerations) that are resolved using the XML function catalog. * is also permitted for an
arbitrary value. The parameter list does not have to be complete; however, for reasons of clarity only an
omission at the end of the list is possible. Specifications that are not present always count as "arbitrary".
An expanded wait condition arises only for the wait instructions for which the message definition contains
a parameter list. Here, as well as a message that fits the specified signature of FBlock, Instance, Function,
and OpType being expected, in addition, the specified parameters must correspond with the parameters
of the message received. As with all wait instructions, all received messages that fit only a part of the
specified signature are ignored. This means that the reception of such messages does not cause the wait
condition to be abandoned.
Error handling
In the event of an error during parsing and resolution of the message string, all functions show a return
value. In this case the function returns immediately without waiting. The error is displayed in the Write
window and recorded in the report, but the measurement is not aborted.
This behavior can be changed with the TestSetParseErrorConstraint command for all subsequent test
commands with symbolic message definition so that these set the verdict of the test case to "fail".
The command must not be used in the context of a test case; however, it can be used at test module level
(that is, in main test). However, if the command is used in the context of a test case, at the end of the
test case the mode reverts to what it was at the beginning of the test case. This ensures the locality of
the test case. The execution of a test case does not affect test cases that may be executed subsequently.
The InstanceID can be specified in each case as a parameter or as a part of the symbolic message
definition. If both specifications are present, a warning will be output at runtime and the parameter value
used. The value in the string is ignored (no measurement abort). If no InstanceID is specified explicitly,
then this is regarded as "arbitrary".
Example
TestWaitForMostMessage ("AudioAmplifier.2.Mute.Status", 200);
SUTInstID = ...;
TestWaitForMostAMSMessage ("AudioAmplifier.Mute.Status(MuteOn)", SUTInstID,
200);
TestJoinMostReportEvent ("NetBlock.2.Shutdown");
Example
Press <Ctrl>+<M> or select Message input with MOST function catalog... from the shortcut menu
to open an input assistant which displays a data entry field in the current program line listing a
selection of all MOST messages described in the function catalog. The selection takes in all
function catalogs assigned to the CAPL node.
In this context, the input assistant permits the description of messages up to parameter values
and adds the resulting description to the program text in quotation marks.
In the event of an error during parsing and resolution of the message string, all functions show a
return value. In this case the function returns immediately without waiting. The error is
displayed in the write window and recorded in the report.
Types of functions Check functions shall be identifiable easily. So the functions are to be prefixed.
Status Report In order to query information about a check, generic and check specific status
functions report functions are implemented.
Stimulus functions Stimulus Generators allow the user to stimulate signals or environment variables -
referred to as data sinks in the following - according to a specific time behavior.
Commands to These functions can be used to turn off checking in not relevant time, and to
control checks continue checking. The control functions can also be used to setup dependencies
between checks.
Error codes For all status report functions, the return values and raised error classes are
applied.
ChkConfig_Init
CAPL Function Overview » Test Service Library » Configuration Functions » ChkConfig_Init
The tests are executed in the context of a specific tester-role. Dependent to the setting
of the role, the error handling is more or less strict. This setting influences the
transformation from an error class to an impact.
Available tester-roles:
• developer
Less strict error handling, additional information during test execution.
• user
More strict error handling
Intended usage:
During development of a test module, the TSL can be set more verbose and some
problems in the test program are tolerated to get a longer list of issues before the test
module is stopped. Purpose is to reduce the count of iterations between test module
implementation and test module execution.
Once the test module is completed, the role should be set to user. Then the TSL is less
verbose and possible errors do have bigger impact.
Purpose: The tester really notices problems in the test configuration.
If the function is used, then it is recommended to perform the initialization once during
preStart section of the CAPL program.
Parameters aRole
0: arguments accepted
5.0 — — •
Example
// test is executed in the role of a developer
on preStart
{
ChkConfig_Init(“developer”);
}
ChkConfig_SetPrecision
CAPL Function Overview » Test Service Library » Configuration Functions » ChkConfig_SetPrecision
Function This function configures the TSL time basis for the current node. The time basis
(precision) affects all future times that are passed when creating checks, and it affects
the time basis for queries (status report functions).
This function allows you to configure the time basis for new checks to be created.
The time bases of checks that have already been created are not changed by this
function. They can be polled by a special query.
Parameters aPrecision
3 10 –3 seconds = ms (default)
4 10 –4 seconds
6 10 –6 seconds = us
7 10 –7 seconds
8 10 –8 seconds
9 10 –9 seconds = ns
5.0 — — •
Example
// precision of the test is set to us
chkConfig_SetPrecision(6);
ChkConfig_SetTitle
CAPL Function Overview » Test Service Library » Configuration Functions » ChkConfig_SetTitle
The check is displayed in the write window and the test report with this title.
Parameters aCheckId
aTitle
-1: Title could not be set due to invalid title parameter, e.g. empty title
7.1 — — •
Example
// set title of the check
dword mCheckId;
mCheckId = ChkCreate_Timeout(1000);
ChkConfig_SetTitle(mCheckId, "Check Timeout");
ChkControl_Start(mCheckId);
TestCheck tc;
tc = TestCheck::CreateTimeout(1000);
tc.SetTitle("Check Timeout");
tc.Start();
ChkControl_Destroy
CAPL Function Overview » Test Service Library » Commands to Control Checks » ChkControl_Destroy
As destructor check.Destroy()
Function The check is destroyed and cannot be accessed anymore. Its resources are freed.
Parameters aCheckId
Must exist
< 0: error
5.0 — — •
Example
dword checkId;
dword numCheckEvents;
// destroy check
ChkControl_Destroy(checkId);
ChkControl_Reset
CAPL Function Overview » Test Service Library » Commands to Control Checks » ChkControl_Reset
Method check.Reset()
Function The status (stored values) of the check is initialized. The check does not have to be
stopped for this function to work.
Parameters aCheckId
Must exist
< 0: error
5.0 — — •
Example
dword checkId;
dword numCheckEvents;
// analysis of check
numCheckEvents = ChkQuery_NumEvents(checkId);
if (numCheckEvents > 0)
TestStepFail("Error Frame occurred!");
ChkControl_Start
CAPL Function Overview » Test Service Library » Commands to Control Checks » ChkControl_Start
Method check.Start()
Function Begin or continue checking the event condition. May work on a check stopped earlier, or
on a check only created previously (e.g. in 'on prestart'). Ignored for active checks.
Parameters aCheckId
Must exist
< 0: error
5.0 — — •
Example
dword checkId;
dword numCheckEvents;
// analysis of check
numCheckEvents = ChkQuery_NumEvents(checkId);
if (numCheckEvents > 0)
TestStepFail("Error Frame occurred!");
// destroy check
ChkControl_Destroy(checkId);
ChkControl_Stop
CAPL Function Overview » Test Service Library » Commands to Control Checks » ChkControl_Stop
Method check.Stop()
Parameters aCheckId
Must exist
< 0: error
5.0 — — •
Example
dword checkId;
dword numCheckEvents;
// analysis of check
numCheckEvents = ChkQuery_NumEvents(checkId);
if (numCheckEvents > 0)
TestStepFail("Error Frame occurred!");
// destroy check
ChkControl_Destroy(checkId);
ChkCreate_AllNodesBabbling, ChkStart_AllNodesBabbling
CAPL Function Overview » Test Service Library » Checks » ChkCreate_AllNodesBabbling, ChkStart_AllNodesBabbling
Function There is a time interval where transmissions are tolerated. After the interval has
been passed, all nodes may no longer send messages. From now on, each transmission
of the nodes is reported.
If the min. quiet time is 0, then each message sent by any node leads to the event.
Possible application:
Supervises the end of a communication.
Supervises the transition of nodes’ or busses’ state to "sleep active".
Gateway nodes require that the bus context corresponds to the network that is being
observed.
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters aMinQuietTime
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned
(handle-) value.
Check-specific ChkQuery_EventInterval
queries
ChkQuery_EventMessageId
ChkQuery_EventMessageName
Example
// checks that after 300 ms no transmission are available
checkId = ChkStart_AllNodesBabbling(300);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_AllNodesDead, ChkStart_AllNodesDead
CAPL Function Overview » Test Service Library » Checks » ChkCreate_AllNodesDead, ChkStart_AllNodesDead
Function All monitored nodes must send at least one of their Tx messages within a specified
interval. Otherwise an event will be triggered.
Each node is checked separately, so a dead node is recognized even if others are
alive.
Gateway nodes require that the bus context corresponds to the network that is being
observed.
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters aMaxQuietTime
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword] > 0: Check was created successfully and may be referenced using the returned
(handle-) value.
Check-specific ChkQuery_EventInterval
queries
Example
// checks that at least one message is sent in each 100 ms
checkId = ChkStart_AllNodesDead (100);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_BurstTimeLimitViolation, ChkStart_BurstTimeLimitViolation
CAPL Function Overview » Test Service Library » Checks » ChkCreate_BurstTimeLimitViolation, ChkStart_BurstTimeLimitViolation
Parameters aBusName
aMaxTime
Maximum burst time. Default unit [ms], if not changed with ChkConfig_SetPrecision.
Return values 0: Check could not be created and must not be referenced
CheckId [dword] > 0: Check was created successfully and may be referenced using the returned
(handle-) value
Possible errors Bus name is not available for the test module.
Maximum burst time is 0.
Check-specific —
queries
7.5 CAN — •
Example
// observes the maximum burst time 3 ms
checkId = ChkStart_BurstTimeLimitViolation ("CAN", 3);
TestAddCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_ErrorFramesOccured, ChkStart_ErrorFramesOccured
CAPL Function Overview » Test Service Library » Checks » ChkCreate_ErrorFramesOccured, ChkStart_ErrorFramesOccured
Function Checks the occurrence of error frames on the bus. The event is generated if fewer than
MinCountOfErrorFrames or more than MaxCountOfErrorFrames are received.
Parameters MinCountOfErrorFrames
MaxCountOfErrorFrames
Timeout
The check is automatically stopped after this time. The check is no longer in progress.
If the timeout is specified with zero, it behaves like all other checks. It runs until the
ChkControl_Stop(id) function is called.
CaplCallbackFunction
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
5.2 CAN — •
Example
// observes that less than 3 Error Frames occurs
checkId = ChkStart_ErrorFramesOccured (0, 2);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_InconsistentDLC, ChkStart_InconsistentDLC
CAPL Function Overview » Test Service Library » Checks » ChkCreate_InconsistentDLC, ChkStart_InconsistentDLC
The check condition is violated if the DLC of the message does not agree with the
specified DLC of the database.
Can only be started in the "on start" area of CAPL or during the measurement. However,
the check may be set up as early as in the "pre start" area.
The numeric functions/constructors with the parameter 'aMessageId' cannot be used for
FlexRay. Instead use the numeric constructors with the parameter 'slotID' (that can only
be applied to a FlexRay bus).
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters aMessage
aCallback
aMessageId
slotID
cycleOffs
This value must be smaller than the repetition factor and lies in the range between 0
and 63.
This value, together with the repetition factor, determines the "Cycle Multiplexing" of a
FlexRay frame.
cycleRep
This value, together with the base cycle, determines the "Cycle Multiplexing" of a
FlexRay frame.
channelMask
Identifies the FlexRay channel of the communication controller. A value of 1 will check
the frame on channel A, 2 will check it on channel B and 3 on any channel (A/B).
Return values 0: Check could not be created and may not be referenced.
CheckId [dword]
> 0: Check was created successfully and can be referenced with the help of the
returned (Handle) value.
Possible errors Specified message object does not exist in the database.
Example
// checks the DLC of the message
checkId = ChkStart_InconsistentDlc (MsgToObserve);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_InconsistentRxDLC, ChkStart_InconsistentRxDLC
CAPL Function Overview » Test Service Library » Checks » ChkCreate_InconsistentRxDLC, ChkStart_InconsistentRxDLC
The check condition is violated if the DLC of the message does not agree with the DLC
specified in the database.
Can only be started in the "on start" area of CAPL or during the measurement.
However, the check may be set up as early as in the "pre start" area.
Parameters aNode
aCallback
Return values 0: Check could not be created and may not be referenced.
CheckId [dword] > 0: Check was created successfully and can be referenced with the help of the
returned (Handle) value.
Possible errors Specified node object does not exist in the database.
Example
// checks the DLC of all Rx messages of the node
checkId = ChkStart_InconsistentRxDlc (NodeToObserve);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_InconsistentTxDLC, ChkStart_InconsistentTxDLC
CAPL Function Overview » Test Service Library » Checks » ChkCreate_InconsistentTxDLC, ChkStart_InconsistentTxDLC
The check condition is violated if the DLC of the message does not agree with the DLC
specified in the database.
Can only be started in the "on start" area of CAPL or during the measurement.
However, the check may be set up as early as in the "pre start" area.
Parameters aNode
aCallback
Return values 0: Check could not be created and may not be referenced.
> 0: Check was created successfully and can be referenced with the help of the
returned (Handle) value.
Possible errors Specified node object does not exist in the database.
Example
// checks the DLC of all Tx messages of the node
checkId = ChkStart_InconsistentTxDlc (NodeToObserve);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MostCriticalUnlock, ChkStart_MostCriticalUnlock
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MostCriticalUnlock, ChkStart_MostCriticalUnlock
dword ChkStart_MostCriticalUnlock()
As constructor TestCheck::CreateMostCriticalUnlock()
function
TestCheck::StartMostCriticalUnlock()
TestCheck::CreateMostCriticalUnlock(Callback aCallback)
TestCheck::StartMostCriticalUnlock(Callback aCallback)
This check always works on events. Therefore, it will not detect a current
"CriticalUnlock" state, if this state has been entered before the check’s activation.
Parameters aCallback
Return values 0: Check could not be created and must not be referenced
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
5.0 MOST — •
Example
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MostErrorMessage, ChkStart_MostErrorMessage
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MostErrorMessage, ChkStart_MostErrorMessage
Function This check can be used to monitor the occurrence of MOST error messages (OpType 0xF
or 0x9).
The check can be implemented for a MOST device address, function block or function.
In addition, monitoring can be limited to error messages with a specific error code.
Parameters aSourceDeviceAddress
Device node address for which the occurrence of error messages is to be monitored,
i.e., only those error messages with a source address equal to the value specified here
are taken into consideration.
aName
Symbolic FBlock or function address for which the occurrence of error messages is to be
monitored. The following formats are allowed (wildcards are not permitted):
• "FBlock.Instance.Function”
• "FBlock.Function"
• "FBlock"
aInstance
aErrorCode
The error code that must be set in an observed error message in order for a check
violation to be triggered.
If 0 is specified, all error messages are monitored regardless of their error codes.
aCallback
Name of the callback function to be called when an error message with the specified
criteria occurs.
Return values 0: Check was not created and may not be referenced.
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
6.0 MOST — •
Example
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MostLightOff, ChkStart_MostLightOff
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MostLightOff, ChkStart_MostLightOff
dword ChkStart_MostLightOff()
As constructor TestCheck::CreateMostLightOff()
function
TestCheck::StartMostLightOff()
TestCheck::CreateMostLightOff(Callback aCallback)
TestCheck::StartMostLightOff(Callback aCallback)
A "LightOff" event occurs if the hardware connected to the channel no longer receives
light at the input.
Parameters aCallback
Name of the callback function, which should be called as soon as a "LightOff" event
occurs.
Return values 0: Check could not be created and must not be referenced
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
5.2 MOST — •
Example
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MostMethodProtocolError,
ChkStart_MostMethodProtocolError
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MostMethodProtocolError, ChkStart_MostMethodProtocolError
Function This check monitors MOST protocol compliance for a given method supporting the
optypes "StartResult" or "StartResultAck". This includes monitoring of the messages
sequences and timeout conditions on answer times and send intervals.
Parameters aMethod
• FBlock.InstanceID.Function
• FBlock.Function
aInstanceID
aTimeoutWaitForProcessing1
Signatures that do not provide this parameter, assume the maximum value of 250 ms
given for tWaitForProcessing1 in the MOST specification.
aTimeoutWaitForProcessing2
Timeout to wait for the following Processing messages. The unit can be set with
ChkConfig_SetPrecision.
Signatures that do not provide this parameter, assume the typical value of 200 ms given
for tWaitForProcessing2 in the MOST specification.
aTimeoutMaxDuration
Maximum response time for the observed method to return a "Result"/ "Resul-tAck" or
"Error"/ "ErrorAck" message. The unit can be set with ChkConfig_SetPrecision.
aCallback
Name of the callback function, which should be called as soon as a protocol violation is
detected.
In simulation nodes this parameter has to be set. In test modules this parameter is
optional.
Return values 0: Check could not be created and must not be referenced
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
Check-specific ChkQuery_NumRequests
queries
ChkQuery_NumTimedoutRequests
ChkQuery_RequestDstAdr
ChkQuery_RequestFBlockId
ChkQuery_RequestFunctionId
ChkQuery_RequestInstId
ChkQuery_RequestOpType
ChkQuery_RequestSrcAdr
ChkQuery_RequestTimestamp
ChkQuery_StatAvResponseTime
ChkQuery_StatMaxValidResponseTime
7.0 MOST — •
Example
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MostNetState, ChkStart_MostNetState
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MostNetState, ChkStart_MostNetState
Function This check is used to monitor the NetState state of the MOST hardware interface.
Concrete checks can be implemented for any NetState state changes, and are triggered
when a NetState event having the corresponding target state occurs with a specified
initial state.
The wildcard value –1 can be specified for one of the netstate parameters, if the check
should monitor only the beginning or ending of a netstate. Both parameters can be set
to wildcard value, if the check should detect any occurring netstate change.
This check always works on events. Therefore, it will not detect a current netstate that
has been established before the time of the check’s activation, as a new netstate.
Parameters aCallback
Name of the callback function that is to be called when a specified state change
occurs. This parameter must be set for simulation nodes; it is optional for test modules.
aOldState
0 MostNetState_Undefined
2 MostNetState_PowerOff
3 MostNetState_NetInterfaceInit
4 MostNetState_ConfigNotOk
5 MostNetState_ConfigOk
aNewState
Target state of the state change to be monitored. Possible values the same as those for
aOldState.
Return values 0: Check could not be created and must not be referenced
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
6.0 MOST — •
Example
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MostPropertyProtocolError,
ChkStart_MostPropertyProtocolError
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MostPropertyProtocolError, ChkStart_MostPropertyProtocolError
TestCheck::CreateMostPropertyProtocolError(char[] aProperty)
TestCheck::StartMostPropertyProtocolError(char[] aProperty)
Function This check monitors MOST protocol compliance for a given property. This includes
monitoring the response times along with the allowable message sequences.
Parameters aProperty
• FBlock.InstanceId.Function
• FBlock.Function
aInstanceID
aAnswerTimeout
Maximum response time [ms], within which a response message for a request message
is expected. Signatures that these parameters do not provide, assume the minimum
standard value tWaitForProperty = 250 ms as response time (see MOST specification
2.4).
aCallback
Name of the callback function, which should be called as soon as a protocol violation is
detected.
Return values 0: Check could not be created and must not be referenced
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
Check-specific ChkQuery_NumRequests
queries
ChkQuery_NumTimedoutRequests
ChkQuery_RequestDstAdr
ChkQuery_RequestFBlockId
ChkQuery_RequestFunctionId
ChkQuery_RequestInstId
ChkQuery_RequestOpType
ChkQuery_RequestSrcAdr
ChkQuery_RequestTimestamp
ChkQuery_StatAvResponseTime
ChkQuery_StatMaxValidResponseTime
ChkQuery_StatMinResponseTime
5.2 MOST — •
Example
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MostShortUnlock, ChkStart_MostShortUnlock
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MostShortUnlock, ChkStart_MostShortUnlock
dword ChkStart_MostShortUnlock()
As cunstructor TestCheck::CreateMostShortUnlock()
function
TestCheck::StartMostShortUnlock()
TestCheck::CreateMostShortUnlock(Callback aCallback)
TestCheck::StartMostShortUnlock(Callback aCallback)
This check always works on events. Therefore, it will not detect a current "ShortUnlock"
state, if this state has been entered before the check’s activation.
Parameters aCallback
Name of the callback function, which should be called as soon as a "LightOff" event
occurs.
Return values 0: Check could not be created and must not be referenced
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
5.2 MOST — •
Example
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MostStableLock, ChkStart_MostStableLock
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MostStableLock, ChkStart_MostStableLock
A "StableLock" event is generated as soon as the hardware has been in the "Lock"
condition for a period of time equal to or longer than tLock (see MOST Specification V
2.4), provided that no "Unlock" events have occurred.
This check always works on events. Therefore, it will not detect a current "StableLock"
state, if this state has been entered before the check’s activation.
Parameters aCallback
Name of the callback function, which should be called as soon as a "StableLock" event
occurs.
Return values 0: Check could not be created and must not be referenced
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
5.2 MOST — •
Example
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MsgAbsCycleTimeViolation,
ChkStart_MsgAbsCycleTimeViolation
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MsgAbsCycleTimeViolation, ChkStart_MsgAbsCycleTimeViolation
Event is generated if the time between sends of the message is smaller than
aMinCycleTime or larger than aMaxCycleTime.
Not to be checked limits are set to 0; there must be at least on limit specified.
Can be started only in the 'on start' section of CAPL or during measurement.
The numeric constructors with the parameter 'slotID' can only be applied to a FlexRay
bus.
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters aObservedMessage
Must exist in DB
aMinCycleTime
aMaxCycleTime
aCallback
slotID
cycleOffs
This value must be smaller than the repetition factor and lies in the range between 0
and 63.
This value, together with the repetition factor, determines the "Cycle Multiplexing" of a
FlexRay frame.
cycleRep
This value, together with the base cycle, determines the "Cycle Multiplexing" of a
FlexRay frame.
channelMask
Identifies the FlexRay channel of the communication controller. A value of 1 will check
the frame on channel A, 2 will check it on channel B and 3 on any channel (A/B).
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
Check-specific ChkQuery_EventInterval
errors
ChkQuery_EventMessageId
ChkQuery_EventMessageName
Example
// checks the cycle time of the message
checkId = ChkStart_MsgAbsCycleTimeViolation (MsgToObserve, 90, 110);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MsgDistViolation, ChkStart_MsgDistViolation
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MsgDistViolation, ChkStart_MsgDistViolation
Function Event is generated if the time interval that starts on receipt of the reference message
and ends with the receipt of the observed message is smaller than aMinDistance or is
larger than aMaxDistance.
The numeric constructors with the parameter 'slotID1/2' can only be applied to a
FlexRay bus.
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters aReferenceMessage
Must exist in DB
aObservedMessage
Must exist in DB
aMinDistance
aMaxDistance
aCallback
aReferenceBus
aObservedBus
slotID1/2
cycleOffs1/2
This value must be smaller than the repetition factor and lies in the range between 0
and 63.
This value, together with the repetition factor, determines the "Cycle Multiplexing" of a
FlexRay frame.
cycleRep1/2
This value, together with the base cycle, determines the "Cycle Multiplexing" of a
FlexRay frame.
channelMask1/2
Identifies the FlexRay channel of the communication controller. A value of 1 will check
the frame on channel A, 2 will check it on channel B and 3 on any channel (A/B).
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
Check-specific ChkQuery_EventInterval
queries
ChkQuery_EventMessageId
ChkQuery_EventMessageName
Example
// checks the distance between two messages
checkId = ChkStart_MsgDistViolation (ReferenceMsg, MsgToObserve, 90,
110);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MsgOccurrenceCount, ChkStart_MsgOccurrenceCount
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MsgOccurrenceCount, ChkStart_MsgOccurrenceCount
Function Checks the absence of the specified message on the bus. An event is created if more
than aMaxCount of the specified message were sent.
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters aMessage
aMessageId
aMaxCount
The maximum number of message that may be sent without the check to fail.
aSourceAdr
aDestAdr
aSymbolicMsg
Symbolic message definition of the message which has to be monitored in the format
"FBlock.Function.OpType". Widcards can also be used (e.g. "AudioDiskPlayer.*.Status").
aInstanceId
slotID
cycleOffs
This value must be smaller than the repetition factor and lies in the range between 0
and 63.
This value, together with the repetition factor, determines the "Cycle Multiplexing" of a
FlexRay frame.
cycleRep
This value, together with the base cycle, determines the "Cycle Multiplexing" of a
FlexRay frame.
channelMask
Identifies the FlexRay channel of the communication controller. A value of 1 will check
the frame on channel A, 2 will check it on channel B and 3 on any channel (A/B).
aNode
aCaplCallbackFunction
Return values 0: Check could not be created and may not be referenced.
CheckId [dword]
> 0: Check was created successfully and can be referenced with the help of the
returned (Handle) value.
Check-specific ChkQuery_EventMessageId
queries
Example
// checks that the message is sent less than 3 times
checkId = ChkStart_MsgOccurrenceCount (MsgToObserve, 2);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MsgRelCycleTimeViolation,
ChkStart_MsgRelCycleTimeViolation
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MsgRelCycleTimeViolation, ChkStart_MsgRelCycleTimeViolation
Event is generated if the time between sends of the message is smaller than
minRelCycleTime * GenMsgCycleTime (DB-attribute) or larger than maxRelCycleTime *
GenMsgCycleTime.
Not to be checked limits are set to 0; there must be at least one limit specified.
Can be started only in the 'on start' section of CAPL or during measurement.
The numeric constructors with the parameter 'slotID' can only be applied to a FlexRay
bus.
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters aObservedMessage
Must exist in DB
aMinRelCycleTime
aMaxRelCycleTime
aCallback
slotID
cycleOffs
This value must be smaller than the repetition factor and lies in the range between 0
and 63.
This value, together with the repetition factor, determines the "Cycle Multiplexing" of a
FlexRay frame.
cycleRep
This value, together with the base cycle, determines the "Cycle Multiplexing" of a
FlexRay frame.
channelMask
Identifies the FlexRay channel of the communication controller. A value of 1 will check
the frame on channel A, 2 will check it on channel B and 3 on any channel (A/B).
Return values 0: Check could not be created and must not be referenced
CheckId [dword] > 0: Check was created successfully and may be referenced using the returned (handle-
) value
There are messages specified as cyclic but the cycle time is 0 or not available
Check-specific ChkQuery_EventInterval
queries
ChkQuery_EventMessageId
ChkQuery_EventMessageName
Example
// checks the cycle time of the message
checkId = ChkStart_MsgRelCycleTimeViolation (MsgToObserve, 0.9, 1.1);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MsgRelOccurrenceViolation,
ChkStart_MsgRelOccurrenceViolation
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MsgRelOccurrenceViolation,
ChkStart_MsgRelOccurrenceViolation
The check condition is violated if the time between transmissions of the message is less
than aMinRelCycleTime * GenMsgDelayTime or greater than aMaxRelCycleTime * Cycle
Time.
Cycle time is calculated from GenMsgCycleTime and GenSigCycleTime.
Limits that should not be checked must be set to 0. At least one limit must be
specified.
Can only be started in the "on start" area of CAPL or during the measurement. However,
the check may be set up as early as in the "pre start" area.
The numeric functions/constructors with the parameter 'aMessageId' cannot be used for
FlexRay. Instead use the numeric constructors with the parameter 'slotID' (that can only
be applied to a FlexRay bus).
Parameters observedMessage
aMinRelCycleTime
aMaxRelCycleTime
aCallback
aMessageId
slotID
cycleOffs
This value must be smaller than the repetition factor and lies in the range between 0
and 63.
This value, together with the repetition factor, determines the "Cycle Multiplexing" of a
FlexRay frame.
cycleRep
This value, together with the base cycle, determines the "Cycle Multiplexing" of a
FlexRay frame.
channelMask
Identifies the FlexRay channel of the communication controller. A value of 1 will check
the frame on channel A, 2 will check it on channel B and 3 on any channel (A/B).
Return values 0: Check could not be created and may not be referenced.
CheckId [dword] > 0: Check was created successfully and can be referenced by the returned (Handle)
value.
Messages were specified as periodic, but their cycle time is either 0 or unavailable.
Check-specific ChkQuery_EventInterval
queries
ChkQuery_EventMessageNam
Example
// checks the periodic occurrence of the message
checkId = ChkStart_MsgRelOccurrenceViolation (MsgToObserve, 0.9, 1.1);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MsgSignalValueInvalid, ChkStart_MsgSignalValueInvalid
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MsgSignalValueInvalid, ChkStart_MsgSignalValueInvalid
Function Check the value of a signal, of an environment variable or a system variable. The value
should be outside the given value range (inclusive the limits).
An event will be generated, if the value of the physical signal, the environment
variable or the system variable is inside the given value range.
Parameters aObservedSignal
aMessageName
aSignalName
EnvVarName
aSysVar
aMinValue
aMaxValue
aCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
Check-specific ChkQuery_EventMessageId
queries
ChkQuery_EventMessageName
ChkQuery_EventSignalValue
5.0 — — •
SP3
Example
// checks the value of the signal (should be outside the given range)
checkId = ChkStart_MsgSignalValueInvalid (SignalToObserve, 2.5, 3.7);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_MsgSignalValueRangeViolation,
ChkStart_MsgSignalValueRangeViolation
CAPL Function Overview » Test Service Library » Checks » ChkCreate_MsgSignalValueRangeViolation,
ChkStart_MsgSignalValueRangeViolation
Function Checks the value of a signal, an environment variable or a system variable. The value
should be inside the given value range (inclusive the limits).
An event will be generated, if the value of physical signal, the environment variable or
the system variable is outside the given value range.
Parameters aObservedSignal
aMessageName
aSignalName
EnvVarName
aSysVar
aMinValue
aMaxValue
aCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword] > 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventMessageId
queries
ChkQuery_EventMessageName
ChkQuery_EventSignalValue
5.0 — — •
Example
// checks the value of the signal (should be inside the given range)
checkId = ChkStart_MsgSignalValueRangeViolation (SignalToObserve, 2.5,
3.7);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_NodeBabbling, ChkStart_NodeBabbling
CAPL Function Overview » Test Service Library » Checks » ChkCreate_NodeBabbling, ChkStart_NodeBabbling
Function This check supervises the end of a communication: There is a time interval where node-
transmissions are tolerated. After the interval has been passed, the node may no longer
send messages. From now on, each transmission of the node is reported.
If the min. quiet time is 0, then each message sent by the node leads to the event.
Use Cases:
Supervise the transition of nodes’ or busses’ state to 'sleep active'.
Gateway nodes require that the bus context corresponds to the bus that is being
observed. This means that the check only works correctly if the current bus context
corresponds to the database in which the node is defined.
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters n
Must exist in DB
aMinQuietTime
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
Check-specific ChkQuery_EventInterval
queries
ChkQuery_EventMessageId
ChkQuery_EventMessageName
Example
// checks that after 300 ms no transmission of the node is available
checkId = ChkStart_NodeBabbling(NodeToObserve, 300);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_NodeDead, ChkStart_NodeDead
CAPL Function Overview » Test Service Library » Checks » ChkCreate_NodeDead, ChkStart_NodeDead
Function All monitored nodes must send at least one of their Tx messages within a specified
interval. Otherwise an event will be triggered.
Gateway nodes require that the bus context corresponds to the bus that is being
observed. This means that the check only works correctly if the current bus context
corresponds to the database in which the node is defined.
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters n
Must exist in DB
aMaxQuietTime
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
Check-specific ChkQuery_EventInterval
queries
Example
// checks that at least one message of the node is sent in each 100 ms
checkId = ChkStart_NodeDead (100);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_NodeMsgsAbsDistViolation, ChkStart_
NodeMsgsAbsDistViolation
CAPL Function Overview » Test Service Library » Checks » ChkCreate_NodeMsgsAbsDistViolation, ChkStart_ NodeMsgsAbsDistViolation
Function This check allows the supervision of the minimum send distance of all Tx-messages of a
node on one bus.
If no rating period and maximal number of distance undercuts is specified, the check
condition fails if the time interval between two messages of the node undercuts the
MinTime.
If the rating period and the maximal number of distance undercuts (> 0) are specified,
the check observes the number of distance undercuts in a time slot. Exceeds the
number of distance undercuts the allowed number in a time slot, the check fails.
Parameters aNode
Must exist in DB. For Gateways the node name has to be prefixed by the bus name.
aMinTime
aViolationsMaxCount
aRatingPeriod
Duration of the time slot, in which the maximal allowed number of distance undercuts
is checked.
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
Example
// checks the send distance between all Tx messages of the node
checkId = ChkStart_NodeMsgsAbsDistViolation(NodeToObserve, 30, 2, 40);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_NodeMsgsRelCycleTimeViolation,
ChkStart_NodeMsgsRelCycleTimeViolation
CAPL Function Overview » Test Service Library » Checks » ChkCreate_NodeMsgsRelCycleTimeViolation,
ChkStart_NodeMsgsRelCycleTimeViolation
Function Checks the occurrences of cyclic messages of the given send node.
Event is generated if the time between sends of the (same) message is smaller than
minRelCycleTime * GenMsgCycleTime (DB-attribute) or larger than maxRelCycleTime *
GenMsgCycleTime.
Not to be checked limits are set to 0; there must be at least on limit specified.
Not checked are send messages with a specified cycle time equal to 0 or network
management messages or diagnostic messages.
For FlexRay only valid data frames and PDUs are recognized as communication, Null
frames and Erroneous frames are ignored.
Parameters aNode
Must exist in DB
aMinRelCycleTime
aMaxRelCycleTime
aCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
There are messages specified as cyclic but the cycle time is 0 or not available
Check-specific ChkQuery_EventInterval
queries
ChkQuery_EventMessageId
ChkQuery_EventMessageName
Example
// checks the cycle time of all messages of the node
checkId = ChkStart_NodeMsgsRelCycleTimeViolation (NodeToObserve, 0.9,
1.1);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_NodeMsgsRelOccurrenceViolation,
ChkStart_NodeMsgsRelOccurrenceViolation
CAPL Function Overview » Test Service Library » Checks » ChkCreate_NodeMsgsRelOccurrenceViolation,
ChkStart_NodeMsgsRelOccurrenceViolation
Function Checks for the occurrence of periodic message of the specified send node.
The check condition is violated if the time between transmissions of the message is less
than aMinRelCycleTime * GenMsgDelayTime or greater than aMaxRelCycleTime * Cycle
Time.
Cycle time is calculated from GenMsgCycleTime and GenSigCycleTime.
Limits that should not be checked must be set to 0. At least one limit must be
specified.
Can only be started in the "on start" area of CAPL or during the measurement. However,
the check may be set up as early as in the "pre start" area.
Parameters observedNode
aminRelCycleTime
aMaxRelCycleTime
aCallback
Return values 0: Check could not be created and may not be referenced.
CheckId [dword] > 0: Check was created successfully and can be referenced with the help of the
returned (Handle) value.
Messages were specified as cyclic, but their cycle times are either 0 or unavailable.
Check-specific ChkQuery_EventInterval
queries
ChkQuery_EventMessageName
Example
// checks the periodic occurrence of all messages of the node
checkId = ChkStart_NodeMsgsRelOccurrenceViolation (NodeToObserve, 0.9,
1.1);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_SignalValueChange, ChkStart_SignalValueChange
CAPL Function Overview » Test Service Library » Checks » ChkCreate_SignalValueChange, ChkStart_SignalValueChange
Parameters aObservedSignal
EnvVarName
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
Check-specific ChkQuery_EventMessageId
queries
ChkQuery_EventMessageName
ChkQuery_EventSignalValue
Example
// checks that there is no change of the value of the signal
checkId = ChkStart_SignalValueChange (SignalToObserve);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_Timeout, ChkStart_Timeout
CAPL Function Overview » Test Service Library » Checks » ChkCreate_Timeout, ChkStart_Timeout
Parameters aTimeout
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword] > 0: Check was created successfully and may be referenced using the returned (handle-
) value
Example
// checks the maximum duration of a sequence of actions
checkId = ChkStart_Timeout (2000);
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkCreate_UndefinedMessageReceived,
ChkStart_UndefinedMessageReceived
CAPL Function Overview » Test Service Library » Checks » ChkCreate_UndefinedMessageReceived,
ChkStart_UndefinedMessageReceived
Function Observes the current bus and reports messages that are not defined.
If the CANoe configuration contains multiple buses, the current bus context has to be
specified (SetBusContext) before the check configuration.
For FlexRay either only valid data frames or PDUs (according to the database type) are
recognized as communication. Null frames and Erroneous frames are ignored.
Caution
For a FlexRay PDU database this check also ignores all received frames! For
a PDU database only PDUs are considered. For a FlexRay PDU database this
test makes no sense, because only those PDUs, which are defined in the
database, can be retrieved from frames. There cannot exist PDUs that are
not defined in the database! Therefore, for a PDU database this check will
always pass.
Parameters CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value
Example
// observes the bus ‘CAN1’ for undefined messages
SetBusContext(getBusNameContext("CAN1"));
checkId = ChkStart_UndefinedMessageReceived();
TestAddCondition(checkId);
// sequence of different actions and waiting conditions
TestWaitForTimeout(1000);
TestRemoveCondition(checkId);
checkId = ChkCreate_UndefinedMessageReceived("CallbackUnknownMsg");
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkQuery_EventInterval
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventInterval
Method check.QueryEventInterval()
Function Returns the last time-interval that has led to the event.
Parameters checkId
Return values -101: The interval for the last event has been started but not yet terminated.
ChkCreate_MsgRelCycleTimeViolation
ChkCreate_MsgRelOccurrenceViolation
ChkCreate_NodeMsgsRelCycleTimeViolation
ChkCreate_NodeMsgsRelOccurrenceViolation
ChkStart_SignalCycleTimeViolation
ChkStart_LINSchedTableViolation
ChkStart_LINSyncBreakTimingViolation
Result: Retrieves the value of the last measured length of the break low phase
ChkStart_LINSyncDelTimingViolation
Result: Retrieves the value of the last measured length of the break delimiter
ChkStart_LINDiagDelayTimesViolation
ChkStart_LINHeaderToleranceViolation
ChkStart_LINRespToleranceViolation
ChkStart_LINMasterInitTimeViolation
ChkStart_LINWakeupReqLengthViolation
ChkStart_LINWakeupRetryViolation
Result: Last measured timeout between two consecutive LIN WakeUp signals
5.0 — — •
Example
long result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_EventInterval(checkId);
Write("result = %d", result);
ChkQuery_EventMessageContents
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventMessageContents
Function Stores the data bytes of the message, for which the event has been sent, in the buffer
and returns the number of stored data bytes (DLC).
Parameters CheckId
buffer
bufferlen
Result: All data bytes of the LIN reconfiguration request, which caused the event
ChkStart_LINETFViolation
Result: All data bytes of the last invalid ETF single response
5.2 LIN — •
Example
ChkQuery_EventMessageId
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventMessageId
Method check.QueryEventMessageId()
Function Returns the Id of the message that has forced the event
Parameters aCheckId
ChkCreate_NodeMsgsRelCycleTimeViolation
ChkCreate_MsgDistViolation
ChkCreate_MsgSignalValueRangeViolation
ChkCreate_MsgSignalValueInvalid
ChkStart_LINRespErrorSignal
Result: the ID of the LIN frame carrying the fired Response_Error signal
ChkStart_LINHeaderToleranceViolation
Result: the ID of the last LIN frame with violated header length
ChkStart_LINSyncBreakTimingViolation
ChkStart_LINSyncDelTimingViolation
ChkStart_LINRespToleranceViolation
Result: the ID of the last LIN frame with violated response length
ChkStart_SignalCycleTimeViolation
Result: the ID of the last frame with a bad signal cycle time
ChkCreate_MsgOccurrenceCount
ChkStart_LINETFViolation
Result: the ID of the last LIN associated frame violating the process of collision
resolution (if applicable)
5.0 — — •
Example
long result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_EventMessageId(checkId);
Write("result = %d", result);
ChkQuery_EventMessageName
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventMessageName
Function Stores the name of the message, that has led to the event, in the buffer and returns
the length of the name, or 0 if specified for a range.
Parameters aCheckId
buffer
bufferlen
ChkCreate_MsgRelCycleTimeViolation
ChkCreate_MsgRelOccurrenceViolation
ChkCreate_NodeMsgsRelCycleTimeViolation
ChkCreate_NodeMsgsRelOccurrenceViolation
ChkCreate_MsgSignalValueRangeViolation
ChkCreate_MsgSignalValueInvalid
ChkStart_LINRespErrorSignal
Result: the name of the LIN frame carrying fired the Response_Error signal
ChkStart_LINRespToleranceViolation
Result: the name of the last LIN frame with violated response length
ChkStart_SignalCycleTimeViolation
Result: the name of the last frame with a bad signal cycle time
ChkStart_LINETFViolation
Result: the name of the last LIN associated frame violating the process of collision
resolution (if applicable)
5.0 — — •
Example
long result;
dword checkId;
char messageName[100];
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_EventMessageName(checkId, messageName, 100);
Write("result = %d", result);
ChkQuery_EventNodeName
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventNodeName
Function Stores the name of the node, for which the event has been sent, in the buffer and
returns the length of the name, or 0 if specified for a range of nodes.
Parameters CheckId
buffer
bufferlen
Result: Node name for which the diagnostic delay has been violated
ChkStart_LINRespToleranceViolation
ChkStart_LINRespErrorSignal
Result: the name of the node, for which the Response_Error has been notified
5.2 LIN — •
Example
ChkQuery_EventReason
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventReason
Method check.QueryEventReason()
Function Retrieves the exact reason of firing event in the LIN specific check.
Parameters CheckId
ChkStart_LINReconfRequestFormatViolation
Bit 9 BYTE Byte does not match (Conditional change NAD command)
ChkStart_LINSchedTableViolation
Result: 1 – Cannot synchronize during one cycle time; 2- Slot frame violated; 3- Slot
delay violated; 4- Invalid empty slot
ChkStart_LINETFViolation
Result: 1 – Invalid format of single response (PID doesn’t match); 2 - No response during
collision resolution; 3 - Wrong order of associated frames during collision resolution; 4 –
Too many associated frames during collision resolution; 5 – Collision resolution is
incomplete
ChkStart_LINWakeupRetryViolation
5.2 LIN — •
Example
testcase tcTSL_LINReconfRequest()
{
dword checkId;
long rqViolationReason;
checkId = ChkStart_LINReconfRequestFormatViolation();
testWaitForTimeout(5000);
ChkControl_Stop(checkId);
rqViolationReason = ChkQuery_EventReason(checkId);
if (rqViolationReason & 0x1)
{
testStep("Evaluation", "Initial NAD is out of range");
}
if (rqViolationReason & 0x2)
{
testStep("Evaluation", "NAD references undefined Slave");
}
if (rqViolationReason & 0x4)
{
testStep("Evaluation", "Supplier ID does not match");
}
if (rqViolationReason & 0x8)
{
testStep("Evaluation", "Function ID does not match");
}
if (rqViolationReason & 0x10)
{
testStep("Evaluation", "Variant ID does not match");
}
}
ChkQuery_EventSchedSlotIndex
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventSchedSlotIndex
Method check.QueryEventSchedSlotIndex()
Function Retrieves slot index of a schedule table for which the event has been sent.
Parameters CheckId
5.2 LIN — •
Example
ChkQuery_EventSignalValue
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventSignalValue
Function This function enables access to the signal value which was last reported by a check as
invalid.
The signature of the function with the same name without the pValue parameter
enables access only to positive signal values.
Parameters checkId
double *pValue
Info
Return values <= 0: Refers the query error codes in this chapter
ChkCreate_MsgSignalValueInvalid
5.0 — — •
Example
CallbackOnSignalXyzViolation(dword aCheckId)
{
double lBadValue[1]; // use an array to allow "call-by-reference";
lenght: 1 element
ChkQuery_EventSignalValue(aCheckId, lBadValue[0]);
write("Last bad signal value=%g", lBadValue[0]);
}
Method check.QueryEventSignalValue()
Function This function enables access to the signal value which was last reported by a check as
invalid.
Parameters checkId
Return values < 0: Refers the query error codes in this chapter
ChkCreate_MsgSignalValueInvalid
5.0 — — •
Example
double result;
dword checkId;
checkId = ChkStart_MsgSignalValueInvalid(Velocity, 80, 100);
// ... execute test sequenc
result = ChkQuery_EventSignalValue(checkId);
ChkQuery_EventStatus
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventStatus
Function Converts the status into a string that can be printed. Returns the number of characters
written (<= length).
Parameters aCheckId
aBuffer
aBufferLength
5.0 — — •
Example
long result;
dword checkId;
char eventStatus[256];
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_EventStatus(checkId, eventStatus, 256);
Write("result = %d", result);
Write("Event Status = %s", eventStatus);
ChkQuery_EventStatusToLog
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventStatusToLog
Method check.QueryEventStatusToLog()
Function Uses the output of ChkQuery_EventStatus and writes the result to the log file.
Parameters aCheckId
5.0 — — •
Example
long result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_EventStatusToLog(checkId);
ChkQuery_EventStatusToWrite
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventStatusToWrite
Method check.QueryEventStatusToWrite()
Function Uses the output of ChkQuery_EventStatus and writes the result to the write window.
Parameters aCheckId
5.0 — — •
Example
long result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_EventStatusToWrite(checkId);
ChkQuery_EventTimeStamp
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventTimeStamp
Method check.QueryEventTimestamp()
Parameters CheckId
> 0: Event timestamp in units set for the queried Check with ChkConfig_SetPrecision
5.2 — — •
Example
long result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_EventTimeStamp(checkId);
ChkQuery_EventTiming
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_EventTiming
Method check.QueryEventTiming()
Function Retrieves the timing value that has been violated in the LIN specific check.
Parameters checkId
ChkStart_LINSyncDelTimingViolation
ChkStart_LINMasterBaudrateViolation
5.2 LIN — •
Example
testcase tcTSL_LINSyncBreak()
{
dword checkId;
float lastMeasuredSyncBreakLength;
lastMeasuredSyncBreakLength = ChkQuery_EventTiming(checkId);
testStep("Evaluation", "Last measured sync break length is %.2f bits",
lastMeasuredSyncBreakLength);
}
ChkQuery_NumEvents
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_NumEvents
Method check.QueryNumEvents()
Function Returns the number of events generated by this check since its initialization.
Parameters aCheckId
5.0 — — •
Example
long result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_NumEvents(checkId);
ChkQuery_NumRequests
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_NumRequests
Method check.QueryNumRequests()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation check |
Function Returns the total number of requests that occurred during the current observation period.
Parameters aCheckId
6.0 MOST — •
Example
ChkQuery_NumTimedoutRequests
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_NumTimedoutRequests
Method check.QueryNumTimedoutRequests()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation check |
Function Returns the number of requests within the current observation period for which no
corresponding response message was observed during the specified timeout.
Parameters aCheckId
6.0 MOST — •
Example
ChkQuery_Precision
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_Precision
Method check.QueryPrecision()
Function Returns a factor that can be multiplied with the return value of the statistical queries to
convert the timestamp to the standard unit milliseconds.
Parameters aCheckId
5.0 — — •
Example
double result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_Precision(checkId);
ChkQuery_RequestDstAdr
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_RequestDstAdr
Method check.QueryRequestDstAdr()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation
check |
Function Returns the destination address of the request message, which last led to a protocol
violation.
Parameters aCheckId
5.2 MOST — •
Example
ChkQuery_RequestFBlockId
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_RequestFBlockId
Method check.QueryRequestFBlockId()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation
check |
Function Returns the FBlock of the request message, which last led to a protocol violation.
Parameters aCheckId
5.2 MOST — •
Example
ChkQuery_RequestFunctionId
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_RequestFunctionId
Method check.QueryRequestFunctionId()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation
check |
Function Returns the function of the request message, which last led to a protocol violation.
Parameters aCheckId
5.2 MOST — •
Example
ChkQuery_RequestInstId
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_RequestInstId
Method check.QueryRequestInstId()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation
check |
Function Returns the InstanceId of the request message, which last led to a protocol violation.
Parameters aCheckId
>= 0: InstanceId.
5.2 MOST — •
Example
ChkQuery_RequestOpType
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_RequestOpType
Method check.QueryRequestOpType()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation
check |
Function Returns the OpType of the request message, which last led to a protocol violation.
Parameters aCheckId
5.2 MOST — •
Example
ChkQuery_RequestSrcAdr
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_RequestSrcAdr
Method check.QueryRequestSrcAdr()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation
check |
Function Returns the source address of the request message, which last led to a protocol
violation.
Parameters aCheckId
5.2 MOST — •
Example
ChkQuery_RequestTimestamp
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_RequestTimestamp
Method check.QueryRequestTimestamp()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation
check |
Function Returns the reception time stamp of the request message, which last led to a protocol
violation.
Parameters aCheckId
5.2 MOST — •
Example
ChkQuery_StatAvResponseTime
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatAvResponseTime
Method check.QueryStatAvResponseTime()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation check |
Function Returns the average time lag between the request and corresponding response messages.
Only those requests that were resolved within the specified maximum response time are
taken into consideration here.
Parameters aCheckId
6.0 • MOST — •
• Test modules
Example
ChkQuery_StatEventFreePeriodAvg
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatEventFreePeriodAvg
Method check.QueryStatEventFreePeriodAvg()
Function Returns the average timely distance between events and check starts/stops.
Info
Among other things with this function the average cycle time of a cyclic
message can be queried.
Parameters aCheckId
Info
5.0 — — •
Example
double result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_StatEventFreePeriodAvg(checkId);
ChkQuery_StatEventFreePeriodMax
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatEventFreePeriodMax
Method check.QueryStatEventFreePeriodMax()
Function Returns the maximum timely distance between events and check starts/stops.
Parameters aCheckId
Info
5.0 — — •
Example
double result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_StatEventFreePeriodMax(checkId);
ChkQuery_StatEventFreePeriodMed
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatEventFreePeriodMed
Method check.QueryStatEventFreePeriodMed()
Function Returns the average timely distance between events and check starts/stops.
Parameters aCheckId
Info
5.0 — — •
Example
double result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_StatEventFreePeriodMed(checkId);
ChkQuery_StatEventFreePeriodMin
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatEventFreePeriodMin
Method check.QueryStatEventFreePeriodMin()
Function Returns the minimum timely distance between events and check starts/stops.
Parameters aCheckId
Info
5.0 — — •
Example
double result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_StatEventFreePeriodMin(checkId);
ChkQuery_StatMaxValidResponseTime
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatMaxValidResponseTime
Method check.QueryStatMaxValidResponseTime()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation check |
Function Returns the longest time lag between the request and corresponding response message
that occurred during the current observation period. Only those requests that were
resolved within the specified maximum response time are taken into consideration here.
Parameters aCheckId
6.0 MOST — •
Example
ChkQuery_StatMinResponseTime
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatMinResponseTime
Method check.QueryStatMinResponseTime()
Check name | MOST Property Protocol Observation check | MOST Method Protocol Observation check |
Function Returns the shortest time lag between the request and corresponding response message
that occurred during the current observation period.
Parameters aCheckId
6.0 • MOST — •
• Test modules
Example
ChkQuery_StatNumProbes
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatNumProbes
Method check.QueryStatNumProbes()
Function Returns the number of probes (measurements) that have been considered by the check. In
general this is the count of messages that have been analyzed by the check.
Parameters aCheckId
5.1 — — •
Example
long result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_StatNumProbes(checkId);
ChkQuery_StatProbeIntervalAvg
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatProbeIntervalAvg
Method check.QueryStatProbeIntervalAvg()
Function Returns the average timely distance between 2 consumed message events.
Parameters aCheckId
Info
5.1 — — •
Example
double result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_StatProbeIntervalAvg(checkId);
ChkQuery_StatProbeIntervalMax
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatProbeIntervalMax
Method check.QueryStatProbeIntervalMax()
Function Returns the maximum timely distance between 2 consumed message events.
Info
Among other things with this function this function the maximum occurred
cycle time of a cyclic message can be queried.
Parameters aCheckId
Info
5.1 — — •
Example
double result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_StatProbeIntervalMax(checkId);
ChkQuery_StatProbeIntervalMin
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_StatProbeIntervalMin
Method check.QueryStatProbeIntervalMin()
Function Returns the minimum timely distance between 2 consumed message events.
Info
Among other things with this function this function the minimum occurred
cycle time of a cyclic message can be queried.
Parameters aCheckId
Info
5.1 — — •
Example
double result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_StatProbeIntervalMin(checkId);
ChkQuery_Valid
CAPL Function Overview » Test Service Library » Status Report Functions » ChkQuery_Valid
Method check.QueryValid()
Parameters aCheckId
> 0: Valid Id
5.1 — — •
Example
long result;
dword checkId;
checkId = ChkStart_MsgRelCycleTimeViolation(VehicleMotion, 0.9, 1.1);
// ... execute test sequence
result = ChkQuery_Valid(checkId);
ChkStart_LINDiagDelayTimesViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINDiagDelayTimesViolation
dword ChkStart_LINDiagDelayTimesViolation ()
TestCheck::StartLINDiagDelayTimesViolation(char[] CaplCallback)
Function Checks the values of P2_min and ST_min for a specified LIN Slave node or for all LIN
Slaves defined in LDF.
An event will be generated, if the measured P2_min or ST_min value is smaller than
one specified in the database (LDF).
Info
Parameters ObservedNode
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Specified node does not appear under "Node Attributes" section in LDF or P2_min,
ST_min are not defined
Check-specific ChkQuery_EventInterval
queries
ChkQuery_EventReason
ChkQuery_EventNodeName
5.2 LIN — •
Example
...
dword checkId;
// Create and start the check for LIN diagnostic delay times
checkId =
ChkStart_LINDiagDelayTimesViolation("LINDiagDelayTimesCallback");
...
// CAPL callback for violation notification
void LINDiagDelayTimesCallback (dword aCheckId)
{ ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINETFViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINETFViolation
Function Checks the format of a single response to ETF. An event will be generated, if the first
data byte does not match protected ID of any of the associated frames (Slave failure).
Checks the collision resolution process. An event will be generated during collision
resolution, if one of the following is detected:
Parameters ETFFrameId
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword] > 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Possible errors Specified frame ID doesn’t match any of symbolic event-triggered frames
Check-specific ChkQuery_EventReason
queries
ChkQuery_EventMessageContents
ChkQuery_EventMessageId
ChkQuery_EventMessageName
6.0 LIN — •
Example
...
dword checkId;
// Create and start the check for LIN Event-triggered frame
// Parameters: Frame identifier of event-triggered frame to verify and
optional CAPL
// callback
checkId = ChkStart_LINETFViolation (0x3A, "CallbackLINETFViolation");
...
// CAPL callback for violation notification
void CallbackLINETFViolation (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINHeaderToleranceViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINHeaderToleranceViolation
An event will be generated, if the measured header transmission time is over specified
tolerance.
Info
For a LIN 2.0 compliance the Tolerance has to be in the range [0 .. 40]%.
Parameters Tolerance
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventInterval
queries
ChkQuery_EventMessageId
ChkQuery_EventTiming
5.2 LIN — •
Example
...
dword checkId;
// Create and start the check for LIN Header tolerance
checkId = ChkStart_LINHeaderToleranceViolation(40.0,
"LINHeaderToleranceCallback");
...
// CAPL callback for violation notification
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINMasterBaudrateViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINMasterBaudrateViolation
Function Checks the LIN Master baud rate, by analyzing frame headers.
An event will be generated, if the measured baud rate is outside of the specified range.
The expected baud rate is taken from DB.
Info
For a LIN 2.0 compliance the Master clock tolerance has to be in the range:
[-0.5 .. 0.5] %.
The actual baud rate is done in Synch Field with the sample rate of 1
second.
This check works only when LIN hardware is not in Master mode, i.e. when
an external Master is used.
Parameters ClockTolerance
Allowed Master clock tolerance. Measured baud rate expected to be in the range:
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventTiming
queries
5.2 LIN — •
Example
...
dword checkId;
// Create and start the check for LIN Master baud rate violation
checkId = ChkStart_LINMasterBaudrateViolation(0.5,
"LINMasterBaudrateCallback");
...
// CAPL callback for violation notification
void LINMasterBaudrateCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINMasterInitTimeViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINMasterInitTimeViolation
Function Checks an initialization time of LIN Master. The initialization state is entered on
switching on and on waking up.
An event will be generated, if the initialization time is out of the specified range.
Info
This function verifies the initialization time on waking up only, i.e. a time
between getting Wakeup signal and the first header transmitted by the
Master.
For a LIN 2.0 compliance the initialization time has to be in the range [100
.. 150] ms.
Parameters MinTime
MaxTime
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventInterval
queries
5.2 LIN — •
Example
...
dword checkId;
// Create and start the check for LIN Master initialization time
violation
checkId = ChkStart_LINMasterInitTimeViolation(100, 150,
"LINMasterInitTimeCallback");
...
// CAPL callback for violation notification
void LINMasterInitTimeViolation (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINReconfRequestFormatViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINReconfRequestFormatViolation
As constructor TestCheck::StartLINReconfRequestFormatViolation ()
function
TestCheck::StartLINReconfRequestFormatViolation (char[] CaplCallback)
Info
Checked attributes: NAD, supplier ID, function ID, variant ID, message ID,
protected ID, StartIndex.
Parameters CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId
> 0: Check was created successfully and may be referenced using the returned (handle-)
[dword] value.
Check-specific ChkQuery_EventReason
queries
ChkQuery_EventMessageContents
5.2 LIN — •
Example
...
dword checkId;
// Create and start the check for LIN reconfiguration request format
violation
checkId =
ChkStart_LINReconfRequestFormatViolation("LINReconfRequestFormatCallback"
);
...
// CAPL callback for violation notification
void LINReconfRequestFormatCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINRespErrorSignal
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINRespErrorSignal
dword ChkStart_LINRespErrorSignal ()
Function Checks the LIN Response_Error signal for a specified LIN Slave node or for all LIN nodes.
An event will be generated, if the Response_Error signal value changes from FALSE (0)
to TRUE (1).
Parameters ObservedNode
Node to be checked.
Only Slave nodes are allowed.
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword] > 0: Check was created successfully and may be referenced using the returned (handle-
) value.
The Response_Error signal for the specified node is not defined or the signal is not
defined for any Slave node
Check-specific ChkQuery_EventMessageName
queries
ChkQuery_EventMessageId
ChkQuery_EventNodeName
5.2 LIN — •
Example
...
dword checkId;
// Create and start the check for LIN response_error signal
checkId = ChkStart_LINRespErrorSignal("LINRespErrCallback");
...
// CAPL callback for violation notification
void LINRespErrCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINRespToleranceViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINRespToleranceViolation
An event will be generated, if the measured response transmission time is over allowed
tolerance.
Info
For a LIN 2.0 compliance the Tolerance has to be in the range [0 .. 40]%.
Parameters Frame
ObservedNode
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventMessageName
queries
ChkQuery_EventMessageId
ChkQuery_EventNodeName
ChkQuery_EventInterval
ChkQuery_EventTiming
5.2 LIN — •
Example
...
dword checkId;
ChkConfig_SetPrecision(9); // switch to ns precision
// Create and start the check for LIN response tolerance violation in
“Motor1” node
checkId = ChkStart_LINRespToleranceViolation(LIN20db::Motor1, 40.0 ,
"LINRespToleranceCallback");
ChkConfig_SetPrecision(3); // switch to ms precision (default)
...
// CAPL callback for violation notification
void LINRespToleranceCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINSchedTableViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINSchedTableViolation
Function Checks a certain LIN schedule table for correspondence with the database definition.
• Slot frame is violated, i.e. transmitted frameID doesn’t match one defined in the
corresponding time slot
• Slot delay is not satisfied, i.e. the delay between two consecutive LIN headers is
out of the range specified by the corresponding time slot and allowed Jitter.
Info
The check has to be started only when the specified schedule table is
already running. That is to allow run-time synchronization, which may take
maximum one schedule cycle time.
Parameters TableIndex
Jitter
Allowed deviation from the timing defined by schedule tables. For this value usually
Master’s Jitter is used. Measured slot delay should be in the range:
D - Jitter <= M <= D + Jitter; where M is measured delay and D is expected delay.
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventSchedSlotIndex
queries
ChkQuery_EventInterval
ChkQuery_EventReason
5.2 LIN — •
Example
...
dword checkId;
ChkConfig_SetPrecision(6); // switch to µs precision
// Create and start the check for LIN schedule table with index 0
checkId = ChkStart_LINSchedTableViolation(0, "LINSchedTableCallback");
ChkConfig_SetPrecision(3); // switch to ms precision (default)
...
// CAPL callback for violation notification
void LINSchedTableCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINSyncBreakTimingViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINSyncBreakTimingViolation
Function Checks the timing of the synchronization break field in LIN headers.
An event will be generated, if the measured length [in bit times] of break low phase is
outside of the specified range.
Parameters MinBreakLen
MaxBreakLen
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventTiming
queries
ChkQuery_EventInterval
ChkQuery_EventMessageId
5.2 LIN — •
Example
...
dword checkId;
ChkConfig_SetPrecision(9); // switch to ns precision
// Create and start the check for LIN break low phase violation
checkId = ChkStart_LINSyncBreakTimingViolation(13, 20,
"LINSyncBreakCallback");
ChkConfig_SetPrecision(3); // switch to ms precision (default)
...
// CAPL callback for violation notification
void LINSyncBreakCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINSyncDelTimingViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINSyncDelTimingViolation
Function Checks the timing of the synchronization break field in LIN headers.
An event will be generated, if the measured length [in bit times] of break delimiter is
outside of the specified range.
Parameters MinDelLen
MaxDelLen
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventTiming
queries
ChkQuery_EventInterval
ChkQuery_EventMessageId
5.2 LIN — •
Example
...
dword checkId;
ChkConfig_SetPrecision(9); // switch to ns precision
// Create and start the check for LIN Synch Delimiter violation
checkId = ChkStart_LINSyncDelTimingViolation(1, 5,
"LINSyncDelimiterCallback");
ChkConfig_SetPrecision(3); // switch to ms precision (default)
...
// CAPL callback for violation notification
void LINSyncDelimiterCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINSynchBreakTimingViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINSynchBreakTimingViolation
Function Checks the timing of the synchronization break field in LIN headers.
An event will be generated, if the measured length [in bit times] of break low phase is
outside of the specified range.
Parameters MinBreakLen
MaxBreakLen
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventTiming
queries
ChkQuery_EventInterval
ChkQuery_EventMessageId
5.2 LIN — •
Example
...
dword checkId;
ChkConfig_SetPrecision(9); // switch to ns precision
// Create and start the check for LIN break low phase violation
checkId = ChkStart_LINSynchBreakTimingViolation(13, 20,
"LINSynchBreakCallback");
ChkConfig_SetPrecision(3); // switch to ms precision (default)
...
// CAPL callback for violation notification
void LINSynchBreakCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
ChkStart_LINSynchDelTimingViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINSynchDelTimingViolation
Function Checks the timing of the synchronization break field in LIN headers.
An event will be generated, if the measured length [in bit times] of break delimiter is
outside of the specified range.
Parameters MinDelLen
MaxDelLen
CaplCallback
Return values 0: Check could not be created and must not be referenced
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventTiming
queries
ChkQuery_EventInterval
ChkQuery_EventMessageId
5.2 LIN — •
Example
...
dword checkId;
ChkConfig_SetPrecision(9); // switch to ns precision
// Create and start the check for LIN Synch Delimiter violation
checkId = ChkStart_LINSynchDelTimingViolation(1, 5,
"LINSynchDelimiterCallback");
ChkConfig_SetPrecision(3); // switch to ms precision (default)
...
// CAPL callback for violation notification
void LINSynchDelimiterCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINWakeupReqLengthViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINWakeupReqLengthViolation
An event will be generated, if a measured length of the Wake-up request is out of the
specified range.
Info
Parameters MinLength
MaxLength
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventInterval
queries
5.2 LIN — •
Example
...
dword checkId;
ChkConfig_SetPrecision(6); // switch to µs precision
// Create and start the check for LIN Wake-up request
checkId = ChkStart_LINWakeupReqLengthViolation(250, 1000,
"LINWakeupLenCallback");
ChkConfig_SetPrecision(3); // switch to ms precision (default)
...
// CAPL callback for violation notification
void LINWakeupLenCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_LINWakeupRetryViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_LINWakeupRetryViolation
Function Checks number of LIN wakeup signals and the time between them.
Parameters TimeoutAfterWakeup
TimeoutAfterThreeWakeups
Tolerance
Default: 14%.
MaxRetryNum
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventInterval
queries
ChkQuery_EventReaso
6.0 LIN — •
Example
...
dword checkId;
ChkConfig_SetPrecision(3); // set precision to ms
// Create and start the check for LIN Wake-Up signals
// Parameters to validate: Timeout between two wake-up signals – 150 ms,
// Timeout after each three wake-up signals – 1.5 sec, Allowed tolerance
2%, maximum
// expected number of retransmitted Wake-Up signals - 4
checkId = ChkStart_LINWakeupRetryViolation (150, 1500, 2, 4, "
LINWakeupRetryCallback");
...
// CAPL callback for violation notification
void LINWakeupRetryCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
ChkStart_SignalCycleTimeViolation
CAPL Function Overview » Test Service Library » Checks » ChkStart_SignalCycleTimeViolation
An event will be generated, if the time between two consecutive signal occurrences is
out of the specified range.
Info
Parameters ObservedSignal
MinCyc
MaxCycleTime
CaplCallback
Return values 0: Check could not be created and must not be referenced
CheckId [dword]
> 0: Check was created successfully and may be referenced using the returned (handle-
) value.
Check-specific ChkQuery_EventMessageName
queries
ChkQuery_EventMessageId
ChkQuery_EventInterval
5.2 LIN — •
Example
...
dword checkId;
// Create and start the check for LIN Wake-up request
checkId = ChkStart_SignalCycleTimeViolation(Motor1State_Cycl::Motor1Temp,
29, // min. cycle time in ms
32, // max cycle time in ms
"SigCycleTimeCallback");
...
// CAPL callback for violation notification
void SigCycleTimeCallback (dword aCheckId)
{
ChkQuery_EventStatusToWrite(aCheckId);
}
| Classes and Objects in CAPL | Functions to Configure Checks | Commands to Control Checks |
long StmControl_Stop(Stimulus::TstimulusId)
long StmControl_Reset(Stimulus::TstimulusId)
long StmControl_Destroy(Stimulus::TstimulusId)
As destructor stimulus.Destroy()
Method stimulus.Start()
stimulus.Stop()
stimulus.Reset()
Function The four control functions have the same Parameter. They only need an ID that refers to
the specific stimulus.
Parameters Stimulus::TStimulusId
Must exist
5.0 — — •
Example
StmCreate_CSV (cyclical)
CAPL Function Overview » Test Service Library » Configuration Functions » StmCreate_CSV (cyclical)
Parameters aMessage
Must exist in DB
aDBSignal
Must exist in DB
aFile
Must exist
If file not exists: EDI Invalid data input (measurement stops)
EnvVarHandle
Must exist in DB
SystemVariable
CycleTime
Defines the cycle in which the signal value in the message buffer is being updated.
There is no affect to the bus.
Defines the cycle in which the value of the environment or system variable is being
updated.
Return values 0: Stimulus could not be created and must not be referenced
dword >0: Stimulus was created successfully and may be referenced using the handle
5.0 — — •
Example
To stimulate signals:
mId = StmCreate_CSV(MsgBuf, Msg::Sig, CycleTime, File);
| Stimulus Generator: CSV File as Data Source | Classes and Objects in CAPL |
StmCreate_CSV (non-cyclical)
CAPL Function Overview » Test Service Library » Stimulus Functions » StmCreate_CSV (non-cyclical)
Parameters aMessage
Must exist in DB
aDBSignal
Must exist in DB
aFile
Must exist
If file not exists: EDI Invalid data input (measurement stops)
EnvVarHandle
Must exist in DB
SystemVariable
Return values 0: Stimulus could not be created and must not be referenced
dword
>0: Stimulus was created successfully and may be referenced using the handle
5.0 — — •
Example
To stimulate signals:
mId = StmCreate_CSV(MsgBuf, Msg::Sig, File);
| Stimulus Generator: CSV File as Data Source | Classes and Objects in CAPL |
StmCreate_EnvVar
CAPL Function Overview » Test Service Library » Stimulus Functions » StmCreate_EnvVar
Parameters aMessage
Must exist in DB
aDBSignal
Must exist in DB
aEnvVar
Must exist in DB
CycleTime
Defines the cycle in which the signal value in the message buffer is being updated.
There is no affect to the bus.
Return values 0: Stimulus could not be created and must not be referenced
dword >0: Stimulus was created successfully and may be referenced using the handle
5.0 — — •
Example
To stimulate signals:
Parameters aMessage
Must exist in DB
aDBSignal
Must exist in DB
EnvVarHandle
Must exist in DB
SystemVariable
CycleTime
Defines the cycle in which the signal value in the message buffer is being updated.
There is no affect to the bus.
Defines the cycle in which the value of the environment or system variable is being
updated.
TimeUp
TimeHigh
TimeDown
Info
TimeLow
Return values 0: Stimulus could not be created and must not be referenced
dword >0: Stimulus was created successfully and may be referenced using the handle
5.0 — — •
Example
To stimulate signals:
mId = StmCreate_Ramp(MsgBuf, Msg::Sig, CycleTime, Tup, Thigh, Tdown,
Tlow);
To stimulate signals with the Interaction Layer:
mId = StmCreate_Ramp(Msg::Sig, CycleTime, Tup, Thigh, Tdown, Tlow);
Parameters aMessage
Must exist in DB
aDBSignal
Must exist in DB
EnvVarHandle
Must exist in DB
SystemVariable
Info
Attention
Value A and Value B are physical values, not raw values. They can be user-
defined or will be taken from the CANdb++ database (dbc-file) that is
assigned to the CANoe configuration and are called Minimum and Maximum
of the signal.
CycleTime
Defines the cycle in which the signal value in the message buffer is being updated.
There is no affect to the bus.
Defines the cycle in which the value of the environment or system variable is being
updated.
TimeUp
TimeHigh
TimeDown
Info
TimeLow
Return values 0: Stimulus could not be created and must not be referenced
dword >0: Stimulus was created successfully and may be referenced using the handle
5.0 — — •
Example 1
To stimulate signals:
mId = StmCreate_Ramp(MsgBuf, Msg::Sig, ValueA, ValueB, CycleTime, Tup,
Thigh, Tdown, Tlow);
To stimulate signals with the Interaction Layer:
mId = StmCreate_Ramp(Msg::Sig, ValueA, ValueB, CycleTime, Tup, Thigh,
Tdown, Tlow);
on preStart
{
chkConfig_Init ("user");
stm_ramp = StmCreate_Ramp(aNeueBotschaft, NeueBotschaft::NeuesSignal,
yMin, yMax, ramp_cycletime, 5000, 100, 0, 0);
}
on start
{
long ret;
ret = StmControl_Start(stm_ramp);
settimer (mytimer, ramp_cycletime);
}
on timer mytimer
{
if (yMax == aNeueBotschaft.NeuesSignal) stmControl_Stop (stm_ramp);
output (aNeueBotschaft);
settimer (mytimer, ramp_cycletime);
}
on preStop
{
StmControl_Destroy (stm_ramp);
}
Parameters aMessage
Must exist in DB
aDBSignal
Must exist in DB
EnvVarHandle
Must exist in DB
SystemVariable
CycleTime
Defines the cycle in which the signal value in the message buffer is being updated.
There is no affect to the bus.
Defines the cycle in which the value of the environment or system variable is being
updated.
Return values 0: Stimulus could not be created and must not be referenced
dword >0: Stimulus was created successfully and may be referenced using the handle
5.0 — — •
Example
To stimulate signals:
mId = StmCreate_Toggle(MsgBuf, Msg::Sig, CycleTime);
To stimulate signals with the Interaction Layer:
mId = StmCreate_Toggle(Msg::Sig, CycleTime);
Parameters aMessage
Must exist in DB
aDBSignal
Must exist in DB
EnvVarHandle
Must exist in DB
SystemVariable
Info
Attention
Value A and Value B are physical values, not raw values. They can be user-
defined or will be taken from the CANdb++ database (dbc-file) that is
assigned to the CANoe configuration and are called Minimum and Maximum
of the signal.
CycleTime
Defines the cycle in which the signal value in the message buffer is being updated.
There is no affect to the bus.
Defines the cycle in which the value of the environment or system variable is being
updated.
Return values 0: Stimulus could not be created and must not be referenced
dword >0: Stimulus was created successfully and may be referenced using the handle
5.0 — — •
Example
To stimulate signals:
mId = StmCreate_Toggle(MsgBuf, Msg::Sig, ValueA, ValueB, CycleTime);
To stimulate signals with the Interaction Layer:
mId = StmCreate_Toggle(Msg::Sig, ValueA, ValueB, CycleTime);
StmQuery_Valid
CAPL Function Overview » Test Service Library » Stimulus Functions » StmQuery_Valid
Method stimulus.QueryValid()
> 0: Valid Id
5.1 — — •
Example
double result;
dword stmId;
stmId = StmCreate_Toggle(Velocity, 60, 80, 100);
// ... execute test sequence
result = StmQuery_Valid(stmId);
Check functions shall be identifiable easily. So the functions are to be prefixed in the following way:
• ChkCreate /ChkStart_
for check creation and check start functions
• ChkControl_
• ChkQuery_
• ChkConfig_
Type Explanation
Message ID or database symbol of the message to check (or case sensitive string).
Signal Database symbol of the signal to check, qualified with the message (or case sensitive signal
short name).
In CAPL Test Modules it's recommended to use Checks as Constraints or Conditions and to create and start
them straight before their usage (ChkStart_...).
testcase TC ()
{
...
chkid = ChkStart_MsgRelCycleTimeViolation (StatusMsg, 0.8, 1.2);
TestAddConstraint (chkid);
...
TestRemoveConstraint (chkid);
}
In this case there's no need to use Callback functions. In addition it's usually not necessary to query test
results since violations of the test specification directly influence the test result and will be documented
in the test report together with some relevant information.
In CAPL Simulation Nodes Checks can be used and controlled directly. In principle this works in CAPL Test
Modules, too. Nevertheless it is not recommended and - apart from some rare special cases - there are no
advantages in doing so.
• Define a new check and start immediately after you finished the definition
• Define a new check for later use (recommended!)
• Start a predefined check (recommended!)
Recommendation
You can define all checks "on_prestart" and use the control functions during a measurement to start/stop
a check.
• Once stopped, the check will no longer test the occurrence of the event condition. Its state is
guaranteed to stay the same until it is restarted.
• A check that has been stopped or created earlier and has not been activated yet, can be activated
again and will generate events if error conditions occur.
• The state of the check may be reset, initializing it.
• When destroyed, the reference to the check looses validity and no information on its previous state
can be queried. Any later access to the check will lead to a fatal error.
Remark
For test programs of typical size and duration, there is no necessity to destroy the checks in CAPL. Only
those rare cases with extremely long running tests and dynamic check creation need to destroy checks to
prevent a lack of memory.
For the check control there are the following functions to influence. These functions can be used to turn
off checking in not relevant time (e.g. with changes of the network hardware), and to continue checking.
These control functions can also be used to setup dependencies between checks:
ChkCreate_NodeMsgsRelCycleTimeViolation,
ChkStart_NodeMsgsRelCycleTimeViolation
ChkCreate_InconsistentTxDLC, ChkStart_InconsistentTxDLC
ChkCreate_MostShortUnlock, ChkStart_MostShortUnlock
ChkCreate_MostStableLock, ChkStart_MostStableLock
If the TSL is to be used in Simulation Nodes (not CAPL Test Modules!), the initialization function
ChkConfig_Init should be called. With this function behavior of the TSL in error cases can also be
configured there in roughly outlined steps.
The time base of the TSL can be modified for the node in question.
ChkConfig_SetPrecision Configures the TSL time basis for the current node.
In order to query information about a check, generic and check specific status report functions are
implemented. The general status report functions are working with all types of checks. The check specific
status report functions are working only with a special part of the checks. If a check specific status report
function is called for a check that does not support this function, a warning will be displayed in the Write
window.
Mode of Operation
The goal of the following functions is to give a value for the quality of the system, but the quality depends
hardly from the runtime of the check. For statistical reasons, all values are derived in a way that an error
event is supposed just before the check has been started and just after the check has been stopped. So
the maximum time between events will be never greater than the time between the event and check start
and the time between the event and check stop.
The following figure explains the statistical data collection in more detail:
At first, session 1 is performed. The red arrows are marking error events, the yellow triangles are marking
particular times, the following description will refer.
After the first session, the following statistical values could be queried at the time "query #1":
• min distance = t1
• max distance = t2
Then the session 2 is started without resetting the check. At the time "query #2", the following statistical
values could be queried (while the check is running).
• min distance = t1
• max distance = t10a
After this session at "query #3", the following results will occur:
These query functions may not raise an error class that leads to a measurement stop.
The following functions return a timely distance given in the actual precision. The decimal places are cut.
To get a value with more decimals (more exact value), the precision can be modified with
ChkConfig_SetPrecision.
The following functions allow the easy writing of the status text to different output sinks.
The check-specific status report functions permit querying of information that is only available for some
types of checks. Which queries are possible and meaningful depend on the purposes of the individual
checks.
Included in the description of individual check types are definitions of which check-specific Status Report
ChkQuery_EventInterval Returns the last time-interval that has led to the event.
ChkQuery_EventMessageId Returns the Id of the message that has forced the event.
ChkQuery_EventSignalValue Enables access to the signal value which was last reported
by a check as invalid.
ChkQuery_EventSignalValue (for signals Enables access to the signal (only with positive) value which
with positive values) was last reported by a check as invalid.
ChkQuery_RequestFBlockId Returns the FBlock of the request message, which last led to
a protocol violation.
ChkQuery_RequestInstId Returns the InstID of the request message, which last led to
a protocol violation.
ChkQuery_RequestOpType Returns the OpType of the request message, which last led
to a protocol violation.
ChkQuery_StatAvResponseTime Returns the average time lag between the request and
corresponding response messages.
ChkQuery_StatMaxValidResponseTime Returns the longest time lag between the request and
corresponding response message that occurred during the
current observation period.
ChkQuery_StatMinResponseTime Returns the shortest time lag between the request and
corresponding response message that occurred during the
current observation period.
ChkQuery_EventSchedSlotIndex Retrieves slot index of a schedule table for which the event
has been sent.
ChkQuery_EventReason Retrieves the exact reason of firing event in the LIN specific
check.
ChkQuery_EventTiming Retrieves the timing value that has been violated in the LIN
specific check.
For all status report functions, the following return values and raised error classes are applied. The query
functions always use a wider range of return values. In most cases the particular check of the return value
isn't necessary. A simple check to a value >0 (stands for valid) is enough.
Please refer the specification of each query function to get the complete value range of return values.
Stimulus Generators are part of the Test Service Library. They allow the user to stimulate signals or
environment variables - referred to as data sinks in the following - according to a specific time behavior.
With the exception of StmCreate_CSV (non-cyclic) all Stimulus Generators have a cycle time. This
cycle time indicates the cycle at which the value of the data sink is updated.
With the exception of StmCreate_EnvVar each Stimulus Generator has a period length T after which the
values are repeated for the data sink. The program supports user-defined integers up to 32 bit.
StmCreate_Toggle(limits taken Create a stimulus generator that toggles between two values.
from database)
StmCreate_Toggle(limits user
defined)
StmCreate_Ramp(limits user
defined)
Stimulus Generator: Short description
Environment variable as data
source
StmCreate_CSV(cyclical)
Stimulus Generator with a signal The message is sent onto the bus independent of the Stimulus
as data sink – Signal is sent in Generator and sending must be executed separately, e.g. in CAPL
CAPL. using a cyclic timer. If the signal value needs to be set before the
first start of the Stimulus Generator it may also be set in CAPL.
Stimulus Generator with a signal The message is sent out onto the bus independent of the Stimulus
as data sink – Signal is sent over Generator, and this is executed automatically via the Interaction
Interaction Layer. Layer. The signal value before the first start of the Stimulus
Generator is also set by the Interaction Layer. A precondition is that
the Interaction Layer must be loaded as a Nodelayer module in the
The Stimulus Generators are created and controlled by the following functions in CAPL:
In a CAPL Simulation Node the Test Service Library must be initialized at the beginning. In CAPL or XML
Test Modules this is neither necessary nor even possible.
Info
• Once the Stimulus Generator has been destroyed the stimulus can no longer be used.
If necessary a new stimulus must be generated by another means.
• All given signal values are always physical values.
Physical value = raw value * factor + offset
The values for "factor" and "offset" are defined in the database.
This Stimulus Generator generates a ramp. After the start the Stimulus Generator updates the data sink
(signal or environment variable) periodically. Value A and value B describe the upper and lower limits of
the ramp, respectively. The Reset Function of the Generator can be used either after a Generator stop or
while it is operating (see below). In both cases the Reset Function causes the value of the data sink to
immediately assume value A and the ramp begins anew. The Reset Function has no effect on the cycle
time.
Info
At least Time Up, Time High or Time Down have to be set to a value > 0. If check failed the
measurement will be stopped.
Functions that create the Stimulus Generator for stimulating signals and environment/system
variables
This generator takes values for updating the data sink (signal or environment variable) from a CSV file.
Output of all values from the CSV file defines one period T of the Stimulus Generator. These periods are
automatically repeated. The Reset Function causes a new period to begin immediately, i.e. values are
taken from the beginning of the CSV file again.
If a Cycle Time is specified for generation by the Stimulus Generator, the data sink is updated periodically
with the next value from the CSV file.
If the Stimulus Generator is operating non periodically, the time stamps associated with the values are
taken from the CVS file to control updating of the data sink. The format of the CSV file is exactly the same
in both cases.
Non-cyclical
Info
The time stamps are absolute data in reference to the start of a new period.
Cyclical
Info
File format: Two backslashes "\\" or one forward slash "/" must be inserted after the drive
characters and between the folders, e.g.:
• C:\\path\\to\\the\\file\\testfile.csv
or
• C:/path/to/the/file/testfile.csv
There are various restrictions with regard to formatting the CSV file. These restrictions are derived from
Trace Window Export Options.
Info
Functions that create the Stimulus Generator for stimulating signals and environment/system
variables
• StmCreate_CSV (non-cyclical)
• StmCreate_CSV (cyclical)
This Generator offers the option of setting any desired time characteristic for the data sink.
After the start of the Stimulus Generator the data sink (signal or environment variable) is updated
periodically with the momentary value of the environment variable.
The Reset Function always causes the value of the data sink to be immediately set to zero. It has no effect
on the cycle time.
If the output of the trace shall be used as input for this stimuli, you have to do the following settings in
the Advanced options dialog (Export shortcut menu of the Trace window – [Advanced…]):
Format
Time format The identifier for the time column can be 't, 'T' or 'Time'
CSV Settings
Layout The CSV file has to contain one table with a time column if necessary and columns for
every signal (first and second option of the window below).
variables
{
// Local message buffer
message StmMsg lStmMsg;
// Defines the cycle for output of the stimulated signals
dword gOutTime;
msTimer tOutStmMsg;
// Remember the handles for the different stimuli:
dword mRampId = 0;
// Description of the stimuli functions in the demo.
// - Creation of stimuli in the pre-start event
// - Control of the stimulated signals by environment variable
}
on preStart
{
// Initialize the TSL functionality.
// TSL should be initialized with "user" or "developer".
// The "user" setting is very silent and reports only severe problems.
// The "developer" setting is more verbose and reports useful information
ChkConfig_Init("user");
// Set precison of timers to us (10-6 seconds)
SetPrecision(6);
// Create the ramp stimulus
mRampId = StmCreate_Ramp(lStmMsg, StmMsg::RampSig,-10,10,5,300,200,100,400);
}
on start
{
gOutTime = getValue(EnvOutTime);
SetTimer(tOutStmMsg, gOutTime);
}
on timer tOutStmMsg
{
// Output of the message
output(lStmMsg);
SetTimer(tOutStmMsg, gOutTime);
}
on envVar EnvRampApply
{
long lRet;
if(getValue(this))
{
if(mRampId)
{
lRet = StmControl_Destroy(mRampId);
mRampId = 0;
}
mRampId = StmCreate_Ramp( lStmMsg,
StmMsg::RampSig,
getValue(EnvRampValueA),
getValue(EnvRampValueB),
getValue(EnvRampCycleTime),
getValue(EnvRampTimeUp),
getValue(EnvRampTimeHigh),
getValue(EnvRampTimeDown),
getValue(EnvRampTimeLow));
if(getValue(EnvCtrlRamp))
{
lRet = StmControl_Start(mRampId);
}
}
}
This Stimulus Generator toggles the data sink (signal or environment variable) periodically between two
values. These two values are user-defined (Values A and B) or they are taken directly from the database.
The Reset Function causes the data sink to be immediately set to the value A. It does not have any effect
on the cycle of the Stimulus Generator.
In this special case the cycle time is exactly half as large as the period T of the Generator.
Functions that create the Stimulus Generator for stimulating signals and environment/system
variables
Info
The methods/functions listed on this site can only be called in connection with system
variables.
SetTransferCycle Sets the cycle time for retrieving the corresponding value from the
VT System.
vtsSetTransferCycle
vtsResetMinMax
vtsSetLoadMode
vtsSetMeasurementMode
vtsSetLoadControlTimeout
vtsSetPWMMeasurementDuration
vtsSetPWMThreshold
SetIntegrationTime Sets the integration time for average and RMS values.
vtsSetIntegrationTime
vtsLoadWFResistance
vtsLoadWFVoltage
vtsSetCurveType
vtsSetStimulationMode
vtsStartStimulation
vtsStopStimulation
vtsSetPWMResistanceLow
vtsSetPWMResistanceHigh
vtsSetPWMVoltageLow
vtsSetPWMVoltageHigh
SetPWMRepeats Sets the number of stimulated PWM periods after the start of
stimulation.
vtsSetPWMRepeats
LoadWFBitStream The function loads a bit stream for the channel from the specified
file.
vtsLoadWFBitStream
vtsSetCurveType
vtsSetIntegrationTime
vtsSetPWMMeasurementDuration
SetPWMRepeats Sets the number of stimulated PWM periods after the start of
stimulation.
vtsSetPWMRepeats
vtsSetPWMVoltageHigh
vtsSetPWMVoltageLow
vtsSetStimulationMode
SetThreshold1_8 Sets the threshold value for differentiating between high and low
levels of the channels 1…8 of a digital module VT2516.
vtsSetThreshold1_8
SetThreshold9_16 Sets the threshold value for differentiating between high and low
levels of the channels 9…16 of a digital module VT2516.
vtsSetThreshold9_16
vtsSetWFParams
vtsStartStimulation
vtsStopStimulation
vtsLoadWFVoltage
vtsResetMinMax
vtsSetCurveType
SetIntegrationTime Sets the integration time for average and RMS values.
vtsSetIntegrationTime
vtsSetMeasurementMode
SetOutputRange Sets the range that is used for analog output on output channels of
vtsSetWFParams
vtsStartStimulation
vtsStopStimulation
LoadWFBitStream The function loads a bit stream for the channel from the specified
file.
vtsLoadWFBitStream
vtsSetCurveType
vtsSetOutputMode
SetOutputSource Sets the source for the high voltage level for output.
vtsSetOutputSource
vtsSetPWMMeasurementDuration
SetPWMRepeats Sets the number of stimulated PWM periods after the start of
stimulation.
vtsSetPWMRepeats
SetThreshold Sets the threshold value for differentiating between high and low
levels of a group of channels on a VT2848 module.
vtsSetThreshold
vtsSetWFParams
vtsStartStimulation
vtsStopStimulation
<OnSerialReceive> Is called when data has been received from the assigned serial port.
<OnSerialSend> Is called when a send operation has been completed on the assigned
serial port.
LoadWFVoltage Loads a control voltage curve for a power supply from a specified
file.
vtsLoadWFVoltage
vtsResetMinMax
vtsSerialClose
vtsSerialConfigure
vtsSerialOpen
vtsSerialReceive
vtsSerialSend
vtsSetIntegrationTime
SetInterconnectionMode Sets the mode for interconnection of the three possible power
supplies and the two power outputs of the power module VT7001.
vtsSetInterconnectionMode
SetMaxCurrentMode Sets the mode for the control voltage output to control the power
supply's maximal output current.
vtsSetMaxCurrentMode
SetRefVoltageMode Sets the mode for the reference voltage output to control the power
supply's output voltage.
vtsSetRefVoltageMode
SerialSetOnErrorHandler Sets the callback that notifies when an error occurred during a send
or receive operation.
vtsSerialSetOnErrorHandler
SerialSetOnReceiveHandler Sets the callback that notifies when data has been received on the
serial port of the specified channel.
vtsSerialSetOnReceiveHandler
SerialSetOnSendHandler Sets the callback that notifies when a send operation on the serial
port of the specified channel is completed successfully.
vtsSerialSetOnSendHandler
SetWFParams Configures the parameters for the output of a control voltage curve.
vtsSetWFParams
vtsStartStimulation
vtsStopStimulation
CAPL offers two different notations for calling the functions of the VT System. On the one hand they can
be called as methods on the namespaces of the modules and channels. On the other hand it is also
possible to call them as global functions. In this case the namespace of the module resp. channel is
passed as a string argument. Both notations will be illustrated with two simple examples in the following.
VT System methods
This is the notation recommended in most cases. Its advantage is that the CAPL compiler can verify the
namespace of the module resp. channel already at compile time.
Example
In this example one channel of a VT1004 module is configured for PWM measurement.
ConfigurePWMMeasurement()
{
// Configure channel for PWM measurement
sysvar::VTS::RPMSensor.SetPWMMeasurementDuration(0.1); // 100ms
sysvar::VTS::RPMSensor.SetPWMThreshold(2.5); // 2.5V
}
VT System functions
For every method of the VT System there is a function with the same name. To allow differentiating these
two each function starts with the prefix vts. The main difference to the methods is that the functions take
the name of their target namespace as a string argument. Because of that the function notation is well
suited for creating generic test functions.
Example
In this example the code for PWM initialization is implemented in a generic way so that it can be
reused for different channels.
testcase TestSensors ()
{
// Initialize PWM measurement on channels
ConfigurePWMMeasurement("VTS::RPMSensor");
ConfigurePWMMeasurement("VTS::TempSensor");
...
}
ConfigurePWMMeasurement(char channelName[])
{
// Configure channel for PWM measurement
vtsSetPWMMeasurementDuration(channelName, 0.1); // 100ms
vtsSetPWMThreshold(channelName, 2.5); // 2.5V
}
vtsLoadWFBitStream
CAPL Function Overview » VT System » vtsLoadWFBitStream
Note
The function may not be called in any CAPL handler routines or in ECU nodes. It may only
be called in the context of the MainTest method of a test module.
Function The function loads a bit stream (a sequence of bit values) for the channel from the
specified file.
The bit stream is used to stimulate the ECU using a digital signal.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
filepath
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
-3: Error when accessing the file. This can mean, for example, that the file was not found
or the file format was different than expected.
-4: Transfer error – The wave form could not be transferred correctly.
Example
The following example demonstrates how to use the bit stream voltage output of a
VT2516 channel for digital stimulation. In this example a bit stream is loaded from the file
BitStream.txt and played back on channel DOut. More details for the output of bit
streams can be found on CANoe online help topics VT2516: Bit Stream Output and VT2848:
Bit Stream Output.
Example BitStream.txt
// Sample bit stream
001100110010101100
</testcase>
| LoadWFBitStream |
vtsLoadWFResistance
CAPL Function Overview » VT System » vtsLoadWFResistance
Note
The function may not be called in any CAPL handler routines or in ECU nodes. It may only
be called in the context of the MainTest method of a test module.
Function This function loads a resistance curve for a VT2004 channel from the specified file.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
filepath
Path of the file containing the resistance curve. The path can be given absolute or
relative to the CANoe configuration.
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace.
-3: Error when accessing the file. This can mean, for example, that the file was not found
or the file format was different than expected.
-4: Transfer error – The wave form could not be transferred correctly.
Example
| LoadWFResistance |
vtsLoadWFVoltage
CAPL Function Overview » VT System » vtsLoadWFVoltage
Note
The function may not be called in any CAPL handler routines or in ECU nodes. It may only
be called in the context of the MainTest method of a test module.
Function The function loads a voltage curve for the channel from the specified file.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
filepath
Path of the file containing the voltage curve. The path can be given absolute or relative
to the CANoe configuration.
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace.
-3: Error when accessing the file. This can mean, for example, that the file was not found
or the file format was different than expected.
-4: Transfer error – The wave form could not be transferred correctly.
Example
The following example demonstrates how to use the waveform voltage output of a VT2004
channel to simulate a sensor. In the example a waveform called WaveForm.txt is loaded
and replayed on channel Temp_Sensor. More details on waveforms can be found on
CANoe online help topic VT2004: Arbitrary Wave Forms.
The second part of the example shows how a waveform can be output on a VT7001 power
supply channel. An external power supply unit (namespace ExtSupply) is used in this
example. The ECU is connected to OUT1 (namespace ECUpower) and GND1; the VT7001
module is named Power-Supply. The output voltage is determined by a predefined curve
(powercycle.txt). The time increment for the curve's interpolation points is 65 ms; the
curve is for 10 seconds.
Example WaveForm.txt
// Example of an arbitrary wave form
0 // Next value is an interpolation point
1.0; 2 // Two sampling points lie between the next interpolation point
4
2 // Also possible
3; 1
1; 1
2
ExternalSupplyWithCurve ()
{
// Set mode to one power supply only -> external power supply 1
vtsSetInterconnectionMode("VTS::PowerSupply", 1);
// Set mode to one power supply only -> external power supply 1
powerSupply.InterconnectionMode.Value = InterconnectionMode.Sup1;
| LoadWFVoltage |
vtsResetMinMax
CAPL Function Overview » VT System » vtsResetMinMax
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
This example demonstrates how to measure the minimum and maximum voltages at a
VT1004 channel. After the test is started, the old min and max values are reset. Then the
input voltage is analyzed for 5 seconds. After that the new min and max voltages are
output to CANoe's Write window / the test report.
| ResetMinMax |
vtsSerialClose
CAPL Function Overview » VT System » vtsSerialClose
Function Closes the serial port of the VT System channel that is specified by the system variable
namespace.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
| SerialClose |
vtsSerialConfigure
CAPL Function Overview » VT System » vtsSerialConfigure
Note
To make sure the correct settings are used execute a wait command between the call of
this function and the following sending or receiving of data.
Function Configures the serial port of the VT System channel that is specified by the system
variable namespace.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
baudrate
The symbol rate to use for reception and transmission. The serial ports of the VT7001
module support rates of 1200, 2400, 4800, 9600, 19200 and 38400 baud.
numberOfDataBits
The number of data bits within a transmission frame. The serial ports of the VT7001
module support a value of 7 or 8.
numberOfStopBits
The number of stop bits within a transmission frame. The serial ports of the VT7001
module support a value of 1 or 2.
parity
1 odd parity
2 even parity
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
This example shows how to use the RS232 functionality of the VT7001 module. It is
assumed, that power supply 1 of the VT7001 is connected to a proper counterpart (e.g. a
PC) via a serial connection. In this example the string “Hello World!” is sent by the
VT7001. After that all incoming characters are output to the write window. After 10
seconds the connection is closed.
// Open the serial port i.e. for communication with an external ECU
power supply
vtsSerialOpen("VTS::ECUPowerSupply");
// Wait briefly to make sure settings are applied and port is ready
TestWaitForTimeOut(10);
number);
}
// Open the serial port i.e. for communication with an external ECU
power supply
ecuPowerSupply.SerialOpen();
// Wait briefly to make sure settings are applied and port is ready
Vector.CANoe.Threading.Execution.Wait(10);
{
// Print error to write window
Vector.Tools.Output.WriteLine("An error occurred in the serial
connection: " + e.ErrorFlags.ToString());
}
| SerialConfigure |
vtsSerialOpen
CAPL Function Overview » VT System » vtsSerialOpen
Note
To make sure that no is lost execute a wait command between the call of this function
and the following sending or receiving of data.
Function Opens the serial port of the VT System channel that is specified by the system variable
namespace.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
| SerialOpen |
vtsSerialReceive
CAPL Function Overview » VT System » vtsSerialReceive
Function Starts receiving blocks of bytes from the serial port of the specified VT7001 channel.
Received data is copied to the specified buffer. The data can only be accessed in the
OnSerialReceive callback.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
buffer
size
Maximum number of Bytes which can be received at a time. Must have a value > 0 and <
65.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
| SerialReceive |
vtsSerialSend
CAPL Function Overview » VT System » vtsSerialSend
Function Sends a block of bytes to the serial port of the specified VT7001 channel
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
buffer
number
Number of bytes to send from the buffer. Number must have a value > 0 and < 65.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
| SerialSend |
vtsSerialSetOnErrorHandler
CAPL Function Overview » VT System » vtsSerialSetOnErrorHandler
Function Sets the callback that notifies when an error occurred during a send or receive operation.
The set callback has to have following signature: void <OnSerialError>( dword
errorFlags)
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
onErrorCallback
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
-3: The passed callback does not have the required signature.
Example
| SerialSetOnErrorHandler |
vtsSerialSetOnReceiveHandler
CAPL Function Overview » VT System » vtsSerialSetOnReceiveHandler
Function Sets the callback that notifies when data has been received on the serial port of the
specified channel.
The set callback has to have following signature: void <OnSerialReceive>( byte
bffer[], dword number)
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
onReceiveCallback
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
-3: The passed callback does not have the required signature.
Example
| SerialSetOnReceiveHandler |
vtsSerialSetOnSendHandler
CAPL Function Overview » VT System » vtsSerialSetOnSendHandler
Function Sets the callback that notifies when a send operation on the serial port of the specified
channel is completed successfully.
The set callback must have following signature: void <OnSerialSend>( byte
sendBuffer[], dword number)
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
onSendCallback
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
-3: The passed callback does not have the required signature, i.e. number or type of the
parameters are different than expected.
Example
| SerialSetOnSendHandler |
vtsSetCurveType
CAPL Function Overview » VT System » vtsSetCurveType
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Type
1 PWM
2 Analog wave form; loaded using LoadWFVoltage (for VT2004 and VT2816 only) or
LoadWFResistance (for VT2004 only), then started using StartStimulation
3 Bit stream (= digital wave form); loaded using LoadWFBitStream, then started using
StartStimulation (for VT2516 and VT2848 only)
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| SetCurveType |
vtsSetIntegrationTime
CAPL Function Overview » VT System » vtsSetIntegrationTime
Function Mean and RMS values are calculated in a moving measurement time window.
The length of the time window can be set with this function.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
IntTime
-1: Call error, e.g., system variable does not belong to the VT system or integration time
is invalid
-2: The system variable on which the command was called is not valid
Example
This example demonstrates how to change the integration time of a VT System system
variable during the measurement. The integration time is set to 1s to cancel out noise in
the sensor readings. It is assumed that the sensor to be read is connected to a channel
called TempSensor of the VT1004 module.
IVT1004Channel;
// Set integration time to 1 second
tempSensor.Avg.IntegrationTime = 1.0;
// Output sensor readings to the write window every second
while (true)
{
Vector.Tools.Output.WriteLine("Average sensor value: " +
tempSensor.Avg.Value.ToString() + "V");
Vector.CANoe.Threading.Execution.Wait(1000);
}
}
| SetIntegrationTime |
vtsSetInterconnectionMode
CAPL Function Overview » VT System » vtsSetInterconnectionMode
Note
This function may not be called in any CAPL handler routines or in ECU nodes. It may only
be called in the context of the MainTest method of a test module. Use a test module that
automatically runs at measurement start to set an initial state.
Function Sets the mode for interconnection of the three possible power supplies and the two power
outputs of the power module VT7001.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Mode
3 Two independent power supplies for OUT1 and OUT2: internal power supply and
power supply 1 (mode supint_sup1)
4 Two independent power supplies for OUT1 and OUT2: internal power supply and
power supply 2 (mode supint_sup2)
5 Two independent power supplies for OUT1 and OUT2: power supply 1 and internal
power supply (mode sup1_supint)
6 Two independent power supplies for OUT1 and OUT2: power supply 1 and power
supply 2 (mode sup1_sup2)
7 Two independent power supplies for OUT1 and OUT2: power supply 2 and internal
power supply (mode sup2_supint)
8 Two independent power supplies for OUT1 and OUT2: power supply 2 and power
supply 1 (mode sup2_sup1)
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The internal power supply unit delivers power and the ECU is connected to OUT1 (clamp
30), OUT2 (clamp 15) and GND1 (clamp 31). In this example, the channel for the internal
power sup-ply unit is named “IntSupply”, the two output channels are named “Clamp30”
and “Clamp15”, and the VT7001 module is named “PowerSupply”.
// Set mode to one power supply only -> external power supply 1
powerSupply.InterconnectionMode.Value = InterconnectionMode.SupInt;
| SetInterconnectionMode |
vtsSetLoadControlTimeout
CAPL Function Overview » VT System » vtsSetLoadControlTimeout
Function When signals with brief interruptions are created (especially PWM signals), it is possible to
set a hold time (a control timeout) so that the electronic load does not have be corrected
again on every signal edge. Thus, if the input voltage rises again before the timeout
expires, the electronic load is still adjusted to the old value and only has to be corrected
minimally, if at all. Because the settling time is eliminated, very rapidly changing PWM
signals can also be operated with the electronic load.
The timeout time selected should be approximately 10 to 100 times higher than the
frequency of the control unit output signal. For a PWM signal with a frequency starting
from 10 Hz, a timeout time of 1 to 10 seconds is sufficient. If this functionality is not
required, the timeout time should be set to 0, because it slows down the corrections.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Timeout
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
vtsSetLoadControlTimeout (sysvar::VTS::LowBeamRight, 10.0);
A timeout of 2 s was set here. The input voltage (yellow) and the current flowing at the
input (red) are presented qualitatively. At the first pulse, the input voltage is not applied
for only approximately 1 s. In this case, a timeout does not occur and the set current
continues flowing when the input voltage is applied again. At the second pulse, a timeout
occurs. In this case, the input voltage is not applied for a period lasting more than 2 s.
The internal load is then connected with high resistance. If the input voltage is restored,
the internal load must first adjust to the set current, which is apparent from the slow rise
in the current.
| SetLoadControlTimeout |
vtsSetLoadMode
CAPL Function Overview » VT System » vtsSetLoadMode
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Mode
1 Current control
2 Resistance control
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates the usage of the internal load of a VT1004 channel.
In this example the channel is called LowBeamLeft. The internal load is configured for
resistance-control-mode with a resistance of 120 Ohm. So the electronic load functions as
a constant resistor against the input.
The second part of the example shows how to use the current control mode. Here the
electronic load is regulated so that a constant current flows between the two ECU lines.
InternalLoad_CurrentControl ()
{
// Set the current of the internal load to 1A
@sysvar::VTS::LowBeamLeft::IntLoadCurrent = 1;
| SetLoadMode |
vtsSetMaxCurrentMode
CAPL Function Overview » VT System » vtsSetMaxCurrentMode
Function Sets the mode for the control voltage output to control the power supply's maximal
output current.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Mode
Factor
Factor to determine the control voltage from the defined (using the system variable or
the wave form) power supply max current value.
Power Supply Max Current * Factor = Control Voltage
The factor has a default value of 1.0 at measurement start. If the function is called
without factor parameter the currently set factor is kept.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
In the following example the maximum current mode is activated on the power supply
channel ExtSupply of a VT7001 module. The max. current output is set to 10 A. Finally
the output Clamp30 of the VT7001 is activated. To set a max current of 10 A, e.g. a
control voltage of 5.0 V has to be given to the power supply. Therefore a factor of 0.5 has
to be used.
// Switch output on
@sysvar::VTS::Clamp30::Active = 1;
}
// Set mode to one power supply only -> external power supply 1
powerSupply.InterconnectionMode.Value = InterconnectionMode.Sup1;
// Switch output on
clamp30.Active.Value = OutputMode.Active;
}
| SetMaxCurrentMode |
vtsSetMeasurementMode
CAPL Function Overview » VT System » vtsSetMeasurementMode
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Mode
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
This example demonstrates how change the measurement mode of a VT1004 channel. By
default the voltage is measured between the two input lines A and B. This example shows
how to configure a measurement between input line A and the VT1004 module’s AGND.
| SetMeasurementMode |
vtsSetOutputMode
CAPL Function Overview » VT System » vtsSetOutputMode
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Mode
0 Output off
3 Push pull
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates how to use the PWM output of a VT2848 channel to
simulate a PWM based sensor (e.g. a RPM sensor). The channel used in this example is
called RPM_Sensor.
vtsSetOutputSource("VTS::SensorModule1", 0, 0);
| SetOutputMode |
vtsSetOutputRange
CAPL Function Overview » VT System » vtsSetOutputRange
Function Sets the range that is used for analog output on output channels of VT2816 modules.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Range
0 0..28V
1 -10V..+10V
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
vtsSetOutputRange ("VTS::TempSensor”, 1);
| SetOutputRange |
vtsSetOutputSource
CAPL Function Overview » VT System » vtsSetOutputSource
Function Sets the source for the high voltage level for output. This settings can only be set for
groups of channels.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Group
0 Channels 1-4
1 Channels 5-8
2 Channels 9-12
3 Channels 13-16
4 Channels 17-20
5 Channels 21-24
6 Channels 25-28
7 Channels 29-32
8 Channels 33-36
9 Channels 37-40
10 Channels 41-44
11 Channels 45-48
Source
0 Vext
1 Vbatt
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| SetOutputSource |
vtsSetPWMMeasurementDuration
CAPL Function Overview » VT System » vtsSetPWMMeasurementDuration
Function The PWM parameters are calculated in a measurement time window of a defined (VT1004)
resp. maximum (VT2516 and VT2848) length, which can be set with this function.
For maximum accuracy during measurement, the time window should be at least 10 times
larger than the PWM signal's duration.
Please note that measurement duration effects latency. PWM parameters are determined
within the defined measurement duration and updated after this period of time. This
means that a change of a PWM signal will be reflected in the measurement values not
before a measurement period defined by this function has expired (exception: VT2516
updates PWM parameters immediately after a full signal period is determined). The
determined PWM parameters are updated on the module and can then be fetched by
CANoe (cyclically done defined by the cycle time).
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Duration
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| SetPWMMeasurementDuration |
vtsSetPWMRepeats
CAPL Function Overview » VT System » vtsSetPWMRepeats
Function This function sets the number of stimulated PWM periods after the start of stimulation. If
the number of cycles output is not limited, numOfRepeats must be set to 0.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
numOfRepeats
-1: Error
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
| SetPWMRepeats |
vtsSetPWMResistanceHigh
CAPL Function Overview » VT System » vtsSetPWMResistanceHigh
Function Specifies the resistance value of a high signal on PWM output in "Resistance output PWM"
mode.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Resistance
Values outside the hardware's possible range of values are rounded up to the next highest
value or the highest or lowest possible value is used.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates how to use the internal resistor decade of a VT2004
channel to simulate a PWM based sensor. On channel Temp_Sensor the resistor is toggled
between 100 Ohm and 140 Ohm with a frequency of 20 Hz and a duty cycle of 50%.
vtsSetPWMRepeats("VTS::Temp_Sensor", 0);
| SetPWMResistanceHigh |
vtsSetPWMResistanceLow
CAPL Function Overview » VT System » vtsSetPWMResistanceLow
Function Specifies the resistance value of a low signal on PWM output in Resistance output PWM
mode.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Resistance
Values outside the hardware's possible range of values are rounded up to the next highest
value or the highest or lowest possible value is used.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| SetPWMResistanceLow |
vtsSetPWMThreshold
CAPL Function Overview » VT System » vtsSetPWMThreshold
Function Sets the threshold value for differentiating between high and low levels.
Voltages at the input exceeding this threshold value are evaluated as high level and
voltages undershooting it are evaluated as low level.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Threshold
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| SetPWMThreshold |
vtsSetPWMVoltageHigh
CAPL Function Overview » VT System » vtsSetPWMVoltageHigh
Function Specifies the high level on output of a digital output signal, especially a PWM signal.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Voltage
Voltage of the high level in volts in the range 0 ... 28 V (VT2004) resp. 0 ... 25 V
(VT2516).
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| SetPWMVoltageHigh |
vtsSetPWMVoltageLow
CAPL Function Overview » VT System » vtsSetPWMVoltageLow
Function Specifies the low level on output of a digital output signal, especially a PWM signal.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Voltage
Voltage of the low level in volts in the range 0 ... 28 V (VT2004) resp. 0 ... 25 V (VT2516).
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| SetPWMVoltageLow |
vtsSetRefVoltageMode
CAPL Function Overview » VT System » vtsSetRefVoltageMode
Function Sets the mode for the reference voltage output to control the power supply's output
voltage.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Mode
Factor
Factor to determine the control voltage from the defined (using the system variable or
the wave form) power supply output voltage.
Info
The factor is given by the external power supply. This factor is the ratio of
the control voltage to the output voltage. For example, if a power supply
outputs 50 V at a control voltage of 5 V, its factor is 0.1 (5/50).
Use form 1 for the internal power supply - the factor is always 1.
Use form 2 with explicitly given factor for the external power supplies. The default factor
is 1.0.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
In order to output a control voltage (VControl) which leads to the desired output voltage VOut,
the VT7001 must know the power supply factor.
In the following example, the factor of the external power supply is 0.1 and the desired
output voltage VOut is 15 V.
To achieve the desired output voltage (VOut), the VT7001 calculates and sets the control
voltage (VControl) automatically (1.5 V =15 * 0.1), which results in an output voltage of 15 V.
// Switch output on
@sysvar::VTS::Clamp30::Active = 1;
}
// Set mode to one power supply only -> external power supply 1
powerSupply.InterconnectionMode.Value = InterconnectionMode.Sup1;
// Switch output on
clamp30.Active.Value = OutputMode.Active;
}
| SetRefVoltageMode |
vtsSetStimulationMode
CAPL Function Overview » VT System » vtsSetStimulationMode
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Mode
1 Voltage stimulation
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates how to use the PWM output of a VT2004 channel to
simulate a PWM based sensor (e.g. a RPM sensor). The channel used in this example is
called RPM_Sensor.
| SetStimulationMode |
vtsSetThreshold
CAPL Function Overview » VT System » vtsSetThreshold
Function Sets the threshold value for differentiating between high and low levels of a group of
channels on a VT2848 module.
There is only one threshold setting for each group.
Voltages at the input exceeding this threshold value are evaluated as high level and
voltages undershooting it are evaluated as low level.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Group
0 Channels 1-8
1 Channels 9-16
2 Channels 17-24
3 Channels 25-32
4 Channels 33-40
5 Channels 41-48
Threshold
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates how to configure the first channel of a VT2848
module for PWM measurement. The channel used in this example is called RPM_Sensor,
// Wait 500ms and output the measured PWM frequency and duty cycle
TestWaitForTimeout(500);
write("Measured frequency %fHz and DC %f",
@sysvar::VTS::RPM_Sensor::PWMFreq, @sysvar::VTS::RPM_Sensor::PWMDC);
}
| SetThreshold |
vtsSetThreshold1_8
CAPL Function Overview » VT System » vtsSetThreshold1_8
Function Sets the threshold value for differentiating between high and low levels of the channels
1…8 of a digital module VT2516.
There is only one threshold setting for all eight channels together.
Voltages at the input exceeding this threshold value are evaluated as high level and
voltages undershooting it are evaluated as low level.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Threshold
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates how to measure a PWM signal on a VT2516 channel
(e.g. a ECU output that controls an LED). The measured frequency and duty cycle is then
output to the Write window / the test report.
float dutyCycle;
| SetThreshold1_8 |
vtsSetThreshold9_16
CAPL Function Overview » VT System » vtsSetThreshold9_16
Function Sets the threshold value for differentiating between high and low levels of the channels
9…16 of a digital module VT2516.
There is only one threshold setting for all eight channels together.
Voltages at the input exceeding this threshold value are evaluated as high level and
voltages undershooting it are evaluated as low level.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
Threshold
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| SetThreshold9_16 |
vtsSetTransferCycle
CAPL Function Overview » VT System » vtsSetTransferCycle
Function Sets the cycle time for retrieving the measured value of a system variable from the VT
System and writing it to the corresponding system variable.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
CycleTime
-1: Call error, e.g., system variable does not belong to the VT System or cycle time is
invalid.
Example
The following example demonstrates how to change the transfer cycle of a VT System
system variable during the measurement. Here the transfer cycle is reduced to 1 ms while
the function waits for the input signal to change. This allows for a fast reaction. After the
event has occurred the transfer cycle is set back to 100 ms.
| SetTransferCycle |
vtsSetWFParams
CAPL Function Overview » VT System » vtsSetWFParams
Function The function configures the parameters for the output of a voltage or resistance curve or
bitstream.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
timeIncrement
Specifies how long the value of a specified interpolation point is to be stimulated before
transitioning to the next interpolation point.
Depending on the module and the wave form different ranges for timeIncrement are
valid:
Resistance curves: 0.0005 (500 µs)…0.065 (65 ms) in R> mode and 0.001 (1 ms)…0.065
(65 ms) in R< mode.
pause
Specifies how long the stimulation is interrupted between two repetitions of the wave
form.
Valid values: 0.0…4294.0 (4294 s).
numOfRepeats
startDelay
Specifies a delay for the start of the stimulation in seconds. This makes it possible to start
multiple curves in a defined sequence. This parameter is only supported by the VT2816
and VT2848 modules.
Valid values: 0.0..4.0 (4 s)
startPoint
Specifies the point of the stimulated curve the stimulation should begin with. This makes
it possible e.g. to start multiple curves with different phase shifts without changing the
curves.
Valid values: 0..4096
-1: Error
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
The following example demonstrates how to use the waveform resistance output of a
VT2004 channel to simulate a sensor. In the example a waveform called WaveForm.txt is
loaded and replayed on channel Temp_Sensor. More details on waveforms can be found
on CANoe online help topic VT2004: Arbitrary Wave Forms.
Example WaveForm.txt
// Example of an arbitrary wave form for resistance stimulation
100
120 ; 2
140 ; 1
100
160 ; 4
100
| SetWFParams |
vtsStartStimulation
CAPL Function Overview » VT System » vtsStartStimulation
Function Starts the output of a stimulation signal. A corresponding output mode must be set in
advance.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| StartStimulation |
vtsStopStimulation
CAPL Function Overview » VT System » vtsStopStimulation
Function Stops the output of a stimulation signal. This resets the output mode.
At the end of the execution of the command there is a short break before other
commands will be executed. This means that the next functions will be executed after a
short delay.
With this procedure ensures that the stop command is executed effectively. The
command should be called only in context of a test module setup but not in handler
functions. In handler functions the correct execution of the stop command can not be
ensured.
Parameters Target
Name of the system variable/namespace that will be affected by this function call.
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| StopStimulation |
LoadWFBitStream
CAPL Function Overview » VT System » LoadWFBitStream
Note
The method can only be called on system variable namespaces of appropriate channels of
VT System modules.
The method may not be called in any CAPL handler routines or in ECU nodes. It may only
be called in the context of the MainTest method of a test module.
Function The function loads a bit stream (a sequence of bit values) for the channel from the
specified file.
The bit stream is used to stimulate the ECU using a digital signal.
Parameters filepath
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
-3: Error when accessing the file. This can mean, for example, that the file was not found
or the file format was different than expected.
-4: Transfer error – The wave form could not be transferred correctly.
Example
The following example demonstrates how to use the bit stream voltage output of a
VT2516 channel for digital stimulation. In this example a bit stream is loaded from the file
BitStream.txt and played back on channel DOut. More details for the output of bit
streams can be found on CANoe online help topics VT2516: Bit Stream Output and VT2848:
Bit Stream Output.
Example BitStream.txt
// Sample bit stream
001100110010101100
sysvar::VTS::DOut.SetStimulationMode(1);
sysvar::VTS::DOut.SetCurveType(3);
| vtsLoadWFBitStream |
LoadWFResistance
CAPL Function Overview » VT System » LoadWFResistance
Note
The method can only be called on system variable namespaces of channels belonging to
the VT System module VT2004.
The method may not be called in any CAPL handler routines or in ECU nodes. It may only
be called in the context of the MainTest method of a test module.
Function This function loads a resistance curve for a VT2004 channel from the specified file.
Parameters filepath
Path of the file containing the resistance curve. The path can be given absolute or
relative to the CANoe configuration.
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace.
-3: Error when accessing the file. This can mean, for example, that the file was not found
or the file format was different than expected.
-4: Transfer error – The wave form could not be transferred correctly.
Example
| vtsLoadWFResistance |
LoadWFVoltage
CAPL Function Overview » VT System » LoadWFVoltage
Note
The method can only be called on system variable namespaces of appropriate channels
ofVT System modules.
The method may not be called in any CAPL handler routines or in ECU nodes. It may only
be called in the context of the MainTest method of a test module.
Function The function loads a voltage curve for the channel from the specified file.
Parameters filepath
Path of the file containing the voltage curve. The path can be given absolute or relative
to the CANoe configuration..
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace.
-3: Error when accessing the file. This can mean, for example, that the file was not found
or the file format was different than expected.
-4: Transfer error – The wave form could not be transferred correctly.
Example
The following example demonstrates how to use the waveform voltage output of a VT2004
channel to simulate a sensor. In the example a waveform called WaveForm.txt is loaded
and replayed on channel Temp_Sensor. More details on waveforms can be found on
CANoe online help topic VT2004: Arbitrary Wave Forms.
The second part of the example shows how a waveform can be output on a VT7001 power
supply channel. An external power supply unit (namespace ExtSupply) is used in this
example. The ECU is connected to OUT1 (namespace ECUpower) and GND1; the VT7001
module is named Power-Supply. The output voltage is determined by a predefined curve
(powercycle.txt). The time increment for the curve's interpolation points is 65 ms; the
curve is for 10 seconds.
Example WaveForm.txt
// Example of an arbitrary wave form
0 // Next value is an interpolation point
1.0; 2 // Two sampling points lie between the next interpolation point
4
2 // Also possible
3; 1
1; 1
2
ExternalSupplyWithCurve ()
{
// Set mode to one power supply only -> external power supply 1
sysvar::VTS::PowerSupply.SetInterconnectionMode(1);
// Set mode to one power supply only -> external power supply 1
powerSupply.InterconnectionMode.Value = InterconnectionMode.Sup1;
| vtsLoadWFVoltage |
OnSerialError
CAPL Function Overview » VT System » OnSerialError
Note
This callback function must be implemented in the CAPL program by the user to get
notifications when an error has occurred in an operation on a serial port of the VT7001
module. The callback can be installed using the CAPL function SerialSetOnErrorHandler.
Function The function is called when an error has occurred in an operation on a serial port of the
VT7001 module.
Parameters errorFlags
Cumulative summary of what went wrong. Bits are set to flag conditions.
Bit Error
2 Frame error. May be caused by parity mismatch or any other frame mismatch (e.g.
number of stop bits).
4 Buffer overrun. It is not specified if the driver of the sender cannot send fast
enough, if it is up to the receiver which got too much data in too short time or
anything else.
Info
Several error bits may be set at the same time. Some error flags are up to the
driver manufacturer what they mean and when they are issued.
Return values —
Example
OnSerialReceive
CAPL Function Overview » VT System » OnSerialReceive
Note
This callback function must be implemented in the CAPL program by the user to get
notifications when data has been received on a serial port of a VT7001 module. The
callback can be installed using the CAPL function SerialSetOnReceiveHandler.
Function The function is called when data has been received from the assigned VT7001 serial port.
Parameters buffer
Receive buffer for the assigned VT7001 serial port (set with SerialReceive).
number
Return values —
Example
OnSerialSend
CAPL Function Overview » VT System » OnSerialSend
Note
This callback function must be implemented in the CAPL program by the user to get
notifications when send operations on a serial port of a VT7001 module have been
completed. The callback can be installed using the CAPL function
SerialSetOnSendHandler.
Function The function is called when a send operation has been completed on the assigned VT7001
serial port.
Parameters buffer
number
Return values —
Example
ResetMinMax
CAPL Function Overview » VT System » ResetMinMax
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Parameters —
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
This example demonstrates how to measure the minimum and maximum voltages at a
VT1004 channel. After the test is started, the old min and max values are reset. Then the
input voltage is analyzed for 5 seconds. After that the new min and max voltages are
output to CANoe's Write window / the test report.
| vtsResetMinMax |
SerialClose
CAPL Function Overview » VT System » SerialClose
Note
The function can only be called on system variable namespaces of channels that represent
an external power supply in a power module VT7001 respectively the system variable
namespace that represents functionality common for the entire VT7001 module.
Function Closes the serial port of the VT System channel that is specified by the system variable
namespace.
Parameters —
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
| vtsSerialClose |
SerialConfigure
CAPL Function Overview » VT System » SerialConfigure
Note
The function can only be called on system variable namespaces of channels that represent
an external power supply in a power module VT7001 respectively the system variable
namespace that represents functionality common for the entire VT7001 module.
To make sure the correct settings are used execute a wait command between the call of
this function and the following sending or receiving of data.
Function Configures the serial port of the VT System channel that is specified by the system
variable namespace.
Parameters baudrate
The symbol rate to use for reception and transmission. The serial ports of the VT7001
module support rates of 1200, 2400, 4800, 9600, 19200 and 38400 baud.
numberOfDataBits
The number of data bits within a transmission frame. The serial ports of the VT7001
module support a value of 7 or 8.
numberOfStopBits
The number of stop bits within a transmission frame. The serial ports of the VT7001
module support a value of 1 or 2.
parity
1 odd parity
2 even parity
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
This example shows how to use the RS232 functionality of the VT7001 module. It is
assumed, that power supply 1 of the VT7001 is connected to a proper counterpart (e.g. a
PC) via a serial connection. In this example the string “Hello World!” is sent by the
VT7001. After that all incoming characters are output to the write window. After 10
seconds the connection is closed.
// Open the serial port i.e. for communication with an external ECU
power supply
sysvar::VTS::ECUPowerSupply.SerialOpen();
// Wait briefly to make sure settings are applied and port is ready
TestWaitForTimeOut(10);
// Open the serial port i.e. for communication with an external ECU
power supply
ecuPowerSupply.SerialOpen();
// Wait briefly to make sure settings are applied and port is ready
Vector.CANoe.Threading.Execution.Wait(10);
| vtsSerialConfigure |
SerialOpen
CAPL Function Overview » VT System » SerialOpen
Note
The function can only be called on system variable namespaces of channels that represent
an external power supply in a power module VT7001 respectively the system variable
namespace that represents functionality common for the entire VT7001 module.
To make sure that no is lost execute a wait command between the call of this function
and the following sending or receiving of data.
Method SysVarNamespace.SerialOpen()
Function Opens the serial port of the VT System channel that is specified by the system variable
namespace.
Parameters —
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
| vtsSerialOpen |
SerialReceive
CAPL Function Overview » VT System » SerialReceive
Note
The function can only be called on system variable namespaces of channels that represent
an external power supply in a power module VT7001 respectively the system variable
namespace that represents functionality common for the entire VT7001 module.
Function Starts receiving blocks of bytes from the serial port of the specified VT7001 channel.
Received data is copied to the specified buffer. The data can only be accessed in the
OnSerialReceive callback.
Parameters buffer
number
Maximum number of Bytes which can be received at a time. Must have a value > 0 and <
65.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
| vtsSerialReceive |
SerialSend
CAPL Function Overview » VT System » SerialSend
Note
The function can only be called on system variable namespaces of channels that represent
an external power supply in a power module VT7001 respectively the system variable
namespace that represents functionality common for the entire VT7001 module.
Function Sends a block of bytes to the serial port of the specified VT7001 channel
Parameters buffer
number
Number of bytes to send from the buffer. Number must have a value > 0 and < 65.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
| vtsSerialSend |
SerialSetOnErrorHandler
CAPL Function Overview » VT System » SerialSetOnErrorHandler
Note
The function can only be called on system variable namespaces of channels that represent
an external power supply in a power module VT7001 respectively the system variable
namespace that represents functionality common for the entire VT7001 module.
Function Sets the callback that notifies when an error occurred during a send or receive operation.
The set callback has to have following signature: void <OnSerialError>( dword
errorFlags)
Parameters onErrorCallback
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
-3: The passed callback does not have the required signature.
Example
| vtsSerialSetOnErrorHandler |
SerialSetOnReceiveHandler
CAPL Function Overview » VT System » SerialSetOnReceiveHandler
Note
The function can only be called on system variable namespaces of channels that represent
an external power supply in a power module VT7001 respectively the system variable
namespace that represents functionality common for the entire VT7001 module.
Function Sets the callback that notifies when data has been received on the serial port of the
specified channel.
The set callback has to have following signature: void <OnSerialReceive>( byte
bffer[], dword number)
Parameters onReceiveCallback
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
-3: The passed callback does not have the required signature.
Example
| vtsSerialSetOnReceiveHandler |
SerialSetOnSendHandler
CAPL Function Overview » VT System » SerialSetOnSendHandler
Note
The function can only be called on system variable namespaces of channels that represent
an external power supply in a power module VT7001 respectively the system variable
namespace that represents functionality common for the entire VT7001 module.
Function Sets the callback that notifies when a send operation on the serial port of the specified
channel is completed successfully.
The set callback must have following signature: void <OnSerialSend>( byte
sendBuffer[], dword number)
Parameters onSendCallback
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
-3: The passed callback does not have the required signature, i.e. number or type of the
parameters are different than expected.
Example
| vtsSerialSetOnSendHandler |
SetCurveType
CAPL Function Overview » VT System » SetCurveType
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Parameters Type
1 PWM
2 Analog wave form; loaded using LoadWFVoltage (for VT2004 and VT2816 only) or
LoadWFResistance (for VT2004 only), then started using StartStimulation
3 Bit stream (= digital wave form); loaded using LoadWFBitStream, then started using
StartStimulation (for VT2516 and VT2848 only)
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| vtsSetCurveType |
SetIntegrationTime
CAPL Function Overview » VT System » SetIntegrationTime
Note
The function can only be called on system variables for average and RMS measurement of
appropriate channels on a VT System module.
Function Mean and RMS values are calculated in a moving measurement time window.
The length of the time window can be set with this function.
Parameters IntTime
-1: Call error, e.g., system variable does not belong to the VT system or integration time
is invalid
-2: The system variable on which the command was called is not valid
Example
This example demonstrates how to change the integration time of a VT System system
variable during the measurement. The integration time is set to 1s to cancel out noise in
the sensor readings. It is assumed that the sensor to be read is connected to a channel
called TempSensor of the VT1004 module.
| vtsSetIntegrationTime |
SetInterconnectionMode
CAPL Function Overview » VT System » SetInterconnectionMode
Note
The function can only be called on system variable namespaces of the VT System power
module VT7001 (namespace that represents the whole module).
This function may not be called in any CAPL handler routines or in ECU nodes. It may only
be called in the context of the MainTest method of a test module. Use a test module that
automatically runs at measurement start to set an initial state.
Function Sets the mode for interconnection of the three possible power supplies and the two power
outputs of the power module VT7001.
Parameters Mode
3 Two independent power supplies for OUT1 and OUT2: internal power supply and
power supply 1 (mode supint_sup1)
4 Two independent power supplies for OUT1 and OUT2: internal power supply and
power supply 2 (mode supint_sup2)
5 Two independent power supplies for OUT1 and OUT2: power supply 1 and internal
power supply (mode sup1_supint)
6 Two independent power supplies for OUT1 and OUT2: power supply 1 and power
supply 2 (mode sup1_sup2)
7 Two independent power supplies for OUT1 and OUT2: power supply 2 and internal
power supply (mode sup2_supint)
8 Two independent power supplies for OUT1 and OUT2: power supply 2 and power
supply 1 (mode sup2_sup1)
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The internal power supply unit delivers power and the ECU is connected to OUT1 (clamp
30), OUT2 (clamp 15) and GND1 (clamp 31). In this example, the channel for the internal
power sup-ply unit is named “IntSupply”, the two output channels are named “Clamp30”
and “Clamp15”, and the VT7001 module is named “PowerSupply”.
// Set mode to one power supply only -> external power supply 1
powerSupply.InterconnectionMode.Value = InterconnectionMode.SupInt;
clamp15.Active.Value = OutputMode.Active;
| vtsSetInterconnectionMode |
SetLoadControlTimeout
CAPL Function Overview » VT System » SetLoadControlTimeout
Note
The function can only be called on system variable namespaces of channels belonging to
the VT System module VT1004.
Function When signals with brief interruptions are created (especially PWM signals), it is possible to
set a hold time (a control timeout) so that the electronic load does not have be corrected
again on every signal edge. Thus, if the input voltage rises again before the timeout
expires, the electronic load is still adjusted to the old value and only has to be corrected
minimally, if at all. Because the settling time is eliminated, very rapidly changing PWM
signals can also be operated with the electronic load.
The timeout time selected should be approximately 10 to 100 times higher than the
frequency of the control unit output signal. For a PWM signal with a frequency starting
from 10 Hz, a timeout time of 1 to 10 seconds is sufficient. If this functionality is not
required, the timeout time should be set to 0, because it slows down the corrections.
Parameters Timeout
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
sysvar::VTS::LowBeamRight.SetLoadControlTimeout (10.0);
A timeout of 2 s was set here. The input voltage (yellow) and the current flowing at the
input (red) are presented qualitatively. At the first pulse, the input voltage is not applied
for only approximately 1 s. In this case, a timeout does not occur and the set current
continues flowing when the input voltage is applied again. At the second pulse, a timeout
occurs. In this case, the input voltage is not applied for a period lasting more than 2 s.
The internal load is then connected with high resistance. If the input voltage is restored,
the internal load must first adjust to the set current, which is apparent from the slow rise
in the current.
| vtsSetLoadControlTimeout |
SetLoadMode
CAPL Function Overview » VT System » SetLoadMode
Note
The function can only be called on system variable namespaces of channels belonging to
the VT System module VT1004.
Parameters Mode
1 Current control
2 Resistance control
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates the usage of the internal load of a VT1004 channel.
In this example the channel is called LowBeamLeft. The internal load is configured for
resistance-control-mode with a resistance of 120 Ohm. So the electronic load functions as
a constant resistor against the input.
The second part of the example shows how to use the current control mode. Here the
electronic load is regulated so that a constant current flows between the two ECU lines.
InternalLoad_CurrentControl ()
{
// Set the current of the internal load to 1A
@sysvar::VTS::LowBeamLeft::IntLoadCurrent = 1;
| vtsSetLoadMode |
SetMaxCurrentMode
CAPL Function Overview » VT System » SetMaxCurrentMode
Note
The function can only be called on system variable namespaces of channels that represent
an external power supply in a power module VT7001.
Function Sets the mode for the control voltage output to control the power supply's maximal
output current.
Parameters Mode
Factor
Factor to determine the control voltage from the defined (using the system variable or
the wave form) power supply max current value.
Power Supply Max Current * Factor = Control Voltage
The factor has a default value of 1.0 at measurement start. If the function is called
without factor parameter the currently set factor is kept.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
In the following example the maximum current mode is activated on the power supply
channel ExtSupply of a VT7001 module. The max. current output is set to 10 A. Finally
the output Clamp30 of the VT7001 is activated. To set a max current of 10 A, e.g. a
control voltage of 5.0 V has to be given to the power supply. Therefore a factor of 0.5 has
to be used.
// Set mode to one power supply only -> external power supply 1
powerSupply.InterconnectionMode.Value = InterconnectionMode.Sup1;
// Switch output on
clamp30.Active.Value = OutputMode.Active;
}
| vtsSetMaxCurrentMode |
SetMeasurementMode
CAPL Function Overview » VT System » SetMeasurementMode
Note
The function can only be called on system variable namespaces of channels belonging to
the VT System module VT1004.
Parameters Mode
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
This example demonstrates how change the measurement mode of a VT1004 channel. By
default the voltage is measured between the two input lines A and B. This example shows
how to configure a measurement between input line A and the VT1004 module’s AGND.
| vtsSetMeasurementMode |
SetOutputMode
CAPL Function Overview » VT System » SetOutputMode
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Parameters Mode
0 Output off
3 Push pull
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates how to use the PWM output of a VT2848 channel to
simulate a PWM based sensor (e.g. a RPM sensor). The channel used in this example is
called RPM_Sensor.
sysvar::VTS::RPM_Sensor.SetCurveType(1);
sysvar::VTS::SensorModule1.SetOutputSource(0, 0);
</vtsystem_configure>
<set title="Set frequency and duty cycle">
<sysvar name="VTS::RPM_Sensor::PWMOutputDC">50.0</sysvar>
<sysvar name="VTS::RPM_Sensor::PWMOutputFreq">100.0</sysvar>
</set>
<vtsystem_configure title="Start stimulation">
<start_stimulation channel="VTS::RPM_Sensor" />
</vtsystem_configure>
</testcase>
| vtsSetOutputMode |
SetOutputRange
CAPL Function Overview » VT System » SetOutputRange
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Function Sets the range that is used for analog output on output channels of VT2816 modules.
Parameters Range
0 0..28V
1 -10V..+10V
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
sysvar::VTS::TempSensor.SetOutputRange (1);
| vtsSetOutputRange |
SetOutputSource
CAPL Function Overview » VT System » SetOutputSource
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Function Sets the source for the high voltage level for output. This settings can only be set for
groups of channels.
Parameters Group
0 Channels 1-4
1 Channels 5-8
2 Channels 9-12
3 Channels 13-16
4 Channels 17-20
5 Channels 21-24
6 Channels 25-28
7 Channels 29-32
8 Channels 33-36
9 Channels 37-40
10 Channels 41-44
11 Channels 45-48
Source
0 Vext
1 Vbatt
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| vtsSetOutputSource |
SetPWMMeasurementDuration
CAPL Function Overview » VT System » SetPWMMeasurementDuration
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Function The PWM parameters are calculated in a measurement time window of a defined (VT1004)
resp. maximum (VT2516 and VT2848) length, which can be set with this function.
For maximum accuracy during measurement, the time window should be at least 10 times
larger than the PWM signal's duration.
Please note that measurement duration effects latency. PWM parameters are determined
within the defined measurement duration and updated after this period of time. This
means that a change of a PWM signal will be reflected in the measurement values not
before a measurement period defined by this function has expired (exception: VT2516
updates PWM parameters immediately after a full signal period is determined). The
determined PWM parameters are updated on the module and can then be fetched by
CANoe (cyclically done defined by the cycle time).
Parameters Duration
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| vtsSetPWMMeasurementDuration |
SetPWMRepeats
CAPL Function Overview » VT System » SetPWMRepeats
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Function This function sets the number of stimulated PWM periods after the start of stimulation. If
the number of cycles output is not limited, numOfRepeats must be set to 0.
Parameters numOfRepeats
-1: Error
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
| vtsSetPWMRepeats |
SetPWMResistanceHigh
CAPL Function Overview » VT System » SetPWMResistanceHigh
Note
The function can only be called on system variable namespaces of channels belonging to
the VT System module VT2004.
Function Specifies the resistance value of a high signal on PWM output in "Resistance output PWM"
mode.
Parameters Resistance
Values outside the hardware's possible range of values are rounded up to the next highest
value or the highest or lowest possible value is used.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates how to use the internal resistor decade of a VT2004
channel to simulate a PWM based sensor. On channel Temp_Sensor the resistor is toggled
between 100 Ohm and 140 Ohm with a frequency of 20 Hz and a duty cycle of 50%.
| vtsSetPWMResistanceHigh |
SetPWMResistanceLow
CAPL Function Overview » VT System » SetPWMResistanceLow
Note
The function can only be called on system variable namespaces of channels belonging to
the VT System module VT2004.
Function Specifies the resistance value of a low signal on PWM output in Resistance output PWM
mode.
Parameters Resistance
Values outside the hardware's possible range of values are rounded up to the next highest
value or the highest or lowest possible value is used.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| vtsSetPWMResistanceLow |
SetPWMThreshold
CAPL Function Overview » VT System » SetPWMThreshold
Note
The function can only be called on system variable namespaces of channels belonging to
the VT System module VT1004.
Function Sets the threshold value for differentiating between high and low levels.
Voltages at the input exceeding this threshold value are evaluated as high level and
voltages undershooting it are evaluated as low level.
Parameters Threshold
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| vtsSetPWMThreshold |
SetPWMVoltageHigh
CAPL Function Overview » VT System » SetPWMVoltageHigh
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Function Specifies the high level on output of a digital output signal, especially a PWM signal.
Parameters Voltage
Voltage of the high level in volts in the range 0 ... 28 V (VT2004) resp. 0 ... 25 V
(VT2516).
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| vtsSetPWMVoltageHigh |
SetPWMVoltageLow
CAPL Function Overview » VT System » SetPWMVoltageLow
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Function Specifies the low level on output of a digital output signal, especially a PWM signal.
Parameters Voltage
Voltage of the low level in volts in the range 0 ... 28 V (VT2004) resp. 0 ... 25 V (VT2516).
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| vtsSetPWMVoltageLow |
SetRefVoltageMode
CAPL Function Overview » VT System » SetRefVoltageMode
Note
The function can only be called on system variable namespaces of channels that represent
a power supply in a power module VT7001.
Function Sets the mode for the reference voltage output to control the power supply's output
voltage.
Parameters Mode
Factor
Factor to determine the control voltage from the defined (using the system variable or
the wave form) power supply output voltage.
Info
The factor is given by the external power supply. This factor is the ratio of
the control voltage to the output voltage. For example, if a power supply
outputs 50 V at a control voltage of 5 V, its factor is 0.1 (5/50).
Use form 1 for the internal power supply - the factor is always 1.
Use form 2 with explicitly given factor for the external power supplies. The default factor
is 1.0.
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
In order to output a control voltage (VControl) which leads to the desired output voltage VOut,
the VT7001 must know the power supply factor.
In the following example, the factor of the external power supply is 0.1 and the desired
output voltage VOut is 15 V.
To achieve the desired output voltage (VOut), the VT7001 calculates and sets the control
voltage (VControl) automatically (1.5 V =15 * 0.1), which results in an output voltage of 15 V.
// Switch output on
@sysvar::VTS::Clamp30::Active = 1;
}
// Set mode to one power supply only -> external power supply 1
powerSupply.InterconnectionMode.Value = InterconnectionMode.Sup1;
// Switch output on
clamp30.Active.Value = OutputMode.Active;
}
| vtsSetRefVoltageMode |
SetStimulationMode
CAPL Function Overview » VT System » SetStimulationMode
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Parameters Mode
1 Voltage stimulation
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates how to use the PWM output of a VT2004 channel to
simulate a PWM based sensor (e.g. a RPM sensor). The channel used in this example is
called RPM_Sensor.
| vtsSetStimulationMode |
SetThreshold
CAPL Function Overview » VT System » SetThreshold
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Function Sets the threshold value for differentiating between high and low levels of a group of
channels on a VT2848 module.
There is only one threshold setting for each group.
Voltages at the input exceeding this threshold value are evaluated as high level and
voltages undershooting it are evaluated as low level.
Parameters Group
0 Channels 1-8
1 Channels 9-16
2 Channels 17-24
3 Channels 25-32
4 Channels 33-40
5 Channels 41-48
Threshold
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates how to configure the first channel of a VT2848
module for PWM measurement. The channel used in this example is called RPM_Sensor,
// Wait 500ms and output the measured PWM frequency and duty cycle
TestWaitForTimeout(500);
write("Measured frequency %fHz and DC %f",
@sysvar::VTS::RPM_Sensor::PWMFreq, @sysvar::VTS::RPM_Sensor::PWMDC);
}
// Wait 500ms and output the measured PWM frequency and duty cycle
Execution.Wait(500);
Output.WriteLine(string.Format("Measured frequency {0}Hz and DC
{0}%", sensors.Channel1.PWMFreq.Value, sensors.Channel1.PWMDC.Value));
}
| vtsSetThreshold |
SetThreshold1_8
CAPL Function Overview » VT System » SetThreshold1_8
Note
The function can only be called on system variable namespaces of a VT System module
VT2516 (namespace for the whole module).
Function Sets the threshold value for differentiating between high and low levels of the channels
1…8 of a digital module VT2516.
There is only one threshold setting for all eight channels together.
Voltages at the input exceeding this threshold value are evaluated as high level and
voltages undershooting it are evaluated as low level.
Parameters Threshold
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
The following example demonstrates how to measure a PWM signal on a VT2516 channel
(e.g. a ECU output that controls an LED). The measured frequency and duty cycle is then
output to the Write window / the test report.
float frequency;
float dutyCycle;
| vtsSetThreshold1_8 |
SetThreshold9_16
CAPL Function Overview » VT System » SetThreshold9_16
Note
The function can only be called on system variable namespaces of a VT System module
VT2516 (namespace for the whole module).
Function Sets the threshold value for differentiating between high and low levels of the channels
9…16 of a digital module VT2516.
There is only one threshold setting for all eight channels together.
Voltages at the input exceeding this threshold value are evaluated as high level and
voltages undershooting it are evaluated as low level.
Parameters Threshold
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT System. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| vtsSetThreshold9_16 |
SetTransferCycle
CAPL Function Overview » VT System » SetTransferCycle
Note
This function is available to all "read" system variables created in the VT System.
Function Sets the cycle time for retrieving the measured value of a system variable from the VT
System and writing it to the corresponding system variable.
Parameters CycleTime
-1: Call error, e.g., system variable does not belong to the VT System or cycle time is
invalid.
Example
The following example demonstrates how to change the transfer cycle of a VT System
system variable during the measurement. Here the transfer cycle is reduced to 1 ms while
the function waits for the input signal to change. This allows for a fast reaction. After the
event has occurred the transfer cycle is set back to 100 ms.
| vtsSetTransferCycle |
SetWFParams
CAPL Function Overview » VT System » SetWFParams
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Function The function configures the parameters for the output of a voltage or resistance curve or
bitstream.
Parameters timeIncrement
Specifies how long the value of a specified interpolation point is to be stimulated before
transitioning to the next interpolation point.
Depending on the module and the wave form different ranges for timeIncrement are
valid:
Resistance curves: 0.0005 (500 µs)…0.065 (65 ms) in R> mode and 0.001 (1 ms)…0.065
(65 ms) in R< mode.
pause
Specifies how long the stimulation is interrupted between two repetitions of the wave
form.
Valid values: 0.0…4294.0 (4294 s).
numOfRepeats
startDelay
Specifies a delay for the start of the stimulation in seconds. This makes it possible to start
multiple curves in a defined sequence. This parameter is only supported by the VT2816
and VT2848 modules.
Valid values: 0.0..4.0 (4 s)
startPoint
Specifies the point of the stimulated curve the stimulation should begin with. This makes
it possible e.g. to start multiple curves with different phase shifts without changing the
curves.
Valid values: 0..4096
-1: Error
-2: The namespace on which the command was called does not exist or is not a valid VT
System namespace.
Example
The following example demonstrates how to use the waveform resistance output of a
VT2004 channel to simulate a sensor. In the example a waveform called WaveForm.txt is
loaded and replayed on channel Temp_Sensor. More details on waveforms can be found
on CANoe online help topic VT2004: Arbitrary Wave Forms.
Example WaveForm.txt
// Example of an arbitrary wave form for resistance stimulation
100
120 ; 2
140 ; 1
100
160 ; 4
100
tempSensor.SetStimulationMode(StimulationMode.ResistanceLower,
CurveType.AnalogWaveform);
| vtsSetWFParams |
StartStimulation
CAPL Function Overview » VT System » StartStimulation
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Function Starts the output of a stimulation signal. A corresponding output mode must be set in
advance.
Parameters —
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| vtsStartStimulation |
StopStimulation
CAPL Function Overview » VT System » StopStimulation
Note
The function can only be called on system variable namespaces of appropriate channels of
VT System modules.
Function Stops the output of a stimulation signal. This resets the output mode.
At the end of the execution of the command there is a short break before other
commands will be executed. This means that the next functions will be executed after a
short delay.
With this procedure ensures that the stop command is executed effectively. The
command should be called only in context of a test module setup but not in handler
functions. In handler functions the correct execution of the stop command can not be
ensured.
Parameters —
-2: The namespace on which the command was called does not exist or is not a valid VT
system namespace
-4: The function wasn't called in the context of the main method of a test module. So it is
not possible to wait until the setting will be taken over from the VT system. Otherwise
the call was successful but it is not sure if the settings have been taken over already when
the call returns.
Example
| vtsStopStimulation |
scopeActivateTrigger
CAPL Function Overview » Scope » scopeActivateTrigger
Function Performs Activate Trigger action for Scope window. This action is equivalent to activating
the trigger via the GUI.
The completion of this action is reported with an internal event which can be awaited via
TFS-function testWaitForScopeEvent() in CAPL programs for test modules.
Parameters —
Return values 2 (success): Trigger is already active. This might be a case when the trigger has been
activated by a previous CAPL call or manually.
1 (success): Trigger activation process started. On success an internal Scope event will be
generated (see above). Failure can be recognized implicitly by not receiving the
corresponding Scope event during certain timeout, e.g. during one second.
Example
long res;
res = scopeActivateTrigger();
if (res <= 0 || res > 2)
{
testStepFail("Initialization","Call to scopeActivateTrigger() failed.
Return code =%d", res);
return;
}
else if (res == 1)
{ // wait till action done
if (testWaitForScopeEvent(eScopeTriggerActivated, 8000) != 1)
{
testStepFail("Initialization ","Scope event eScopeTriggerActivated
was not received");
return;
}
}
testStep("Initialization","Scope trigger activation succeeded");
scopeConnect
CAPL Function Overview » Scope » scopeConnect
Function Performs Connect Scope action for Scope window. This action is equivalent to connecting
Scope via the GUI. The Scope window will be opened automatically if not yet opened.
The completion of this action is reported with an internal event which can be awaited via
TFS-function testWaitForScopeEvent() in CAPL programs for test modules.
Parameters —
Return values 2 (success): Connection is already established. This might be a case when connection has
been established by a previous CAPL call or manually.
Example
long res;
res = scopeConnect();
if (res < 0 || res > 2)
{
testStepFail("Initialization"," Call to scopeConnect() failed. Return
code =%d", res);
return;
}
else if (res == 1)
{ // wait till action done
if (testWaitForScopeEvent(eScopeConnected, 8000) != 1)
{
testStepFail("Initialization ","Scope event eScopeConnected was not
received");
return;
}
}
testStep("Initialization","USB connection with the scope hardware is
established");
scopeDeactivateTrigger
CAPL Function Overview » Scope » scopeDeactivateTrigger
Function Performs Deactivate Trigger action for Scope window. This action is equivalent to
deactivating the trigger via the GUI.
The completion of this action is reported with an internal event which can be awaited via
TFS-function testWaitForScopeEvent() in CAPL programs for test modules.
Parameters —
Return values 2 (success): Trigger is already inactive. This might be a case when the trigger has been
deactivated by a previous CAPL call or manually.
1 (success): Trigger deactivation process started. On success an internal Scope event will
be generated (see above). Failure can be recognized implicitly by not receiving the
corresponding Scope event during certain time-out, e.g. during one second.
Example
long res;
res = scopeDeactivateTrigger();
if (res <= 0 || res > 2)
{
testStepFail("Initialization","Call to scopeDeactivateTrigger() failed.
Return code =%d", res);
return;
}
else if (res == 1)
{ // wait till action done
if (testWaitForScopeEvent(eScopeTriggerDeactivated, 8000) != 1)
{
testStepFail("Initialization ","Scope event eScopeTriggerDeactivated
was not received");
return;
}
}
testStep("Initialization","Scope trigger deactivation succeeded");
scopeDisconnect
CAPL Function Overview » Scope » scopeDisconnect
Function Performs Disconnect Scope action for Scope window. This action is equivalent to
disconnecting Scope via the GUI.
The completion of this action is reported with an internal event which can be awaited via
TFS-function testWaitForScopeEvent() in CAPL programs for test modules.
Parameters —
Return values 2 (success): Scope is already disconnected. This might be a case when the disconnection
has been done by a previous CAPL call or manually.
Example
long res;
res = scopeDisconnect();
if (res <= 0 || res > 2)
{
testStepFail("Initialization","Call to scopeDisconnect() failed. Return
code =%d", res);
return;
}
else if (res == 1)
{ // wait till action done
if (testWaitForScopeEvent(eScopeDisconnected, 8000) != 1)
{
testStepFail("Initialization ","Scope event eScopeDisconnected was
not received");
return;
}
}
testStep("Initialization","USB connection with the scope hardware is
interrupted");
scopeTriggerNow
CAPL Function Overview » Scope » scopeTriggerNow
Function Performs Trigger Now action for Scope window. This action is equivalent to immediate
triggering via the GUI.
The completion of this action is reported with an internal event which can be awaited via
TFS-function testWaitForScopeEvent() in CAPL programs for test modules.
Parameters —
Return values 1 (success): Trigger signal has been generated. On trigger completion an internal Scope
event will be generated (see above). Failure can be recognized implicitly by not receiving
the corresponding Scope event during certain timeout, e.g. during one second.
Example
long res;
res = scopeTriggerNow();
if (res != 1)
{
testStepFail("Initialization","Call to scopeTriggerNow() failed. Return
code =%d", res);
return;
}
ScopeEvent Seletors
CAPL Function Overview »Scope » ScopeEvent Seletors
DataID Data identifier of the captured data created after re- int Read-only
quest to trigger on Scope hardware completed.
Time Timestamp of the captured data created after request to int64 Read-only
trigger on Scope hardware completed.
| testGetWaitScopeEventData| testWaitForScopeEvent |
Value Description
| testWaitForScopeEvent |
Info
xcpActive Activates a a2l signal for upload, download and DAQ measurement.
xcpConnect Establishes a connection to the XCP/CCP device and starts the configured
DAQ measurement.
xcpActive
CAPL Function Overview » XCP » xcpActive
Function Activates a a2l signal for upload, download and DAQ measurement.
Parameters namespace
variable
sysVar
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::".
The name must be preceded by "sys-Var::"
Return values 0: OK
7.5 XCP — •
Example
| xcpDeactive |
xcpConnect
CAPL Function Overview » XCP » xcpConnect
Function Establishes a connection to the XCP/CCP device and starts the configured DAQ
measurement.
Parameters ecuQualifier
Return values 0: OK
7.2 XCP — •
Example
| xcpDisconnect |
xcpDeactive
CAPL Function Overview » XCP » xcpDeactive
Parameters namespace
variable
sysvar
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::".
The name must be preceded by "sys-Var::"
Return values 0: OK
7.5 XCP — •
Example
| xcpActive |
xcpDisconnect
CAPL Function Overview » XCP » xcpDisconnect
Parameters ecuQualifier
Return values 0: OK
7.2 XCP — •
Example
| xcpConnect |
xcpIsConnected
CAPL Function Overview » XCP » xcpIsConnected
Parameters ecuQualifier
1: Connected
7.2 XCP — •
Example
| xcpConnect | xcpDisconnect |
xcpUpload
CAPL Function Overview » XCP » xcpUpload
Function Initiates an upload of the XCP signal from ECU and updates the dedicated system variable.
After finishing of the upload the callback function OnXcpUplad is called to indicate the
upload status.
Use the return value of xcpUpload to check if an error occurred during initiation of the
upload.
Use the errorIndication parameter of the OnXcpUpload callback function to check for
errors occurred during the upload, if an error during call of xcpUpload occurs
OnXcpUpload is not called.
Parameters namespace
variable
sysvar
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::".
The name must be preceded by "sysvar::"
errorIndication
0: OK
-4: Device is not connected
Return values 0: OK
7.6 XCP — •
Example
testcase TC_SignalInactive ()
{
xcpUpload("XCP::ECU","testword0");
....
}
//Callback function:
void OnXcpUpload (char namespace[], char variable[], long returnValue)
{
if (returnValue==0)
write("Systemvariable updated: %s %s", namespace,variable);
}
26
39
46 AEC_ERR_NO_PATTERNFILE_DEFINED No parameterfilename.
53 AEC_TCP_EXIT_NOTCLOSED
58 AEC_REG_OPEN_KEY_FAILED Key
"HKEY_LOCAL_MACHINE\\SOFTWARE\\VECTOR\\CANape"
missing at Windows Registry, maybe CANape setup has
not been correctly performed.
71 AEC_LAST_ERRCODE
| CANape Documentation |
The ASAM-MCD/CAPL API makes available the following functions for MCD control:
MCDGetCurrentValue Get one of the values which was configured with the data
acquisition.
MCDStartDataAcq/ Configure and start the data acquisition. / The data acquisition
MCDStartDataAcqAsync is started asynchronous.
Explicit read functions are not available. The response of the MCD server will be given in the callback
function MCDParamResponse. Here the user can implement his specific code.
MCDCreateModule
CAPL Function Overview » ASAM-MCD » MCDCreateModule
Parameters moduleName
Return values 0: OK
- 1: Error
6.1 ASAM-MCD — •
Example
MCDEcuOnOffline
CAPL Function Overview » ASAM-MCD » MCDEcuOnOffline
Parameters moduleName
Name of the module that is configured in the global options dialog Configuration
Settings|MCD Server.
ecuState
Return values 1: OK
0: Error
6.1 ASAM-MCD — •
Example
MCDExit
CAPL Function Overview » ASAM-MCD » MCDExit
Parameters —
Return values 0: OK
5.2 ASAM-MCD — •
Example
MCDGetCurrentValue
CAPL Function Overview » ASAM-MCD » MCDGetCurrentValue
Function Get one of the values which was configured with the data acquisition.
Parameters ModuleName
Name of the module that is configured in the global options dialog Configuration
Settings|MCD Server.
parameterName
5.2 ASAM-MCD — •
Example
MCDGetECUParam
CAPL Function Overview » ASAM-MCD » MCDGetECUParam
Function Reading of a parameter. The read parameter value will be available in the
MCDParamResponse callback handler.
Parameters ModuleName
Name of the module that is configured in the global options dialog Configuration
Settings|MCD Server.
parameterName
format
Return values 0: OK
5.2 ASAM-MCD — •
Example
MCDGetLastError
CAPL Function Overview » ASAM-MCD » MCDGetLastError
Parameters —
Return values <Error number>: See Error Codes for the description.
5.2 ASAM-MCD — •
Example
MCDInit
CAPL Function Overview » ASAM-MCD » MCDInit
Function Initialisation of the MCD server. CANape will be started in non modal mode.
This function must only be called during the initialisation phase of the measurement
(MeasurementInit).
Parameters —
Return values 0: OK
- 1: Error
5.2 ASAM-MCD — •
Example
MCDInitEx
CAPL Function Overview » ASAM-MCD » MCDInitEx
Function Initialisation of the MCD server. CANape will be started in non modal mode.
This function must only be called during the initialisation phase of the measurement
(MeasurementInit).
Parameters driverType
autoCreate
0: Only the MCD server is started; the module is not created implicitly.
1: The module is created implicitly; MCDCreateModule is not needed afterwards.
sampleSize
Number of values of the data acquisition. The default in the other functions is 32.
Info
Return values 0: OK
- 1: Error
6.1 ASAM-MCD — •
Example
MCDMapECUParamToSysVariableRead
CAPL Function Overview » ASAM-MCD » MCDMapECUParamToSysVariableRead
Function Maps an ECU parameter to a system variable so that it the system variable changes
whenever the parameter is updated. The MCD data acquisition must already be started.
Parameters moduleName
Name of the module that is configured in the global options dialog Configuration
Settings|MCD Server.
parameterName
SysVarName
System variable.
Example
MCDMapECUParamToSysVariableWrite
CAPL Function Overview » ASAM-MCD » MCDMapECUParamToSysVariableWrite
Function Maps an ECU parameter to a system variable so that it is changed whenever the system
variable changes.
Parameters moduleName
Name of the module that is configured in the global options dialog Configuration
Settings|MCD Server.
parameterName
SysVarName
System variable.
Example
| MCDMapECUParamToSysVariableRead | MCDSetECUParam |
MCDParamIsValid
CAPL Function Overview » ASAM-MCD » MCDParamIsValid
Function Checks, if a parameter is valid. The value has to be from the MCD communication.
Parameters moduleName
Name of the module that is configured in the global options dialog Configuration
Settings|MCD Server.
parameterName
6.1 ASAM-MCD — •
Example
MCDParamResponse
CAPL Function Overview » ASAM-MCD » MCDParamResponse
Function Callback handler on a MCDGetECUParam request. This function must be defined in the
CAPL program to get a response on a read request.
Parameters moduleName
Name of the module that is configured in the global options dialog Configuration
Settings|MCD Server.
parameterName
value
Return values —
5.2 ASAM-MCD — •
Example
MCDQuitCANape
CAPL Function Overview » ASAM-MCD » MCDQuitCANape
Parameters —
Return values 0: OK
5.2 ASAM-MCD — •
Example
MCDSetECUParam
CAPL Function Overview » ASAM-MCD » MCDSetECUParam
Parameters ModuleName
Name of the module that is configured in the global options dialog Configuration
Settings|MCD Server.
parameterName
value
Return values 0: OK
5.2 ASAM-MCD — •
Example
MCDStartDataAcq/ MCDStartDataAcqAsync
CAPL Function Overview » ASAM-MCD » MCDStartDataAcq/ MCDStartDataAcqAsync
Syntax long MCDStartDataAcq( char moduleName[], int taskId, int pollingRate, char
parameters[])
Function Configure and start the data acquisition. After a data acquisition is started the configured
parameters are transferred to CANoe with the specified polling rate. The values can be
obtained with MCDGetCurrentValue.
Parameters ModuleName
Name of the module that is configured in the global options dialog Configuration
Settings|MCD Server.
taskId
pollingRate
Cycle time with which the values are reported to CANoe internally.
parameters
A string that specifies the parameters which are cyclically reported to CANoe. The
parameters are separated with ';'.
Note: the size of the string must contain the null terminator.
Return values 0
5.2 ASAM-MCD — •
Example
MCDStatusIndication
CAPL Function Overview » ASAM-MCD » MCDStatusIndication
The function provides the status of successful/ not successful data acquisition starts.
Parameters modulName
Module name configured in the global option dialog. Configuration settings |MCD Server.
operation
Status
1: Successful
0: Fail
Return values —
6.1 ASAM-MCD — •
Example
MCDStopDataAcq
CAPL Function Overview » ASAM-MCD » MCDStopDataAcq
Function Stops the data acquisition explicitly. An active data acquisition is stopped implicitly on
measurement stop.
Parameters —
Return values 0
5.2 ASAM-MCD — •
Example
26
39
46 AEC_ERR_NO_PATTERNFILE_DEFINED No parameterfilename.
53 AEC_TCP_EXIT_NOTCLOSED
58 AEC_REG_OPEN_KEY_FAILED Key
"HKEY_LOCAL_MACHINE\\SOFTWARE\\VECTOR\\CANape"
missing at Windows Registry, maybe CANape setup has
not been correctly performed.
71 AEC_LAST_ERRCODE
| CANape Documentation |
Pending.
state Pending.
CANstressAvailableDevices
CAPL Function Overview » CANstress » CANstressAvailableDevices
Function Indicates the number of configured CANstress devices. This number is defined in the
canstress.ini file, which is located in the CANstress installation directory.
Parameters —
6.0 • CANstress — •
• Test modules
Example
CANstressConnect
CAPL Function Overview » CANstress » CANstressConnect
Function Establishes a connection between the CANstress software and the CANstress hardware.
Parameters —
-2: In case of error (due to an internal timeout during the connection establishment).
5.0 • CANstress — •
• Test modules
Example
CANstressCreateServer
CAPL Function Overview » CANstress » CANstressCreateServer
Note
This function must be called before all other CANstress CAPL functions!
Function Starts the CANstress software and establishes a connection via the COM interface to this
COM server. If no registered CANstress COM server is found, the ongoing measurement is
stopped.
Parameters —
5.0 • CANstress — •
• Test modules
Example
CANstressCreateServer(DeviceAlias)
CAPL Function Overview » CANstress » CANstressCreateServer(DeviceAlias)
Note
This function must be called before all other CANstress CAPL functions!
Function Starts the CANstress software and establishes a connection to this COM server via the COM
interface. The COM server generated only establishes a connection to the CANstress
device defined in deviceAlias. Connected CANstress devices are mapped to an alias using
the canstress.ini file. You will find this file in the CANstress software’s installation
directory. If the call is successful, the device defined in deviceAlias will be set as the
current device.
Parameters —
6.0 • CANstress — •
• Test modules
Example
CANstressCreateServer(Device number)
CAPL Function Overview » CANstress » CANstressCreateServer(Device number)
Note
This function must be called before all other CANstress CAPL functions!
Function Starts the CANstress software and establishes a connection to this COM server via the COM
interface. The COM server generated only establishes a connection to the CANstress
device defined in deviceNr. Connected CANstress devices are mapped to a number using
the canstress.ini file. You will find this file in the CANstress software’s installation
directory. If the call is successful, the device defined in deviceNr will be set as the
current device.
Parameters —
6.0 • CANstress — •
• Test modules
Example
| CANstressCreateServer() | CANstressCreateServer(DeviceAlias) |
CANstressGetDevice
CAPL Function Overview » CANstress » CANstressGetDevice
Function Sends back the handle for the current CANstress device.
Parameters —
6.0 • CANstress — •
• Test modules
Example
CANstressGetInfo
CAPL Function Overview » CANstress » CANstressGetInfo
Note
So that the call can be executed successfully, there must be a connection between the
CANstress software and the CANstress hardware. Only in this case can the information for
the CANstress hardware (firmware, CAN interface, serial number) be acquired correctly.
Function Delivers information about CANstress software and the connected CAN hardware.
Parameters softwareVersion
Buffer in which the version of the software is written (recommended buffer size: 20
Byte).
swVersionBufLen
Size of the buffer in which the software version is written (in bytes).
firmwareVersion
Buffer in which the version of the firmware is written (recommended buffer size: 10
Byte).
fwVersionBufLen
Size of the buffer in which the firmware version is written (in bytes).
serialNumber
Buffer in which the serial number of the CANstress hardware is written (recommended
buffer size: 20 Byte).
snBufLen
Size of the buffer in which the hardware serial number is written (in bytes).
canInterface1
Buffer in which the type of the CAN interface 1 of the CANstress hardware is written
(recommended buffer size: 40 Byte).
if1BufLen
Size of the buffer in which the type of the CAN interface1 is written (in bytes).
canInterface2
Buffer in which the type of the CAN interface 2 of the CANstress hardware is written
(recommended buffer size: 40 Byte).
if2BufLen
Size of the buffer in which the type of the CAN interface 2 is written (in bytes).
5.0 • CANstress — •
• Test modules
Example
CANstressGetPerformedDisturbances
CAPL Function Overview » CANstress » CANstressGetPerformedDisturbances
Parameters —
Return values Number of disturbances that were executed since the last call to disturb.
5.0 • CANstress — •
• Test modules
Example
CANstressIsFinished
CAPL Function Overview » CANstress » CANstressIsFinished
Function Serves to query whether the CANstress hardware is in the state Finished.
Parameters —
5.0 • CANstress — •
• Test modules
Example
CANstressIsIdle
CAPL Function Overview » CANstress » CANstressIsIdle
Function Serves to query whether the CANstress hardware is in the state Idle.
Parameters —
5.0 • CANstress — •
• Test modules
Example
CANstressIsPending
CAPL Function Overview » CANstress » CANstressIsPending
Function Serves to query whether the CANstress hardware is in the state Pending.
Parameters —
5.0 • CANstress — •
• Test modules
Example
CANstressOnFinished
CAPL Function Overview » CANstress » CANstressOnFinished
Function Registers a CAPL function as callback that is called if CANstress is switched into the state
Finished.
Parameters fnctCallback
Info
5.0 • CANstress — •
• Test modules
Example
CANstressOnIdle
CAPL Function Overview » CANstress » CANstressOnIdle
Function Registers a CAPL function as callback that is called if CANstress is switched into the state
Idle.
Parameters fnctCallback
Info
5.0 • CANstress — •
• Test modules
Example
CANstressOnPending
CAPL Function Overview » CANstress » CANstressOnPending
Function Registers a CAPL function as callback that is called if CANstress is switched into the state
Pending.
Parameters fnctCallback
Info
5.0 • CANstress — •
• Test modules
Example
CANstressOpen
CAPL Function Overview » CANstress » CANstressOpen
Parameters fileName
If the passed configuration file is configured as a User File, only the file name is passed
here. Otherwise either an absolute path or a relative path relating to the folder of the
CANoe configuration must be passed.
Return values —
5.0 • CANstress — •
• Test modules
Example
CANstressQuit
CAPL Function Overview » CANstress » CANstressQuit
Function Ends the CANstress software. All following CANstress CAPL functions cause error messages
(if previously a CANstress server was not created a new).
Parameters —
Return values —
5.0 • CANstress — •
• Test modules
Example
CANstressSetBTR
CAPL Function Overview » CANstress » CANstressSetBTR
Function Sets the value of the Bus Timing Register. This setting affects the baud rate of the CAN
bus set in CANstress. The CAN controller data sheet will list valid pairs of values.
Parameters btr0
btr1
Return values —
6.0 • CANstress — •
• Test modules
Example
CANstressSetContinuousDisturbanceTimeLimited
CAPL Function Overview » Canisters » CANstressSetContinuousDisturbanceTimeLimited
Function Sets the Continuous disturbance (time limited) mode. If the disturbance has not
previously been terminated by means of an explicit command such as CANstressStop, the
end of the test module or the end of the measurement, it will prevail for the period of
time set in duration.
Parameters time
Defines the maximum length of the continuous disturbance. The length is specified in ms
and must be greater than 0.
type
Defines the type of continuous disturbance. The disturbance can be associated with
dominant or recessive bits or it can be an analog disturbance. 2 indicates a dominant
disturbance, 3 a recessive disturbance and 4 an analog disturbance (only in conjunction
with CANstress DR).
Return values —
6.0 • CANstress — •
• Test modules
Example
CANstressSetContinuousDisturbanceUntilStop
CAPL Function Overview » CANstress » CANstressSetContinuousDisturbanceUntilStop
Function Sets the Continuous disturbance (until stop) mode. Once the trigger has been activated,
the continuous disturbance will prevail until the CANstress device is deactivated (e.g. by
means of the CANstressStop function) and/or the measurement or test module is
terminated.
Parameters type
Defines the type of continuous disturbance. The disturbance can be associated with
dominant or recessive bits or it can be an analog disturbance. 2 indicates a dominant
disturbance, 3 a recessive disturbance and 4 an analog disturbance (only in conjunction
with CANstress DR).
Return values —
6.0 • CANstress — •
• Test modules
Example
CANstressSetContinuousDisturbanceWhileTrigger
CAPL Function Overview » CANstress » CANstressSetContinuousDisturbanceWhileTrigger
Function Sets the Continuous disturbance (while trigger) mode. The continuous disturbance will
prevail for as long as the trigger is active. Please note that this mode is generally only
useful in conjunction with a software trigger.
Parameters type
Defines the type of continuous disturbance. The disturbance can be associated with
dominant or recessive bits or it can be an analog disturbance. 2 indicates a dominant
disturbance, 3 a recessive disturbance and 4 an analog disturbance (only in conjunction
with CANstress DR).
Return values —
6.0 • CANstress — •
• Test modules
Example
CANstressSetDevice
CAPL Function Overview » CANstress » CANstressSetDevice
Parameters deviceId
Handle for the CANstress device on which further functions are to run. This handle is sent
back by the CANstressCreateServer function.
This means that deviceId is not a valid handle for a CANstress device. Only handles sent
back by the CANstressCreateServer function and for which the connection to the COM
server has not yet been terminated with CANstressQuit are valid.
6.0 • CANstress — •
• Test modules
Example
CANstressSetDisturbanceSequence
CAPL Function Overview » CANstress » CANstressSetDisturbanceSequence
Parameters sequence
resolution
Sets the resolution of the disturbance sequence. Possible values are 0 for bit times and 1
for BTL cycles.
Return values —
6.0 • CANstress — •
• Test modules
Example
CANstressSetDisturbanceSequence(“uuuu1111“, 0);
CANstressSetLimitedDisturbanceNumber
CAPL Function Overview » CANstress » CANstressSetLimitedDisturbanceNumber
Function Sets the Limited number of disturbances disturbance mode. In this mode, the number n
of disturbances in a disturbance cycle is limited. n disturbances will be followed by a
configurable pause p as long as this is not a single disturbance cycle.
Parameters cycles
Defines the number of disturbance cycles. Values from 1 to 65,535 are valid.
distPerCycles
Defines the number of disturbances per disturbance cycle. Values from 1 to 255 are valid.
cyclePause
Defines the length of the pause between two disturbance cycles. The length is defined in
ms and may be between 1 and 65,535.
Return values —
6.0 • CANstress — •
• Test modules
Example
CANstressSetResistor
CAPL Function Overview » CANstress » CANstressSetResistor
Function Sets the value of a resistor for analog disturbances. This command will only take effect if
permitted by the resistor layout set in the basic configuration. If the R_H layout is active,
it will only be possible to set the RH resistor. If the CANstress device is inactive at this
point, settings will only be applied once the CANstress device is active, i.e., once the
trigger has been activated.
Parameters resId
1 for RH
2 for RSH
3 for RHL
4 for RSL
5 for RL
value
New resistor value. The value is specified in ohms, whereby only multiples of 2.5 in the
range between 0 and 10,237.5 are valid. In the event of values that may be invalid, a
warning will appear in the test report. If an invalid value is transferred, it will be ignored
(i.e., not applied) by the COM server.
Return values —
6.0 • CANstress — •
• Test modules
Example
CANstressSetTriggerId
CAPL Function Overview » CANstress » CANstressSetTriggerId
Function Sets the message ID, which will activate the trigger.
Parameters Id
Message ID for trigger. Both simple and complex CAN message IDs can be specified.
However, the corresponding mode must be set in the basic configuration!
Return values —
6.0 • CANstress — •
• Test modules
Example
CANstressSetTriggerRange
CAPL Function Overview » CANstress » CANstressSetTriggerRange
Function Sets a range for message IDs, which will activate triggers. Both simple and complex CAN
message IDs can be specified. However, the corresponding mode must be set in the basic
configuration!
Parameters fromId
toId
Return values —
6.0 • CANstress — •
• Test modules
Example
CANstressSetUnlimitedDisturbanceNumber
CAPL Function Overview » CANstress » CANstressSetUnlimitedDisturbanceNumber
Function Sets the Unlimited number of disturbances disturbance mode. In this mode, a
disturbance occurs on every trigger event. There is no limit to the total number of
disturbances.
Parameters —
Return values —
6.0 • CANstress — •
• Test modules
Example
CANstressStart
CAPL Function Overview » CANstress » CANstressStart
Function Orders the CANstress COM server to activate the hardware for the error disturbance
activity. If there is no connection between the CANstress software and the CANstress
hardware, this is established previously.
Parameters —
5.0 • CANstress — •
• Test modules
Example
CANstressStop
CAPL Function Overview » CANstress » CANstressStop
Function Orders the CANstress COM server to end the current disturbance activity of the hardware.
Parameters —
Return values —
5.0 • CANstress — •
• Test modules
Example
CANstressStopTrigger
CAPL Function Overview » CANstress » CANstressStopTrigger
Parameters —
5.0 • CANstress — •
• Test modules
Example
CANstressTrigger
CAPL Function Overview » CANstress » CANstressTrigger
Parameters —
5.0 • CANstress — •
• Test modules
Example
CANstressWaitForFinished
CAPL Function Overview » CANstress » CANstressWaitForFinished
Parameters timeoutText
Specifies a maximal time in milliseconds that is waited. At the latest after the expiration
of this time, the function returns.
Info
With timeout = 0 an infinite time is waited until the state Finished occurs.
Thus the additional test procedure is blocked if the state Finished is not
reached.
5.0 • CANstress — •
• Test modules
Example
CANstressWaitForIdle
CAPL Function Overview » CANstress » CANstressWaitForIdle
Parameters timeout
Specifies a maximal time in milliseconds that is waited. At the latest after the expiration
of this time, the function returns.
Info
With timeout = 0 an infinite time is waited until the state Idle occurs. Thus
the additional test procedure is blocked if the state Idle is not reached.
5.0 • CANstress — •
• Test modules
Example
CANstressWaitForPending
CAPL Function Overview » CANstress » CANstressWaitForPending
Parameters timeout
Specifies a maximal time in milliseconds that is waited. At the latest after the expiration
of this time, the function returns.
Info
With timeout = 0 an infinite time is waited until the state Pending occurs.
Thus the additional test procedure is blocked if the state Pending is not
reached.
5.0 • CANstress — •
• Test modules
Example
With previous versions of CANstress NL DLL, it was only possible to access a single CANstress device from a
single test module. With Version 2.0, it is now possible to control as many CANstress devices as you like
from a single test module. To do this, you need to start by configuring the connected CANstress devices in
the CANstress.ini file. You will find this file in the CANstress application’s installation directory. For
more information, see online help of the CANstress application.
To establish a connection to a specific CANstress device, you need to use the CANstressCreateServer
command with the alias or number of a configured CANstress device as a parameter. You will then obtain
a handle, which you can use to switch between different devices. To do this, you need to use the
CANstressSetDevice function with the relevant handle as a parameter.
The NodeLayer DLL will recognize the set CANstress device. When CANstressCreateServer or
CANstressSetDevice is called, the following calls to CANstress CAPL functions are executed on the set
device.
Example
// Check that CANstress devices have been configured
if (CANstressAvailableDevices() < 2)
{
TestCaseFail();
Write("Number of configured CANstress devices is less than 2!");
}
CANstressSetDevice(deviceId1);
// The following commands are executed on "cstCAN1"
CANstressOpen(".\\CANstress\\EngineData_BusOff.cst");
Since version 7.5 SP2 of CANoe, the use of CANstress integration in combination with CANoe RT is
simplified. Use with VN8900 modules is also now possible.
Important changes
• The CANstressOpen command now supports the specification of CANstress configuration files as
application data.
• For access to CANstress devices via CANstress commands in CANoe, it is no longer necessary to install
the CANstress application. All necessary components are now part of CANoe. The CANstress
application is now needed only to create configuration files. In CANoe version 7.5 SP2 and higher, the
access to CANstress devices that are connected to VN8900 is also supported.
The following must be noted for use of CANstress commands together with CANoe RT or the VN8900:
• All CANstress configuration files used must be entered in the CANoe configuration as user files. They
are transferred automatically to the RT Server or the VN8900 at the start of a measurement.
• The calls of CANstressOpen specify just the file name, instead of a relative or absolute path.
• For example, if a configuration is needed for access to multiple devices, access to the correct device
can be configured using the configuration page for CANstress. This requires the CANstress devices to
first be connected to the correct system. When CANoe RT is used, this is the RT Server, e.g., a VT6010
module. If a VN8900 is used, CANstress devices must be connected there. With CANoe RT, the
connection to the RT server is then established in the Options. With VN8900, only the correct
configuration of the channels used is needed to establish the connection automatically. If Options is
now reopened and the CANstress configuration page is displayed, the CANstress devices are searched
for on the correct system, and the configuration on that system is displayed. Changes to the
configuration are then saved on the correct system.
A configuration in which the first two points are observed can be operated either with or without CANoe
RT. The use of relative or absolute paths continues to be supported, but will likely lead to problems when
CANoe RT is used.
Example
MainTest ()
{
dword ret = 0;
dword numDisturbances = 0;
// Now, wait until the CANstress has been finished or the timeout has been
elapsed
ret = CANstressWaitForFinished( 5000 );
if (ret == 0)
{
Write( "All disturbances of the configuration has been performed." );
}
else
{
numDisturbances = CANstressGetPerformedDisturbances();
Write( "Disturb_100_RTR.cst : Not all disturbances has been performed:" );
Write( "Performed Disturbances: %d", numDisturbances );
}
In Option .FlexRay the following functions are available with FRstress hardware:
FRSSetTrigPort Sets the input port for the trigger condition in digital
mode.
FRSOnStopped
FRSOnFinished
CAPL Function Overview » FRstress » FRSOnFinished
Note
Function Registers a callback. The callback will be executed when the dedicated disturbance
counter is 0. The callback function must be added in the CAPL section callback.
Parameters CallbackName
Callback unit
parameter
Device number: 1 or 2
page
Trigger/Disturbance page: 1 - 4
7.0 • FlexRay — •
• Test nodes
Example
FRSOnStopped
CAPL Function Overview » FRstress » FRSOnStopped
Note
Function Registers a callback. The callback will be executed when the session ends. The callback
function must be added in the CAPL section callback.
Parameters CallbackName
Callback <name>(void)
7.0 • FlexRay — •
• Test nodes
Example
FRSActivateCRCCalc
CAPL Function Overview » FRstress » FRSActivateCRCCalc
Note
Function Activates the automatic CRC computation based on the disturbance data (FRSSetFrmDist,
FRSSetFrmDistElem, FRSSetDistPayload) and the real frame.
Parameters index
Values: 1-4
calculateCRC
Values:
0 no calculation
1 calculate header crc
2 calculate frame crc
3 calculate header and frame crc
Return values 0: successful
7.2 • FlexRay — •
• Digital mode
• Test nodes
Example
FRSClear
CAPL Function Overview » FRstress » FRSClear
Note
Parameters —
7.2 • FlexRay — •
• Digital, analog, Scope
mode
• Test nodes
Example
FRSEnableTrigDist
CAPL Function Overview » FRstress » FRSEnableTrigDist
Note
Function Activates a trigger/disturbance page of FRstress. This function can be called out of a
measurement session.
Parameters triggerCondition
Values: 1-4
iEnable
Enable = 1
Disable = 0
7.0 • FlexRay — •
• Test nodes
Example
FRSGetDevice
CAPL Function Overview » FRstress » FRSGetDevice
Note
Function Indicates the device number of the FRstress hardware, set with FRSSetDevice.
Parameters —
Return values Returns the device number of the currently active hardware unit.
7.0 • FlexRay — •
• Test nodes
Example
FRSInit
CAPL Function Overview » FRstress » FRSInit
Note
Function Initializes FRstress and starts the COM server. The function must be called once in on
prestart.
Parameters —
7.0 • FlexRay — •
• Test nodes
Example
FRSOpen
CAPL Function Overview » FRstress » FRSOpen
Note
Parameters sFileName
7.0 • FlexRay — •
• Test nodes
Example
FRSQuit
CAPL Function Overview » FRstress » FRSQuit
Note
Parameters —
Return values —
7.0 • FlexRay — •
• Test nodes
Example
FRSSetAnalogMode
CAPL Function Overview » FRstress » FRSSetAnalogMode
Note
Parameters baudrate
channel
payloadLength
7.2 • FlexRay — •
• Digital, analog, Scope
mode
• Test nodes
Example
FRSSetBitstreamDist
CAPL Function Overview » FRstress » FRSSetBitstreamDist
Note
Function Generates a bit sequence that is applied to the bus as a disturbance after the trigger is
detected. In addition, a delay between the trigger and disturbance can be set. The
autoincrement value increases the delay by the specified amount at each additional
trigger.
Parameters triggerCondition
Values: 1…4
disturbanceSequence
disturbanceLength
delayAfterTrigger
autoincrement
7.2 • FlexRay — •
• Digital, analog mode
• Test nodes
Example
FRSSetDevice
CAPL Function Overview » FRstress » FRSSetDevice
Note
Function Sets the device number for FRstress. All subsequent calls will be addressed to this unit.
Parameters iDeviceNo
Device number: 1 or 2
Return values —
7.0 • FlexRay — •
• Test nodes
Example
FRSSetDigitalMode
CAPL Function Overview » FRstress » FRSSetDigitalMode
Note
Info
Parameters baudrate
channel
payloadLength
macrotickLengthUs
Values: 1-6 us
TSSLengthBit
Values3-15 Bit
cycleLengthUs
Values: 26 – 16000 us
numberStaticSlots
Values: 2-1023
actionPointOffsetMT
staticSlotLengthMT
TSSExtension
7.2 • FlexRay — •
• Digital, analog, Scope
mode
• Test nodes
Example
FRstressSetDistCount
CAPL Function Overview » FRstress » FRstressSetDistCount
Note
Parameters index
Values: 1-4
disturbanceCount
7.2 • FlexRay — •
• Digital, analog mode
• Test nodes
Example
FRSSetDistPayload
CAPL Function Overview » FRstress » FRSSetDistPayload
Note
Function Modifies the Payload with bit accuracy. The disturbance is defined as a bit sequence. A
complex disturbance can be configured through multiple calls.
The associated trigger condition must not overlap with the disturbance.
If the function is called in analog mode, it has no effect.
Parameters triggerCondition
Values: 1…4
disturbancePayloadElement
byteIndex
disturbanceValue
Bit sequence of the respective payload byte. The possible elements of the sequence are
0,1,x (don’t care).
7.2 • FlexRay — •
• Digital mode
• Test nodes
Example
| FRSActivateCRCCalc |
FRSSetFrmDist
CAPL Function Overview » FRstress » FRSSetFrmDist
Note
Function Modifies the specified frame element with bit accuracy. The disturbance is defined as a
bit sequence. A complex disturbance can be configured through multiple calls.
The associated trigger condition must not overlap with the disturbance.
Parameters triggerCondition
Values: 1-4
disturbanceElement
Values:
1 PPI
2 NFI
3 SFI
4 SUPFI
5 FrameId
6 PayloadLength
7 HeaderCR
8 cycleCount
9 BSS1
10 BSS2
11 BSS3
12 BSS4
13 BSS5
14 TrailerBSS1
15 TrailerBSS2
16 TrailerBSS3
17 TrailerCRCByte1
18 TrailerCRCByte2
19 TrailerCRCByte
20 FES
disturbanceValue
The respective maximum lengths must be noted. For example, the PayloadLength field
must not exceed the maximum length of 7 bits.
7.2 • FlexRay — •
• Digital mode
• Test nodes
Example
| FRSActivateCRCCalc |
FRSSetFrmDistElem
CAPL Function Overview » FRstress » FRSSetFrmDistElem
Note
Function Modifies the specified frame element with bit accuracy. A complex disturbance can be
configured through multiple calls.
The associated trigger condition must not overlap with the disturbance.
Parameters triggerCondition
Values: 1-4
disturbanceElement
Values:
1 PPI
2 NFI
3 SFI
4 SUPFI
5 FrameId
6 PayloadLength
7 HeaderCRC
8 cycleCount
9 BSS1
10 BSS2
11 BSS3
12 BSS4
13 BSS5
14 TrailerBSS1
15 TrailerBSS2
16 TrailerBSS3
17 TrailerCRCByte1
18 TrailerCRCByte2
19 TrailerCRCByte3
20 FES
disturbanceValue
7.2 • FlexRay — •
• Digital mode
• Test nodes
Example
| FRSActivateCRCCalc |
FRSSetScopeMode
CAPL Function Overview » FRstress » FRSSetScopeMode
Note
Parameters baudrate
channel
payloadLength
7.2 • FlexRay — •
• Digital, analog, Scope
mode
• Test nodes
Example
FRSSetTrig
CAPL Function Overview » FRstress » FRSSetTrig
Note
Function Adds a bit sequence to the respective trigger condition as a trigger value. A complex
trigger condition can be created through multiple calls.
Parameters triggerCondition
Values: 1-4
triggerElement
Values:
0 reservedBit
1 PPI
2 NFI
3 SFI
4 SUPFI
5 FrameId
6 PayloadLength
7 HeaderCRC
8 cycleCount
9 BSS1
10 BSS2
11 BSS3
12 BSS4
13 BSS5
14 TrailerBSS1
15 TrailerBSS2
16 TrailerBSS3
17 TrailerCRCByte1
18 TrailerCRCByte2
19 TrailerCRCByte3
20 FES
triggerValue
Bit sequence of the respective frame field. The possible elements of the sequence are
0,1,x (don’t care). The respective maximum lengths must be noted. For example, the
PayloadLength field must not exceed the maximum length of 7 bits.
7.2 • FlexRay — •
• Digital, analog, Scope
mode
• Test nodes
Example
FRSSetTrigElem
CAPL Function Overview » FRstress » FRSSetTrigElem
Note
Function Adds a numerical trigger value to the respective trigger condition. A complex trigger
condition can be created through multiple calls.
Parameters triggerCondition
Values: 1-4
triggerElement
Values:
0 reservedBit
1 PPI
2 NFI
3 SFI
4 SUPFI
5 FrameId
6 PayloadLength
7 HeaderCRC
8 cycleCount
9 BSS1
10 BSS2
11 BSS3
12 BSS4
13 BSS5
14 TrailerBSS1
15 TrailerBSS2
16 TrailerBSS3
17 TrailerCRCByte1
18 TrailerCRCByte2
19 TrailerCRCByte3
20 FES
triggerValue
Numerical value of the respective frame field. The respective maximum values must be
noted. For example, the Payload Length must not exceed the maximum value of 127
words.
7.2 • FlexRay — •
• Digital, analog, Scope
mode
• Test nodes
Example
FRSSetTrigOutput
CAPL Function Overview » FRstress » FRSSetTrigOutput
Note
Function Activates the trigger output of FRsstress. The trigger output can react to individual trigger
lowerings or to a combination of sources.
Parameters triggermask
Values:
1 Trigger1
2 Trigger2
4 Trigger3
8 Trigger4
16 SW Trigger
32 External Trigger
triggerlevel
7.2 • FlexRay — •
• Digital, analog, Scope
mode
• Test nodes
Example
FRSSetTrigPayload
CAPL Function Overview » FRstress » FRSSetTrigPayload
Note
Function Adds a bit sequence to the respective trigger condition as a trigger value. A complex
trigger condition can be created through multiple calls.
Parameters triggerCondition
Values: 1…4
triggerPayloadElement
byteIndex
triggerValue
Bit sequence of the respective Payload byte. The possible elements of the sequence are
0,1,x (don’t care).
7.2 • FlexRay — •
• Digital, analog, Scope
mode
• Test nodes
Example
FRSSetTrigPort
CAPL Function Overview » FRstress » FRSSetTrigPort
Note
Function Adds a bit sequence to the the respective trigger condition as a trigger value. A complex
trigger condition can be created through multiple calls.
Parameters triggerCondition
Values: 1-4
portMask
7.2 • FlexRay — •
• Digital mode
• Test nodes
Example
FRSSoftwareTrigger
CAPL Function Overview » FRstress » FRSSoftwareTrigger
Note
Parameters iEnable
Enable = 1
Disable = 0
7.0 • FlexRay — •
• Test nodes
Example
FRSStart
CAPL Function Overview » FRstress » FRSStart
Note
Function Orders the FRstress COM server to activate the hardware for the error disturbance
activity.
Parameters —
7.0 • FlexRay — •
• Test nodes
Example
FRSStop
CAPL Function Overview » FRstress » FRSStop
Note
Function Orders the FRstress COM server to end the current disturbance activity of the hardware.
Parameters —
7.0 • FlexRay — •
• Test nodes
Example
• IEEE 488
• HP-IB
• IEC
In order to be able to use GPIB functionality, a GPIB controller must be installed on the system.
The GPIB/CAPL API makes available the following functions for GPIB control:
GPIBGetCnt Returns the number of bytes transferred by the last GPIB operation.
GPIBGetFloatResult Helps functions for extracting numeric values from GPIB response
strings.
GPIBGetIntResult Helps functions for extracting numeric values from GPIB response
strings.
GPIBReqRelSysCtrl Sets or deletes the permission to send interface clear (IFC) or remote
enabler (REN).
Info
No explicit read functions are available. The response of GPIB devices is announced in the
callback function GPIBResponse. Here users can implement their specific code.
GPIBDevChangeSecAddr
CAPL Function Overview » GPIB » GPIBDevChangeSecAddr
Parameters deviceDescriptor
Device ID
newAddr
5.0 GPIB — •
Example
GPIBDevChangePrimAddr
CAPL Function Overview » GPIB » GPIBDevChangePrimAddr
Parameters deviceDescriptor
Device ID
newAddr
5.0 GPIB — •
Example
GPIBDevClear
CAPL Function Overview » GPIB » GPIBDevClear
Parameters deviceDescriptor
Device ID
5.0 GPIB — •
Example
GPIBDevGotoLocal
CAPL Function Overview » GPIB » GPIBDevGotoLocal
Function Sets a device into local mode. A successor GPIB command sets the device back into
remote mode.
Parameters deviceDescriptor
Device ID
5.0 GPIB — •
Example
GPIBDevOnline
CAPL Function Overview » GPIB » GPIBDevOnline
Parameters deviceDescriptor
Device ID
mode
1: online
0: offline
5.0 GPIB — •
Example
GPIBDevOpen
CAPL Function Overview » GPIB » GPIBDevOpen
Syntax long GPIBDevOpen (long boardIdx, long primAddr, long secAddr, long timeout,
long eot, long eos)
Parameters boardIdx
primAddr
secAddr
timeout
This indicates the maximum duration of an I/O operation. If this time expires before the
operation has ended the function rolls back with a timeout error in the status word.
Indicates whether the GPIB EOI line should be set at the end of a write operation.
Values: 0, 1 (typical: 1)
eos
For further information please refer to documentation for your GPIB controller.
Typical value: 0
-1: on error
5.0 GPIB — •
Example
GPIBGetCnt
CAPL Function Overview » GPIB » GPIBGetCnt
Function Returns the number of bytes transferred by the last GPIB operation.
Parameters —
5.0 GPIB — •
Example
GPIBGetCtrlLineStatus
CAPL Function Overview » GPIB » GPIBGetCtrlLineStatus
Parameters boardIdx
GPIB Board ID
The value consists of 2 bytes. The low-order byte (bits 0 through 7) contains a mask
indicating the capability of the GPIB interface to sense the status of each GPIB control
line. The high-order byte (bits 8 through 15) contains the GPIB control line state
information. If a bit is set (1), the corresponding control line can be monitored by the
interface or is asserted, respectively. The following is a pattern of each byte.
7 6 5 4 3 2 1 0
5.0 GPIB — •
Example
GPIBGetError
CAPL Function Overview » GPIB » GPIBGetError
Function Returns the error variable. It is meaningful only when the ERR bit in the status word is set
Parameters —
5.0 GPIB — •
Example
// “40” is not a valid GPIB address
GPIBDevChangePrimAddr(devDescr, 40);
if ( ( 1 << 15) & GPIBGetStatus() )
{
write("ERR bit set in status word");
if ( 4 == GPIBGetError() )
{
write("error is EARG: Invalid argument to function call");
}
}
GPIBGetFloatResult
CAPL Function Overview » GPIB » GPIBGetFloatResult
Function Helper functions for extracting numeric values from GPIB response strings.
Parameters buffer
The string in buffer, which may have been obtained by the GPIBResponse function, is
searched for a floating-point number, using the function strtod of C/C++. If a space
character is present in the string, the search for the number starts at the first such
character.
5.0 GPIB — •
Example
GPIBGetIntResult
CAPL Function Overview » GPIB » GPIBGetIntResult
Function Helper functions for extracting numeric values from GPIB response strings.
Parameters buffer
The string in buffer, which may have been obtained by the GPIBResponse function, is
searched for an integer number: All non-digit characters in the string as well as all digits
found after the first comma character or decimal point are ignored, when assembling the
integer number.
5.0 GPIB — •
Example
GPIBGetStatus
CAPL Function Overview » GPIB » GPIBGetStatus
Parameters —
5.0 GPIB — •
Example
GPIBOnError
CAPL Function Overview » GPIB » GPIBOnError
Users may implement this function and then receive the original query string or the data
to be written, respectively. The result string, if any, is also returned, as well as the GPIB
status word, the error code and the device descriptor.
Parameters deviceDescriptor
query
response
The data received from the device so far. The empty string if a write operation failure is
reported.
status
error
Return values —
Example
The GPIBOnError callback function is used very much like GPIBResponse. Refere to it for
an example.
GPIBQuery
CAPL Function Overview » GPIB » GPIBQuery
Note
Data up to the size of 1000 bytes are read with this function. To read more data bytes
please use function GPIBQueryEx.
The cmdStr is put to a queue, and then the function returns immediately. When the
cmdStr has been sent to the device, and a response has been received, the user-supplied
function GPIBResponse is called.
Parameters deviceDescriptor
Device ID
cmdStr
Query string
5.0 GPIB — •
Example
Query of the voltage: GPIBQuery(myDev, "V?")
GPIBQueryEx
CAPL Function Overview » GPIB » GPIBQueryEx
The cmdStr is put to a queue, and then the function returns immediately. When the
cmdStr has been sent to the device, and a response has been received, the user-supplied
function GPIBResponse is called.
Parameters deviceDescriptor
Device ID
cmdStr
Query string
Size
6.1 GPIB — •
Example
Query after wave form: GPIBQuery(myDev, "WAVF?", 1024)
GPIBReqRelSysCtrl
CAPL Function Overview » GPIB » GPIBReqRelSysCtrl
Function Sets or deletes the permission to send interface clear (IFC) or remote enable (REN). If
mode is "0," the GPIB board surrenders system control and all controller-specific
commands are not allowed. If mode = "1," then controller-specific commands are allowed.
Parameters boardIdx
GPIB Board ID
mode
(0..1)
5.0 GPIB — •
Example
GPIBResponse
CAPL Function Overview » GPIB » GPIBResponse
Function This function is called when the query returns. Users must implement this function and
receive the original query string, the result as a string and the device ID.
Parameters deviceDescriptor
queryString
resultString
Return values —
5.0 GPIB — •
Example
char myQuery[3] = "V?";
GPIBQuery(myDevice, "V?");
...
GPIBResponse (long deviceDescriptor, char queryString[], char
resultString[])
{
if (deviceDescriptor == myDevice)
{
if ( !strncmp(queryStr, myQuery))
{
putValue(EnvVoltage, GPIBGetFloatResult(resultString));
}
}
}
GPIBWriteNum
CAPL Function Overview » GPIB » GPIBWriteNum
The function returns immediately and does not wait for the end of the command
transmission.
Parameters deviceDescriptor
Device ID
cmdStr
GPIB command
value
5.0 GPIB — •
Example
Setting of a voltage of 1.23 V: GPIBWriteStr(myDev, "V", 1.23)
GPIBWriteStr
CAPL Function Overview » GPIB » GPIBWriteStr
The function returns immediately and does not wait for the end of the command
transmission.
Parameters deviceDescriptor
Device ID
cmdStr
GPIB command
5.0 GPIB — •
Example
Setting of a voltage of 1.23 V: GPIBWriteStr(myDev, "V 1.23")
Error Code
Contains the error code of the current bus/device situation. It can be obtained using the function
GPIBGetError.
Integer, Range: 0..28
Explanation
0 System error
GPIB: Status
(Only available with GPIB & CANoe!)
CAPL Function Overview » GPIB » Status
Status Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ERR TIMO END SRQI RQS — — CMPL LOK REM CIC ATN TACS LACS DTAS DCAS
Explanation
TIMO Timeout
CIC Controller-in-Charge
fileReadFloat
fileReadInt
fileReadString
fileWriteFloat Opens a file, finds a special section and writes the variable entry with a
special value.
fileWriteInt
fileWriteString
getSignalTimeByTxNode Gets the time point relative to the measurement start at which the signal
was last sent on the bus.
inportLPT
outportLPT
RegisterSignalDriverByTxNode Registers the given callback as a 'signal driver' for the signal.
Diagnostics
FlexRay
FlexRayRcvV6Frame A function defined in CAPL with this signature receives all FlexRay
messages.
FlexRayRcvV6StartCycle A function defined in CAPL with this signature receives all FlexRay
StartCycle events.
FrSendV6Frame
FrSendV6Msg
FrSetSendV6Frame
FrSetSendV6Msg
FRStress
LIN
getChecksum Returns the currently set checksum of a LIN message or LIN checksum
error.
linInitGetRs232Baud Returns the current transmission speed of the RS232 port to the hardware.
linInitSetMaster Activates or deactivates the Master mode and the terminating resistor on
the LIN hardware.
linMrSendRequest Sends a transmit request on the LIN bus for the specified LIN message
identifer.
linRcvFrame A function defined in CAPL with this signature receives all LIN frames that
are occurring on the bus and are not filtered out by a global message filter.
linSlFSMSetStSFUp Causes the Slave to respond to the transmit request for the message.
linSlSimulate Activates the Slave with the passed identifier for simulation.
MOST
MostGetOptoMode Returns the operation mode of the Optolyzer connected to the given
channel.
MostSetOptoMode Sets the operation mode of the Optolyzer to the specified value.
RS232
Test
testValidateSignalOutsideRangeByTxNode
beep
CAPL Function Overview » Obsolete » beep
Obsolete function
Replaced by msgBeep
Function Tone output. In the Windows Version the parameter duration has no effect.
Parameters freq
In the Windows version, the parameters freq defines the tone output. Different sounds
are defined in the section [SOUND] in the file WIN.INI:
Info
Windows always generates the same system beep, if you have no sound card
installed on your PC. In this case, the parameter freq has no effect.
duration
Return values —
2.5 — • •
Example
void sound() {
// with sound card: 400 Hz tone / 500ms long
// without sound card: Default signal tone
beep (400,500);
}
canGetChipState
CAPL Function Overview » Obsolete » canGetChipState
Obsolete function
Replaced by ChipState.
Function Returns the current chip state of the specified CAN controller.
Parameters channel
CAN channel.
Return values Chip state of the specified CAN controller. See the following table for a description of the
return values.
1 Simulated
3 Error Active
4 Warning Level
5 Error Passive
6 Bus Off
7.0 CAN • •
Example
canGetErrorCount
CAPL Function Overview » Obsolete » canGetErrorCount
Obsolete function
Replaced by ErrorFrameCount.
Function Returns the number of error frames on the specified channel since start of measurement.
Parameters channel
CAN channel.
Return values Number of error frames on the specified channel since start of measurement.
7.0 CAN • •
Example
canGetErrorRate
CAPL Function Overview » Obsolete » canGetErrorRate
Obsolete function
Replaced by ErrorFrameRate.
Function Returns the current rate of CAN error messages of the specified channel.
Parameters channel
CAN channel.
Return values Current Rate of CAN error messages on the specified channel in messages per second.
7.0 CAN • •
Example
canGetExtData
CAPL Function Overview » Obsolete » canGetExtData
Obsolete function
Replaced by ExtendedFrameCount.
Function Returns the number of extended CAN frames on the specified channel since start of
measurement.
Parameters channel
CAN channel.
Return values Number of extended CAN frames on the specified channel since start of measurement.
7.0 CAN • •
Example
canGetExtDataRate
CAPL Function Overview » Obsolete » canGetExtDataRate
Obsolete function
Replaced by ExtendedFrameRate.
Function Returns the current rate of extended CAN frames on the specified channel.
Parameters channel
CAN channel.
Return values Current rate of extended CAN frames on the specified channel in messages per second.
7.0 CAN • •
Example
canGetExtRemote
CAPL Function Overview » Obsolete » canGetExtRemote
Obsolete function
Replaced by ExtendedRemoteFrameCount.
Function Returns the number of extended remote CAN messages on the specified channel since
start of measurement.
Parameters channel
CAN channel.
Return values Number of extended remote CAN messages on the specified channel since start of
measurement.
7.0 CAN • •
Example
canGetExtRemoteRate
CAPL Function Overview » Obsolete » canGetExtRemoteRate
Obsolete function
Replaced by ExtendedRemoteFrameRate.
Function Returns the current rate of extended remote CAN messages on the specified channel.
Parameters channel
CAN channel.
Return values Current rate of extended remote CAN messages on the specified channel in frames per
second.
7.0 CAN • •
Example
canGetOverloadCount
CAPL Function Overview » Obsolete » canGetOverloadCount
Obsolete function
Replaced by OverloadFrameCount.
Function Returns the number of CAN overload frames on the specified channel since start of
measurement.
Parameters channel
CAN channel.
Return values Number of CAN overload frames on the specified channel since start of measurement.
7.0 CAN • •
Example
canGetOverloadRate
CAPL Function Overview » Obsolete » canGetOverloadRate
Obsolete function
Replaced by OverloadFrameRate.
Function Returns the current rate of CAN overload frames on the specified channel.
Parameters channel
CAN channel.
Return values Current rate of CAN overload frames on the specified channel in messages per second.
7.0 CAN • •
Example
canGetPeakLoad
CAPL Function Overview » Obsolete » canGetPeakLoad
Obsolete function
Replaced by PeakLoad.
Parameters channel
CAN channel.
7.0 CAN • •
Example
canGetRxErrorCount
CAPL Function Overview » Obsolete » canGetRxErrorCount
Obsolete function
Replaced by RxChipErrorCount.
Function Returns the current RX error count in the receiver of the specified CAN channel.
Parameters channel
CAN channel.
Return values Current error count in the receiver of the specified CAN channel.
7.0 CAN • •
Example
canGetStdData
CAPL Function Overview » Obsolete » canGetStdData
Obsolete function
Replaced by StandardFrameCount.
Function Returns the number of standard CAN frames on the specified channel since start of
measurement.
Parameters channel
CAN channel.
Return values Number of standard CAN frames on the specified channel since start of measurement.
7.0 CAN • •
Example
canGetStdDataRate
CAPL Function Overview » Obsolete » canGetStdDataRate
Obsolete function
Replaced by StandardFrameRate.
Function Returns the current rate of standard CAN frames on the specified channel.
Parameters channel
CAN channel.
Return values Current rate of standard CAN frames on the specified channel in messages per second.
7.0 CAN • •
Example
canGetStdRemote
CAPL Function Overview » Obsolete » canGetStdRemote
Obsolete function
Replaced by StandardRemoteFrameCount.
Function Returns the number of standard remote CAN frames on the specified channel since start
of measurement.
Parameters channel
CAN channel.
Return values Number of standard remote CAN frames on the specified channel since start of
measurement.
7.0 CAN • •
Example
canGetStdRemoteRate
CAPL Function Overview » Obsolete » canGetStdRemoteRate
Obsolete function
Replaced by StandardRemoteFrameRate.
Function Returns the current rate of standard remote CAN frames of the specified channel.
Parameters channel
CAN channel.
Return values Current rate of standard remote CAN frames of the specified channel in messages per
second.
7.0 CAN • •
Example
canGetTxErrorCount
CAPL Function Overview » Obsolete » canGetTxErrorCount
Obsolete function
Replaced by TxChipErrorCount.
Function Returns the current number of TX errors in the CAN receiver of the specified channel.
Parameters channel
CAN channel.
Return values Current number of errors in the CAN receiver of the specified channel.
7.0 CAN • •
Example
checkSignalInRangeByTxNode
CAPL Function Overview » Obsolete » checkSignalInRangeByTxNode
Obsolete function
Parameters aSignal
aTxNode
aLowLimit
aHighLimit
0: If the condition is violated or the signal is unavailable, i.e. was not on the bus yet
5.1 — — •
Example
DiagGetParameterSize
CAPL Function Overview » Obsolete » DiagGetParameterSize
Obsolete function
Parameters obj
Diagnostics object
parameterName
Parameter qualifier
5.0 — — •
Example
fileReadArray
CAPL Function Overview » Obsolete » fileReadArray
Obsolete function
Replaced by getProfileArray
Function Searches for the variable entry in the section section of the file file. Its contents are
interpreted as a list of byte values. The number format is decimal or with the prefix 0x it
is hexadecimal. Numbers are separated by spaces, tabs, a comma, semi-colon or slash.
The buffer is filled up to a quantity of bufferlen bytes.
Parameters section
Section of file
entry
Name of variable
buffer
bufferlen
filename
Name of file
3.0 — • •
Example
File TEST.INI:
[DATA]
FIELD=1,2,3,0x20,100
...
int len;
char buf[20];
len = fileReadArray("DATA", "FIELD", buf, elCount(buf), "TEST.INI");
...
Result:
fileReadFloat
CAPL Function Overview » Obsolete » fileReadFloat
Obsolete function
Replaced by getProfileFloat
Syntax float fileReadFloat(char section[], char entry[], float def, char ile);
Parameters section
Section of file
entry
Name of variable
def
Value
file
Name of file
3.0 — • •
Example
File TEST.INI:
[DATA]
FIELD=1,2,3,0x20,100
..
int len;
char buf[20];
len = fileReadArray("DATA", "FIELD", buf, elCount(buf), "TEST.INI");
...
Result:
fileReadInt
CAPL Function Overview » Obsolete » fileReadInt
Obsolete function
Replaced by getProfileInt
Syntax long fileReadInt(char section[], char entry[], long def, char file[]);
Function Searches for the variable entry in the section section of the file filename. If its value is a
number, this number is returned as the functional result. If the file or entry is not found,
or if entry does not contain a valid number, the default value def is returned as the
functional result.
Parameters section
Section of file
entry
Name of variable
def
Value
file
Name of file
3.0 — • •
Example
File TEST.INI:
[DATA]
NAME=Feld
ADDR=200
FIELD=1,2,3,0x20,100
...
myAddress=fileReadInt("DATA", "ADDR", 0, "TEST.INI");
...
Result:
The value 200 is assigned to the variable myAddress. If the entry ADDR does not exist in
the file TEST.INI the default value 0 is assigned to myAddress.
fileReadString
CAPL Function Overview » Obsolete » fileReadString
Obsolete function
Replaced by getProfileString
Function Searches for the variable entry in the section section of the file filename. Its content
(value) is written to the buffer buffer. Its length must be passed correctly to bufferlen. If
the file or entry is not found, the default value def is copied to buffer.
Parameters section
Section of file
entry
Name of variable
def
Value
buffer
bufferlen
filename
Name of file
3.0 — • •
Example
ile TEST.INI:
[DATA]
NAME=Feld
ADDR=200
FIELD=1,2,3,0x20,100
...
int len;
char buf[20];
fileReadString("DATA", "NAME", "DefaultString", buf, elCount(buf),
"TEST.INI");
...
Result:
fileWriteFloat
CAPL Function Overview » Obsolete » fileWriteFloat
Obsolete function
Replaced by writeProfileFloat
Syntax long fileWriteFloat(char section[], char entry[], float def, char file[]);
Function Analogous to fileWriteInt, but writes a float variable to the file instead of a text.
Parameters section
Section of file
entry
Name of variable
def
Value
file
Name of file
3.0 — • •
Example
...
if(!fileWriteInt("DeviceData","DeviceAddr",2.2, "TEST.INI"))
write("file error");
...
This call writes the following entry in the file TEST.INI:
[DeviceData]
DeviceAddr=2.2
fileWriteInt
CAPL Function Overview » Obsolete » fileWriteInt
Obsolete function
Replaced by writeProfileInt
Syntax long fileWriteInt(char section[], char entry[], long def, char file[]);
Function Analogous to fileWriteString, but writes a long variable to the file instead of a text.
Parameters section
Section of file
entry
Name of variable
def
Value
file
Name of file
3.0 — • •
Example
...
if(!fileWriteInt("DeviceData","DeviceAddr",2, "TEST.INI"))
write("file error");
...
This call writes the following entry in the file TEST.INI:
[DeviceData]
DeviceAddr=2
fileWriteString
CAPL Function Overview » Obsolete » fileWriteString
Obsolete function
Replaced by writeProfileString
Function Opens the file filename, finds the section section and writes the variable entry with the
value value. If entry already exists, the old value is overwritten. The functional result is
the number of characters written, or 0 for an error.
Parameters section
Section of file
entry
Name of variable
value
filename
Name of file
3.0 — • •
Example
...
if(!fileWriteString("Device","DeviceName","LPT1","test.ini"))
write("file error");
...
This call writes the following entry in the file TEST.INI:
[Device]
DeviceName=LPT1
FlexRayRcvV6Frame
CAPL Function Overview » Obsolete » FlexRayRcvV6Frame
Obsolete function
Syntax FlexRayRcvV6Frame( long msgTime, word channel, word frameID, byte cycle,
byte len, byte data[], int sync, int NMIndication, int ReservedFlag, word
headerCRC, word status, int rcv )
Function A function defined in CAPL with this signature receives all FlexRay messages.
Parameters msgTime
channel
frameID
cycle
Current cycle.
len
data[]
Data bytes.
sync
Sync Flag.
Indicates whether this message is used for time synchronization.
NMIndication
ReservedFlag
headerCRC
status
rcv
Send direction:
1 Tx
0 Rx
Return values
5.1 FlexRay • •
Example
FlexRayRcvV6StartCycle
CAPL Function Overview » Obsolete » FlexRayRcvV6StartCycle
Obsolete function
Note
Function A function defined in CAPL with this signature receives all FlexRay StartCycle events.
The event is generated at the beginning of a communication cycle.
It contains the NM vector that is valid for this round.
Parameters msgTime
nmlen
Nmdata[]
Return values
5.1 FlexRay • •
Example
FrSendMsg
CAPL Function Overview » Obsolete » FrSendMsg
Obsolete function
Syntax FrSendMsg ( class VIMessage* const message, unsigned int channel, unsigned
char dataBytes[] )
Function This function generates a FlexRay frame and places it in the appropriate Tx register of the
xModule/PC104.
The xModule/PC104 sends the frame at the next possible transmission time.
Parameters message
channel
dataBytes []
Return values
FlexRay — •
Example
variables
{
message Identifier_01 msg_01;
int gChannel_2 = 2 ;
int gId_02 = 2 ;
int gMux = 1 ;
int gNoSync = 0 ;
int gLen_Id2 = 4;
Byte gData2a[12] =
{0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c};
Byte gData1a[12] =
{0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c};
}
on key 'z'
{
FrSendFrame(gId_02, gNoMux, gChannel_2, gNoSync, gLen_Id2, gData2a, -1
);
FrSendMsg (msg_01, gChannel_2, gData1a );
}
FrSendV6Frame
CAPL Function Overview » Obsolete » FrSendV6Frame
Obsolete function
Syntax FrSendV6Frame( int frameId, int channel, int sync, int len, dataBytes [],
int nmIndication, int sendcounter );
Function This function generates a FlexRay message and sends it to the hardware.
The hardware transmits the message at the next possible time point.
Parameters frameId
channel
sync
Sync Flag.
Indicates whether this message is used for time synchronization.
len
databytes[]
Data bytes.
nmIndication
sendcounter
-1 unlimited
n Number of messages
Return values
FlexRay — •
Example
FrSendV6Msg
CAPL Function Overview » Obsolete » FrSendV6Msg
Obsolete function
Syntax FrSendV6Msg( VIMessage * const message, int channel, BYTE dataBytes [], int
nmIndication, int sendcounter );
Function This function generates a FlexRay message and sends it to the hardware. The hardware
transmits the message at the next available time point. The symbolic name from the
database is used to activate message parameters.
Parameters message
channel
databytes[]
Data bytes
nmIndication
sendcounter
-1 Unlimited
n Number of messages
Return values
5.1 FlexRay • •
Example
FrSetSendMsg
CAPL Function Overview » Obsolete » FrSetSendMsg
Obsolete function
Function Frames to be transmitted by the xModule/PC104 must first be registered in the Service
Module.
Parameters message
channel
Return values
Example
variables
{
message Identifier_01 msg_01;
int gChannel_2 = 2;
int gId_02 = 2;
int gMux = 1;
int gNoSync = 0;
int gLen_Id2 = 4;
Byte gData2a[12] =
{0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c};
Byte gData1a[12] =
{0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c};
}
on key 'z'
{
FrSendFrame(gId_02, gNoMux, gChannel_2, gNoSync, gLen_Id2, gData2a, -1
);
FrSendMsg (msg_01, gChannel_2, gData1a );
}
FrSetSendV6Frame
CAPL Function Overview » Obsolete » FrSetSendV6Frame
Obsolete function
Note
When using the BusDoctor this function is not necessary and is ignored.
Syntax FrSetSendV6Frame( int frameId, int channel, int sync, int len, int
nmIndication );
Parameters frameId
channel
sync
Sync Flag.
Indicates whether this message is used for time synchronization.
len
nmIndication
Return values
5.1 FlexRay — •
Example
FrSetSendV6Msg
CAPL Function Overview » Obsolete » FrSetSendV6Msg
Obsolete function
Note
You should use this function if a database is available and you can therefore work with
symbolic values.
If no database is available you cannot work with symbolic values.
In this case you must use the function FrSetSendV6Frame.
When using the BusDoctor this function is not necessary and is ignored.
Parameters msg
channel
nmIndication
Return values
5.1 FlexRay — •
Example
FRSSetDistMode
CAPL Function Overview » Obsolete » FRSSetDistMode
Obsolete function
Note
Function Sets the disturbance type. A bitstream disturbance generates the disturbance sequence
after the trigger is detected. The frame disturbance changes individual bits within a
frame with bit accuracy.
Parameters triggerCondition
Values: 1-4
mode
Values:
1=Bitstream disturbance (analog & digital mode), the disturbance is configured using
FRSSetBitstreamDist.
2=Frame disturbance (only digital mode), the disturbance is configured using
FRSSetFrmDistElem, FRSSetFrmDist and FRSSetDistPayload.
Example
canGetBusLoad
CAPL Function Overview » Obsolete » canGetBusLoad
Obsolete function
Replaced by BusLoad.
Parameters channel
CAN channel.
7.0 — • •
Example
getChecksum
CAPL Function Overview » Obsolete » getChecksum
Obsolete function
The name of this function is obsolete and has been replaced by linGetChecksum
Function Returns the currently set checksum of a LIN message or LIN checksum error.
In the case of a LIN message, the correct value derived from the message data is returned
by default, even after the message data has been modified. The user can, however set a
deviating value with setManualChecksum to generate checksum errors on the LIN bus. This
value is then constant and will not be affected by changes in the message data. To turn
off this behavior for a given message, the user must call resetManualChecksum.
Parameters msg
error
The LIN checksum error for which the checksum will be queried.
Example
getSignalByTxNode
CAPL Function Overview » Obsolete » getSignalByTxNode
Obsolete function
Parameters aSignal
aTxNode
Return values Value of the signal or 0 if the signal was not on the bus yet.
7.0 — — •
Example
getSignalTimeByTxNode
CAPL Function Overview » Obsolete » getSignalTimeByTxNode
Obsolete function
Function Gets the time point relative to the measurement start at which the signal was last sent on
the bus.
Parameters aSignal
aTxNode
Return values Time point or 0 if the signal was not sent yet.
7.0 — — •
Example
inport
CAPL Function Overview » Obsolete » inport
Obsolete function
For simple control applications you can use the IOcab, the IOpiggy or a simple
measurement hardware, e.g. the Meilhaus-RedLab series or an appropriate NI card.
Note
Before you can use the CAPL functions outport, inport(), outportLPT and inportLPT, you
must install the generic I/O port driver for Windows. You will find this driver and its
description (ReadMe.Txt) in the directory Exec32\GpIoDrv.
Our business hours are Monday to Friday from 9:00 am to 5:00 pm (CET):
• Phone: +49.711.80670.200
• Fax: +49.711.80670.111
• E-Mail: support@vector.com
• Online Report Form:
https://www.vector.com/vi_problem_report_en.html
Function Reads a byte from the specified port. If you want to read from a parallel port the port has
to be in a bi-directional mode (PS/2 or "Byte" Modus). Please check this in the CMOS setup
(BIOS).
Symbolic assignment:
Please write:
word addr = 0x378;
byte ctrl;
// Read the parallel port control registers
ctrl = inport( addr + 2);
— • •
Example
// This example reads some bytes from LPT1
// The LPT port is first changed to input if necessary.
word addr = 0x378;
byte ctrl;
byte b;
// Read the parallel port control registers
ctrl = inport( addr + 2);
if ( ( ctrl & 0x20) == 0)
{
// Output mode is active -> change
ctrl |= 0x20;
outport( addr + 2, ctrl);
// Check
ctrl = inport( addr + 2);
if ( ( ctrl & 0x20) == 0)
{
// Error!!!
write( "Parallel port (0x%x) could not be changed to input mode!!!", addr);
return;
}
}
b = inport( addr);
inportLPT
CAPL Function Overview » Obsolete » inportLPT
Obsolete function
Replaced by inport
Before you can use the CAPL functions outport, inport, outportLPT and inportLPT, you
must install the generic I/O port driver for Windows. You will find this driver and its
description (ReadMe.Txt) in the directory Exec32\GpIoDrv.
Function Reads a byte from the specified parallel port. This function changes the transmission
mode of the parallel port automatically to input. If you want to read from a parallel port
the port has to be in a bi-directional mode (PS/2 or "Byte" Modus). Please check this in
the CMOS setup (BIOS).
Symbolic assignment:
3.1 — • •
Example
// This example reads a character from LPT1.
// The mode of LPT1 is set automatically.
byte b;
b = inportLPT( LPT1);
linCalcChecksum
CAPL Function Overview » Obsolete » linCalcChecksum
Obsolete function
Replaces linCalcCRC
Parameters numberOfDataBytes
The number of valid bytes to be taken into consideration in the following data field.
dataBytes
Example
linCalcCRC
CAPL Function Overview » Obsolete » linCalcCRC
Obsolete function
Replaced by linCalcChecksum
Parameters numberOfDataBytes
dataBytes
3.0 LIN • •
Example
linInitBegin
CAPL Function Overview » Obsolete » linInitBegin
Obsolete function
No replacement
Note
Parameters —
Example
linInitEnd
CAPL Function Overview » Obsolete » linInitEnd
Obsolete function
No replacement
Note
Function Terminates the LIN initialization procedure and starts transmission of initialization data to
the hardware.
After LINInitEnd() has been called it is not possible to execute another LIN initialization.
Parameters —
Example
linInitGetRs232Baud
CAPL Function Overview » Obsolete » linInitGetRs232Baud
Obsolete function
No replacement
Function Returns the current transmission speed of the RS232 port to the hardware.
Parameters —
Return values Current transmission speed of the RS232 port in bits per second.
Example
linInitSetBaseBaud
CAPL Function Overview » Obsolete » linInitSetBaseBaud
Obsolete function
No replacement
Note
Function Sets the transmission speed in baud on the LIN bus. This overwrites the value from the LIN
database.
Parameters baudrate
Return values
Example
linInitSetMaster
CAPL Function Overview » Obsolete » linInitSetMaster
Obsolete function
No replacement
Note
Function This function activates or deactivates the Master mode and the terminating resistor on
the LIN hardware.
The default setting is to deactivate both of these parameters when no Master node is
modeled.
Parameters masterMode
This parameter specifies whether Master mode on the LIN hardware has to be enabled or
disabled.
0: Disable
1: Enable
masterResistor
This parameter specifies whether terminating resistor on the LIN hardware has to be
enabled or disabled.
0: Disable
1: Enable
Return values —
Example
on linReceiveError
{
linInitSetMaster(1, 1); // manually activate Master mode on LIN hardware
}
linMrSchedGetMode
CAPL Function Overview » Obsolete » linMrSchedGetMode
Obsolete function
No replacement
Note
Parameters —
Example
linMrSchedSetGlobal
CAPL Function Overview » Obsolete » linMrSchedSetGlobal
Obsolete function
No replacement
Note
Parameters cycleTime
Frequency with which the Scheduler works through its task lists.
With a value of 0 it arranges the working steps directly after one another.
Entries are made in milliseconds.
numberOfModes
Return values
Example
linMrSchedSetMode
CAPL Function Overview » Obsolete » linMrSchedSetMode
Obsolete function
No replacement
Note
Parameters mode
Mode to be activated.
The highest mode is activated if mode is too large.
Return values
Example
linMrSchedSetRqId
CAPL Function Overview » Obsolete » linMrSchedSetRqId
Obsolete function
No replacement
Note
Info
linMrSchedSetRqId may only be called once for each LIN Message Identifier.
During a processing step of the Scheduler the outstanding transmit requests
are serviced in the order in which they were configured by
linMrSchedSetRqId.
Parameters requestId
period
Regulates the frequency of the request. The duration between two requests is the
period * cycle time of the Scheduler.
modeFlags
Bit field that must be large enough to take up a bit for each Scheduler mode.
The least significant bit of Byte 0 refers to Mode 0, the least significant bit of Byte 1
refers to Mode 8, etc.
One entry is made for each mode for which a corresponding flag is set.
Return values
Example
linMrSchedSetSyncT
CAPL Function Overview » Obsolete » linMrSchedSetSyncT
Obsolete function
No replacement
Note
Parameters syncBreakLength
syncDelimiterLength
To conform to the LIN specification the following conditions must also be satisfied:
The configured values are only used when the LIN hardware is operating in Master mode.
Return values
Example
linMrSendRequest
CAPL Function Overview » Obsolete » linMrSendRequest
Obsolete function
Function When Master mode is activated this function sends a transmit request on the LIN bus for
the specified LIN message identifer.
Parameters requestId
Return values —
3.0 LIN — •
Example
linRcvFrame
CAPL Function Overview » Obsolete » linRcvFrame
Obsolete function
Syntax void linRcvFrame (long syncTimeStamp, long origTimeStamp, int msgId, int
frameDlc, int frameDir, int bytecount, byte data[])
Function A function defined in CAPL with the exact signature shown above receives all LIN frames
that are occurring on the bus and are not filtered out by a global message filter.
Parameters syncTimeStamp
Time stamp of the LIN frame that was synchronized with the global time basis in the PC
(CAN hardware or PC system clock).
Units: 10 microseconds.
This time stamp must be used if time relationships with events from other sources are to
be evaluated.
This time stamp is also output in the Trace window.
origTimeStamp
Units: 10 microseconds.
In individual cases it may be advisable to use this unsynchronized - and therefore still
original - time stamp. However, its use is only meaningful for time comparisons between
two LIN hardware generated events.
msgId
frameDlc
frameDir
bytecount
Number of valid data bytes (may be less than frameDlc in error situations).
data
Return values —
3.0 LIN • •
Example
linSetDlc
CAPL Function Overview » Obsolete » linSetDlc
Obsolete function
No replacement
Note
This function does not have any effect in the event procedure on preStart.
Function Initializes the Data Length Code (i.e. length in bytes) of a LIN frame. This function must
be called in the event procedure on prestart. The DLC of each frame ID can only be
initialized once using this function.
To change the DLC of a LIN frame during the measurement, use the function
linChangeDlc().
Per default the DLC of LIN frames is initialized according to the LIN Description File (LDF).
This function is therefore only needed if you are simulating LIN nodes without using an
LDF.
Parameters frameID
DLC
Return values If successful a value unequal to zero. Zero will be returned if for example the DLC has
already been set for the selected ID.
Example
linSetHeaderError
CAPL Function Overview » Obsolete » linSetHeaderError
Obsolete function
No replacement
Function With this function it is possible to set invalid parameters in a transmitted LIN header.
These invalid parameters will be used until changed by another call to linSetHeaderError()
for the same identifier (specified by the lower 6 bits of idWithParity). Setting the correct
values with this function will of course disable all header errors for the specified id.
Info
If the LIN hardware is not in Master mode calling this function will have no
effect.
The invalid header is not reported on the transmitting channel. To get the
error notified an additional channel has to be configured and connected to
the transmitting channel.
Parameters syncByte
idwithParity
Data value to be sent in the Protected Identifier filed. The lower 6 bits specify the
identifier to be used. The upper 2 bits specify the identifier parity to be used.
StopAfterError
Specifies whether the transmission should be stopped after an error. If an incorrect synch
byte is set by this function and StopAfterError is 1, the identifier will not be sent. The
same is true for the message response (has to be activated independently) and an
incorrect parity.
5.1 • LIN — •
• Real bus mode
Example
// Force an error in header of LIN frame with ID=0x33 by setting wrong protected ID
on key 'h'
{
byte linID, protectedID, corParity, errParity, errPID;
// calculate protected ID with wrong parity bits
linID = 0x33; // use frame ID=0x33
protectedID = linGetProtectedID(linID); // get protected ID
corParity = (protectedID & 0xC0) >> 6; // extract parity (0xC=0=11000000)
errParity = (corParity ^ 0x2) & 0x3; // calculate wrong parity using
XOR
errPID = linID | (errParity << 6); // calculate PID with wrong parity
linSetHeaderError(0x55, errPID, 0);
}
...
or
...
// Force an error in header of LIN frame with ID=0x33 by setting wrong
Synch byte
linSetHeaderError(0x50, linGetProtectedID(0x33), 0);
linSetResponseData
CAPL Function Overview » Obsolete » linSetResponseData
Obsolete function
Function Sets the response data for a transmit request. The LIN hardware is instructed to respond
from now on to the transmit request sendID with the data data. The used data length
code is passed in dlc.
• If no DLC has been set by the data base, the DLC will be set by the dlc parameter of
the function.
• If the DLC already has been set by the data base, this value must be handover
correctly on every call of this function.
The functionality to set the DLC is only available with LIN specification 1.2 (or above)!
DLC value range: 0…8 (bytes)When you use the first alternative of the syntax (see above),
the checksum is automatically generated correctly. When you use the second alternative
of the syntax (see above), you can set any checksum. If this function is called in the event
procedure on preStart then the LIN hardware is configured so that the response is made
to a suitable transmit request. During the measurement this method may only be called
for transmit identifiers that were already configured in the event procedure on preStart
or in the LIN database.
Parameters sendId
dlc
data
checksum
Return values If a DLC has been set, a value unequal "0" will be returned.
3.0 LIN — •
Example
linSetResponseMsg
CAPL Function Overview » Obsolete » linSetResponseMsg
Obsolete function
Function Sets the response data for a transmit request. The LIN hardware is instructed to
immediately respond to the transmit request with the same identifier as msg with the data
bytes of msg.
When you use the first alternative of the syntax (see above), the checksum is automatically
generated correctly.
When you use the second alternative of the syntax (see above), you can set any checksum.
If this function is called in the event procedure on preStart then the LIN hardware is
configured so that the response is made to a suitable transmit request. During the
measurement this method may only be called for transmit identifiers that were already
configured in the event procedure on preStart or in the LIN database.
Parameters msg
Pattern for the transmitting behavior of the LIN hardware. In the future, in response to the
transmit identifier that is defined by this message, the data bytes of this message will be
sent.
In general msg will be a message contained in the database created for LIN. This offers an
easy way to access the individual signal values.
3.0 LIN — •
Example
message LinSlaveLeft sLinSlaveLeft;
sLinSlaveLeft.Angle = 50;
linSetResponseMsg(sLinSlaveLeft);
linSleepModeEvent
CAPL Function Overview » Obsolete » linSleepModeEvent
Obsolete function
Function Is called whenever a SleepModeEvent (not SleepModeFrame) is received. The time stamps
are the same as by LINRcvFrame.
Parameters wasAwake
If this flag is set, the LIN hardware was active before the Event occurred.
If not, the LIN hardware was in Sleep mode before the Event occurred.
isAwake
externalCause
If this flag is set, the Event is caused by an external event (e.g. SleepModeFrame,
WakeupFrame or bus traffic).
If not, the Event is caused by an internal event (e.g. SleepModeFrame, WakeupFrame,
SilentSleepMode command or BusIdle timeout).
reason
This value returns the cause of the Event. One of the following values can be returned.
General values:
0 Start state
1 SleepModeFrame
2 BusIdle timeout
11 Bus traffic (only occurs while the LIN hardware is not the Master)
Values, if the LIN hardware does not switch to Sleep mode in spite of a request:
18 Bus traffic (only occurs while the LIN hardware is not the Master)
Return values
3.2 LIN • •
Example
linSlFSMSetGlobal
CAPL Function Overview » Obsolete » linSlFSMSetGlobal
Obsolete function
No replacement
Note
Function Sets the number of states given in numberOfStates for the Slave with identifier slaveId.
This function must be called before the Slave's states are configured.
Parameters slaveId
Identifier of the relevant Slave. Corresponds to the slaveId, that was defined with
linSlSimulate.
numberOfStates
Number of states that the Finite State Machine (FSM) which implements the Slave should
have.
Return values
Example
linSlFSMSetState
CAPL Function Overview » Obsolete » linSlFSMSetState
Obsolete function
No replacement
Note
This function does not have any effect in the event procedure on preStart. A Slave always
starts in the 0 state.
Function Switches the Slave with identifier slaveId to the state stateId.
Parameters slaveId
Identifier of the relevant Slave. Corresponds to the slaveId, that was defined with
linSlSimulate.
stateId
Identifier of the relevant state of the Finite State Machine (FSM). Lies in the range that
was defined by linSlFSMSetGlobal.
Return values
Example
linSlFSMSetStBegin
CAPL Function Overview » Obsolete » linSlFSMSetStBegin
Obsolete function
No replacement
Note
Function Prepares the configuration of the state specified by stateId of the Slave with the
identifier slaveId.
Parameters slaveId
Identifier of the relevant Slave. Corresponds to the slaveId that was defined with
linSlSimulate.
stateId
Identifier of the relevant state of the Finite State Machine (FSM). Lies in the range that
was defined by linSlFSMSetGlobal.
Return values
Example
linSlFSMSetStEnd
CAPL Function Overview » Obsolete » linSlFSMSetStEnd
Obsolete function
No replacement
Note
Function Ends the configuration of the state specified by stateId of the Slave with the identifier
slaveId.
Parameters slaveId
Identifier of the relevant Slave. Corresponds to the slaveId, that was defined with
linSlSimulate.
stateId
Identifier of the relevant state of the Finite State Machine (FSM). Lies in the range that
was defined by linSlFSMSetGlobal.
Return values
Example
linSlFSMSetStMFUp
CAPL Function Overview » Obsolete » linSlFSMSetStMFUp
Obsolete function
No replacement
Function Sets up a comparison operation for the state stateId of the Slave slaveId.
• If no DLC has been set by the data base, the DLC will be set by the dlc parameter of
the function.
• If the DLC already has been set by the data base, this value must be handover
correctly on every call of this function.
The functionality to set the DLC is only available with LIN specification 1.2 (or above)!
Parameters slaveId
Identifier of the relevant Slave. Corresponds to the , that was defined with linSlSimulate.
stateId
Identifier of the relevant state of the Finite State Machine (FSM). Lies in the range
defined by linSlFSMSetGlobal.
uniqueKey
Dummy differentiation code for multiple comparison operations with the same
slaveId/stateId pair (see below)
patternRequestId
If this transmit identifier was placed on the bus by the Master, the condition described
here is evaluated.
dlc
maskBytes
patternBytes
followUpState
The contents of messages with the identifier pattern RequestId that are sent on the LIN
bus are linked bitwise with maskBytes by an AND operation. If the result of this
comparison is identical to patternBytes, the Slave transitions to the state followUpState.
Since multiple comparisons may be configured for the same message identifier for a given
Slave state, a code uniqueKey is also necessary to permit identification of the various
comparison operations.
This code must be unique within the Slave state. If there are multiple comparison
operations for a message identifier within a state of a Slave, they are processed in the
order of their specification until all comparisons have been performed or a comparison
was successful.
During a measurement this function can be used to change the following data of a
comparison operation already configured in the on preStart event procedure:
• Comparison mask
• Results pattern
• Resulting state
Example
linSlFSMSetStSFUp
CAPL Function Overview » Obsolete » linSlFSMSetStSFUp
Obsolete function
No replacement
Function Causes the Slave with identifier slaveId that is in the specified state stateId to respond to
the transmit request for the message with identifier requestId. This involves using the
data specified in dataBytes and the checksum.
• If no DLC has been set by the data base, the DLC will be set by the dlc parameter of
the function.
• If the DLC already has been set by the data base, this value must be handover
correctly on every call of this function.
The functionality to set the DLC is only available with LIN specification 1.2 (or above)!
Parameters slaveId
Identifier of the relevant Slave. Corresponds to the slaveId, that was defined with
linSlSimulate.
stateId
Identifier of the relevant state of the Finite State Machine (FSM). Lies in the range
defined by linSlFSMSetGlobal.
requestId
Condition: If this transmit identifier was placed on the bus by the Master, the action
described here triggers.
dlc
dataBytes
checksum
Checksum that should be used in the response. It should be noted that the CRC might also
be incorrect! In this case a checksum error is generated.
followUpState
State to be switched to after the action has occurred. This could be the same as the
current state.
During a measurement the following data can be modified for an action already
configured in the on preStart event procedure:
• Transmission data
• Checksum
• Resulting state
Example
linSlFSMSetStTO
CAPL Function Overview » Obsolete » linSlFSMSetStTO
Obsolete function
No replacement
Note
Syntax void linSlFSMSetStTO (unsigned int slaveId, unsigned int stateId, unsigned
int timeout, unsigned int followUpState);
Function Sets a timeout for the state specified by stateId of the Slave with the identifier slaveId.
Parameters slaveId
Identifier of the relevant Slave. Corresponds to the slaveId, that was defined with
linSlSimulate.
stateId
Identifier of the relevant state of the Finite State Machine (FSM). Lies in the range that
was defined by linSlFSMSetGlobal.
timeout
followUpState
State that should be assumed if the current state is ended with a timeout.
After a timeout has occurred the hardware sends a Slave Timeout message and switches
the Slave to the followUpState state.
Return values
Example
linSlSimulate
CAPL Function Overview » Obsolete » linSlSimulate
Obsolete function
No replacement
Note
Function Activates the Slave with the passed identifier for simulation. This function must be called
before the Slave is further configured.
Parameters slaveId
Return values
Example
linWakeupFrame
CAPL Function Overview » Obsolete » linWakeupFrame
Obsolete function
Function Is called whenever a Wakeup frame is recognized. The time stamps are the same as by
LINRcvFrame.
Parameters signal
The actually received byte (0x00, 0x80 or 0xC0) when the baud rate is correct. Signals
(Wakeup frames) with different byte values will not be recognized.
The bytes 0x00 and 0xC0 are the result of a deviation in their baud rate (caused by Sleep
mode).
external
If this flag is set, the Wakeup frame has been sent from an external device.
If not, the LIN hardware sent the Wakeup frame.
Return values —
3.2 LIN • •
Example
Obsolete function
Please use the mostMessage and mostAMSMessage selectors FBlockID, FunctionID and
OpType instead.
Function These functions return the FBlockID, FunctionID or OpType of the message.
Parameters msg
Info
3.2 MOST • •
Example
MostGetLight, MostSetLight
CAPL Function Overview » Obsolete » MostGetLight, MostSetLight
Obsolete function
No replacement
Parameters channel
0: light out
• MOST — •
• After measurement start
• Not in Stop
measurement
Example
Obsolete function
The following function are obsolete! Please use the mostMessage and mostAMSMessage
selectors FBlockID, FunctionID and OpType instead.
Info
Since the FBlockID, FunctionID and OpType are part of the message ID these
functions change the ID as well.
Parameters msg
value
Return values —
3.2 MOST • •
Example
MostSetOptoMode, MostGetOptoMode
CAPL Function Overview » Obsolete » MostSetOptoMode, MostGetOptoMode
Obsolete function
No replacement
Function Sets the operation mode of the Optolyzer to the specified value.
Returns the operation mode of the Optolyzer connected to the given channel.
Parameters channel
Refer to the OptoControl helpfile for further explanations of the values for optoMode.
This function only works in the "Prestart" Section of the CAPL program.
Example
outport
CAPL Function Overview » Obsolete » outport
Obsolete function
For simple control applications you can use the IOcab, the IOpiggy or a simple
measurement hardware, e.g. the Meilhaus-RedLab series or an appropriate NI card.
Note
Before you can use the CAPL functions outport, inport, outportLPT and inportLPT, you
must install the generic I/O port driver for Windows. You will find this driver and its
description (ReadMe.Txt) in the directory Exec32\GpIoDrv.
Our business hours are Monday to Friday from 9:00 am to 5:00 pm (CET):
• Phone: +49.711.80670.200
• Fax: +49.711.80670.111
• E-Mail: support@vector.com
• Online Report Form:
https://www.vector.com/vi_problem_report_en.html
Parameters addr
value
Output value
Symbolic assignment:
Please write:
word addr = 0x378;
byte ctrl;
...
// Output mode is active -> change
ctrl |= 0x20;
outport( addr + 2, ctrl);
...
Return values —
— • •
Example
// These example sends some characters to the first LPT port.
// The LPT port is first changed to output if necessary.
word addr = 0x378;
byte ctrl;
int i;
byte b;
// Read the parallel port control register
ctrl = inport( addr + 2);
if ( ctrl & 0x20)
{
// Input mode is active -> change
ctrl &= 0xdf;
outport( addr + 2, ctrl);
}
b = 0x01;
for ( i = 0; i < 8; i++)
{
// Output
outport( addr, b);
b <<= 1;
}
outportLPT
CAPL Function Overview » Obsolete » outportLPT
Obsolete function
Replaced by outport
Note
Before you can use the CAPL functions outport, inport, outportLPT and inportLPT, you
must install the generic I/O port driver for Windows. You will find this driver and its
description (ReadMe.Txt) in the directory Exec32\GpIoDrv.
Function Writes a byte to the specified parallel port. This function changes the transmission mode
of the parallel port automatically to output.
Parameters addr
value
Output value
Symbolic assignment:
Return values —
— • •
Example
// This example triggers a external device via the parallel port. (e.g:
CANscope)
on start
{
// reset LPT1 output
outportLPT( LPT1, 0);
}
on message ABSdata
{
if ( this.CarSpeed.phys > 200)
{
// trigger CANscope (running with external Trigger "low->high" enabled)
outportLPT( LPT1, 1);
// reset LPT1 output
outportLPT( LPT1, 0);
}
// dispatch original CAN message
output( this);
}
RegisterSignalDriverByTxNode
CAPL Function Overview » Obsolete » RegisterSignalDriverByTxNode
Obsolete function
No replacement
Function Registers the given callback as a 'signal driver' for the signal.
Parameters aSignal
DB signal to be queried.
aTxNode
DB node that should send the signal. It is only necessary if several send nodes are
approved for a message.
aCallbackFunction
7.0 — — •
Example
resetManualChecksum
CAPL Function Overview » Obsolete » resetManualChecksum
Obsolete function
Replaced by linResetManualChecksum
Function Turns the correct checksum back on for a LIN message, automatically adjusted to match
the message data.
Parameters msg
The LIN message for which the correct checksum will be used again.
Return values
Example
RS232ByteCallback
CAPL Function Overview » Obsolete » RS232ByteCallback
Obsolete function
Each node which implements this handler will receive data. The handler receives data
from all opened ports (i.e. opened by CANoe/CANalyzer).
It is cumbersome and slower by design since it gets one byte time by time. Block handlers
receive blocks of data at an instant of time.
Parameters port
datum
note
1: success
7.0 — — •
Example
if ( 0!=RS232WriteByte(2,65) )
write(“Written byte to port 2.”);
// port 2 may be connected with port 1
...
// at node which listens to port 1 is connected to port 2
RS232ByteCallback(dword port, dword datum, dword note)
{
// receive value 65 with port==1
}
RS232CloseHandle
CAPL Function Overview » Obsolete » RS232CloseHandle
Obsolete function
Replaced by RS232Close
Parameters port
The error occurs if the serial port with the given number does not exist on the system.
1: success
7.0 — — •
Example
RS232EscapeCommExt
CAPL Function Overview » Obsolete » RS232EscapeCommExt
Obsolete function
Replaced by RS232SetSignalLine
Info
If you use hardware handshake, then this function may conflict with the
automatic handshaking.
Parameters port
modemControl
Signal lines and levels to bet set on all open ports (opened by CANoe/CANalyzer).
0 0 0
1 1 0
2 0 1
3 1 1
• the serial port with the given number does not exist on the system
• the port has not been opened
1: success
7.0 — — •
Example
RS232EscapeCommFunc
CAPL Function Overview » Obsolete » RS232EscapeCommFunc
Obsolete function
Replaced by RS232SetSignalLine
Function Sets signal lines on all open serial ports (opened by CANoe/CANalyzer).
Info
If you use hardware handshake, then this function may conflict with the
automatic handshaking.
It is the only function of the RS232 API which does not take a port as
parameter.
Parameters modemControl
Signal lines and levels to bet set on all open ports (opened by CANoe/CANalyzer).
0 0 0
1 1 0
2 0 1
3 1 1
• the serial port with the given number does not exist on the system
• the port has not been opened
1: success
7.0 — — •
Example
RS232SetCommState
CAPL Function Overview » Obsolete » RS232SetCommState
Obsolete function
Parameters port
baudrate
Typically, 9600 is used. There is a list of possible values which depends on the serial port.
Normally, 115.200 is the allowed maximum.
numberOfDataBits
8 is used at most. Only values between 5 and 8 are possible. Not all values and not all
combinations with other frame parameters may be supported by the serial port.
numberOfStopBits
A code which sets the number of stop bits within a transmission frame.
parity
1 odd parity
2 even parity
• the serial port with the given number does not exist on the system
• the port has not been opened
• another program uses the serial port according to the port number
1: success
7.0 — — •
Example
RS232WriteBlock
CAPL Function Overview » Obsolete » RS232WriteBlock
Obsolete function
Replaced by RS232Send
[RS232]
BlockingWrite=0
Values: integer
0=non-Blocking, 1=blocking
Parameters port
buffer
number
• the serial port with the given number does not exist on the system
• the port has not been opened
• only relevant for non-blocking usage:
if another send operation (this one,RS232WriteByte or RS232Send) has been used
shortly before, then the previous send operation may not have finished which leads to
an error. Use the RS232OnSend callback handler to synchronize operations.
1: success
In contrast to RS232Send success means here that the operation has really succeeded to
transmit data.
2: time out, i.e. write access could not be completed till timeout (only relevant for
blocking variant, see RS232SetHandshake for setting timeout).
7.0 — — •
Example
char text[20] = “Hello World !”;
byte buffer[20];
int i;
int length;
length=strlen(text)+1;
for (i=0;i<length;i++) buffer[i]=text[i];
if ( 0!=RS232WriteBlock(1,buffer,length) )
write(“It works with port 1.”);
RS232WriteByte
CAPL Function Overview » Obsolete » RS232WriteByte
Obsolete function
Replaced by RS232Send
[RS232]
BlockingWrite=0
Values: integer
0=non-Blocking, 1=blocking
Parameters port
datum
• if the serial port with the given number does not exist on the system, then the call
will fail.
• if the port has not been opened, then the call will fail.
• only relevant for non-blocking usage:
if another send operation (this one,RS232WriteBlock or RS232Send) has been used
shortly before, then the previous send operation may not have finished which leads to
an error. Use the RS232OnSend callback handler to synchronize operations.
1: success
In contrast to RS232Send success means here that the operation has really succeeded to
transmit data.
2: time out, i.e. write access could not be completed till timeout (only relevant for
7.0 — — •
Example
if ( 0!=RS232WriteByte(1,65) )
write("It works with port 1.");
seqFileClose
CAPL Function Overview » Obsolete » seqFileClose
Obsolete function
Replaced by fileClose
Function The function closes the file specified by handle file. All System-allocated buffers are
freed upon closing.
Parameters file
Return values The function returns zero on success. If the operation fails, it returns an non-zero error
code.
3.2 — — •
Example
seqFileGetBlock
CAPL Function Overview » Obsolete » seqFileGetBlock
Obsolete function
Replaced by fileGetBinaryBlock
Function The function reads at most bufferSize characters from the file specified by handle file
into the array buffer. The file position indicator is advanced by the number of characters
successfully read. It is indeterminate after an error.
Parameters buffer
bufferSize
file
Return values The return value is the number of characters successfully read, which may be less than
bufferSize, if an error or end-of-file is encountered.
3.2 — — •
Example
seqFileGetLine
CAPL Function Overview » Obsolete » seqFileGetLine
Obsolete function
Replaced by fileGetString
Function The function reads at most bufferSize-1 characters from the file with the handle file into
the array buffer. No additional characters are read after a newline character or after end-
of-file.
The function retains the newline character, but the line is not zero-terminated.
Parameters buffer
bufferSize
file
Return values Return value is the number of characters successfully read, or a negative error code, if
the operation fails.
3.2 — — •
Example
seqFileGetLineSZ
CAPL Function Overview » Obsolete » seqFileGetLineSZ
Obsolete function
Replaced by fileGetStringSZ
Function The function reads at most bufferSize-1 characters from the file with the handle file into
the array buffer. No additional characters are read after a newline character or after end-
of-file.The function retains the newline character. If cStyle is set to 1 the line is
terminated by a null character, if cStyle is set to 0 not.
Parameters buffer
bufferSize
file
cStyle
Return values Return value is the number of characters successfully read, or a negative error code, if
the operation fails.
3.2 — — •
Example
seqFileLoad
CAPL Function Overview » Obsolete » seqFileLoad
Obsolete function
Replaced by openFileRead
Note
The function searches the file in the path given by the SeqFilePath entry in the [CAPL]
section of the CAN.INI initialization file. If the entry does not exist the file is searched in
the application directory (Exec/Exec32). Any drive and path information provided in the
parameter is ignored.
Function The function opens the file whose name is the string pointed to by name. The file will be
opened as read-only.
Parameters filename
Return values The return value is the file handle. The return value is <= 0 if an error occurs.
3.2 — — •
Example
seqFileRewind
CAPL Function Overview » Obsolete » seqFileRewind
Obsolete function
Replaced by fileRewind
Function The function sets the file position indicator to the beginning of the file specified by
handle file.
Parameters file
Return values The function returns zero on success. If the operation fails, it returns an non-zero error
code.
3.2 — — •
Example
setManualChecksum
CAPL Function Overview » Obsolete » setManualChecksum
Obsolete function
Replaced by linSetManualChecksum
Function Sets a checksum for a LIN message (that is different that the correct one).
Parameters msg
checksum
Return values
Example
setMsgTime
CAPL Function Overview » Obsolete » setMsgTime
Obsolete function
No replacement
Function Assigns to one message the capture time of another message or the current time. This
function is obsolete and only serves to establish compatibility with older versions.
Return values —
— • •
Example
setMsgTime(m100, this); // CANalyzer 1.xx & 2.xx
m100.time = this.time; // CANalyzer 2.xx
setMsgTime (m101, now);
Obsolete function
Replaced by setCanCabsMod
Note
For transceiver:
• 252
• 1041
• 1053
• 1054
• opto variations
Function To enable the different CAN bus tranceiver modes Normal Mode (standard at start) or
Sleep Mode.
For this function you have to take care that the channel number is the logical one which
is used by CANalyzer / CANoe according to the assignment in CAN Driver Configuration.
Parameters 8 bit parameter with the following, lowspeed CANcab specific meaning:
To enable one mode, the parameter has to contain one of the following bit combinations:
Normal Mode 0 1
Sleep Mode 1 0
No change 1 1
No change 0 0
Return values —
— • •
Example
Obsolete function
Replaced by setCanCabsMod
Note
For transceiver:
• CANcab 5790
• 5790 opto
For this function you have to take care that the channel number is the logical one which
is used by CANalyzer / CANoe according to the assignment in CAN Driver Configuration.
Further on, setting the mode explicitly for one channel is not possible, you always have to
set the modes for both channels (which can be different modes of course).
Parameters 8 bit parameter with the following, single wire CANcab specific meaning:
Sleep Mode 0 0
HighVoltage Mode 0 1
Fast Mode 1 0
Normal Mode 1 1
For normal data interchange the Normal-Mode with baud rates up to 40 kBaud is used. A
Fast-Mode, which allows only a limited number of bus nodes (e.g. for flash programming),
with baud rates up to 100 kBaud is supported. The HighVoltage-Mode is used to send
HighVoltage-WakeUp messages (12 V); in Sleep-Mode the transceiver is switched off.
Return values —
— • •
Example
SetSignalByTxNode
CAPL Function Overview » Obsolete » SetSignalByTxNode
Obsolete function
Replaced by SetSignal
If no suitable signal driver exists and thus no signal can be stimulated, then the verdict of
the test module is set to "fail".
Parameters aSignal
Signal to be set.
aNode
Send node.
aValue
Return values —
Example
SysGetVariableIntArray
CAPL Function Overview » Obsolete » SysGetVariableIntArray
Obsolete function
Replaced by SysGetVariableLongArray
Parameters namespace
variable
values
arraySize
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1 — — •
7.0 — • •
Example
SysSetVariableIntArray
CAPL Function Overview » Obsolete » SysSetVariableIntArray
Obsolete function
Replaced by SysSetVariableLongArray.
Parameters namespace
variable
values
arraySize
SysVarName
Name of the fully qualified name of the system variable, including all name spaces,
separated by "::". The name must be preceded by "sysVar::". (form 2)
1: name space was not found or second try to define the same name space
2: variable was not found or second try to define the same variable
5.1 — — •
7.0 — • •
Example
long lVarArr[10];
...
sysSetVariableIntArray(sysvar::MyNamespace::IntArrayVar, lVarArr,
elcount(lVarArr));
TestReportSetLoggingBlock
CAPL Function Overview » Test Feature Set » TestReportSetLoggingBlock
Obsolete function
This command is still retained for compatibility reasons since the logging files used are
automatically annotated in the XML log after version 5.2.
Function This function annotates a logging file to a report, e.g. to HTML reports created with
extendedNavigation.xslt.
Return values —
Example
testValidateSignalInRangeByTxNode
CAPL Function Overview » Obsolete » testValidateSignalInRangeByTxNode
Obsolete function
The test step is then evaluated as passed or failed, depending on the results
Parameters aTestStep
aSignal
aTxNode
aLowLimit
aHighLimit
0: Correct functionality
Example
testValidateSignalOutsideRangeByTxNode
CAPL Function Overview » Obsolete » testValidateSignalOutsideRangeByTxNode
Obsolete function
or
Parameters aTestStep
aSignal
aTxNode
aLowLimit
aHighLimit
0: Correct functionality
Example
TestWaitForSignal
CAPL Function Overview » Obsolete » TestWaitForSignal
Obsolete function
Replaced by TestWaitForSignalAvailable
Function Tests the availability of a specific signal and waits if necessary until its availability.
A signal that is received at least once from the bus after the measurement starts is
classified as "available".
This function is useful when you want to assure that single signals are available before
starting a signal-oriented test, i.e. to synchronize the tester with the bus.
Parameters aSignal
aTimeout
Example
| TestWaitForSignals |
TestWaitForSignals
CAPL Function Overview » Obsolete » TestWaitForSignals
Obsolete function
Replaced by TestWaitForSignalsAvailable
Function Tests the availability of all the send signals of a node and waits if necessary until all the
send signals of the node are available. Signals that are received at least once from the
bus after the measurement starts are classified as "available".
This function is useful when you want to assure that all signals are available before
starting a signal-oriented test, i.e. to synchronize the tester with the bus.
Parameters aNode
aTimeout [ms]
0: Wait state is exited due to a timeout; not all signals are available
1: The wait state is exited; all of the node’s send signals are available for further tests
Example
| TestWaitForSignal |
www.vector.com