User Manual CAPL Functions Version 1.1 Englisch Imprint Vector Informatik GmbH Ingersheimer Straße 24 D-70499 Stuttgart 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 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General Event Procedures General Event Procedures CAPL Function Overview » General Event Procedures 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: Event Event procedure Receipt of any message on * Receipt of a CAN message on message Occurrence of an error frame on errorFrame Environment variable change (only CANoe) on envVar System variable change on sysVar on sysVar_change Notification of system variable updates without value change on sysVar_update Press of a key on key Elapse of a timer on timer Response to signal changes Receipt of a signal on signal_update Signal change on signal Events of measurement system Initialization of measurement (before start) on preStart Program start on start Measurement stop has been requested on preStop End of measurement on stopMeasurement Events of CAN controller CAN controller goes to ErrorActive on errorActive CAN controller goes to ErrorPassive on errorPassive CAN controller reaches the Warning Limit on warningLimit CAN controller goes to Bus Off on busOff Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General Event Procedures 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 Info for using handlers within CAPL test nodes. Note for preStop handler, event handler and time handler: If a test is stopped (test module inactive), these handlers will not be executed within the CAPL test node. Example: In a XML test module a CAPL test node is added. on preStart { write ("start"); } 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedure: on * Event Procedure: on * CAPL Function Overview » General Event Procedures » on * You can access the on * event procedure in measurement setup. 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedure: on envVar Event Procedure: on envVar CAPL Function Overview » General Event Procedures » on envVar 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; // Read out the value of the switch // Assign to the signal Stop msg.Stop = getvalue(this); // Output the message on the bus output(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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedure: on errorFrame Event Procedure: on errorFrame CAPL Function Overview » General Event Procedures » on errorFrame 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. The access is executed with the following syntax: • this.time_ns (timestamp, unit: 1 nanosecond, type qword) • this.time (timestamp, unit: 10 microsecond, type dword) • this.can (channel number) • this.ecc (ECC error code, type byte) • this.sof (start of frame, unit: 1 nanosecond, type qword, only valid for CAN-Core-based interfaces) • this.ErrorPosition_Bit (bit error position in the frame, only valid for CAN-Core-based interfaces) • this.ErrorPosition_Time (error position in the frame, unit: 1 nanosecond, Only valid for CAN-Core- based interfaces) 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; }; } Following information appears in the Write window: 10.123456 Ch 2 RxErr Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedure: on key Event Procedure: on key CAPL Function Overview » General Event Procedures » on key 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. In CAPL the different keys have to be called as follows: Key CAPL code <F1> - <F12> (<F7>, <F8> and <F9> are not supported) F1 - F12 <Shift>+<F1> - <Shift>+<F12> shiftF1 - shiftF12 <Ctrl>+<F1> - <Ctrl>+<F12> ctrlF1 - ctrlF12 <Ctrl>+<Page up> / <Ctrl>+<Page down> ctrlPageUp / ctrlPageDown <Page up> / <Page down> PageUp / PageDown <End> End <Home> Home <Insert> InsertKey <Delete> DeleteKey Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedure: on key < ←>, <→>, <↑>, <↓ > <Ctrl>+< CursorLeft, CursorRight, CursorUp, CursorDown ←>, >, <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: on key 'a' Reacts on pressing key 'a' on key ' ' Reacts on pressing the spacebar on key 0x20 Reacts on pressing the spacebar You would use symbolic identifiers to react to activation of function keys: on key F1 Reacts on pressing <F1> on key shiftF3 Reacts on pressing <Shift>+<F3> on key ctrlF12 Reacts on pressing <Ctrl>+<F12> on key PageUp Reacts on pressing <Page up> on key ctrlPageDown Reacts on pressing <Page down> on key Home Reacts on pressing <Home> on key End Reacts on pressing <End> Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedure: on message Event Procedure: on message CAPL Function Overview » General Event Procedures » on message 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. To make the CAPL node transparent to messages you would write: on message * { output(this); }; 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 on message 123 React to message 123 (dec, standard identifier), regardless of receiving chip on message 123x React to message 123 (dec, extended identifier), regardless of receiving chip Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedure: on message on message 0x123 React to message 123 (hex, standard identifier), regardless of receiving chip on message 0x123x React to message 123 (hex, extended identifier), regardless of receiving chip on message EngineData React to message EngineData on message CAN1.123 React to message 123 if it is received by CAN1 chip on message * React to all messages on message CAN2.* React to all messages received by CAN2 chip on message 0,1,1020 React to messages 0, 1 and 10 through 20 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedure: on sysVar Event Procedure: on sysVar CAPL Function Overview » General Event Procedures » on sysVar 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedure: on timer Event Procedure: on timer CAPL Function Overview » General Event Procedures » on timer 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. You would start a previously-defined timer with the function setTimer. In CAPL exists the following variable types for timer: • timer - timer based on seconds • msTimer - timer based on milliseconds 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 If several CAPL timers elapse to the exact same time: • all timers will be executed • the event procedures of these timers will be operated in an undefined sequence 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 Since version 7.5 you can save timers in an array. Example variables { mstimer myTimers[10]; } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedure: on timer 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); } on timer myTimers(dword index) { // ... } 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); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Events of the CAN Controller Events of the CAN Controller CAPL Function Overview » General Event Procedures » Events of CAN Controller 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: • this.errorCountRX (Receive error counter) • this.errorCountTX (Transmit error counter) • this.can (Assign the channel) 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Event Procedures: Example Event Procedures: Example CAPL Function Overview » General Event Procedures » Example 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: Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Events of the Measurement System Events of the Measurement System CAPL Function Overview » General Event Procedures » Events of Measurement System 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. Info for CANoe users 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); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Events of the Measurement System on stopMeasurement procedure on stopMeasurement { write("Message 0x%x received: %d", msg.id, msg_Count); } Info for using handler within CAPL test nodes. Note for preStop handler, event handler and time handler: If a test is stopped (test module inactive), these handlers will not be executed within the CAPL test node. Example: In a XML test module a CAPL test node is added. on preStart { write ("start"); } on preStop { write ("stop"); deferStop (5000); } If the test module is inactive, the on preStart() write is displayed, on preStop will not be executed. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Unconditional (Boxed) Event Procedures Unconditional (Boxed) Event Procedures CAPL Function Overview » Unconditional (Boxed) Event Procedures 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Unconditional (Boxed) Event Procedures • frSlot | General Event Procedures | LIN Event Procedures | MOST Event Procedures | FlexRay Event Procedures | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Keyword this 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. Special Case: Output of signal values using this on message 101 { float a = 0; a = this.Signal1.phys; } 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; } | Access to signal values using this | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Classes and Objects in CAPL Classes and Objects in CAPL CAPL Function Overview » Classes and Objects 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 (predefined data types) Classes Timer, Ms Timer File Tcp Socket Udp Socket Test Check Test Stimulus Diag Request Diag Response Associative fields CAN 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. A renewed call of a destructor on a already destructed object has no effect. 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. There are two types of constructors: Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Classes and Objects in CAPL • 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: Associative fields Class: Associative fields CAPL Function Overview » Classes and Objects » Associative fields Note The methods are linked to the description of the corresponding CAPL function. Constructor — Destructor — Methods clear containsKey remove size | Associative Fields CAPL Functions | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: CAN 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: DiagRequest Class: DiagRequest CAPL Function Overview » Classes and Objects » DiagRequest This class represents a diagnostic request. Note The methods are linked to the description of the corresponding CAPL function. Constructor Specially with the qualifier, e.g. IDENTIFICATION::Development_Data::Read; 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: DiagRequest GetRespParameter GetRespParameterRaw GetRespPrimitiveByte GetRespPrimitiveSize GetSuppressResp, SetSuppressResp IsParameterConstant, IsRespParameterConstant IsParameterDefault IsRaw IsRawResp ResetParameter Resize | Resize SendMarked SendNegativeResponse SendNetwork SendRequest SetComplexParameter SetParameter SetPrimitiveByte SetRespPrimitiveByte SetSuppressResp SetTimeoutHandler | Diagnostics CAPL Functions | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: DiagResponse Class: DiagResponse CAPL Function Overview » Classes and Objects » DiagResponse This class represents a diagnostic response. Note The methods are linked to the description of the corresponding CAPL function. Constructor Specially with the qualifier, e.g. diagResponse this resp; 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: DiagResponse IsParameterConstant IsParameterDefault IsPositiveResponse IsRaw ResetParameter Resize | Resize SendNegativeResponse SendPositiveResponse SendResponse SetComplexParameter SetParameter SetPrimitiveByte | Diagnostics CAPL Functions | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: File Class: File CAPL Function Overview » Classes and Objects » File This class is used to read from a file or write to a 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: TcpSocket Class: TcpSocket CAPL Function Overview » Classes and Objects » TcpSocket This class is used to implement TCP network communications. Note The methods are linked to the description of the corresponding CAPL function. Constructor functions accept open Destructor close Methods bind connect getLastSocketError getLastSocketErrorAsString listen receive send setSocketOption shutdown | TCP/IP API | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: TestCheck 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. Constructor functions CreateAllNodesBabbling, StartAllNodesBabbling 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: TestCheck 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: TestCheck 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: TestCheck QueryStatProbeIntervalMax QueryStatProbeIntervalMin QueryValid | Test Service Library Functions | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: TestStimulus 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. Constructor CreateCSV (cyclical); CreateCSV (non-cyclical) CreateEnvVar CreateRamp (limits taken from database); CreateRamp (limits user defined) CreateToggle (limits taken from database); CreateToggle (limits user defined) Destructor destroy Methods reset start stop QueryValid | Test Service Library Functions | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: Timer, MsTimer Class: Timer, MsTimer CAPL Function Overview » Classes and Objects » Timer, MsTimer These classes are used to execute a specific function at regular intervals. Note The methods are linked to the description of the corresponding CAPL function. Constructor — Destructor — Methods set cancel timeToElapse Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Class: UdpSocket Class: UdpSocket CAPL Function Overview » Classes and Objects » UdpSocket This class is used to implement UDP network communications. Note The methods are linked to the description of the corresponding CAPL function. Constructor function open Destructor close Methods bind getLastSocketError getLastSocketErrorAsString receiveFrom sendTo setSocketOption | TCP/IP API | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General CAPL Functions General CAPL Functions CAPL Function Overview » General CAPL Functions Access to CAN and Other Hardware Functions Short description canSetChannelAcc Sends received messages through to CANoe via an acceptance filter. canSetChannelMode Activates/deactivates the TxReq of the CAN controller. canSetChannelOutput Defines the response of the CAN controller to the bus traffic and sets the ACK bit. getCardType Determines the type of CAN platform being used. getCardTypeEx Determines the card type of CAN channel. getChipType Determines the type of CAN controller used. 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. resetCan Resets the CAN controller. ResetCanEx Resets the CAN controller for one specific CAN channel. ScanBaudrateActive Determines the baud rate for the given channel. ScanBaudratePassive Starts the scan and detects the baud rate on the given channel. setBtr Sets another baud rate. setCanCabsMode Sets various CANcab modes. setOcr Sets the Output Control Register. xlAcquireLED Acquires the specified LEDs of a hardware device. xlReleaseLED Releases specified LEDs. xlSetLED Sets specified LEDs. Access to CANoe Environment Variables and Panels Functions Short description callAllOnEnvVar Calls all event procedures for environment variables (on envVar). ClockControlReset Resets the Clock Control designed as stop watch in the Panel Designer. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General CAPL Functions 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. closePanel Closes a panel. enableControl Selective activation and deactivation of special elements. getValue Determines the value of the environment variable. getValueSize Returns the size of the environment variable value in bytes. MakeRGB Calculates the color value from the three primary color components. openPanel Opens a panel. putValue Assigns the value to the environment variable. putValueToControl Assigns the value to the multi display. SetClockControlTime Sets the time of the Panel Designer clock control. SetControlBackColor Sets the background color of panel elements. SetControlColors Sets the background and text color of panel elements. SetControlForeColor Sets the text (foreground) color of panel elements. SetControlProperty Sets a property of an ActiveX control. 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. Byte Swapping (Intel/Motorola) Functions Short description swapDWord Swaps bytes of parameters. swapInt swapLong swapWord Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General CAPL Functions CANdb Functions Functions Short description GetFirstCANdbName Finds out the name of the first assigned database. getMessageAttrInt Gets the value of a message attribute from the database. GetMessageID Finds out the message ID. GetMessageName Finds out the message name. GetNextCANdbName Finds out the names of the other assigned databases. setSignalStartValues Sets the values of the signals in the parameter to the start values defined in the database. File Functions Functions Short description fileClose Closes the specified file. fileGetBinaryBlock Reads characters from the specified file in binary format. fileGetString Reads a string from the specified file. fileGetStringSZ Reads a string from the specified file. filePutString Writes a string in the specified file. fileRewind Resets the position pointer to the beginning of the file. fileWriteBinaryBlock Writes bytes in the specified file. 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 Open This function opens the file named filename. openFileRead Opens the file for the read access. openFileWrite Opens the file for the write access. setFilePath Sets the read and write path to the directory. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General CAPL Functions setWritePath Sets the write path for the function openFileWrite. writeProfileFloat Opens the file, searches the section and writes the variable. writeProfileInt writeProfileString Flow Control Functions Short description canOffline Cuts the connection between the node and the bus. canOnline Restores the connection of the node to the bus. getStartdelay Determines the value of the start delay configured for this network node in the Simulation Setup. isOfflineMode Gets the information if CANoe is in offline mode. isSimulated Gets the information if CANoe is in simulated mode. setStartdelay Sets the value of the Start Delay for this network node. stop Programmed interrupt of the ongoing measurement. Language Support and Debugging Functions Short description elCount Determines the number of elements of an array. fileName Output of the CAPL program in the Write window. halt Stops the execution of the simulation. inspect Causes an update of the variables displayed on the Inspect side of the Write window. runError Triggers a run error. setWriteDbgLevel Sets the priority level for the writeDbgLevel CAPL function. writeDbgLevel Outputs a message to the Write window with the specified priority. Logging Functions Functions Short description setLogFileName Sets the name of the logfile. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General CAPL Functions setPostTrigger Sets the posttrigger of the logging. setPreTrigger Sets the pretrigger of the logging. StartLogging Starts all logging blocks immediately bypassing all logging trigger settings. StopLogging Stops all logging blocks immediately bypassing all logging trigger settings. trigger Activates/Deactivates logging triggering of all logging and trigger blocks. triggerEx Activates/Deactivates logging triggering of a special logging or trigger block. writeToLog Writes an output string to an ASCII logging file. writeToLogEx Writes an output string to an ASCII logging file. Other Functions Functions Short description CompleteStop Indicates completion of pre-stop activities after a measurement stop has been deferred. 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. GetBusContext Returns the current bus context of the CAPL block. GetBusNameContext Returns the context of the specified bus. GetComputerName Retrieves the fully qualified name of the computer. GetEventSortingStatus Determines the Event Sorting state. GetIPAddress Retrieves the default (first) IP address of the computer as a string. gmLanGetPID Gets the parameter ID of the message. gmLanGetPrio Gets the priority of the message. gmLanGetSourceId Gets the source address of the message. gmLanId Creates a message ID for a GMLAN message. gmLanSetPID Sets the parameter ID of the message. gmLanSetPrio Sets the priority of the message. gmLanSetSourceId Sets the source address of the message. isStatisticAcquisitionRunning Tests whether an acquisition range has already been started. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General CAPL Functions SetBusContext Sets the bus context of the CAPL block. startStatisticAcquisition Starts a new acquisition range. stopStatisticAcquisition Stops a started acquisition range. traceSetEventColors Sets the font, and background color for the message display in the Trace window. Replay Functions Functions Short description ReplayResume Starts the Replay block after it is suspended. ReplayStart Starts the Replay block. ReplayState Returns the state of the Replay block. ReplayStop Stops the Replay block. ReplaySuspend Suspends the Replay block . StartMacroFile Starts playing the macro. StartReplayFile Starts playing the replay file. StopMacroFile Stops the macro from playing. StopReplayFile Stops the replay file from playing. Standard / Extended Identifiers Functions Short description isStdId Checks parameter for standard identifier . isExtId Checks parameter for extended identifier. mkExtId Returns an extended ID. valOfId Returns the value of a message identifier independent of its type. Standalone Mode Functions Short description StandaloneConfigOpen Opens the rtcfg file with the given name as standalone configuration. StandaloneConfigSetDefault Changes the default configuration file. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General CAPL Functions String Functions Functions Short description _gcvt Converts a number to a string. atodbl Converts a string into a double number. atol Converts a string to a LONG number. ltoa Converts a number to a string. snprintf Prints a formatted string to character array. strlen Gets the length of a string. strncat Appends a string to another string. strncmp Compares the number of characters of two strings. strncmp_off strncpy Copies a string to another string. strncpy_off strstr Searches a string in another string. strstr_off substr_cpy Copies a substring to another string. substr_cpy_off str_match_regex Checks whether a string completely matches a regular expression pattern. str_replace Replaces all occurrences of a text in a string with another string. Replaces a part of a string with another string. str_replace_regex Replaces all occurrences of pattern in a string with another string. strstr_regex Searches for a regular expression pattern in a string. strstr_regex_off toLower Transforms a character or string to lower case. toUpper Transforms a character or string to upper case. Time Management Functions Short description cancelTimer Stops an active timer Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General CAPL Functions ConvertTimestamp Converts a timestamp to separate parts. ConvertTimestampNS EnvVarTimeNS Returns the time stamp of the environment variable envVariable in nanoseconds. getDrift Determines the constant deviation when Drift is set. 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. getLocalTime Returns details to the current date and time. getLocalTimeString Copies a printed representation of the current date and time. isTimerActive Return value indicates whether a specific timer is active. MessageTimeNS Returns the time stamp in nanoseconds. setDrift Sets a constant deviation for the timers of a network node. setJitter Sets the Jitter interval for the timers of a network node. setTimer Sets a timer. timeDiff Time difference between messages or between a message and the current time in ms. timeNow Supplies the current simulation time [10 microseconds]. timeNowFloat Supplies the current simulation time [10 microseconds]. timeNowInt64 Supplies the current simulation time [nanoseconds]. timeNowNS Supplies the current simulation time [nanoseconds]. timeToElapse Returns a value indicating how much more time will elapse before an on timer event procedure is called. Trigonometric and Mathematical Functions Functions Short description arccos Calculates arccosine of a value. arcsin Calculates arcsine of a value. arctan Calculates arctangent of a value. _ceil Calculates the ceiling of a value. _floor Calculates the floor of a value. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General CAPL Functions _Log Calculates the natural logarithm. _Log10 Calculates the logarithm to base 10. _max Returns the maximum of the parameters. _min Returns the minimum of the parameters. _pow Returns x to the power of y. _round Rounds a number. abs Returns the absolute value cos Calculates the cosine. exp Calculates the exponential function. random Calculates a random number. sin Calculates the sine. sqrt Calculates the square root. User Interactions Functions Short description keypressed Returns the key code of a currently pressed key. msgBeep Plays back a sound predefined by the Windows system. sysExec, sysExecCmd Executes an external command. sysExit Exits the system (CANoe) from within a CAPL program. sysMinimize Minimizes or restores the application window of CANoe. write Outputs a text message to the Write window . writeClear Clears the contents of the specified page in the Write window. writeConfigure Configures the specified page in the Write window. writeCreate Generates a new page in the Write window with the specified name. writeDestroy Removes the specified page from the Write window. 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: General CAPL Functions 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. | File Search Procedure | File Functions | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: abs abs CAPL Function Overview » General » abs Syntax long abs(long x); double abs(double x); Function Returns the absolute value. Parameters Value whose absolute value is to be returned. Return values Absolute value of x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 2.5 — • • Example long x; x = abs(15); // Result: 15 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: arccos arccos CAPL Function Overview » General » arccos Syntax double arccos(double x); Function Calculates arccosine of x. Parameters x Value between –1 and 1 whose arccosine is to be calculated. Values outside this range cause a CAPL runtime error. Return values Arcus Cosine of x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 — • • Example double x; x = arccos(0); // result PI/2 x = arccos(1); // result 0 | arcsin | arctan | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: arcsin arcsin CAPL Function Overview » General » arcsin Syntax double arcsin(double x); Function Calculates arcsine of x. Parameters x Value between –1 and 1 whose arcsine is to be calculated. Values outside this range cause a CAPL runtime error. Return values Arcus Sine of x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 — • • Example double x; x = arcsin(1); // result PI/2 x = arcsin(0); // result 0 | arccos | arctan | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: arctan arctan CAPL Function Overview » General » arctan Syntax double arctan(double x); Function Calculates arctangent of x. Parameters x Value whose arctangent is to be calculated. Return values Arcus Tangent of x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 — • • Example double x; x = arctan(0); // result 0 x = arctan(1); // result PI/4 | arccos | arcsin | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: atodbl atodbl CAPL Function Overview » General » atodbl Syntax double atodbl(char s[]); 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] String parsing ceases at the first non-compliant character. If the string cannot be converted into a number, 0.0 is returned. If the string starts with 0x, the base used is 16. Only integer numbers can be read in. Parameters Input string to be converted. Return values Double number, the converted string. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 — • • Example double d; d = atodbl(" -3.7"); d = atodbl("0x1F"); d = atodbl("1.3E2"); // -3.7 // 31.0 // 130.0 | atol | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: atol atol CAPL Function Overview » General » atol Syntax long atol(char s[]); 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. Parameters String to be converted. Return values long integer Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example ... long long z1 = z2 = ... z1; z2; atol("200"); atol("0xFF"); Result: z1 = 200, z2 = 255 | ltoa | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: callAllOnEnvVar callAllOnEnvVar CAPL Function Overview » General » callAllOnEnvVar Syntax void 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — — • Example on start { callAllOnEnvVar(); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: cancelTimer cancelTimer CAPL Function Overview » General » cancelTimer Syntax void cancelTimer(msTimer t); void cancelTimer(timer t); Method t.cancel(); Function Stops an active timer. Parameters Timer or msTimer variable. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • 7.0 SP5: method — • • 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"); } | setTimer | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: CANdelaLibCloseChannel CANdelaLibCloseChannel CAPL Function Overview » General » CANdelaLibCloseChannel Syntax void CANdelaLibCloseChannel(char ECUqualifier[]) 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. Return values void Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 SP2 — • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: canOffline canOffline CAPL Function Overview » General » canOffline Syntax void canOffline(); // Form 1 obsolete dword canOffline(dword flags); // Form 2 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. Form 1 only has an effect on the CAPL-program. In Form 2 you can choose between the CAPL-program and/or the Nodelayer-DLL. Parameters Flags Indicates the deactivated part of the node. 1 Deactivates the CAPL-program 2 Deactivates the Nodelayer 3 Deactivates the CAPL-program and the Nodelayer Return values Form 2 returns the part of the node being online before the function call. Equal to the flags. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: canOnline canOnline CAPL Function Overview » General » canOnline Syntax void canOnline(); // Form 1 obsolete dword canOnline(dword flags); // Form 2 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. Form 1 only has an effect on the CAPL-program. In Form 2 you can choose between the CAPL-program and/or the Nodelayer-DLL. Parameters Flags Indicates the activated part of the node. 1 Activates the CAPL-program 2 Activates the Nodelayer 3 Activates the CAPL-program and the Nodelayer Return values Form 2 returns the part of the node being online before the function call. Equal to the flags. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: canSetChannelAcc 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. Syntax long canSetChannelAcc(long channel, dword code, dword mask); 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. Parameters CAN channel Acceptance code for ID filtering Acceptance mask for ID filtering Return values 0: ok !=0: error Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: canSetChannelMode 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. Syntax long canSetChannelMode(long channel, long gtx, long gtxreq); Function Activates/deactivates the TxReq and Tx of the CAN controller. This function does nothing with the Ack bit. Parameters CAN channel gtx 0 tx off 1 tx on gtxreq Return values 0 gtxreq off 1 gtxreq on 0: ok !=0: error Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: 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. Syntax long canSetChannelOutput(long channel, long silent); 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. Parameters CAN channel silent Return values 0 silent 1 normal 0: ok !=0: error Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 — • • Example on key 's' { long channel =2; long silent =0; canSetChannelOutput(channel,silent); Write("silent set to %d",silent); } | canSetChannelAcc | canSetChannelMode | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: _ceil _ceil CAPL Function Overview » General » _ceil Syntax float _ceil(float x); Function Calculates the ceiling of a value, i.e. the smallest integer larger or equal to the value. Parameters x Value of which the ceiling shall be calculated. Return values Ceiling of x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — • • Example float x; x = _ceil(3.6); // x == 4.0 | _floor | _round | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ClockControlReset ClockControlReset CAPL Function Overview » General » ClockControlReset Syntax void ClockControlReset(char[] panel, char[] control); 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 stop watch cannot be reset when it is already running. The panel is accessed by its individual panel name that is entered in the Panel Designer. Parameters panel Panel name ("" – references all opened panels) 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. The form for signals is: "Signal:<signal name>". The form for environment variables is: "EnvVar:<environment variable name>". The form for system variables is: "SysVar:<name of system variable>". The name space must not be used. Info • Symbol assignment must not be case sensitive. • If you want to access all elements of a panel the notation "" is used, see example below. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 Clock Control • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ClockControlReset Example // Reset the clock control designed as stop watch. on key 'a' { ClockControlReset("ClockControl", "StoppWatch"); } | ClockControlStart | ClockControlStop | SetClockControlTime | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ClockControlStart ClockControlStart CAPL Function Overview » General » ClockControlStart Syntax void ClockControlStart(char[] panel, char[] control); 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. The stop watch is updated every second. Info The stop watch cannot be started when it is already running. The panel is accessed by its individual panel name that is entered in the Panel Designer. Parameters panel Panel name ("" – references all opened panels) 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. The form for signals is: "Signal:<signal name>". The form for environment variables is: "EnvVar:<environment variable name>". The form for system variables is: "SysVar:<name of system variable>". The name space must not be used. Info • Symbol assignment must not be case sensitive. • If you want to access all elements of a panel the notation "" is used, see example below. 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) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ClockControlStart Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 Clock Control • • Example // Start the clock control designed as stop watch. on key 'a' { ClockControlStart("ClockControl", "StoppWatch"); } | ClockControlStop | ClockControlReset | SetClockControlTime | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ClockControlStop ClockControlStop CAPL Function Overview » General » ClockControlStop Syntax void ClockControlStop(char[] panel, char[] control); 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 Panel name ("" – references all opened panels) 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. The form for signals is: "Signal:<signal name>". The form for environment variables is: "EnvVar:<environment variable name>". The form for system variables is: "SysVar:<name of system variable>". The name space must not be used. Info • Symbol assignment must not be case sensitive. • If you want to access all elements of a panel the notation "" is used, see example below. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 Clock Control • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ClockControlStop Example // Stop the clock control designed as stop watch. on key 'a' { ClockControlStop("ClockControl", "StoppWatch"); } | ClockControlStart | ClockControlReset | SetClockControlTime | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: closePanel 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. Syntax void closePanel(char panelName[]); Function Closes a panel. The panel is accessed by its individual panel name that is entered in the Panel Designer / Panel Editor. Parameters panelName Panel name Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 — • • Example — | openPanel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: CompleteStop CompleteStop CAPL Function Overview » General » CompleteStop Syntax void CompleteStop () Function Indicates completion of pre-stop actions carried out in a certain node after a measurement stop has been deferred by DeferStop. Infos • If several CAPL nodes or internal components defer a measurement stop, measurement continues until they have all indicated completion of their pre-stop actions (either by explicitly calling CompleteStop or implicitly when the timeout whose interval has been defined in the DeferStop call has passed). • CompleteStop may not be called before a stop request has arrived (i.e. before the on preStop handler is called). Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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(); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ConvertTimestamp, ConvertTimestampNS ConvertTimestamp, ConvertTimestampNS CAPL Function Overview » General » ConvertTimestamp, ConvertTimestampNS Syntax void ConvertTimestamp(dword timestamp, dword& days, byte& hours, byte& minutes, byte& seconds, word& milliSeconds, word& microSeconds); // form 1 void ConvertTimestampNS(qword timestamp, dword& days, byte& hours, byte& minutes, byte& seconds, word& milliSeconds, word& microSeconds, word& nanoSeconds); // form 2 Function Converts a timestamp to separate parts. Parameters timestamp timestamp in 10 microseconds (form 1) timestamp in nanoseconds (form 2) days Receives the days of the timestamp hours Receives the hours the timestamp (between 0 and 23) minutes Receives the minutes of the timestamp (between 0 and 59) seconds Receives the seconds of the timestamp (between 0 and 59) milliseconds Receives the milliseconds of the timestamp (between 0 and 999) microseconds Receives the microseconds of the timestamp (between 0 and 999) nanoseconds (only form 2) Receives the nanoseconds of the timestamp (between 0 and 999) Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ConvertTimestamp, ConvertTimestampNS } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: cos cos CAPL Function Overview » General » cos Syntax double cos(double x); Function Calculates cosine of x. Parameters Value in radians whose cosine is to be calculated. Return values Cosine of x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example double x; x = cos(PI); // result -1 or double tangens(double x) { return sin(x) / cos(x); } | sin | sqrt | exp | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: DeferStop DeferStop CAPL Function Overview » General » DeferStop Syntax void DeferStop(dword maxDeferTime) Function Defers measurement stop. 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 • If several CAPL nodes or internal components defer a measurement stop, measurement continues until they have all indicated completion of their pre-stop actions (either by explicitly calling CompleteStop or implicitly when the maxDeferTime timeout has occurred). • DeferStop may not be called after the CAPL node has indicated completion of pre-stop activities (explicitly or implicitly). • By calling DeferStop twice within the same node the interval until the automatic complete timeout occurs can be extended. Reduction of the timeout interval is not supported. • If DeferStop is called before a stop request arrives measurement stop will be deferred even if an on preStop handler is not defined. The timer whose interval is defined in maxDeferTime refers to the instance of the stop request arrival. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 — — • Example on preStop { message ShutdownReq m; output(m); DeferStop(1000); } on message ShutdownAck { CompleteStop(); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: elCount elCount CAPL Function Overview » General » elCount Syntax long elCount(...); Function Determines the number of elements of an array. Parameters Array of any arbitrary type. Return values Number of elements. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example void bsp(int ar[]) { int i; for(i=0; i < elCount(ar); i++) ... } void bsp2(byte ar[][]) { int i, j; for(j=0; j < elCount(ar); j++ ) for(i=0; i<= elCount(ar[j]); i++ ) ... } | runError | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: enableControl enableControl CAPL Function Overview » General » enableControl Syntax void enableControl(char panel[], char control[], long enable); Function Selective activation and deactivation of the following elements: • 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 Name of the 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. The form for signals is: "Signal:<signal name>". The form for environment variables is: "EnvVar:<environment variable name>". The form for system variables is: "SysVar:<name of system variable>". The name space must not be used. Info • Symbol assignment must not be case sensitive. • If you want to access all elements of a panel the notation "" is used, see example below. 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 0: turn off (disable) 1: turn on (enable) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: enableControl Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.1 — • • Example on key 'a' { enableControl("gateway", "ElemPanelHelp", 1); // Activates Panel help in the "gateway" panel. // enable all controls of the panel enableControl("gateway", "", 1); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: EnvVarTimeNS EnvVarTimeNS CAPL Function Overview » General » EnvVarTimeNS Syntax float EnvVarTimeNS(envvar envVariable); Function Returns the time stamp of the environment variable envVariable in nanoseconds. Parameters envVariable Name of the environment variable. Return values Time stamp of the environment variable in ns. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 — • • Example — | MessageTimeNS | timeNowNS | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: exp exp CAPL Function Overview » General » exp Syntax double exp(double x); Function Calculates the exponential function. Parameters Value whose exponent is to be calculated Return values Exponent to base e. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example double x; x = exp(5); write("Exponent of 5: %l",x); // Result: 148.413159 | cos | sin | sqrt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FDXTriggerDataGroup FDXTriggerDataGroup CAPL Function Overview » General » FDXTriggerDataGroup Syntax long FDXTriggerDataGroup (WORD goupID) Function This function triggers the transmission of a data group via CANoe FDX protocol. Parameters groupID ID of the FDX data group that should be transmitted. Return values 0: Success -1: The given data group is not configured. -2: No client is registered to receive this data group. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: fileClose fileClose CAPL Function Overview » General » fileClose Syntax long fileClose (dword fileHandle) As Destructor file.close() Function This function closes the specified file. Parameters The integer contains the handle to the file. Return values If an error occurs the return value is 0, else 1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • 7.0 SP5: method — • • Example | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: fileGetBinaryBlock fileGetBinaryBlock CAPL Function Overview » General » fileGetBinaryBlock Syntax long fileGetBinaryBlock (byte buff[], long buffsize, dword fileHandle) Method file.GetBinaryBlock(byte buff[], long buffsize) Function The function reads characters from the specified file in binary format. The source file must be opened in binary format. Parameters buff Buffer buffsize Maximum of buffsize characters fileHandle Handle to the file Return values The function returns the number of characters read. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • 7.0 SP5: method — • • Example | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: fileGetString fileGetString CAPL Function Overview » General » fileGetString Syntax long fileGetString (char buff[], long buffsize, dword fileHandle); Method file.GetString(char buff[], long buffsize); 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 readout characters is equal to buffsize -1. Parameters buff Buffer for the read-out string buffsize Length of the string fileHandle Handle to the file Return values If an error occurs, the return value is 0, else 1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • 7.0 SP5: method — • • Example | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: fileGetStringSZ fileGetStringSZ CAPL Function Overview » General » fileGetStringSZ Syntax long fileGetStringSZ(char buff[], long buffsize, dword fileHandle); Method file.GetStringSZ(char buff[], long buffsize); 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 buffsize1. The new line character is not included in the string. See also fileGetString. Parameters buff Length of the string buffsize Buffer for the read-out string fileHandle Handle to the file Return values If an error occurs, the return value is 0, else 1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • 7.0 SP5: method — • • Example | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: fileName fileName CAPL Function Overview » General » fileName Syntax void fileName(); Function Output of the CAPL program name in the Write window. Helpful for debugging purposes. Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example ... fileName(); ... Result: output of actual filename of CAPL program to Write window. | elCount | runError | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: filePutString filePutString CAPL Function Overview » General » filePutString Syntax long filePutString (char buff[], long buffsize, dword fileHandle); Method file.PutString(char buff[], long buffsize); Function This function writes a string in the specified file. Parameters buff Buffer for the read-in string buffsize Number of characters fileHandle Handle to the file Return values If an error occurs, the return value is 0, else 1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • 7.0 SP5: method — • • Example | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: fileRewind fileRewind CAPL Function Overview » General » fileRewind Syntax long fileRewind (dword fileHandle) Method file.Rewind() Function This function resets the position pointer to the beginning of the file. Parameters The integer indicates the file handle. Return values If an error occurs, the return value is 0, else 1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • 7.0 SP5: method — • • Example | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: fileWriteBinaryBlock fileWriteBinaryBlock CAPL Function Overview » General » fileWriteBinaryBlock Syntax long fileWriteBinaryBlock (byte buff[], long buffsize, dword fileHandle) Method file.WriteBinaryBlock(byte buff[], long buffsize) Function This function writes buffsize bytes in the specified file. Parameters buff Buffer, the characters are read-out buffersize Number of bytes fileHandle Handle to the file Return values The function returns the number of bytes written. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: _floor _floor CAPL Function Overview » General » _floor Syntax float _floor(float x); Function Calculates the floor of a value, i.e. the largest integer smaller or equal to the value. Parameters x Value of which the floor shall be calculated. Return values Floor of x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — • • Example float x; x = _floor(3.6); // x == 3.0 | _ceil | _round | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: _gcvt _gcvt CAPL Function Overview » General » _gcvt Syntax void _gcvt(double val, int digits, char s[]); 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 Number of significant digits. s String, which contains the converted number. If the string size is too small, the string keeps unchanged. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 SP2 — • • Example char s[15]; float val1 = 3.1415926535; float val2 = 271828.18284; _gcvt(val1, 10, s); writeToLogEx("val1: %f: s: %s", val1, s); _gcvt(val2, 9, s); writeToLogEx("val2: %f: s: %s", val2, s); _gcvt(val2, 5, s); writeToLogEx("val2: %f: s: %s", val2, s); _gcvt(val2, 20, s); // String size too small, string keeps unchanged writeToLogEx("val2: %f: s: %s", val2, s); ... Result: val1: val2: val2: val2: 3.141593: s: 3.141592654 271828.182840: s: 271828.182 271828.182840: s: 2.7183e+005 271828.182840: s: 2.7183e+005 | atol | ltoa | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getAbsFilePath getAbsFilePath CAPL Function Overview » General » getAbsFilePath Info This function is not available in case of a distributed environment. Syntax long getAbsFilePath(char relPath[], char absPath[], long absPathLen) Function Gets the absolute path of a file. 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 Buffer to which the full path name should be copied. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 — • • Example on key 'x' { char absPath[256]; getAbsFilePath("Nodes\\Test.can", absPath, 256); write ("absPath: %s ", absPath); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetBusContext 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. You should use the functions GetBusNameContext, GetBusContext and SetBusContext to determine the context of a bus, to query or to change the current bus context. Syntax dword GetBusContext() Function Returns the current bus context of the CAPL block. Parameters — Return values The current bus context. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 — — • Example This is an example for a simulation node. Test nodes should copy the bus context to a CAPL variable in the Main() function because all global variables are cleared when the test module is started. variables { dword ibus_context = 0; dword motbus_context = 0; } on preStart { ibus_context = GetBusNameContext( "ibus"); motbus_context = GetBusNameContext( "motbus"); } void apCanOn() { dword context; // activate the CAN channel on the "current" context CanOnline(); // determine the "other" context context = ibus_context == GetBusContext() ? motbus_context : ibus_context; // set the context to the "other" bus... Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetBusContext SetBusContext( context); // ...and activate its CAN chip as well CanOnline(); } | GetBusNameContext | SetBusContext | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetBusNameContext 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. You should use the functions GetBusNameContext, GetBusContext and SetBusContext to determine the context of a bus, to query the current bus context, or to change its context. Syntax dword GetBusNameContext(char name[]) Function Returns the context of the specified bus. Parameters name The name of the bus. Return values In the case of success, the context of the specified bus is returned. If the specified bus does not exist, 0 is returned. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 — — • Example This is an example for a simulation node. Test nodes should copy the bus context to a CAPL variable in the Main() function because all global variables are cleared when a test module is started. variables { char ibus[32] = "ibus"; char motbus[32] = "motbus"; 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); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetBusNameContext } if ( 0 == motbus_context) { writeex( 0, 3, "Error: Cannot determine context for bus: %s", motbus); } } | GetBusContext | SetBusContext | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getCardType getCardType CAPL Function Overview » General » getCardType Syntax long getCardType(); Function Determines the type of CAN platform being used. Is needed e.g. to program the BTR / OCR values. Parameters — Return values 17: for Vector drivers For other manufacturer other values will be returned. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example ... switch(getCardType()) { case 6: setOcr(0,0x02); break; case ... default: write("Unknown driver %d", getCardType()); break; } ... | getChipType | getCardTypeEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getCardTypeEx getCardTypeEx CAPL Function Overview » General » getCardTypeEx Syntax int getCardTypeEx(int can); Function Determines the card type of CAN channel. Is needed e.g. to program the BTR / OCR values. Parameters CAN Channel number Return values Type of board as one of the following values: 0 DBB196 - Daimler-Benz-Board with FullCAN 1 DBB196B - with BasicCAN 2 CANIB - Bosch CANIB 3 DEMO - Demo driver 6 CANAC2 - Softing AC2/200/ANA 7 CANAC2X - Softing AC 2/527/ANA 8 CPC/PP = EMS wish module 9 INDIGO - Silicon Graphics Indigo2 10 CANCARD - PCMCIA 11 Bit 11 CANCARDX - PCMCIA 29 Bit 12 CANAC2B - Softing AC2/527 11 Bit 15 Peak CAN-Dongle 16 Vector CAN-Dongle 17 Vector PCMCIA CANcardX 18 Virtual CAN driver 20 Softing PCMCIA CANcard SJA1000 25 Vector PCMCIA CANcardXL 27 Vector USB CANcaseXL 28 Vector CANcaseXLLog (USB + memory) 29 Vector CANboardXL PCI Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getCardTypeEx 30 Vector CPCI CANboardXL Compact 31 Vector CANboardXL PCI express 33 Vector VN7600 34 Vector ExpressCard CANcardXLe Additional types may be added! Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 — • • Example — | getCardType | getChipType | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getChipType getChipType CAPL Function Overview » General » getChipType Syntax long getChipType(long channel); Function Determines the type of CAN controller used. Parameters CAN channel Return values 0 both controller 1 Channel 1 2 Channel 2 Type of controller with the following values: 5 NEC 72005 200 Philipps PCA82C200 526 Intel 82526 527 Intel 82527 1000,1001 Philipps SJA1000 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example ... switch(getChipType(0)) { case 200: setOcr(0,0x02); break; case ... default: write("Unknown CAN-chip %d", getChipType(0)); break; } ... | getCardType | getCardTypeEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetComputerName GetComputerName CAPL Function Overview » General » GetComputerName Syntax long GetComputerName(char buffer[], dword bufferSize) Function Retrieves the fully qualified name of the computer. Parameters buffer Space for the returned name. bufferSize Length of the buffer. Return values 0 if the function completed successfully, else unequal 0. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 SP3 — • • Example char buffer[50]; GetComputerName(buffer, elcount(buffer)); write("Computer name: %s", buffer); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getDrift getDrift CAPL Function Overview » General » getDrift Syntax int getDrift() Function Determines the constant deviation when Drift is set. Parameters — Return values Drift in parts per thousand. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — — • Example int val; ... // Assign to val the Drift value val = getDrift(); ... | getJitterMax | getJitterMin | setDrift | setJitter | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetEventSortingStatus GetEventSortingStatus CAPL Function Overview » General » GetEventSortingStatus Syntax int GetEventSortingStatus(message msg); int GetEventSortingStatus(pg msg); int GetEventSortingStatus(gmLanMessage msg); int GetEventSortingStatus(linmessage msg); int GetEventSortingStatus(beanMessage); int GetEventSortingStatus(mostMessage msg); int GetEventSortingStatus(mostAmsMessage msg); int GetEventSortingStatus(mostRawMessage msg); int GetEventSortingStatus(j1587Param msg); int GetEventSortingStatus(linBaudrateEvent event); int GetEventSortingStatus(linCsError event); int GetEventSortingStatus(linDlcinfo event); int GetEventSortingStatus(linReceiveError event); int GetEventSortingStatus(linSchedulerModeChange event); int GetEventSortingStatus(linSlaveTimeout event); int GetEventSortingStatus(linSleepModeEvent event); int GetEventSortingStatus(linSyncError event); int GetEventSortingStatus(linTransmError event); int GetEventSortingStatus(linWakeupFrame event); int GetEventSortingStatus(beanError event); int GetEventSortingStatus(mostLightLockError event); int GetEventSortingStatus(FRSlot event); int GetEventSortingStatus(FRFrame msg); int GetEventSortingStatus(FrStartCycle event); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetEventSortingStatus Function Determines the Event Sorting state. With active Event Sorting the return value indicates if the given event in the simulation setup of CANoe was processed in correct time sequence. Parameters Message event variable of type "message", "pg", "gmLanMessage", "linmessage", "beanMessage", "mostMessage", "mostAmsMessage", "mostRawMessage", "j1587Param", "linBaudrateEvent", "linCsError", "linDlcinfo", "linReceiveError", "linSchedulerModeChange", "linSlaveTimeout", "linSleepModeEvent", "linSyncError", "linTransmError", "linWakeupFrame", "beanError", "mostLightLockError", "FRSlot", "FRFrame" or "FrStartCycle". Return values 0: Invalid state 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 ); } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetEventSortingStatus 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 { Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetEventSortingStatus 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 ); } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetFirstCANdbName GetFirstCANdbName CAPL Function Overview » General » GetFirstCANdbName Syntax dword GetFirstCANdbName( char buffer[], dword size) Function Finds out the name of the first assigned database. Parameters buffer Buffer in which the database name is written. size Size of the buffer in Buyte. Return values If successful unequal 0, otherwise 0. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.0 — • — Example on start { char buffer[256]; dword pos; pos = GetFirstCANdbName( buffer, elcount( buffer)); //Finds the name of the first database. //If a database is found, "pos" contains the value 1 //If none is found "pos" contains 0 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. write( "Database position number : %d Database name : %s",pos, buffer); } | GetMessageName | GetNextCANdbName | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetIPAddress GetIPAddress CAPL Function Overview » General » GetIPAddress Syntax long GetIPAddress(char buffer[], dword bufferSize) Function Retrieves the default (first) IP address of the computer as a string. Parameters buffer Space for the returned address. bufferSize Length of the buffer. Return values 0 if the function completed successfully, else unequal 0. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 SP3 — • • Example char buffer[50]; GetIPAddress(buffer, elcount(buffer)); write("IP Address: %s", buffer); | IpGetAdapterAddress | IpGetAdapterAddressAsString | IpGetAddressAsNumber | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getJitterMax getJitterMax CAPL Function Overview » General » getJitterMax Syntax int getJitterMax() Function Determines the upper limit for the allowable deviation when Jitter is set. Parameters — Return values Upper deviation in parts per thousand. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — — • Example int val; ... // Assign to val the upper value of the Jitter val = getJitterMax(); ... | getDrift | getJitterMin | setDrift | setJitter | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getJitterMin getJitterMin CAPL Function Overview » General » getJitterMin Syntax int getJitterMin() Function Determines the lower limit for the allowable deviation when Jitter is set. Parameters — Return values Lower deviation in parts per thousand. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — — • Example int val; ... // Assign to val the lower value of the Jitter val = getJitterMin(); ... | getDrift | getJitterMax | setDrift | setJitter | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getLocalTime getLocalTime CAPL Function Overview » General » getLocalTime Syntax void getLocalTime(long time[]); Function Returns details to the current date and time in an array of type long. Parameters An array of type long with at least 9 entries. The entries of the array will be filled with the following information: 1 Seconds (0 - 60) 2 Minutes (0 - 60) 3 Hours (0 - 24) 4 Day of month (1 - 31) 5 Month (0 - 11) 6 Year (starting with 1900) 7 Day of week (0 - 7) 8 Day of Year (0 - 365) 9 Flag for daylight saving time (0 - 1, 1 = daylight saving time) Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getLocalTimeString getLocalTimeString CAPL Function Overview » General » getLocalTimeString Syntax void getLocalTimeString(char timeBuffer[]); 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 The buffer the string will be written in. This buffer must be at least 26 characters long. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • — Example ... char timeBuffer[64]; getLocalTimeString(timeBuffer); // now timeBuffer contains for example. "Fri Aug 21 15:22:24 1998" ... | getLocalTime | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getMessageAttrInt 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). Syntax long GetMessageAttrInt(message canMessage, char attributeName[]); long GetMessageAttrInt(pg parameterGroup, char attributeName[]); Function Gets the value of a message attribute from the database. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetMessageID GetMessageID CAPL Function Overview » General » GetMessageID Syntax dword GetMessageID(char messageName[]) // form 1 dword GetMessageID(char messageName[], char dbName[]) // form 2 Function Finds out the message ID Parameters messageName Name of the message. dbName Name of the database, needed if the message name is used in more than one database. Return values Message ID, or (dword)-1 if the message is not found Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 — • • Example dword id; id = GetMessageID("LightState"); | GetMessageName | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetMessageName GetMessageName CAPL Function Overview » General » GetMessageName Syntax dword GetMessageName( dword id, dword context, char buffer[], dword size) Function Finds out the message name. Parameters id Id of the message for which the message name should be found. context Context of assigned databases. The low word of context contains the channel number. The high word of context contains the bus type. Available bus types: CAN 1 LIN 5 MOST 6 FlexRay 7 BEAN 8 J1708 9 buffer Buffer in which the message name is written. size Size of the buffer in Byte. Return values If successful unequal 0, otherwise 0. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 * Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetMessageName { char buffer[64]; if ( GetMessageName( this.ID, contextCAN | this.CAN, buffer, elcount( buffer))) { write( "Message: %s", buffer); } } | GetFirstCANdbName | GetNextCANdbName | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetNextCANdbName GetNextCANdbName CAPL Function Overview » General » GetNextCANdbName Syntax dword GetNextCANdbName( dword pos, char buffer[], dword size) Function Finds out the names of the other assigned databases with pos. Parameters pos Position number of the database to be found. buffer Buffer in which the database name is written. size Size of the buffer in Byte. Return values If successful unequal 0, otherwise 0. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.0 — • — Example on start { char buffer[256]; dword pos; pos = GetFirstCANdbName( buffer, elcount( buffer)); //Finds the name of the first database. //If a database is found, "pos" contains the value 1. //If none is found "pos" contains 0. 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. write( "Database position number : %d Database name : %s",pos, buffer); } | GetFirstCANdbName | GetMessageName | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: GetOfflineFileName GetOfflineFileName CAPL Function Overview » General » GetOfflineFileName Syntax long GetOfflineFileName(char[] buffer, dword bufferSize) Function Returns the complete path of the currently used offline source file. Parameters buffer Space for the returned string. bufferSize Size of the buffer. Return values 0: If no error 1: If buffer is too small 2: For other errors (e.g. not in offline mode) Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — • — Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getProfileArray getProfileArray CAPL Function Overview » General » getProfileArray Note A filename must be passed to this function. The absolute filename is determined by means of a search procedure. Syntax long getProfileArray(char section[], char entry[],char buff[], long buffsize, char filename[]); 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 Section of the file as a string. entry Variable name as a string. buff Buffer for the read-in numerical values. buffsize Size of buff: Maximum number of read in numerical values (max. 1279 characters). filename File path as a string. Return values Number of numerical values read in. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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. The above mentioned format is sufficiently for 256 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getProfileInt getProfileInt CAPL Function Overview » General » getProfileInt Note A filename must be passed to this function. The absolute filename is determined by means of a search procedure. 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 Section of the file as a string. entry Variable name as a string. def Default value in case of error as an integer. filename File path as a string. Return values Integer that was read in. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getProfileFloat getProfileFloat CAPL Function Overview » General » getProfileFloat Note A filename must be passed to this function. The absolute filename is determined by means of a search procedure. Syntax float getProfileFloat(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 Section of the file as a string. entry Variable name as a string. def Default value in case of error as a float. filename File path as a string. Return values Float that was read in. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getProfileString getProfileString CAPL Function Overview » General » getProfileString Note A filename must be passed to this function. The absolute filename is determined by means of a search procedure. Syntax long getProfileString(char section[], char entry[], char def[], char buff[], long buffsize, char filename[]) 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 Section of the file as a string. entry Variable name as a string. def Default value in case of error as a string. buff Buffer for the read-in character as a string. buffersize Size of buff in bytes. filename File name as a string. Return values Number of characters that were read. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getStartdelay getStartdelay CAPL Function Overview » General » getStartdelay Syntax int 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — — • Example int val; ... // Assign to val the value of the start delay val = getStartdelay(); ... | setStartdelay | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getValue getValue CAPL Function Overview » General » getValue Syntax int getValue(EnvVarName); // form 1 float getValue(EnvVarName); // form 2 long getValue(EnvVarName, char buffer[]); // form 3 long getValue(EnvVarName, byte buffer[]); // form 4 long getValue(EnvVarName, byte buffer[], long offset); // form 5 float getValue(char name[]); // form 6 long getValue(char name[], char buffer[]); // form 7 long getValue(char name[], byte buffer[]); // form 8 long getValue(char name[], byte buffer[], long offset); // form 9 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 With forms 6 to 9 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. EnvVarName Environment variable name buffer Return buffer (form 3, 4 and 5) offset Offset of the first data byte copied (form 5) Return values Form 1 and 2 Active value of the environment variable. Form 3, 4 and 5 Number of bytes copied. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getValue 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getValueSize getValueSize CAPL Function Overview » General » getValueSize Syntax int getValueSize(EnvVarName); int getValueSize(char name[]); // Form 2 Function Returns the size of the environment variable value in bytes. Info Parameters • 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. EnvVarName Environment variable name name Environment variable name Return values Size of the data in bytes. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: gmLanId gmLanId CAPL Function Overview » General » gmLanId Syntax Dword gmLanId (dbMessage aMessage, dword aSourceId) Dword gmLanId (dbMessage aMessage, Node aTxNode) 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 GMLAN message for which a message ID is to be created. aSourceId Source ID of the node to be coded as the transmission node in the message ID. aTxNode Node to be coded as the transmission node in the message ID. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 — — • Example dword gmID = 0; long result = 0; gmID = gmLanId(Comfort::Console_1, 48); waitResult = TestWaitForMessage(gmID, 5000); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: gmLanSetPID, gmLanSetSourceId, gmLanSetPrio, gmLanGetPID, gmLanGetSourceId, gmLanGetPrio gmLanSetPID, gmLanSetSourceId, gmLanSetPrio, gmLanGetPID, gmLanGetSourceId, gmLanGetPrio CAPL Function Overview » General » gmLanSetPID, gmLanSetSourceId, gmLanSetPrio, gmLanGetPID, gmLanGetSourceId, gmLanGetPrio Syntax gmLanSetPID(gmLanMessage msg, long v); gmLanSetSourceId(gmLanMessage msg, long v); gmLanSetPrio(gmLanMessage msg, long v); gmLanGetPID(gmLanMessage msg); gmLanGetSourceId(gmLanMessage msg); gmLanGetPrio(gmLanMessage msg); Function gmLanSetPID sets the parameter ID of the message. gmLanSetSourceId sets the source address of the message. gmLanSetPrio sets the priority of the message. gmLanGetPID gets the parameter ID of the message. gmLanGetSourceId gets the source address of the message. gmLanGetPrio gets the priority of the message. Parameters msg Message v Parameter ID, source address or priority Return values gmLanSetPID, gmLanSetSourceId, gmLanSetPrio: — gmLanGetPID, gmLanGetSourceId, gmLanGetPrio: Parameter ID, source address or priority Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.1 — • • Examples A GMLAN message is modified and sent with output(msg). The parameter ID is set with selector gm_pid. gmLanMessage * msg1 ={SA =0x44, PRIO= 0x7, gm_pid=0x11}; gmLanSetSourceId(msg1,0x55); gmLanSetPID(msg1,0x11); gmLanSetPrio(msg1,0x5); output(msg1); write("pid: 0x%x, source: 0x%x, prio: x%x",gmLanGetPID(msg1),gmLanGetSourceId(msg1),gmLanGetPrio(msg1)); Priority and source address are copied from Battery_Voltage message to the new message Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: gmLanSetPID, gmLanSetSourceId, gmLanSetPrio, gmLanGetPID, gmLanGetSourceId, gmLanGetPrio 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 ... } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: halt halt CAPL Function Overview » General » halt Syntax void 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.1 — — • Example on key 'h' { halt(); // Stops execution of the simulation in Simulation mode } | inspect | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: inspect inspect CAPL Function Overview » General » inspect Syntax void inspect(); Function This function causes an update of the variables displayed on the Inspect side of the Write window. Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.1 — — • Example on key 'i' { inspect(); // Update of the variables displayed on the Inspect side of the Write window } | halt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: InterfaceStatus InterfaceStatus CAPL Function Overview » General » InterfaceStatus Syntax void InterfaceStatus(long time, long channel, long status); 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 Time, resolution 10us channel The channel number status Status of the channel Values: 3015: The connection is lost Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6 — • • Example void InterfaceStatus(long time, { if(status == 3015) { write("Time %f s, channel lost!", ((float)time)/100000.0, } else { //other status is not yet } } long channel, long status) %d: The connection to the interface is channel); supported Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: isStatisticAcquisitionRunning 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. Syntax int isStatisticAcquisitionRunning() 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • — Example tatistical Evaluation (StatisticAcquisition) ... // Tests for running acquisition range and stops it. // If no statistical data acquisition is active a new one is started. if(isStatisticAcquisitionRunning()) { // Stops the running acquisition range stopStatisticAcquisition(); } else { // Starts a new acquisition range startStatisticAcquisition(); }... | startStatisticAcquisition | stopStatisticAcquisition | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: isOfflineMode isOfflineMode CAPL Function Overview » General » isOfflineMode Syntax long isOfflineMode() Function This function is used to get the information if CANoe is in offline mode. Parameters — Return values 1: True, CANoe / CANalyzer is in offline mode. 0: False, CANoe / CANalyzer is in online mode. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP4 — • — Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: isSimulated isSimulated CAPL Function Overview » General » isSimulated Syntax long isSimulated() Function This function is used to get the information if CANoe is in simulated mode. Parameters — Return values 1: True, CANoe is in simulated mode. 0: False, CANoe is in real mode. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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!"); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: isStdId, isExtId isStdId, isExtId CAPL Function Overview » General » isStdId, isExtId Syntax long isStdId(dword id); long isStdId(message m); long isExtId(dword id); long isExtId(message m); Function Checks parameter for extended identifier (29 bit) or standard identifier (11 Bit). Parameters Variable of type message. Id part of a message Return values 1 if check was successful, else 0 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example ... if(isExtId(this)) write("extended identifier"); else write("standard identifier"); or std = isStdId(m100.id); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: isTimerActive isTimerActive CAPL Function Overview » General » isTimerActive Syntax int isTimerActive(timer t) int isTimerActive(mstimer t) Function Return value indicates whether a specific timer is active. This is the case between the call to the setTimer function and the call to the on timer event procedure. Parameters timer or mstimer variable Return values 1, if the timer is active; otherwise 0. 0 is also returned within the on timer event procedure. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 — • • Example timer t; write("Active? %d", isTimerActive(t)); // writes 0 setTimer(t, 5); write("Active? %d", isTimerActive(t)); // writes 1 | setTimer | cancelTimer | timeToElapse | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: keypressed keypressed CAPL Function Overview » General » keypressed Syntax dword 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 — Return values Key code of pressed key. 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). Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 } setTimer (myTimer,0); // start timer running = 1; // memorise of first keypress Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: _Log _Log CAPL Function Overview » General » _Log Syntax double _log(double x) Function Calculates the natural logarithm. Parameters Value of which the logarithm shall be calculated. Return values Logarithm of x (to base e). Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 — • • Example double x; x = _log(1.0); // x == 0.0 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: _Log10 _Log10 CAPL Function Overview » General » _Log10 Syntax double _log10(double x) Function Calculates the logarithm to base 10. Parameters Value of which the logarithm shall be calculated. Return values Logarithm of x (to base 10). Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 — • • Example double x; x = _log10(100.0); // x == 2.0 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ltoa ltoa CAPL Function Overview » General » ltoa Syntax void ltoa(long val, char s[], long base); 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. s String, which contains the converted number. base Number base. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MakeRGB MakeRGB CAPL Function Overview » General » MakeRGB Syntax MakeRGB(long Red, long Green, long Blue); Function Calculates the color value from the three primary color components. Parameters Red Red color component (0 - 255) Green Green color component (0 - 255) Blue Blue color component (0 - 255) Return values Color value (Type: long) Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.1 — • • Example MakeRGB(0, 255, 149); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: _max _max CAPL Function Overview » General » _max Syntax long _max(long x, long y) // Form 1 dword _max(dword x, dword y) // Form 2 int64 _max(int64 x, int64 y) // Form 3 qword _max(qword x, qword y) // Form 4 float _max(float x, float y) // Form 5 Function Returns the maximum of the parameters. Parameters x First operand y Second operand Return values y>x?y:x Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 — • • Example float result; result = _max(1.0, _max(-3.0, 5.2)); // result == 5.2 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MessageTimeNS MessageTimeNS CAPL Function Overview » General » MessageTimeNS Syntax float MessageTimeNS(message msg); float MessageTimeNS(linmessage msg); float MessageTimeNS(mostMessage msg); float MessageTimeNS(mostAmsMessage msg); float MessageTimeNS(mostRawMessage msg); Function Returns the time stamp in nanoseconds. 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 mostMessage, mostAmsMessage, mostRawMessage MOST message Return values Time stamp of the message in ns Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 — • • Example — | MessageTimeNS (FlexRay) | EnvVarTimeNS | timeNowNS | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: _min _min CAPL Function Overview » General » _min Syntax long _min(long x, long y) // Form 1 dword _min(dword x, dword y) // Form 2 int64 _min(int64 x, int64 y) // Form 3 qword _min(qword x, qword y) // Form 4 float _min(float x, float y) // Form 5 Function Returns the minimum of the parameters. Parameters x First operand y Second operand Return values y<x?y:x Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 — • • Example float result; result = _min(1.0, _min(-3.0, 5.2)); // result == -3.0 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mkExtId mkExtId CAPL Function Overview » General » mkExtId Syntax dword mkExtId(dword id); Function Returns an extended id. Parameters Id part of a message. Return values Extended identifier Example ... msg.id = mkExtId(this.id); ... Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: msgBeep 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! Syntax void msgBeep (long soundType) Function The msgBeep function plays back a sound predefined by the Windows system. It replaces the previous beep function. Parameters soundType Integer for the predefined sound. Specifically these are: 0 MB_ICONASTERISK SystemAsterisk 1 MB_ICONEXCLAMATION SystemExclamation 2 MB_ICONHAND SystemHand 3 MB_ICONQUESTION SystemQuestion 4 MB_OK SystemDefault 5 Standard beep using the PC speaker (default) Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example void sound() { // Standard signal question msgBeep (3); } | write | writeToLog | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Open Open CAPL Function Overview » General » Open Note A filename must be passed to this function. The absolute filename is determined by means of a search procedure. First a search is made to determine whether the given file is located in a directory of the databases. If the desired file is not found the active configuration directory is used. Syntax file(char [] filename, dword access, dword mode) Method file.open(char [] filename, dword access, dword mode) Function This function opens the file named filename. If access = 0, the file is opened for write access; if access = 1 the file is opened for read access. If mode = 0 the file is opened in ASCII mode; if mode = 1 the file is opened in binary mode. Parameters filename The name of the file access 0 for write access, 1 for read access mode 0 for ASCII mode, 1 for binary mode Return values — (constructor) Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 CAN • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: openFileRead openFileRead CAPL Function Overview » General » openFileRead Note A filename must be passed to this function. The absolute filename is determined by means of a search procedure. First a search is made to determine whether the given file is located in a directory of the databases. If the desired file is not found the active configuration directory is used. Syntax dword openFileRead (char filename[], dword mode); Function This function opens the file named filename for the read access. If mode=0 the file is opened in ASCII mode; if mode=1 the file is opened in binary mode. Parameters filename file name mode Return values The return value is the file handle that must be used for read operations. If an error occurs, the return value is 0. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: openFileWrite 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. Syntax dword openFileWrite (char filename[], dword mode); Function This function opens the file named filename for the write access. If mode=0 writing can be executed in ASCII mode; if mode=1 writing can be executed in binary mode. An already existing file will be overwritten. 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. If an error occurs, the return value is 0. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: openPanel 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. Syntax void openPanel(char panelName[]); Function Opens a panel. The panel is accessed by its individual panel name that is entered in the Panel Designer/Panel Editor. Parameters panelName Panel name Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 — • • Example — | closePanel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: output output CAPL Function Overview » General » output Syntax void output(message msg); void output(errorFrame); Function Outputs a message or an error frame from the program block. Parameters Variable of type message or errorFrame. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: _pow _pow CAPL Function Overview » General » _pow Syntax double _pow(double x, double y); Function Returns x to the power of y. Parameters x – base y – exponent Return values x to the power of y. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — • • Example double result; result = _pow(2.0, 3.0); // result == 8.0 result = _pow(4.0, 0.5); // result == 2.0 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: putValue putValue CAPL Function Overview » General » putValue Syntax void putValue(EnvVarName, int val); // form 1 void putValue(EnvVarName, float val); // form 2 void putValue(EnvVarName, char val[]); // form 3 void putValue(EnvVarName, byte val[]); // form 4 void putValue(EnvVarName, byte val[], long vSize); // form 5 void putValue(char name[], int val); // form 6 void putValue(char name[], float val); // form 7 void putValue(char name[], char val[]); // form 8 void putValue(char name[], byte val[]); // form 9 void putValue(char name[], byte val[], long vSize); // form 10 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 With forms 6 to 10 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. EnvVarName Environment variable name (form 1-5) name Environment variable name (form 6-10) 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example byte dataBuf[64]; ... // Assign the value 0 to environment variable Switch Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: putValue 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: putValueToControl putValueToControl CAPL Function Overview » General » putValueToControl Syntax Value & String Output void putValueToControl(char panel[], char control[], float val); void putValueToControl(char panel[], char control[], float val, long paragraph); 1 void putValueToControl(char panel[], char control[], long val); void putValueToControl(char panel[], char control[], long val, long paragraph);1 void putValueToControl(char panel[], char control[], long val, long paragraph, long dispHex);1 void putValueToControl(char panel[], char control[], char val[]); Message Output void putValueToControl(char panel[], char control[], message val); void putValueToControl(char panel[], char control[], message val, long paragraph);1 void putValueToControl(char panel[], char control[], message val, long paragraph, long dispHex);1 PG Output void putValueToControl(char panel[], char control[], pg val); void putValueToControl(char panel[], char control[], pg val, long paragraph);1 void putValueToControl(char panel[], char control[], pg val, long paragraph, long dispHex);1 LIN Message Output void putValueToControl(char panel[], char control[], linMessage val); void putValueToControl(char panel[], char control[], linMessage val, long paragraph);1 void putValueToControl(char panel[], char control[], linMessage val, long paragraph, long dispHex);1 MOST Message Output void putValueToControl(char panel[], char control[], mostMessage val); void putValueToControl(char panel[], char control[], mostMessage val, long paragraph);1 void putValueToControl(char panel[], char control[], mostMessage val, 1 This function requires CANoe 7.5 and higher. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: putValueToControl long paragraph, long dispHex);1 MOST Raw Message Output void putValueToControl(char panel[], char control[], mostRawMessage val); void putValueToControl(char panel[], char control[], mostRawMessage val, long paragraph);1 void putValueToControl(char panel[], char control[], mostRawMessage val, long paragraph, long dispHex);1 GMLAN Message Output void putValueToControl(char panel[], char control[], gmLanMessage val); void putValueToControl(char panel[], char control[], gmLanMessage val, long paragraph);1 void putValueToControl(char panel[], char control[], gmLanMessage val, long paragraph, long dispHex);1 BEAN Message Output void putValueToControl(char panel[], char control[], beanMessage val); void putValueToControl(char panel[], char control[], beanMessage val, long paragraph);1 void putValueToControl(char panel[], char control[], beanMessage val, long paragraph, long dispHex);1 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 Using a Multi Display Control/CAPL Output View, no environment variable is necessary. Parameters panel Title of the panel. control Name of the control. val Value to be displayed. paragraph Indicates if the output shall be written to a new line. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: putValueToControl Info This parameter is only available with the CAPL Output View. Parameter Values Description 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. 1 In this case, the output is written to a new line. dispHex Indicates if the output is formatted hexadecimal. Info • This parameter is only available with the CAPL Output View. • The physical value of a signal cannot be displayed in hexadecimal format. Then the setting is not considered and will be ignored. Only the raw value of a signal can be formatted hexadecimal. Parameter Values Description 0 In this case, the signal/message/value is written in decimal notation. 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. 1 In this case, the signal/message/value is written in hexadecimal notation. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 — • • 7.5: 1 CAPL Output View • • Example: Output of a string, a message, a signal - no additional function parameters used variables { int value; message EngineData mEngineData; } on envVar EnvShowMultiDisplay { Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: putValueToControl 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; } } Example: Output of a message — optional with function parameters variables { ...message MyMessage TestMsg; } 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); } Example: Output of a signal (raw format) — optional with function parameters variables { ...message MyMessage TestMsg; } 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); //Output of a signal (raw), each time in a new paragraph. putValueToControl("TestPanel","ControlOutput1", TestMsg.Signal1, 1); //Output of a signal (raw), each time in a new paragraph and in hexadecimal notation. putValueToControl("TestPanel","ControlOutput1", TestMsg.Signal1, 1, 1); } Example: Output of a signal (physical format) — optional with function parameters variables { ...message MyMessage TestMsg; } 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); //Output of a signal (physical), each time in a new paragraph. putValueToControl("TestPanel","ControlOutput1", TestMsg.Signal1.phys, 1); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: putValueToControl } | putValue | getValue | getValueSize | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: random random CAPL Function Overview » General » random Syntax dword random(dword x); Function Calculates a random number between 0 and x-1. Parameters Determines the interval. Return values Random number between 0 and x-1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example dword x; // generate random number in the interval [0;100[ x = random(100); | runError | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ReplayResume ReplayResume CAPL Function Overview » General » ReplayResume Syntax dword ReplayResume (char pName[]) Function Starts the Replay block with the name pName after it is suspended by ReplaySuspend. Parameters pName Name of the Replay block. Return values 1: If successful 0: If the Replay block does not exist or cannot be restarted Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ReplayStart ReplayStart CAPL Function Overview » General » ReplayStart Syntax dword ReplayStart (char pName[]) Function Starts the Replay block with the name pName. Parameters pName Name of the Replay block. Return values 1: If successful 0: If the Replay block does not exist or cannot be restarted Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ReplayState ReplayState CAPL Function Overview » General » ReplayState Syntax dword ReplayState (char pName[]) Function Returns the state of the Replay block with the name pName. Parameters pName Name of the Replay block Return values 0: Replay Block is stopped (state: stopped) 1: Execution of the Replay file was started (state: running) 2: Execution of the Replay file was stopped (state: suspended) (dword)-1: when the Replay block does not exist Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ReplayStop ReplayStop CAPL Function Overview » General » ReplayStop Syntax dword ReplayStop (char pName[]) Function Stops the Replay block with the name pName. Parameters pName Name of the Replay block. Return values 1: If successful 0: If the Replay block does not exist or cannot be restarted Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ReplaySuspend ReplaySuspend CAPL Function Overview » General » ReplaySuspend Syntax dword ReplaySuspend (char pName[]) Function Suspends the Replay block with the name pName. Parameters pName Name of the Replay block Return values 1: If successful 0: If the Replay block does not exist or cannot be restarted Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: resetCan resetCan CAPL Function Overview » General » resetCan Syntax void 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — — • Example on key 'r' { // Controller is reset after BUSOFF resetCan(); } | setOcr | setBtr | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ResetCanEx ResetCanEx CAPL Function Overview » General » ResetCanEx Syntax void ResetCanEx(long channel); 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.1 — • • Example on key 'r' { // After BUSOFF the controller on Channel 2 is reset resetCanEx(2); } | resetCan | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: _round _round CAPL Function Overview » General » _round Syntax long _round(double x); int64 _round64(double x); Function Rounds x to the nearest integral number. The rounding method used is symmetric arithmetic rounding. Parameters x Number to be rounded Return values Nearest integral number. For very large numbers, you should use _round64, which returns a 64 bit integer. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — • • Example long result; result = _round(2.4); // result == 2 result = _round(2.5); // result == 3 result = _round(-3.5); // result == -4 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: runError runError CAPL Function Overview » General » runError Syntax void runError(long err, long); 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example ... if(rpm < 0) runError(1001,1); ... | elCount | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ScanBaudrateActive ScanBaudrateActive CAPL Function Overview » General » ScanBaudrateActive Note This function is only available with CANcardXL, CANcaseXL and CANboardXL. 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. Syntax long ScanBaudrateActive( DWORD channel, DWORD messageID, double firstBaudrate, double lastBaudrate, DWORD timeout); 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 CAN.ini file settings for the baudrate scanner: [BaudrateScanner] Dlc=8 DisplayBaudrateList=0 Dlc: DLC of the message sent by the scanner. 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 Channel number. (1,..,32) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ScanBaudrateActive messageID ID of the message that the scanner will send to detect the baudrate. The DLC of the message is always 8. firstBaudrate / lastBaudrate Baud rate range to scan. • 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 nonzero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 — — • Example — | ScanBaudratePassive | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ScanBaudratePassive ScanBaudratePassive CAPL Function Overview » General » ScanBaudratePassive Note This function is only available with CANcardXL, CANcaseXL and CANboardXL. 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. Syntax long ScanBaudratePassive( DWORD channel, DWORD messageID, double firstBaudrate, double lastBaudrate, DWORD timeout, DWORD bAcknowledge); 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 CAN.ini file settings for the baudrate scanner: [BaudrateScanner] Dlc=8 DisplayBaudrateList=0 Dlc: DLC of the message sent by the scanner. 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 Channel number. (1,..,32) messageID Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ScanBaudratePassive 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 Baudrate range to scan. • 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 Acknowledge mode on (1)/off (0). 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 nonzero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 — — • Example — | ScanBaudrateActive | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setBtr setBtr CAPL Function Overview » General » setBtr Syntax long setBtr(long channel, byte btr0, byte btr1); 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. Parameters CAN channel 0 Both controllers 1 channel 1 2 channel 2 BTR0 Value of Bit Timing Register 0. BTR1 Value of Bit Timing Register 1. Return values Always 1 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — — • Example ... setBtr(0, 0x00, 0x3a); // 500 kBaud for 82C200 resetCan(); // aktivate ... | resetCan | setOcr | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetBusContext 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. You should use the functions GetBusNameContext, GetBusContext and SetBusContext to determine the context of a bus, to query the current bus context, or to change the context. Syntax dword SetBusContext( dword context) Function Sets the bus context of the CAPL block. Parameters context The new bus context to be set. Return values The bus context that was valid before the call was made is returned. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 — — • Example This is an example for a simulation node. Test nodes should copy the bus context to a CAPL variable in the Main() function because all global variables are cleared when the test module is started. variables { dword ibus_context = 0; dword motbus_context = 0; } on preStart { ibus_context = GetBusNameContext( "ibus"); motbus_context = GetBusNameContext( "motbus"); } void apCanOn() { dword context; // activate the CAN channel on the "current" context CanOnline(); // determine the "other" context context = ibus_context == GetBusContext() ? motbus_context : ibus_context; // set the context to the "other" bus... Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetBusContext SetBusContext( context); // ...and activate its CAN chip as well CanOnline(); } | GetBusNameContext | GetBusContext | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setCanCabsMode setCanCabsMode CAPL Function Overview » General » setCanCabsMode Syntax long setCanCabsMode(long ntype,long nchannel,long nmode,long nflags); Function Various CANcabs modes may be set. Replaces the setPortBits functions. Parameters ntype Unused, must be set to 0 nchannel CAN channel nmode Is used for the control of the board lines via a bit pattern. Mode, valid values: 0 NORMAL 1 SLEEP 2 HIVOLTAGE 3 HISPEED 4 DUAL_WIRE 5 SINGLE_WIRE_LOW 6 SINGLE_WIRE_HIGH 7 is reserved For CANcab Eva two output lines can be set. nMode Line 2 Line 1 8 0 0 9 0 1 10 1 0 11 1 1 Example Call the function with ntype = 0, nchannel = 1, nMode = 11, nflags = 0 setCanCabsMode(0,1,11,0); // sets both lines to 1 nflags Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setCanCabsMode Is used for the control of the board lines via a bit pattern. Flag, valid values: 0x01 AUTOWAKEUP, only together with SLEEP 0x02 HIGHPRIO, only CANcab 5790 c, 1=clear tx-buffers Info Flags can be ORed, e.g. 0x03 = AUTOWAKE+HIGHPRIO Info Not all mode and flag values are valid for all CANcabs! (see also the hardware description for CANcabs) Return values 0: ok !=0: Error Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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"); } | setPortBits - Single Wire | setPortBits - Lowspeed | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetClockControlTime SetClockControlTime CAPL Function Overview » General » SetClockControlTime Syntax void SetClockControlTime(char[] panel, char[] control, int hours, int minutes, int seconds); void SetClockControlTime(char[] panel, char[] control, int time); 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 Panel name ("" – references all opened panels) 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. The form for signals is: "Signal:<signal name>". The form for environment variables is: "EnvVar:<environment variable name>". The form for system variables is: "SysVar:<name of system variable>". The name space must not be used. Info • Symbol assignment must not be case sensitive. • If you want to access all elements of a panel the notation "" is used, see example below. 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 Defines the hours of the time to be displayed in the clock control. minutes Defines the minutes of the time to be displayed in the clock control. seconds Defines the seconds of the time to be displayed in the clock control. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetClockControlTime 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 Clock Control • • Example // Set the time in hours, minutes, seconds. It will be displayed '10:20:30'. on key 'a' { SetClockControlTime("ClockControl1", "ClockCAPL", 10, 20, 30); } // Set the time in seconds. It will be displayed '01:00:00'. on key 'b' { SetClockControlTime("ClockControl1", "ClockCAPL", 3600); } | SetControlProperty | SetControlForeColor | SetControlBackColor | SetDefaultControlColors | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetControlBackColor SetControlBackColor CAPL Function Overview » General » SetControlBackColor Syntax void SetControlBackColor(char[] panel, char[] control, long color); Function Sets the background color of panel elements. The panel is accessed by its individual panel name that is entered in the Panel Designer / Panel Editor. Parameters panel Panel name ("" – references all opened 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. The form for signals is: "Signal:<signal name>". The form for environment variables is: "EnvVar:<environment variable name>". The form for system variables is: "SysVar:<name of system variable>". The name space must not be used. Info • Symbol assignment must not be case sensitive. • If you want to access all elements of a panel the notation "" is used, see example below. 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) Info for 'CAPL Output View' Control 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 Color value (e.g. calculated by MakeRGB) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetControlBackColor Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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)); | SetControlProperty | SetControlForeColor | SetControlColors | SetDefaultControlColors | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetControlColors SetControlColors CAPL Function Overview » General » SetControlColors Syntax void SetControlColors(char[] panel, char[] control, long backcolor, long textcolor); Function Sets the background and text color of panel elements. The panel is accessed by its individual panel name that is entered in the Panel Designer. Parameters panel Panel name ("" – references all opened 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. The form for signals is: "Signal:<signal name>". The form for environment variables is: "EnvVar:<environment variable name>". The form for system variables is: "SysVar:<name of system variable>". The name space must not be used. Info • Symbol assignment must not be case sensitive. • If you want to access all elements of a panel the notation "" is used, see example below. 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) Info for 'CAPL Output View' Control 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 Color value (e.g. calculated by MakeRGB) textcolor Color value (e.g. calculated by MakeRGB) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetControlColors Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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)); | SetControlProperty | SetControlForeColor | SetControlBackColor | SetDefaultControlColors | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetControlForeColor SetControlForeColor CAPL Function Overview » General » SetControlForeColor Syntax void SetControlForeColor(char[] panel, char[] control, long color); Function Sets the foreground color of panel elements. The panel is accessed by its individual panel name that is entered in the Panel Designer / Panel Editor. Parameters panel Panel name ("" – references all opened 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. The form for signals is: "Signal:<signal name>". The form for environment variables is: "EnvVar:<environment variable name>". The form for system variables is: "SysVar:<name of system variable>". The name space must not be used. Info • Symbol assignment must not be case sensitive. • If you want to access all elements of a panel the notation "" is used, see example below. 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) Info for 'CAPL Output View' Control 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 Color value (e.g. calculated by MakeRGB) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetControlForeColor Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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)); | SetControlBackColor | SetControlProperty | SetControlColors | SetDefaultControlColors | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetControlProperty SetControlProperty CAPL Function Overview » General » SetControlProperty Syntax void SetControlProperty(char[] panel, char[] control, char[] property, long value); void SetControlProperty(char[] panel, char[] control, char[] property, float value); void SetControlProperty(char[] panel, char[] control, char[] property, char[] value); Function Sets a property of an ActiveX control. The panel is accessed by its individual panel name that is entered in the Panel Editor. It is easier to access color properties by MakeRGB. Parameters panel Panel name ("" – references all opened panels) control Name of the panel element ("" – references all elements on the panel) property Name of the property value Value to be set (long, float or string value) Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.1 — • • Example SetControlProperty("Measurements", "StatusIndicator", "Caption", "running"); SetControlProperty("Measurements", "StatusIndicator", "BackColor", MakeRGB(0,145,255)); | SetControlBackColor | SetControlForeColor | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetDefaultControlColors SetDefaultControlColors CAPL Function Overview » General » SetDefaultControlColors Syntax void SetDefaultControlColors(char[] panel, char[] control); 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 Panel name ("" – references all opened 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. The form for signals is: "Signal:<signal name>". The form for environment variables is: "EnvVar:<environment variable name>". The form for system variables is: "SysVar:<name of system variable>". The name space must not be used. Info • Symbol assignment must not be case sensitive. • If you want to access all elements of a panel the notation "" is used, see example below. 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) Info for 'CAPLOutputView' Control 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 — • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetDefaultControlColors 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("", ""); | SetControlProperty | SetControlForeColor | SetControlBackColor | SetControlColors | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setDrift setDrift CAPL Function Overview » General » setDrift Syntax void setDrift(int drift) 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 Setting of a Drift causes any existing Jitter to be reset. Parameters drift Integer for the constant deviation. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — — • Example ... // Sets the Drift to 35.5 percent setDrift(3550); ... | setJitter | getDrift | getJitterMin | getJitterMax | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setFilePath setFilePath CAPL Function Overview » General » setFilePath Info This function is not available in case of a distributed environment. Syntax void setFilePath (char Path[],dword mode); 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 0 Sets path for read functions 1 Sets path for write functions (same as setWritePath) 2 Sets path for both types of functions Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 = Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setFilePath 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setJitter setJitter CAPL Function Overview » General » setJitter Syntax setJitter(int min, int max) 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 Integer for the lower interval limit. max Integer for the upper interval limit. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); ... | getJitterMax | getJitterMin | setDrift | getDrift | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setLogFileName setLogFileName CAPL Function Overview » General » setLogFileName Syntax setLogFileName(char fileName[]); setLogFileName(char strLoggingBlockName[], char fileName[]); Function Sets the name of the logfile. 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 Within a string literal a second backslash has to be set (see example). 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 Name of the logging block. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • — 7.6 SP3: form 2 — • • 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"); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setLogFileName ... Sets the absolute path of the logging file. ... setLogFileName("Logging1", "..\\Logging\\newlog"); ... Sets the relative path of the logging file. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetMediaFile SetMediaFile CAPL Function Overview » General » SetMediaFile Syntax SetMediaFile(panel, control, mediafile); 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 Panel name ("" – references all opened panels) control Name of the panel element ("" – references all controls on the panel) mediafile Path and name of the media file. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 Media Player • • Example Setting media file using absolute path. on key 'x' { SetMediaFile("Movie", "Media Player", "D:\\Example\\MediaPlayerProject\\Videos\\song.mpg"); } 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setOcr setOcr CAPL Function Overview » General » setOcr Syntax setOcr(long channel, byte ocr); 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. Parameters CAN channel 0 all channels >0 only the given channel OCR Value of the Output Control Register Return values 1: success 0: error Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — — • Example ... setOcr(0, 0x02); // set resetCan(); // activate ... | resetCan | setBtr | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SetPictureBoxImage SetPictureBoxImage CAPL Function Overview » General » SetPictureBoxImage Syntax setPictureBoxImage(panel, control, imagefile); 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 Panel name ("" – references all opened panels) control Name of the panel element ("" – references all controls on the panel) iamgefile Path and name of the image file. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 Picture Box • • Example Setting image file using absolute path. on key 'x' { SetPictureBoxImage("Movie", "Picture Box", "D:\\Example\\PictureBoxProject\\Images\\Picture.bmp"); } 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setPostTrigger setPostTrigger CAPL Function Overview » General » setPostTrigger Syntax setPostTrigger(long preTriggerTime); 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. Parameters New posttrigger value in milliseconds. If a value of -1 is supplied, the prosttrigger will be set to infinity. Return values 1, if the posttrigger is set to the given value, 0 else. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setPreTrigger setPreTrigger CAPL Function Overview » General » setPreTrigger Syntax setPreTrigger(long preTriggerTime); 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. Parameters New pretrigger value in milliseconds. Return values 1, if the pretrigger is set to the given value, 0 else. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • — Example ... setPreTrigger(25); ... Set the pretrigger time of the logging to 25 milliseconds. | setPostTrigger | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setSignalStartValues setSignalStartValues CAPL Function Overview » General » setSignalStartValues Syntax setSignalStartValues(message msg) // Form 1 setSignalStartValues(multiplexed_message msg) // Form 2 setSignalStartValues(frFrame frame) // Form 3 setSignalStartValues(frFrame frame, byte uninitializedData) // Form 4 setSignalStartValues(frPDU pdu) // Form 5 setSignalStartValues(frPDU pdu, byte uninitializedData) // Form 6 setSignalStartValues(pg paramGroup) // Form 7 setSignalStartValues(j1587Param param) // Form 8 setSignalStartValues(linmessage msg) // Form 9 Function Sets the values of the signals in the parameter to the start values defined in the database. Parameters msg, frame, pdu, paramGroup, parameter Objects where the signals shall be set. uninitializedData (Form 4, Form 6) Value to which the bytes in the frame / PDU shall be set which are not used by signals. Return values 0: function was successful 1: message / frame / PDU / paramGroup wasn't found in the database 2: at least one signal start value didn't fit into the signal in the message Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 — • • Example message LightState msg; setSignalStartValues(msg); | StartLogging | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setStartdelay setStartdelay CAPL Function Overview » General » setStartdelay Syntax void setStartdelay(int delay) 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — — • Example ... on preStart { // Set Start Delay to 10 seconds setStartdelay(10000); } | getStartdelay | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setTimer setTimer CAPL Function Overview » General » setTimer Syntax void setTimer(msTimer t, long duration); void setTimer(timer t, long duration); (Type 1) void setTimer(timer t, long durationSec, long durationNanoSec); (Type 2) Info Method • The precision of timers in CAPL depends on the hardware used (generally one millisecond). Nevertheless the event procedures (on message, on timer, ...) are processed in the correct sequence, i.e. for analysis purposes (e.g. timeout monitoring) the event's time stamp can be used instead of the clock signal generated by the hardware. • The maximum of msTimer is: 2147483647 ms = 2147483,647 s = 596,52h. The maximum of timer (Type 1) is: 2147483647 s = 596523.23h. The maximum of timer (Type 2) is: 2147483647 s + 2147483647ns ~2147483649s. t.set(long duration); t.set(long duration, long durationNanoSec); Function Sets a timer. Parameters Timer or msTimer variable and an expression which specifies the duration of the timer. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • 7.0 SP5: methods — • • 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 } | cancelTimer | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setTimerCyclic setTimerCyclic CAPL Function Overview » General » setTimerCyclic Syntax void setTimerCyclic(msTimer t, long firstDuration, long period) // Form 1 void setTimerCyclic(msTimer t, long period) // Form 2 Function Sets a cyclical timer. With form 2, firstDuration is implicitly the same as period, i.e. the timer runs precisely according to period the first time. Parameters t The timer to be set. firstDuration Time in milliseconds until the timer runs out for the first time. period Time in milliseconds in which the timer is restarted in case of expiration. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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) } | cancelTimer | setTimer | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setWriteDbgLevel setWriteDbgLevel CAPL Function Overview » General » setWriteDbgLevel Syntax void setWriteDbgLevel (unsigned int priority); Function This function sets the priority level for the writeDbgLevel CAPL function. The output priority must be set for every network node. Parameters priority Priority of current CAPL node for output to the Write window. Rays for priority: 0 to 15 0 Only write output with a priority of 0 are shown in the write window. 5 Write output with a priority ranging from 0 to 5 are shown. 15 All outputs are shown. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: setWritePath setWritePath CAPL Function Overview » General » setWritePath Note This function is not available in case of a distributed environment. After drive letters and also between folders you have to enter two "\" e.g. setWritePath("E:\\testconfiguration\\exercise"). Syntax void setWritePath (char relativeOrAbsolutePath[]); 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. Parameters The file path as a string. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example SetWritePath("C:\\TEMP")– after the drive letter (e.g. "C:") you have to enter two backslashes "\\"! | setFilePath | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: sin sin CAPL Function Overview » General » sin Syntax double sin(double x); Function Calculates sine of x. Parameters Value in radians whose sine is to be calculated. Return values Sine of x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example double x; x = sin(PI); // Result 0 | cos | exp | sqrt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: snprintf snprintf CAPL Function Overview » General » snprintf Syntax long snprintf(char dest[], long len, char format[], ...); 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 CAPL supports a function call with maximum 9 parameters. Parameters dest Character buffer to print to. len Maximum number of characters printed to buffer. format Formatted string printed to buffer. Return values The number of characters written. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: sqrt sqrt CAPL Function Overview » General » sqrt Syntax double sqrt(double x); Function Calculates the square root. Parameters Value whose square root is to be calculated. Return values Square root of x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example double x; x = sqrt(4.0); // Result 2.0 | cos | exp | sin | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StandaloneConfigOpen StandaloneConfigOpen CAPL Function Overview » General » StandaloneConfigOpen Syntax DWORD StandaloneConfigOpen(CHAR rtcfgFileName[], DWORD stopCurrentMeasurement, DWORD startNewMeasurement, DWORD returnToActiveConfig) Function Opens the rtcfg file with the given name as standalone configuration. Parameters • 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. 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 If this parameter is set to 1 the default configuration (usually a sort of “master configuration”) will be loaded automatically after measurement based on the new configuration will have been stopped. Return values The function returns an error code with 0 representing successful operation. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6 SP3 Standalone mode — • 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StandaloneConfigOpen | StandaloneConfigSetDefault | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StandaloneConfigSetDefault StandaloneConfigSetDefault CAPL Function Overview » General » StandaloneConfigSetDefault Syntax DWORD StandaloneConfigSetDefault(CHAR rtcfgFileName[]) 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. Parameters • 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. rtcfgFileName Name of the standalone configuration file (without path) to be set as default configuration file. Return values The function returns an error code with 0 representing successful operation. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6 SP3 Standalone mode — • Example — | StandaloneConfigOpen | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: startStatisticAcquisition 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. Syntax void startStatisticAcquisition() 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • — Example Statistical Evaluation (StatisticAcquisition) ... // Tests for running acquisition range and stops it. // If no statistical data acquisition is active a new one is started. if(isStatisticAcquisitionRunning()) { // Stops the running acquisition range stopStatisticAcquisition(); } else { // Starts a new acquisition range startStatisticAcquisition(); } ... | isStatisticAcquisitionRunning | stopStatisticAcquisition | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StartLogging StartLogging CAPL Function Overview » General » StartLogging Syntax void startLogging(); void startLogging(char strLoggingBlockName[]); void startLogging(char strLoggingBlockName[], long preTriggerTime); 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. Function also sets a pre-trigger time to a value of the preTriggerTime. Parameters strLoggingBlockName Name of the logging block. preTriggerTime Pre-trigger time interval in ms. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StartMacroFile 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. Syntax dword StartMacroFile(char fileName[]); 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StartReplayFile 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. Syntax dword StartReplayFile(char fileName[]); 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: stop stop CAPL Function Overview » General » stop Syntax void stop(); Function Programmed interrupt of the ongoing measurement. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example ... if( isExtId(this) ) stop(); ... | trigger | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: stopStatisticAcquisition 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. Syntax void stopStatisticAcquisition() 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • — Example Statistical Evaluation (StatisticAcquisition) ... // Tests for running acquisition range and stops it. // If no statistical data acquisition is active a new one is started. if(isStatisticAcquisitionRunning()) { // Stops the running acquisition range stopStatisticAcquisition(); } else { // Starts a new acquisition range startStatisticAcquisition(); } ... | isStatisticAcquisitionRunning | startStatisticAcquisition | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StopLogging StopLogging CAPL Function Overview » General » StopLogging Syntax void stopLogging(); void stopLogging(char strLoggingBlockName[]); void stopLogging(char strLoggingBlockName[], long postTriggerTime); 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. Functions also sets a post-trigger time to a value of the postTriggerTime. Parameters strLoggingBlockName Name of the logging block. postTriggerTime Post-trigger time interval in ms. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StopMacroFile StopMacroFile CAPL Function Overview » General » StopMacroFile Syntax void StopMacroFile(dword handle); Function Stops the macro from playing with the handle handle. Parameters handle Handle of the started macro. The handle is returned from the StartMacroFile function when starting the macro. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StopReplayFile StopReplayFile CAPL Function Overview » General » StopReplayFile Syntax void StopReplayFile(dword handle); Function Stops the replay file from playing with the handle handle. Parameters handle Handle of the started replay file. The handle is returned from the StartReplayFile function when starting the reply file. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: strlen strlen CAPL Function Overview » General » strlen Syntax long strlen(char s[]); Function The functional result is the length of the string s. Parameters string Return values Length of the string. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example long length; char buffer[100] = "CANalyzer"; length = strlen(buffer); Result: length = 9 | strncat | strncmp | strncpy | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: str_match_regex str_match_regex CAPL Function Overview » General » str_match_regex Syntax long str_match_regex(char s[], char pattern[]) Function Checks whether a string completely matches a regular expression pattern. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | str_replace | str_replace_regex | strstr_regex | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: strncat strncat CAPL Function Overview » General » strncat Syntax void strncat(char dest[], char src[], long len); 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 Unlike the strncat C-function, rather than the number of characters to be appended, len indicates the maximum length of the composite string, including the terminating "\0". Parameters dest Target string to which characters are appended. src Appended string. len Maximum length of composite string. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example char s[20]; strncpy(s, "Vector", strncat(s, " CANoe", strncpy(s, "Vector", strncat(s, " CANoe", 10); 19); 10); 11); // // // // s s s s is is is is "Vector" "Vector CANoe" "Vector" "Vector CAN" | strlen | strncmp | strncpy | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: strncmp strncmp CAPL Function Overview » General » strncmp Syntax long strncmp(char s1[], char s2[], long len); long strncmp(char s1[], char s2[], long s2offset, long len) Function This function compares s1 with s2 for a maximum of len characters. If they are identical the functional result is 0. If s1 is less than s2 the result is -1, else +1. Form 2 starts the comparison in s2 at the specified offset. Parameters s1 First string s2 Second string s2offset Offset in s2 len Maximum number of characters to compare Return values -1 if s1 is less than s2. 1 if s2 is less than s1. 0 if the strings are equal. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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"); } | strlen | strncat | strncpy | strncmp_off | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: strncmp_off strncmp_off CAPL Function Overview » General » strncmp_off Syntax long strncmp_off(char s1[], long s1offset, char s2[], long s2offset, long len); Function This function compares s1 with s2 for a maximum of len characters. If they are identical the functional result is 0. If s1 is less than s2 the result is -1, else +1. Comparison starts in s1 at s1offset and in s2 at s2offset. Parameters s1 First string s1offset Offset in s1 s2 Second string s2offset Offset in s2 len Maximum number of characters to compare Return values -1 if s1 is less than s2. 1 if s2 is less than s1. 0 if the strings are equal. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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!"); | strlen | strncat | strncpy | strncmp | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: strncpy strncpy CAPL Function Overview » General » strncpy Syntax void strncpy(char dest[], char src[], long len); 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 Maximum number of characters in src and dest Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example variables { char s1[7] = "Vector"; char s2 [32]; } on key 'z' { strncpy (s2,s1,elcount(s2)); write ("Result: %s",s2); } Output to the Write-Window: Result: Vector | strlen | strncat | strncmp | strncpy_off | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: strncpy_off 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-1destOffset characters are copied. Characters are overwritten in dest starting at destOffset. Parameters dest Destination buffer destOffset Offset in destination buffer src Source string max Maximum number of characters in src and dest Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — • • Example char s[6] = "Hallo"; strncpy_off(s, 1, "e", elcount(s)); // s: He | strlen | strncat | strncmp | strncpy | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: str_replace str_replace CAPL Function Overview » General » str_replace Syntax long str_replace(char s[], char searched[], char replacement[]) // form 1 long str_replace(char s[], long startoffset, char replacement[], long length) // form 2 Function Form 1: Replaces all occurrences of a text in a string with another string. Form 2: Replaces a part of a string with another string. Parameters s String to be modified. searched Text which shall be replaced. startoffset Offset at which to start replacing characters. replacement Text which replaces the original characters. length Maximum number of characters to replace. Return values 1 if successful, 0 if the resulting string would be too long for the buffer s. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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_match_regex | str_replace_regex | strstr_regex | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: str_replace_regex str_replace_regex CAPL Function Overview » General » str_replace_regex Syntax long str_replace_regex(char s[], char pattern[], char replacement[]) Function Replaces all occurrences of pattern in a string with another string. 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 Replacement for the parts which match the pattern. Return values 1 if successful, 0 if the resulting string would be too long for the buffer s. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 SP2 — • • Example char buffer[70] = "Vector Informatik"; str_replace_regex(buffer, "Inf[a-z]*", "CANoe"); write(buffer); | str_match_regex | str_replace | strstr_regex | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: strstr, strstr_off strstr, strstr_off CAPL Function Overview » General » strstr, strstr_off Syntax long strstr(char s1[], char s2[]); long strstr_off(char s1[], long offset, char s2[]); Function Searches in s1 for s2. Parameters s1 First string offset Offset in s1 at which the search shall be started s2 Second string Return values First position of s2 in s1, or -1 if s2 is not found in s1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — • • Example long pos; char s1[18] = "Vector Informatik"; char s2[11] = "Informatik"; pos = strstr(s1, s2); // pos = 7 | strlen | strncat | strncpy | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: strstr_regex, strstr_regex_off strstr_regex, strstr_regex_off CAPL Function Overview » General » strstr_regex, strstr_regex_off Syntax long strstr_regex(char s[], char pattern[]) long strstr_regex_off(char s[], long offset, char pattern[]) Function Searches for a regular expression pattern in a string. Parameters s String to be searched. offset Offset in s at which the search shall be started. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | str_match_regex | str_replace | str_replace_regex | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: substr_cpy 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-1destOffset characters are copied. Characters are overwritten in dest starting at destOffset. Parameters dest Destination buffer src Source string srcStart Start index in src of substring len Length of the substring, or -1 to copy the string until the end max Maximum number of characters in src and dest Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — • • Example char s1[7]; char s2[18] = "Vector Informatik"; substr_cpy(s1, s2, 0, 6, elcount(s1)); // s1: Vector | strstr | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: substr_cpy_off substr_cpy_off CAPL Function Overview » General » substr_cpy_off Syntax void substr_cpy_off(char dest[], long destOffset, 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-1destOffset characters are copied. Parameters dest Destination buffer destOffset Offset in destination buffer src Source string srcStart Start index in src of substring len Length of the substring, or -1 to copy the string until the end max Maximum number of characters in src and dest Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: swapWord, swapInt, swapDWord, swapLong swapWord, swapInt, swapDWord, swapLong CAPL Function Overview » General » swapWord, swapInt, swapDWord, swapLong Syntax word swapWord(word x); int swapInt(int x); dword swapDWord(dword x); long swapLong(long x); 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 "bigendian-format" (Motorola). Parameters Value whose bits are to be swapped. Return values Value with swapped bytes. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example bigEndian = swapInt(1234); // create constant 1234 for Motorola processors Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: sysExec, sysExecCmd sysExec, sysExecCmd CAPL Function Overview » General » sysExec, sysExecCmd Syntax long sysExec(char cmd[], char params[]); long sysExec(char cmd[], char params[], char directory[]); // Form 2 long sysExecCmd(char cmd[], char params[]); long sysExecCmd(char cmd[], char params[], char directory[]); // Form 2 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. Return values 1 if the command was successfully started, else 0. Info Note that no return value from the command itself is given because the call does not wait for the command to finish. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: sysExit sysExit CAPL Function Overview » General » sysExit Syntax void sysExit(); Function Exits the system (CANoe) from within a CAPL program. Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • — Example ... sysExit(); ... | sysMinimize | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: sysMinimize sysMinimize CAPL Function Overview » General » sysMinimize Syntax void 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • — Example ... sysMinimize(); ... | sysExit | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: timeDiff timeDiff CAPL Function Overview » General » timeDiff Syntax long timeDiff(message m1, NOW); long timeDiff(message m1, message m2); 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). Parameters Variable of type message Variable of type now Return values Time difference in ms. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example diff = timeDiff(m100, now); // CANalyzer 1.x & 2.x diff = this.time - m100.time; // CANalyzer 2.xx | timeNow | timeNowFlaot | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: timeNow timeNow CAPL Function Overview » General » timeNow Syntax dword timeNow(); Function Supplies the current simulation time. 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). Depending on the hardware configuration, the simulation time • 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 • the message times will have a higher accuracy (e.g., system with one LIN channel connected to one LINda) Parameters — Return values Simulation time in 10 microseconds. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example ... float x; x = timeNow()/100000.0; //current time in seconds ... | timeDiff | timeNowFlaot | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: timeNowFloat timeNowFloat CAPL Function Overview » General » timeNowFloat Syntax float timeNowFloat(); Function Supplies the current simulation time. 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). Depending on the hardware configuration, the simulation time • 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 • the message times will have a higher accuracy (e.g., system with one LIN channel connected to one LINda) Parameters — Return values Simulation time in 10 microseconds. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example ... float x; x = timeNowFloat()/100000.0; //current time in seconds ... | timeDiff | timeNow | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: timeNowNS, timeNowInt64 timeNowNS, timeNowInt64 CAPL Function Overview » General » timeNowNS, timeNowInt64 Syntax float TimeNowNS(); int64 timeNowInt64(); Function Supplies the current simulation time. 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). Depending on the hardware configuration, the simulation time • 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 • the message times will have a higher accuracy (e.g., system with one LIN channel connected to one LINda) Parameters — Return values Simulation time in nanoseconds. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 — • • Example — | EnvVarTimeNS | MessageTimeNS | timeNowFloat | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: timeToElapse timeToElapse CAPL Function Overview » General » timeToElapse Syntax long timeToElapse(timer t) (Form 1) long timeToElapse(mstimer t) (Form 2) 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. Parameters timer or mstimer variable Return values Time to go until the timer elapses and the event procedure is called. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 — • • Example timer t; setTimer(t, 5); write("Time to elapse: %d", timeToElapse(t)); // writes 5 | setTimer | cancelTimer | isTimerActive | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: toLower toLower CAPL Function Overview » General » toLower Syntax char toLower(char c); // form 1 void toLower(char dest[], char source[], dword bufferSize); // form 2 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 Destination buffer for the transformed string. bufferSize Size of the destination buffer. Return values Lower case of the character (form 1). Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — • • Example char buffer[20]; toLower(buffer, "Vector", elcount(buffer)); // buffer contains "vector" | toUpper | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: toUpper toUpper CAPL Function Overview » General » toUpper Syntax char toUpper(char c); // form 1 void toUpper(char dest[], char source[], dword bufferSize); // form 2 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 Destination buffer for the transformed string. bufferSize Size of the destination buffer. Return values Upper case of the character (form 1). Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — • • Example char buffer[20]; toUpper(buffer, "Vector", elcount(buffer)); // buffer contains "VECTOR" | toLower | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: traceSetEventColors traceSetEventColors CAPL Function Overview » General » traceSetEventColors Syntax traceSetEventColors(message msg, long font, long bkgnd) traceSetEventColors(errorFrame msg, long font, long bkgnd) traceSetEventColors(pg msg, long font, long bkgnd) traceSetEventColors(linmessage msg, long font, long bkgnd) traceSetEventColors(mostRawMessage msg, long font, long bkgnd) traceSetEventColors(mostMessage msg, long font, long bkgnd) traceSetEventColors(mostAmsMessage msg, long font, long bkgnd) traceSetEventColors(frFrame msg, long font, long bkgnd) traceSetEventColors(frError msg, long font, long bkgnd) 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 Parameters • 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. msg Variable type: message, errorFrame, pg, linMessage, mostRawMessage, mostMessage, mostAmsMessage, frFrame, frError font Font color (RGB value) bkgnd Background color (RGB value) Return values 0: OK -1: Invalid RGB value of a color. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — • — Example on message * { traceSetEventColors(this, makeRGB(0x00, 0xFF, 0xFF), makeRGB(0x00, 0x00, 0x00)); output(this); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: traceSetEventColors } on message * { message * msg; msg = this; traceSetEventColors(msg, makeRGB(0x00, 0xFF, 0xFF), makeRGB(0x00, 0x00, 0x00)); output(msg); } | MOST Trace Highlighting | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: trigger trigger CAPL Function Overview » General » trigger Syntax void trigger(); Function Activates/Deactivates logging triggering of all logging and trigger blocks. Info Please note in CANoe online help the Trigger Condition: CAPL Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: triggerEx triggerEx CAPL Function Overview » General » triggerEx Syntax void triggerEx(char name[]); Function Activates/Deactivates logging triggering of a special logging or trigger block. If you enter no block name, triggering will be activated/deactivated for all blocks. Info Please note in CANoe online help the Trigger Condition: CAPL Parameters name Name of the logging or trigger block you want to activate/deactivate triggering. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.0 — • • Example — | trigger | stop | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: valOfId valOfId CAPL Function Overview » General » valOfId Syntax long valOfId(dword id); long valOfId(message m); Function Returns the value of a message identifier independent of its type. Identifier as long value. Parameters Variable of the type message or Id portion of a message. Return values Identifier as long value. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example on message * { long x; x = valOfId(this); write("Received Identifier: %d",x); output(this); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: write write CAPL Function Overview » General » write Syntax void write(char format[], ...); 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. Parameters Format string, variables or expressions Legal format expressions: "%ld","%d" decimal display "%lx","%x" hexadecimal display "%lX","%X" hexadecimal display (upper case) "%lu","%u" unsigned display "%lo","%o" octal display "%s" display a string "%g","%f" floating point display 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. "%c" display a character "%%" display %-character "%I64d" decimal display of a 64 bit value "%I64x" hexadecimal display of a 64 bit value "%I64X" hexadecimal display of a 64 bit value (upper case) "%I64u" unsigned display of a 64 bit value Info The %n format is invalid and it must not be used! Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 2.5 — • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: write 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); } | snprintf | writeToLog | writeToLogEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeClear writeClear CAPL Function Overview » General » writeClear Syntax void writeClear(dword sink) 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 Target identifier for the page to be deleted. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 — • • Example | write | writeCreate | writeDestroy | writeEx | writeLineEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeConfigure writeConfigure CAPL Function Overview » General » writeConfigure Syntax void writeConfigure( dword sink, dword lines, dword logging, char filename[]); Function Configures the specified page in the Write window. Parameters sink Target identifier for the page to be configured. lines The number of lines of the page. logging Enables the logging feature if non-zero. filename Name of the logging file. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6 SP3 — • • Example | write | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeCreate writeCreate CAPL Function Overview » General » writeCreate Syntax dword writeCreate(char name[]) Function Generates a new page in the Write window with the specified name. The page is automatically deleted the next time a measurement starts. Parameters name Name of the page to be generated. Return values Sink identifier that is valid for output to the new page. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 — • • Example | write | writeClear | writeDestroy | writeEx | writeLineEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeDbgLevel writeDbgLevel CAPL Function Overview » General » writeDbgLevel Syntax long writeDbgLevel(unsigned int priority, char format1[], char format2[], ...); 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 Output priority from 0 to 15. format Format string, variables or expressions legal format expressions: "%ld", "%d" decimal display "%lx", "%x" hexadecimal display "%lX", "%X" hexadecimal display (upper case) "%lu", "%u" unsigned display "%lo", "%o" octal display "%s" display a string "%g", "%lf" floating point display "%c" display a character "%%" display %-character Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeDbgLevel | setWriteDbgLevel | write | writeDbgLevel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeDestroy writeDestroy CAPL Function Overview » General » writeDestroy Syntax void writeDestroy(dword sink) 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 Target identifier for the page to be removed. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 — • • Example | write | writeClear |writeCreate | writeEx | writeLineEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeEx writeEx CAPL Function Overview » General » writeEx Syntax void writeEx(dword sink, dword severity, char format[], ...) 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 0 Output to the System tab of the Write window 1 Output to the CAPL tab of the Write window 4 Output to the Test tab of the Write window severity Constant for the type of message. Values: 0 Success 1 Information 2 Warning 3 Error The parameter severity has no meaning for output to the Trace window. format Formatting character sequence. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 — • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeEx Example | write | writeClear | writeCreate | writeDestroy | writeLineEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeLineEX writeLineEX CAPL Function Overview » General » writeLineEX Syntax void writeLineEx(dword sink, dword severity, char format[], ...) 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 0 Output to the System tab of the Write window 1 Output to the CAPL tab of the Write window 4 Output to the Test tab of the Write window severity Constant for the type of message. 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 Formatting character sequence. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeLineEX Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 — • • Example | write | writeClear | writeCreate | writeDestroy | writeEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeProfileInt 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. Syntax long writeProfileInt(char section[], char entry[], long value, char filename[]); 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 Section of the file as a string. entry Variable name as a string. value Value as a integer. filename File path as a string. Return values The functional result is 0 in case of an error. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeProfileFloat 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. Syntax long writeProfileFloat(char section[], char entry[], float value, char filename[]) 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 Section of the file as a string. entry Variable name as a string. value Value as a float. filename File path as a string. Return values The functional result is 0 in case of an error. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeProfileString 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. Syntax long writeProfileString(char section[], char entry[], char value[], char filename[]); 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 Section of the file as a string. entry Variable name as a string. value Value as a string. filename File path as a string. Return values 0: Write error > 1: Write access. Number of characters will not be returned. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.0 — • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeTextBkgColor writeTextBkgColor CAPL Function Overview » General » writeTextBkgColor Syntax void writeTextBkgColor(dword sink,dword red, dword green, dword blue) 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 Specifies the intensity of the red color. green Specifies the intensity of the green color. blue Specifies the intensity of the blue color. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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"); | write | writeCreate | writeClear | writeDestroy | writeEx | writeLineEx | writeTextColor | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeTextColor writeTextColor CAPL Function Overview » General » writeTextColor Syntax void writeTextColor(dword sink,dword red, dword green, dword blue) 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 Specifies the intensity of the red color. green Specifies the intensity of the green color. blue Specifies the intensity of the blue color. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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"); | write | writeCreate | writeClear | writeDestroy | writeEx | writeLineEx | writeTextBkgColor | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeToLog writeToLog CAPL Function Overview » General » writeToLog Syntax void writeToLog(char format[], ...); 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. Parameters Format string, variables or expressions Legal format expressions: "%ld","%d" decimal display "%lx","%x" hexadecimal display "%lX","%X" hexadecimal display (upper case) "%lu","%u" unsigned display "%lo","%o" octal display "%s" display a string "%g","%lf" floating point display "%c" display a character "%%" display %-character "%I64d" decimal display of a 64 bit value "%I64x" hexadecimal display of a 64 bit value "%I64X" hexadecimal display of a 64 bit value (upper case) "%I64u" unsigned display of a 64 bit value Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example void MarkLogFile(int marker) { // marks line of ASCII logging file with an integer writeToLog("===> %d",marker); } | snprintf | write | writeToLogEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeToLogEx writeToLogEx CAPL Function Overview » General » writeToLogEx Syntax void writeToLogEx(char format[], ...); 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. Parameters Format string, variables or expressions Legal format expressions: "%ld","%d" decimal display "%lx","%x" hexadecimal display "%lX","%X" hexadecimal display (upper case) "%lu","%u" unsigned display "%lo","%o" octal display "%s" display a string "%g","%lf" floating point display "%c" display a character "%%" display %-character "%I64d" decimal display of a 64 bit value "%I64x" hexadecimal display of a 64 bit value "%I64X" hexadecimal display of a 64 bit value (upper case) "%I64u" unsigned display of a 64 bit value Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup All — • • Example // write marker with current date and time to logging file void MarkLogFileWithTimeString(void) { char timeBuffer[64]; getLocalTimeString(timeBuffer); writeToLogEx("===> %s",timeBuffer); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: writeToLogEx | snprintf | write | writeToLog | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: xlAcquireLED xlAcquireLED CAPL Function Overview » General » xlAcquireLED Syntax dword xlAcquireLED(dword ledBitMask); 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 The LEDs you want to release. The following LEDs are available. Note that you can bitwise combine the values to specify multiple LEDs. LED Numeric value Module (M) 0x001 CAN Channel 1 0x008 CAN Channel 2 0x010 CAN Channel 3 0x020 CAN Channel 4 0x040 FlexRay Channel 1 A Return values 0x080 FlexRay Channel 1 B 0x100 Keypad S1 0x200 Keypad S2 0x400 0: no error, function succeeded. != 0: error, function failed. Check whether your device supports this function and you have an appropriate driver installed on the device. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: xlAcquireLED const dword kLedMaskC1 = 0x008; const dword kLedMaskC2 = 0x010; const dword kLedMaskC3 = 0x020; // constants for LED operation modes const dword kLedOrangeOn = 0x00000020; const dword kLedOrangeBlinking = 0x00000040; 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*/ Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: xlReleaseLED xlReleaseLED CAPL Function Overview » General » xlReleaseLED Syntax dword xlReleaseLED(dword ledBitMask); 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 The LEDs you want to acquire. Following LEDs can be acquired. Note that you can bitwise combine the values to specify multiple LEDs LED Numeric value Module (M) 0x001 CAN Channel 1 0x008 CAN Channel 2 0x010 CAN Channel 3 0x020 CAN Channel 4 0x040 FlexRay Channel 1 A Return values 0x080 FlexRay Channel 1 B 0x100 Keypad S1 0x200 Keypad S2 0x400 0: no error, function succeeded. != 0: error, function failed. Check whether your device supports this function and you have an appropriate driver installed on the device. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 SP6 — — • Example See xlAcquireLED Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: xlSetLED xlSetLED CAPL Function Overview » General » xlSetLED Syntax dword xlSetLED(dword ledBitMask, dword ledMode); 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. The following LEDs are available: LED Numeric value Module (M) 0x001 CAN Channel 1 0x008 CAN Channel 2 0x010 CAN Channel 3 0x020 CAN Channel 4 0x040 FlexRay Channel 1 A 0x080 FlexRay Channel 1 B 0x100 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. The following operation modes are available: Operation mode Numeric value No Change 0x00000000 LED Off 0x00000001 LED On Red 0x00000002 LED Blinking Red 0x00000004 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: xlSetLED LED On Green 0x00000008 LED Blinking Green 0x00000010 LED On Orange 0x00000020 LED Blinking Orange 0x00000040 Info For the LEDs S1 and S2 only the No Change, LED Off and LED On Green operation modes are valid. Return values 0: no error, function succeeded. != 0: error, function failed. Check whether your device supports this function and you have an appropriate driver installed on the device. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 SP6 — — • Example See xlAcquireLED Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Associative Fields CAPL Functions Associative Fields CAPL Functions CAPL Function Overview » Associative Fields CAPL Functions Methods Short Description clear Removes all elements from the field. containsKey Returns the information if a key is available in the field. remove Removes one element from the field. size Returns the number of elements in the field. | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: clear clear CAPL Function Overview » Associative Fields » clear Method m.clear(); Function Removes all elements from the field. Parameters — Return values — Complexity O(log(N) + N) Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP5 — • • Example m.clear(); | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: containsKey containsKey CAPL Function Overview » Associative Fields » containsKey Method m.containsKey(key) Function Returns the information if a key is available in the field. Parameters key Key that should be checked. Return values 1 if the key was available - otherwise 0 Complexity O(log(N)) Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP5 — • • Example if (m.containsKey(3)) { // … | Classes and objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: remove remove CAPL Function Overview » Associative Fields » remove Method m.remove(key) Function Removes one element from the field. Parameters key Key of the element. Return values 1 if the key was available - otherwise 0 Complexity O(log(N)) Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP5 — • • Example Text m.remove(3); | Classes and objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: size size CAPL Function Overview » Associative Fields » size Method m.size() Function Returns the number of elements in the field. Parameters — Return values Number of elements in the field. Complexity O(1) Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP5 — • • Example if (m.size() == 0) write("Map is empty!"); | Classes and objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232 CAPL Functions RS232 CAPL Functions CAPL Function Overview » RS232 CAPL Functions 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. RS232 API Short description RS232Close Closes a serial port. RS232Open Opens serial port. RS232Configure Configures serial port (everything besides handshake). RS232SetHandshake Configures handshake parameters. RS232Send Sends block of data asynchronously on serial port. RS232Receive Sets receiver buffer for serial port. RS232SetSignalLine Sets signal line on serial port. RS232 API Callback Handlers Short description 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. RS232OnError Handler will be called if an error has occurred. 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.”); | Deprecated INI File | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232 CAPL Functions: Deprecated INI File RS232 CAPL Functions: Deprecated INI File CAPL Function Overview» RS232 » Deprecated INI File 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 Values of specific sections overwrite the values of the general section for a specific port. [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 Values of specific sections overwrite the values of the general section for a specific port. [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). Section Key Values [COMsettings] COMport List of identifiers for serial ports which will be opened at first call which opens a port (RS232Open and RS232SetCommState). The list is separated by semicolons (e.g. COMport=1;2;3). [COMsettings_COMx] with x a number between 1 and 255 UseCOMspecificSettings Either 0 or 1. If 1, then the section is enabled. If 0, then the values of the specific section are not used. [COMsettings] as well as [COMsettings_COMx] with x a number Baud The symbol rate to use for reception and transmission. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232 CAPL Functions: Deprecated INI File between 1 and 255 Info Typically, 9600 is used. There is a list of possible values which depends on the serial port. Normally, 115.200 is the allowed maximum. [COMsettings] as well as [COMsettings_COMx] with x a number between 1 and 255 ByteSize [COMsettings] as well as [COMsettings_COMx] with x a number between 1 and 255 StopBits [COMsettings] as well as [COMsettings_COMx] with x a number between 1 and 255 [Queue-Sizes] as well as [Queue-Sizes _COMx] with x a number between 1 and 255 The number of data bits within a transmission frame. Info 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. A code which sets the number of stop bits within a transmission frame. Parity 0 1 stop bit is used; it is the typical and most reasonable value 1 1.5 stop bits are used 2 2 stop bits are used A code which identifies the parity mode to use. QueueSize_Rx 0 no parity used, i.e. frame contains no parity bit 1 odd parity 2 even parity The size of the receiver buffer of the driver. The size is given in bytes. The range of numbers and the constraints (e.g. dividable by 8) are dependent on the driver. The number will be used as recommendation by the driver. Info If you specify a small number which is really used by the driver, then frequent buffer overruns may happen and the connection may not be stable. [Queue-Sizes] as well as [Queue-Sizes _COMx] with x a number between 1 and 255 QueueSize_Tx The size of the transmission buffer of the driver. The size is given in bytes. The range of numbers and the constraints (e.g. dividable by 8) are dependent on the driver. The number will be used as recommendation by the driver. Info If you specify a small number which is really used by the driver, then frequent buffer overruns may happen and the connection may not be stable. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232 CAPL Functions: Deprecated INI File 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 ; "Baud" sets baud rate ; note that only specific settings are possible ; the exact settings depend on the serial driver ; typical maximum is 115200 Baud=9600 ; "ByteSize" means "number of data bits" within one transmission frame ; typically 5..8 are allowed ; 8 is most reasonable for best performance ByteSize=8 ; "StopBits" means "number of stop bits" within one transmission frame ; possible values: ; 0 : 1 StopBits (!!!) ; 1 : 1.5 StopBits ; 2 : 2 StopBits ; example: "StopBits=0" means to use one stop bit ; 0 is most reasonable for best performance StopBits=0 ; "Parity" determines parity bit in frame ; possible values: ; 0: No parity ; 1: Even parity ; 2: Odd parity ; 0 is most reasonable for best performance Parity=0 ; specific section for COM1 port ; (can only be used if port is available) ; uses the same key-value-pairs as general section ; i.e. "Baud", "ByteSize", "StopBits", "Parity" [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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232Close RS232Close CAPL Function Overview » RS232 » RS232Close Syntax dword RS232Close( dword port ) Function Closes a serial port. 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 A number between 1 and 255 identifying a serial port. Return values 0: error The error occurs if the serial port with the given number does not exist on the system. 1: success Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 — — • Example if ( 1==RS232Close(1) ) write(“It works with port 1.”); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232Configure RS232Configure CAPL Function Overview » RS232 » RS232Configure Syntax dword RS232Configure( dword port, dword baudrate, dword numberOfDataBits, dword numberOfStopBits, dword parity ) Function Configures a serial port. Without setting up a configuration explicitly, the default configuration is used. Default baud rate: 9600, 8 data bits, 1 stop bit, no parity. If a deprecated INI file exists, then the data of the INI file will be used. Parameters port A number between 1 and 255 identifying a serial port. baudrate The symbol rate to use for reception and transmission. 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 The number of data bits within a transmission frame. 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. 1 1 stop bit is used ( 1 has changed meaning compared to obsolete variant RS232SetCommState ) 2 2 stop bits are used Info 1.5 stop bits are not supported any more. parity A code which identifies the parity mode to use. 0 no parity used, i.e. frame contains no parity bit 1 odd parity 2 even parity Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232Configure Return values 0: error The error occurs if • the serial port with the given number does not exist on the system • the port has not been opened 1: success Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 — — • Example if ( 0!=RS232Configure(1,9600,8,1,0) ) write(“Set typical default at port 1.”); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232OnError RS232OnError CAPL Function Overview » RS232 » RS232OnError Syntax RS232OnError( dword port, dword errorFlags ) Function Callback handler for reception of errors at a serial port. Info Will be called only at the node which issued send/receive operations. 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. It is possible that in case of configuration mismatches errors may not occur at once, e.g. a configuration of 9600/8/1/no parity at one port and 115200/8/1/no parity at the other end may seem to work (though rubbish is received). Parameters port A number between 1 and 255 identifying a serial port. errorFlags Cumulative summary of what went wrong. Bits are set to flag conditions. Bit Error 0 Send operation failed. 1 Receive operation failed. 2 Frame error. May be caused by parity mismatch or any other frame mismatch (e.g. number of stop bits). 3 Frame parity error. Is caused by parity mismatch. 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. 5 Buffer overrun at receiver. 6 Break state. Other end requested to pause. 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232OnError Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 — — • Example RS232OnError(dword port, dword errorFlags) { if ( errorFlags & 1 ) writeLineEx(0,3,“send failed”); if ( errorFlags & 2 ) writeLineEx(0,3,“receive failed”); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232OnReceive RS232OnReceive CAPL Function Overview » RS232 » RS232OnReceive Syntax RS232OnReceive( dword port, byte buffer[], dword number ) Function Callback handler for reception of data at a serial port. 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 A number between 1 and 255 identifying a serial port. buffer The buffer given to the start receive call. number The number of bytes which have been received. Info The number of received bytes will vary strongly with the speed of the connection. Return values 0: error The error occurs if no start receive operation has been. 1: success Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232OnReceive 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 } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232OnSend RS232OnSend CAPL Function Overview » RS232 » RS232OnSend Syntax RS232OnSend( dword port, byte buffer[], dword number ) Function Callback handler for completion of send operation to a serial port. 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 A number between 1 and 255 identifying a serial port. buffer The buffer given to the send call. number The number of bytes which have been sent. Return values 0: error The error occurs if no send operation will be used. 1: success Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232Open RS232Open CAPL Function Overview » RS232 » RS232Open Syntax dword RS232Open( dword port ) Function Opens a serial port. 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 A number between 1 and 255 identifying a serial port. Return values 0: error The error occurs if • 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 — — • Example if ( 1==RS232Open(1) ) write(“It works with port 1.”); | RS232 CAPL Functions: Deprecated INI File | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232Receive RS232Receive CAPL Function Overview » RS232 » RS232Receive Syntax dword RS232Receive( dword port, byte buffer[], dword size ) Function Receive blocks of bytes from a serial port. Parameters • The operation works continuous if issued once. • If any data has been received, the node will be notified by the callback handler RS232OnReceive. • If another receive operation will be given, the result buffer will change to that one given by the last receive operation. • To get informed about errors occurring in later stages of the operation use RS232OnError. Retrials to receive will be started continuously but you won’t be notified if an error happens again. port A number between 1 and 255 identifying a serial port. buffer An array of bytes. size Maximum number of bytes which can be received. Return values 0: error The error occurs if • the serial port with the given number does not exist on the system • the port has not been opened An error is only given if a problem is issued directly by the system. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232Receive } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232Send RS232Send CAPL Function Overview » RS232 » RS232Send Syntax dword RS232Send( dword port, byte buffer[], dword number ) Function Sends a block of bytes to a serial port. Parameters • The operation starts the sending of a block. • The callback handler RS232OnSend will notify the node of completion. • To get informed about errors occurring in later stages of the operation use RS232OnError. There are no automatic retrials in case of error. port A number between 1 and 255 identifying a serial port. buffer An array of bytes of which number will be sent. number Number of bytes to send. Return values 0: error The error occurs if • 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. An error is only given if a problem is issued directly. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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.”); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232SetHandshake RS232SetHandshake CAPL Function Overview » RS232 » RS232SetHandshake Note deprecated is variant with timeout as parameter Syntax Obsolete dword RS232SetHandshake( dword port, dword handshake, dword XonLimit, dword XoffLimit, dword XonChar, dword XoffChar, dword timeout ) dword RS232SetHandshake( dword port, dword handshake, dword XonLimit, dword XoffLimit, dword XonChar, dword XoffChar ) Function Sets handshake parameters on serial port. 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 A number between 1 and 255 identifying a serial port. handshake Sets variant of handshake to use. Allowed values (internal bit field leads to strange values): 0 no handshake at all 10 hardware handshake, use DTR<->DSR 33 hardware handshake, use RTS<->CTS 65 hardware handshake, use RTS<->CTS, use “toggle” variant 128 software handshake, use Xon and Xoff characters DTR: Data-Terminal-Ready (from sender). RTS: Request-To-Send (from sender). DSR: Data-Set-Ready (from receiver). CTS: Clear-To-Send (from receiver). Info Mixtures of hardware and software handshake are not supported. For sake of compatibility, it is possible to set signal lines to fixed levels with this function. Please prefer for that purpose RS232SetSignalLine. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232SetHandshake 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. Xon is issued if current level < XonLimit. Xoff is issued if current level > (buffer size-XoffLimit). Both ranges may overlap so that Xon and Xoff would be signalled at the same time. Another problem may arise if XoffLimit > buffer size. 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. Xon and Xoff are sent at transitions, not steadily. timeout Timeout in milliseconds to be used for all send and receive operations. -1 infinite < 10 is not allowed 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232SetHandshake Return values 0: error The error occurs if • the serial port with the given number does not exist on the system • the port has not been opened 1: success Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 — — • Example if ( 0!=RS232SetHandshake(1,0,0,0,0,0) ) write(“No handshake at port 1.”); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RS232SetSignalLine RS232SetSignalLine CAPL Function Overview » RS232 » RS232SetSignalLine Syntax dword RS232SetSignalLine( dword port, dword line, dword state ) Function Sets signal lines on serial port. Info If you use hardware handshake, then this function may conflict with the automatic handshaking. Parameters port A number between 1 and 255 identifying a serial port. line Specifies signal line of which the state shall be set. 0 RTS 1 DTR Data-Terminal-Ready (from sender). RTS: Request-To-Send (from sender). state Return values 0 disabled 1 enabled 0: error The error occurs if • the serial port with the given number does not exist on the system • the port has not been opened 1: success Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Signal Access CAPL Functions Signal Access CAPL Functions CAPL Function Overview » Signal Access CAPL Functions Functions Short description getSignal Gets the value of a signal. 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. SetSignal Sets the transmitted signal to the accompanying value. checkSignalInRange Checks the value of a signal, a system variable or an 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Struct Byte Access CAPL Functions Struct Byte Access CAPL Functions CAPL Function Overview » Struct Byte Access CAPL Functions Functions Short description memcmp Compares the bytes of the parameters. memcpy Copies bytes from a source to a destination. memcpy_h2n Copies the bytes from the struct into the array. memcpy_n2h Fills the struct with bytes from the array. memcpy_off Copies bytes from a source to destination, giving a destination start offset. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: memcmp memcmp CAPL Function Overview » Struct Byte Access » memcmp Syntax int memcmp(struct s, byte buffer[]) // form 1 int memcmp(byte buffer[], struct s) // form 2 int memcmp(struct s, struct t) // form 3 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 t Another struct Return values 0 if the bytes are equal; a value different from 0 if they are unequal Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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."); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: memcpy memcpy CAPL Function Overview » Struct Byte Access » memcpy Syntax void memcpy(byte dest[], struct source) // form 1 void memcpy(byte dest[], int offset, struct source) // form 2 void memcpy(struct dest, byte source[]) // form 3 void memcpy(struct dest, byte source[], int offset) // form 4 void memcpy(struct dest, struct source); // form 5 void memcpy(struct dest, char source[]); // form 6 void memcpy(struct dest, char source[], dword offset); // form 7 void memcpy( byte dest[], byte source[], dword length); // form 8 void memcpy( char dest[], byte source[], dword length); // form 9 void memcpy( byte dest[], char source[], dword length); // form 10 void memcpy( char dest[], char source[], dword length); // form 11 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 (form 1, 2, 5): Struct whose bytes shall be copied. (other forms): Array whose bytes shall be copied. dest (form 3, 4, 5, 6, 7): Struct into which the bytes shall be copied. (other forms): Array into which the bytes shall be copied. offset (form 2, 4, 7): Offset in the array which marks the start of the data. length (form 8, 9, 10, 11): number of bytes which shall be copied. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP3 — • • 7.2: form 7-11 — • • Example byte data[4]; struct WrapDword Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: memcpy { 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]); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: memcpy_h2n memcpy_h2n CAPL Function Overview » Struct Byte Access » memcpy_h2n Syntax void memcpy_h2n(byte dest[], struct source) // form 1 void memcpy_h2n(byte dest[], int offset, struct source) // form 2 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 Struct whose bytes shall be copied dest Array into which the bytes shall be copied offset (form 2) Offset into the array Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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]); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: memcpy_n2h memcpy_n2h CAPL Function Overview » Struct Byte Access » memcpy_n2h Syntax void memcpy_n2h(struct dest, byte source[]) // form 1 void memcpy_n2h(struct dest, byte source[], int offset) // form 2 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 Array whose bytes shall be copied dest Struct into which the bytes shall be copied offset (form 2) Offset in the array where the data begins Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP3 — • • Example See example memcpy_h2n Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: memcpy_off 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 void memcpy_off( byte dest[], dword destOffset, byte source[], dword sourceOffset, dword length); // form 5 void memcpy_off( char dest[], dword destOffset, byte source[], dword sourceOffset, dword length); // form 6 void memcpy_off( byte dest[], dword destOffset, char source[], dword sourceOffset, dword length); // form 7 void memcpy_off( char dest[], dword destOffset, char source[], dword sourceOffset, dword length); // form 8 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 (form 1, 2): Struct into which the bytes shall be copied. (other forms): Array into which the bytes shall be copied. source (form 3, 4): Struct from which the bytes shall be copied. (other forms): Array from which the bytes shall be copied. destOffset Start offset in the destination struct or array. sourceOffset Start offset int the source struct or array. length Number of bytes which shall be copied. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: memcpy_off Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: System Variables CAPL Functions System Variables CAPL Functions CAPL Function Overview » System Variables CAPL Functions Functions Short description SysDefineNamespace Defines a name space. SysUndefineNamespace Deletes a name space. SysUndefineVariable Deletes a variable. Functions to define variables SysDefineVariableData Defines a variable of the data type. SysDefineVariableFloat Defines a variable of the float type. SysDefineVariableFloatArray Defines a variable of the float[] type. SysDefineVariableInt Defines a variable of the int type. SysDefineVariableIntArray Defines a variable of the int[] type. SysDefineVariableString Defines a variable of the String (char[]) type. Functions to return the value of a variable SysGetOrigTimeNS Returns the original time stamp of the last update to the variable value. sysGetVariableArrayLength Returns the length of an array system variable. SysGetVariableData Returns the value of a variable of the data type. SysGetVariableFloat Returns the value of a variable of the float type. SysGetVariableFloatArray Returns the value of a variable of the float[] type. SysGetVariableInt Returns the value of a variable of the int type. SysGetVariableLongArray Returns the value of a variable of the int[] type. SysGetVariableString Returns the value of a variable of the String (char[]) type. SysGetVariableMax Retrieves the maximum of a variable. SysGetVariableMin Retrieves the minimum of a variable SysGetVariableTimeNS Returns the time stamp of the last update to the variable value. Functions to set the value of the variable sysSetAnalysisOnlyVariable Defines whether the variable shall be used only in the analysis part of CANoe. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: System Variables CAPL Functions SysSetVariableData Sets the value of a variable of the data type. SysSetVariableFloat Sets the value of a variable of the float type. SysSetVariableFloatArray Sets the value of a variable of the float[] type. SysSetVariableInt Sets the value of a variable of the int type. SysSetVariableLongArray Sets the value of a variable of the int[] type. SysSetVariableString Sets the value of a variable of the String (char[]) type. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysDefineNamespace SysDefineNamespace CAPL Function Overview » System Variables » SysDefineNamespace Syntax long SysDefineNamespace(char namespace[]) Function Defines a name space Parameters namespace Name of the name space Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysDefineVariableData SysDefineVariableData CAPL Function Overview » System Variables » SysDefineVariableData Syntax long sysDefineVariableData(char namespace[], char variable[], byte initialData[], long initialSize) Function Defines a variable of data type. Parameters namespace Name of the name space variable Name of the variable initialData Initial value of the variable initialSize Initial size (in bytes) of the variable. Must not exceed the length of the initialData array. Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysDefineVariableFloat 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. Syntax long SysDefineVariableFloat(char namespace[], char variable[], double initialValue) long SysDefineVariableFloat(char namespace[], char variable[], double initialValue, double minimum, double maximum) Function Defines a variable of the float type. Parameters namespace Name of the name space variable Name of the variable initialValue Initial value of the variable minimum The minimum value of the variable maximum The maximum value of the variable Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function 5: given minimum is larger than the given maximum Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2 — — • 7.2: form 2 — — • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysDefineVariableFloat — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysDefineVariableFloatArray 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. Syntax long SysDefineVariableFloatArray(char namespace[], char vari-able[], float initialValues[], long arraySize) long SysDefineVariableFloatArray(char namespace[], char variable[], double initialValues[], long arraySize, double minimum, double maximum) Function Defines a variable of the float[] type. Parameters namespace Name of the name space variable Name of the variable initialValue Initial value of the variable arraySize Number of values in the array minimum The minimum value of the variable maximum The maximum value of the variable Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function 5: given minimum is larger than the given maximu Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2 — — • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysDefineVariableFloatArray 7.2: form 2 — — Example — Version: 7.6 SP4 | © Vector Informatik GmbH • User Manual Topic: SysDefineVariableInt 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. Syntax long SysDefineVariableInt(char namespace[], char variable[], long initialValue) long SysDefineVariableInt(char namespace[], char variable[], long initialValue, long minimum, long maximum) Function Defines a variable of the int type. Parameters namespace Name of the name space variable Name of the variable initialValue Initial value of the variable minimum The minimum value of the variable maximum The maximum value of the variable Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function 5: given minimum is larger than the given maximum Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5,2 — — • 7.2: form 2 — — • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysDefineVariableInt — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysDefineVariableIntArray 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. Syntax long SysDefineVariableIntArray(char namespace[], char variable[], int initialValues[], long arraySize) long SysDefineVariableIntArray(char namespace[], char variable[], int initialValues[], long arraySize, long minimum, long maximum) Function Defines a variable of the int[] type. Parameters namespace Name of the name space variable Name of the variable initialValue Initial value of the variable arraySize Number of values in the array minimum The minimum value of the variable maximum The maximum value of the variable Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function 5: given minimum is larger than the given maximu Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2 — — • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysDefineVariableIntArray 7.2: form 2 — — Example — Version: 7.6 SP4 | © Vector Informatik GmbH • User Manual Topic: SysDefineVariableString 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. Syntax long SysDefineVariableString(char namespace[], char variable[], char initialValue[]) Function Defines a variable of the String (char[]) type. Parameters namespace Name of the name space variable Name of the variable initialValue Initial value of the variable Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetOrigTimeNS SysGetOrigTimeNS CAPL Function Overview » System Variables » SysGetOrigTimeNS Syntax int64 SysGetOrigTimeNS(SysVarName) 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — • • Example int64 timeStamp; timeStamp = SysGetOrigTimeNS(sysvar::MyNamespace::FloatVar); | SysGetVariableTimeNS | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: sysGetVariableArrayLength sysGetVariableArrayLength CAPL Function Overview » System Variables » sysGetVariableArrayLength Syntax dword SysGetVariableArrayLength(char namespace[], char variable[]) // form 1 dword SysGetVariableArrayLength(SysVarName) // form 2 Function Returns the length of the array of the system variable. Info An access to the whole array is with this variant not possible. Parameters namespace Name of the name space (form 1). variable Name of the variable (form 1). 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) 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. For system variables of type long or float, returns 1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP4 — • form 2 • form 1 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); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableData SysGetVariableData CAPL Function Overview » System Variables » SysGetVariableData Syntax long SysGetVariableData(char namespace[], char variable[], byte buffer[], long& copiedBytes) // form 1 long SysGetVariableData(SysVarName, byte buffer[], long& copiedBytes) // form 2 Function Returns the value of a variable of the data type. Parameters namespace Name of the name space variable Name of the variable buffer Buffer which takes the value of the variable 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::". Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function 5: the buffer is too small for the value Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6: form 1 — — • 7.6: form 2 — • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableFloat SysGetVariableFloat CAPL Function Overview » System Variables » SysGetVariableFloat Syntax double SysGetVariableFloat(char namespace[], char variable[]) // form 1 double SysGetVariableFloat(SysVarName) // form 2 Function Returns the value of a variable of the float type. Parameters namespace Name of the name space (form 1) variable Name of the variable (form 1) 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) Return values Value of the variable or 0 in case of error Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2: form 1 — — • 7.0: form 2 — • • Example SysGetVariableFloat(sysvar::MyNamespace::FloatVar); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableFloatArray SysGetVariableFloatArray CAPL Function Overview » System Variables » SysGetVariableFloatArray Syntax long SysGetVariableFloatArray(char namespace[], char variable[], float values[], long arraySize) // form 1 long SysGetVariableFloatArray(SysVarName, float values[], long arraySize) // form 2 Function Returns the value of a variable of the float[] type. 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 An access to the whole array is with this variant not possible. Parameters namespace Name of the name space (form 1) variable Name of the variable (form 1) values Gets the values of the variable (both forms) arraySize Size of the array (both forms) 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) Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableFloatArray Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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)); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableInt SysGetVariableInt CAPL Function Overview » System Variables » SysGetVariableInt Syntax long SysGetVariableInt(char namespace[], char variable[]) // form 1 long SysGetVariableInt(SysVarName) // form 2 Function Returns the value of a variable of the int type. Parameters namespace Name of the name space (form 1) variable Name of the variable (form 1) 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) Return values Value of the variable or 0 in case of error Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2 — — • 7.0: form 2 — • • Example SysGetVariableInt(sysvar::MyNamespace::IntVar); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableLongArray SysGetVariableLongArray CAPL Function Overview » System Variables » SysGetVariableLongArray Syntax long SysGetVariableLongArray(char namespace[], char variable[], long values[], long arraySize) // form 1 long SysGetVariableLongArray(SysVarName, long values[], long arraySize) // form 2 Function Returns the value of a variable of the int[] type. 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 An access to the whole array is with this variant not possible. Parameters namespace Name of the name space (form 1) variable Name of the variable (form 1) values Values of the variable (both forms) arraySize Number of values in the array (both forms) 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) Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableLongArray Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP3 — — • Example long lVarArr[10]; // array size should match the size of the system variable ... SysGetVariableLongArray(sysvar::MyNamespace::LongArrayVar, lVarArr, elcount(lVarArr)); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableMax SysGetVariableMax CAPL Function Overview » System Variables » SysGetVariableMax Syntax long sysGetVariableMax(SysVarName, long& maximum) // form 1 long sysGetVariableMax(SysVarName, double& maximum) // form 2 long sysGetVariableMax(char namespace[], char variable[], long& maximum) // form 3 long sysGetVariableMax(char namespace[], char variable[], double& maximum) // form 4 Function Retrieves the maximum of a variable. 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 Name of the namespace (form 3 and 4) variable Name of the variable (form 3 and 4) maximum Receives the maximum of the variable if no errors occur (reference parameter). Must be the correct type for the system variable. Return values 0: success 4: variable is of the wrong type or has no maximum defined Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableMin SysGetVariableMin CAPL Function Overview » System Variables » SysGetVariableMin Syntax long sysGetVariableMin(SysVarName, long& minimum) // form 1 long sysGetVariableMin(SysVarName, double& minimum) // form 2 long sysGetVariableMin(char namespace[], char variable[], long& minimum) // form 3 long sysGetVariableMin(char namespace[], char variable[], double& minimum) // form 4 Function Retrieves the minimum of a variable of type Integer or Integer Array. 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 Name of the namespace (form 3 and 4) variable Name of the variable (form 3 and 4) minimum Receives the minimum of the variable if no errors occur (reference parameter). Must be the correct type for the system variable. Return values 0: success 4: variable is of the wrong type or has no minimum defined Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableString SysGetVariableString CAPL Function Overview » System Variables » SysGetVariableString Syntax long SysGetVariableString(char namespace[], char variable[], char buffer[], long bufferSize) // form 1 long SysGetVariableString(SysVarName,char buffer[], long bufferSize) // form 2 Function Returns the value of a variable of the String (char[]) type. Info An access to the whole string is with this variant not possible. Parameters namespace Name of the name space (form 1) variable Name of the variable (form 1) buffer Buffer that takes the value of the variable (form 1) bufferSize Size of the buffer 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) Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2: form 1 — — • 7.0: form 2 — • • Example SysGetVariableString(sysvar::MyNamespace::StringVar, buf, elcount(buf)); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysGetVariableTimeNS SysGetVariableTimeNS CAPL Function Overview » System Variables » SysGetVariableTimeNS Syntax int64 SysGetVariableTimeNS(SysVarName) 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 — • • Example int64 timeStamp; timeStamp = SysGetVariableTimeNS(sysvar::MyNamespace::FloatVar); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysSetAnalysisOnlyVariable SysSetAnalysisOnlyVariable CAPL Function Overview » System Variables » SysSetAnalysisOnlyVariable Syntax void SysSetAnalysisOnlyVariable(SysVarName, long anlyzLocal) 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — • — Example SysSetAnalysisOnlyVariable(sysvar::MyNamespace::StringVar, 1); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysSetVariableData SysSetVariableData CAPL Function Overview » System Variables » SysSetVariableData Syntax long SysSetVariableData(char namespace[], char variable[], byte data[], long size) // form 1 long SysSetVariableData(SysVarName, byte data[], long size) // form 2 Function Sets the value of a variable of the data type. Parameters namespace Name of the name space variable Name of the variable data New values for the variable 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::". Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6: form 1 — — • 7.6: form 2 — • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysSetVariableFloat SysSetVariableFloat CAPL Function Overview » System Variables » SysSetVariableFloat Syntax long SysSetVariableFloat(char namespace[], char variable[], float value) // form 1 long SysSetVariableFloat(SysVarName, float value) // form 2 Function Sets the value of a variable of the float type. Parameters namespace Name of the name space (form 1) variable Name of the variable (form 1) value New value of the variable (both forms) 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) Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2: form 1 — — • 7.0: form 2 — • • Example float fVar; ... SysSetVariableFloat(sysvar::MyNamespace::FloatVar, fVar); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysSetVariableFloatArray SysSetVariableFloatArray CAPL Function Overview » System Variables » SysSetVariableFloatArray Syntax long SysSetVariableFloatArray(char namespace[], char variable[], float values[], long arraySize) // form 1 long SysSetVariableFloatArray(SysVarName,float values[], long arraySize) // form 2 Function Sets the value of a variable of the float[] type. 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 An access to the whole array is with this variant not possible. Parameters namespace Name of the name space (form 1) variable Name of the variable (form 1) values New values of the variable (both forms) arraySize Number of values in the array (both forms) 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) Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2: form 1 — — • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysSetVariableFloatArray 7.0: form 2 — • • Example float fVarArr[10]; ... SysSetVariableFloatArray(sysvar::MyNamespace::FloatArrayVar, fVarArr, elcount(fVarArr)); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysSetVariableInt SysSetVariableInt CAPL Function Overview » System Variables » SysSetVariableInt Syntax long SysSetVariableInt(char namespace[], char variable[], long value) // form 1 long SysSetVariableInt(SysVarName, long value) // form 2 Function Sets the value of a variable of the int type. Parameters namespace Name of the name space (form 1) variable Name of the variable (form 1) value New value of the variable (both forms) 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) Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2: form 1 — — • 7.0: form 2 — • • Example long lVar; ... SysSetVariableInt(sysvar::MyNamespace::IntVar, lVar); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysSetVariableLongArray SysSetVariableLongArray CAPL Function Overview » System Variables » SysSetVariableLongArray Syntax long SysSetVariableLongArray(char namespace[], char variable[], long values[], long arraySize) // form 1 long SysSetVariableLongArray(SysVarName, long values[], long arraySize) // form 2 Function Sets the value of a variable of the int[] type. 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 An access to the whole array is with this variant not possible. Parameters namespace Name of the name space (form 1) variable Name of the variable (form 1) values Values of the variable (both forms) arraySize Number of values in the array (both forms) 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) Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP3: form 1 — — • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysSetVariableLongArray 7.0 SP3: form 2 — • • Example long lVarArr[10]; ... SysSetVariableLongArray(sysvar::MyNamespace::LongArrayVar, lVarArr, elcount(lVarArr)); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysSetVariableString SysSetVariableString CAPL Function Overview » System Variables » SysSetVariableString Syntax long SysSetVariableString(char namespace[], char variable[], char value[]) // form 1 long SysSetVariableString(SysVarName, char value[]) // form 2 Function Sets the value of a variable of the String (char[]) type. Info An access to the whole string is with this variant not possible. Parameters namespace Name of the name space (form 1) variable Name of the variable (form 1) value New value of the variable (both forms) 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) Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2: form 1 — — • 7.0: form 2 — • • Example SysSetVariableString(sysvar::MyNamespace::StringVar, "Vector"); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysUndefineNamespace SysUndefineNamespace CAPL Function Overview » System Variables » SysUndefineNamespace Syntax long SysUndefineNamespace(char namespace[]) Function Deletes a name space. Also all variables in this name space are automatically deleted. Parameters namespace Name of the name space Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: SysUndefineVariable SysUndefineVariable CAPL Function Overview » System Variables » SysUndefineVariable Syntax long SysUndefineVariable(char namespace[], char variable[]) Function Deletes a variable. Parameters namespace Name of the name space variable Name of the variable Return values 0: no error, function successful 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 3: no writing right for the name space available 4: the variable has no suitable type for the function Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1/5.2 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TCP/IP API 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. IP API functions Short description IpBind Associates an address and a port with a specified socket. IpGetAdapterAddress Retrieves the addresses associated with a network interface. IpGetAdapterAddressAsString Retrieves the string representation of the first address associated with a specified network interface. IpGetAdapterCount Returns the number of network interfaces for the local computer. IpGetAdapterDescription Retrieves the description of a specified network interface. IpGetAdapterGateway Retrieves the default gateway address associated with a specified network interface. IpGetAdapterGatewayAsString Retrieves the string representation of the default gateway address associated with a specified network interface. IpGetAdapterMask Retrieves the address masks associated with a specified network interface. IpGetAdapterMaskAsString Retrieves the string representation of the first address mask associated with a specified network interface. IpGetAddressAsNumber Converts an address string in dot notation to it's numerical value in network-byte order. IpGetAddressAsString Converts a numeric address in network-byte order to a address string in dot notation. IpGetLastError Returns the Winsock 2 error code of the last operation that failed. IpGetLastSocketError Returns the Winsock 2 error code of the last operation that failed on a specified socket. IpGetLastSocketErrorAsString Retrieves the error message of the last operation that failed on a specified socket. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TCP/IP API IpSetSocketOption Modifies a socket option. UDP API The UDP API is used for UDP communications. It provides a high level interface for implementing connectionless, datagram-oriented communications. UDP API functions Short description UdpClose Closes the UDP socket. UdpOpen Creates an UDP socket for use in connectionless, datagramm-oriented communications. UdpReceiveFrom Receives data into a specified buffer. UdpSendTo Sends data to a specified location. The UDP API supports the following CAPL callbacks: OnUdpReceiveFrom It is dispatched when an asynchronous receive operation on an UDP socket completes. OnUdpSendTo It is dispatched when an asynchronous send operation on an UDP socket completes. TCP API The TCP API is used for TCP connections. It provides a high level interface for implementing connectionbased, message-oriented communications. TCP API functions Short description TcpAccept Accepts an incoming connection request on a specified socket resulting in a new socket. TcpClose Closes the TCP socket. TcpConnect Establishes a connection with a specified location. TCPGetRemoteAddress Retrieves the remote address of the specified socket. TCPGetRemoteAddressAsString Retrieves the remote address of the specified socket in Internet standard dotted-decimal format. TcpListen Causes the socket to listen for incoming connection requests. TcpOpen Creates a TCP socket for use in connection-based, message-oriented communications. TcpReceive Receives data into a specified buffer. TcpSend Sends data on a specified socket. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TCP/IP API TcpShutdown Disables send operations on a specified socket. The TCP API supports the following CAPL callbacks: OnTcpClose It is dispatched when a TCP socket receives a close notification. OnTcpConnect It is dispatched when an asynchronous connection operation completes. OnTcpListen It is dispatched when a connection request for a specified socket is received. OnTcpReceive It is dispatched when an asynchronous receive operation on a TCP socket completes. OnTcpSend It is dispatched when an asynchronous send operation on a TCP socket completes. | Winsock 2 Error Codes | Technical Details | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Winsock 2 Error Codes Winsock 2 Error Codes CAPL Function Overview » TCP/IP API » Winsock 2 Error Codes For your convenience, the Winsock 2 Error Codes are re-printed from the MSDN Online-Library: Return Code / Value Description WSAEINTR Interrupted function call. 10004 A blocking operation was interrupted by a call to WSACancelBlockingCall. WSAEACCES Permission denied. 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.. WSAEFAULT Bad address. 10014 The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr). WSAEINVAL Invalid argument. 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. WSAEMFILE Too many open files. 10024 Too many open sockets. Each implementation may have a maximum number of socket handles available, either globally, per process, or per thread. WSAEWOULDBLOCK Resource temporarily unavailable. 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. WSAEINPROGRESS Operation now in progress. 10036 A blocking operation is currently executing. Windows Sockets only allows a single blocking operation—per- task or thread—to be outstanding, and if any other function call is made (whether or not it references that or any other socket) the function fails with the WSAEINPROGRESS error. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Winsock 2 Error Codes WSAEALREADY Operation already in progress. 10037 An operation was attempted on a non-blocking socket with an operation already in progress—that is, calling connect a second time on a nonblocking socket that is already connecting, or canceling an asynchronous request (WSAAsyncGetXbyY) that has already been canceled or completed. WSAENOTSOCK Socket operation on nonsocket. 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. WSAEDESTADDRREQ Destination address required. 10039 A required address was omitted from an operation on a socket. For example, this error is returned if sendto is called with the remote address of ADDR_ANY. WSAEMSGSIZE Message too long. 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. WSAEPROTOTYPE Protocol wrong type for socket. 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. WSAENOPROTOOPT Bad protocol option. 10042 An unknown, invalid or unsupported option or level was specified in a getsockopt or setsockopt call. WSAEPROTONOSUPPORT Protocol not supported. 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. WSAESOCKTNOSUPPORT Socket type not supported. 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. WSAEOPNOTSUPP Operation not supported. 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. WSAEPFNOSUPPORT Protocol family not supported. 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, Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Winsock 2 Error Codes and all Windows Sockets functions that return one of these messages also specify WSAEAFNOSUPPORT. WSAEAFNOSUPPORT Address family not supported by protocol family. 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. WSAEADDRINUSE Address already in use. 10048 Typically, only one usage of each socket ad-dress (protocol/IP address/port) is permitted. This error occurs if an application attempts to bind a socket to an IP address/port that has al-ready been used for an existing socket, or a socket that was not closed properly, or one that is still in the process of closing. For server applications that need to bind multiple sockets to the same port number, consider using setsockopt (SO_REUSEADDR). Client applications usually need not call bind at all— connect chooses an unused port automatically. When bind is called with a wildcard address (involving ADDR_ANY), a WSAEADDRI-NUSE error could be delayed until the specific address is committed. This could happen with a call to another function later, including connect, listen, WSAConnect, or WSAJoinLeaf. WSAEADDRNOTAVAIL Cannot assign requested address. 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). WSAENETDOWN Network is down. 10050 A socket operation encountered a dead net-work. This could indicate a serious failure of the network system (that is, the protocol stack that the Windows Sockets DLL runs over), the network interface, or the local network itself. WSAENETUNREACH Network is unreachable. 10051 A socket operation was attempted to an un-reachable network. This usually means the local software knows no route to reach the remote host. WSAENETRESET Network dropped connection on reset. 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. WSAECONNABORTED Software caused connection abort. 10053 An established connection was aborted by the software in your host computer, possibly due to a data transmission time-out or protocol error. WSAECONNRESET Connection reset by peer. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Winsock 2 Error Codes 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 information 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. WSAENOBUFS No buffer space available. 10055 An operation on a socket could not be per-formed because the system lacked sufficient buffer space or because a queue was full. WSAEISCONN Socket is already connected. 10056 A connect request was made on an already-connected socket. Some implementations also return this error if sendto is called on a connected SOCK_DGRAM socket (for SOCK_STREAM sockets, the to parameter in sendto is ignored) although other implementations treat this as a legal occurrence. WSAENOTCONN Socket is not connected. 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. WSAESHUTDOWN Cannot send after socket shutdown. 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. WSAETIMEDOUT Connection timed out. 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. WSAECONNREFUSED Connection refused. 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. WSAEHOSTDOWN Host is down. 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. WSAEHOSTUNREACH No route to host. 10065 A socket operation was attempted to an un-reachable host. See WSAENETUNREACH. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Winsock 2 Error Codes WSAEPROCLIM Too many processes. 10067 A Windows Sockets implementation may have a limit on the number of applications that can use it simultaneously. WSAStartup may fail with this error if the limit has been reached. WSASYSNOTREADY Network subsystem is unavailable. 10091 This error is returned by WSAStartup if the Windows Sockets implementation cannot function at this time because the underlying system it uses to provide network services is currently unavailable. Users should check: • 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. WSAVERNOTSUPPORTED Winsock.dll version out of range. 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. WSANOTINITIALISED Successful WSAStartup not yet performed. 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. WSAEDISCON Graceful shutdown in progress. 10101 Returned by WSARecv and WSARecvFrom to indicate that the remote party has initiated a graceful shutdown sequence. WSATYPE_NOT_FOUND Class type not found. 10109 The specified class was not found. WSAHOST_NOT_FOUND Host not found. 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. WSATRY_AGAIN Nonauthoritative host not found. 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. WSANO_RECOVERY This is a nonrecoverable error. 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, Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Winsock 2 Error Codes or a DNS request was returned by the server with a severe error. WSANO_DATA Valid name, no data record of requested type. 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. WSA_INVALID_HANDLE Specified event object handle is invalid. 6 An application attempts to use an event object, but the specified handle is not valid. WSA_INVALID_PARAMETER One or more parameters are invalid. 87 An application used a Windows Sockets function which directly maps to a Windows function. The Windows function is indicating a problem with one or more parameters WSA_IO_INCOMPLETE Overlapped I/O event object not in signaled state. 996 The application has tried to determine the status of an overlapped operation which is not yet completed. Applications that use WSAGetOverlappedResult (with the fWait flag set to FALSE) in a polling mode to deter-mine when an overlapped operation has completed, get this error code until the operation is complete. WSA_IO_PENDING Overlapped operations will complete later. 997 The application has initiated an overlapped operation that cannot be completed immediately. A completion indication will be given later when the operation has been completed. WSA_NOT_ENOUGH_MEMORY Insufficient memory available. 8 An application used a Windows Sockets function that directly maps to a Windows function. The Windows function is indicating a lack of required memory resources. WSA_OPERATION_ABORTED Overlapped operation aborted. 995 An overlapped operation was canceled due to the closure of the socket, or the execution of the SIO_FLUSH command in WSAIoctl. WSAINVALIDPROCTABLE Invalid procedure table from service provider. 10104 A service provider returned a bogus procedure table to Ws2_32.dll. (This is usually caused by one or more of the function pointers being null.) WSAINVALIDPROVIDER Invalid service provider version number. 10105 A service provider returned a version number other than 2.0. WSAPROVIDERFAILEDINIT Unable to initialize a service provider. 10106 Either a service provider's DLL could not be loaded (LoadLibrary failed) or the provider's WSPStartup/NSPStartup function failed. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Winsock 2 Error Codes WSASYSCALLFAILURE System call failure. 10107 Generic error code, returned under various conditions. 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: 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. | Winsock 2 Error Codes | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnTcpClose OnTcpClose CAPL Function Overview » TCP/IP API » OnTcpClose Syntax void OnTcpClose( dword socket, long result) Function Provided the CAPL program implements this callback it is dispatched when a TCP socket receives a close notification. Parameters socket The socket handle. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnTcpConnect OnTcpConnect CAPL Function Overview » TCP/IP API » OnTcpConnect Syntax void OnTcpConnect( dword socket, long result) Function Provided the CAPL program implements this callback it is dispatched when an asynchronous connection operation completes. Parameters socket The socket handle. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnTcpListen OnTcpListen CAPL Function Overview » TCP/IP API » OnTcpListen Syntax void OnTcpListen( dword socket, long result) Function Provided the CAPL program implements this callback it is dispatched when a connection request for the specified socket is received. Parameters socket The socket handle. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnTcpReceive 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 The socket handle. 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 The buffer into which the data was stored. size The size of the received data. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnTcpSend 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 The socket handle. result The result code of the asynchronous operation. If the operation completed successfully the value is zero. Otherwise the value is non-zero. buffer The buffer provided with the send operation. size The number of bytes sent. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnUdpReceiveFrom 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 The socket handle. 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 The buffer into which the data was stored. size The number of bytes received. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnUdpSendTo 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 The socket handle. result The result code of the asynchronous operation. If the operation completed successfully the value is zero. Otherwise the value is non-zero. buffer The buffer provided with the send operation. size The number of bytes sent. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpBind IpBind CAPL Function Overview » TCP/IP API » IpBind Syntax long IpBind( dword socket, dword address, dword port) Method socket.Bind( dword address, dword port) Function The function associates an address and a port with the specified socket. Parameters socket The socket handle. address The local address in network-byte order. port The local port in host-byte order. Return values 0: The function completed successfully. WSA_INVALID_PARAMETER (87): The specified socket was invalid. SOCKET_ERROR (-1): The function failed. Call IpGetLastError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetAdapterAddress IpGetAdapterAddress CAPL Function Overview » TCP/IP API » IpGetAdapterAddress Syntax long IpGetAdapterAddress( dword index, dword address[],dword count) 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 The 1-based network interface index. address The array used to store the addresses in network-byte order. count The size of the address array. Return values 0: The function completed successfully. ERROR_NOT_ENOUGH_MEMORY (8): The address array was insufficient. WSA_INVALID_PARAMETER (87): The specified network interface index was invalid. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetAdapterAddressAsString IpGetAdapterAddressAsString CAPL Function Overview » TCP/IP API » IpGetAdapterAddressAsString Syntax long IpGetAdapterAddressAsString( dword index, char address[], dword count) Function The function retrieves the string representation of the first address associated with the specified network interface. Parameters index The 1-based network interface index. address The buffer used to store the address string in dot notation. count The size of the address buffer. Return values 0: The function completed successfully. ERROR_NOT_ENOUGH_MEMORY (8): The address buffer was insufficient. WSA_INVALID_PARAMETER (87): The specified network interface index was invalid. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetAdapterCount IpGetAdapterCount CAPL Function Overview » TCP/IP API » IpGetAdapterCount Syntax dword IpGetAdapterCount() Function The function returns the number of network interfaces for the local computer, not including the loopback interface. Parameters — Return values The number of network interfaces. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetAdapterDescription IpGetAdapterDescription CAPL Function Overview » TCP/IP API » IpGetAdapterDescription Syntax long IpGetAdapterDescription( dword index, char name[], Function The function retrieves the description of the specified network interface. Parameters index dword count) The 1-based network interface index. name The buffer used to store the description. count The size of the name buffer. Return values 0: The function completed successfully. ERROR_NOT_ENOUGH_MEMORY (8): The name buffer was insufficient. WSA_INVALID_PARAMETER (87): The specified network interface index was invalid. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetAdapterGateway IpGetAdapterGateway CAPL Function Overview » TCP/IP API » IpGetAdapterGateway Syntax long IpGetAdapterGateway( dword index, dword address[], dword count) Function The function retrieves the default gateway address associated with the specified network interface. Parameters index The 1-based network interface index. address The array used to store the gateway addresses in network-byte order. count The size of the address array. Return values 0: The function completed successfully. ERROR_NOT_ENOUGH_MEMORY (8): The address array was insufficient. WSA_INVALID_PARAMETER (87): The specified network interface index was invalid. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetAdapterGatewayAsString IpGetAdapterGatewayAsString CAPL Function Overview » TCP/IP API » IpGetAdapterGatewayAsString Syntax long IpGetAdapterGatewayAsString( dword index, char address[], dword count) Function The function retrieves the string representation of the default gateway address associated with the specified network interface. Parameters index The 1-based network interface index. address The buffer used to store the gateway address string in dot notation. count The size of the address buffer. Return values 0: The function completed successfully. ERROR_NOT_ENOUGH_MEMORY (8): The address buffer was insufficient. WSA_INVALID_PARAMETER (87): The specified network interface index was invalid. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetAdapterMask IpGetAdapterMask CAPL Function Overview » TCP/IP API » IpGetAdapterMask Syntax long IpGetAdapterMask( dword index, dword mask[], dword count) Function The function retrieves the address masks (subnet masks) associated with the specified network interface. Parameters index The 1-based network interface index. mask The array used to store the address masks in network-byte order. count The size of the mask array. Return values 0: The function completed successfully. ERROR_NOT_ENOUGH_MEMORY (8): The mask array was insufficient. WSA_INVALID_PARAMETER (87): The specified network interface index was invalid. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetAdapterMaskAsString IpGetAdapterMaskAsString CAPL Function Overview » TCP/IP API » IpGetAdapterMaskAsString Syntax long IpGetAdapterMaskAsString( dword index, char mask[], dword count) Function The function retrieves the string representation of the first address mask associated with the specified network interface. Parameters index The 1-based network interface index. mask The buffer used to store the address mask string in dot notation. count The size of the mask buffer. Return values 0: The function completed successfully. ERROR_NOT_ENOUGH_MEMORY (8): The mask buffer was insufficient. WSA_INVALID_PARAMETER (87): The specified network interface index was invalid. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetAddressAsNumber IpGetAddressAsNumber CAPL Function Overview » TCP/IP API » IpGetAddressAsNumber Syntax dword IpGetAddressAsNumber( char address[]) Function The function converts an address string in dot notation to it's numerical value in networkbyte order. Parameters address The address to be converted. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetAddressAsString IpGetAddressAsString CAPL Function Overview » TCP/IP API » IpGetAddressAsString Syntax long IpGetAddressAsString( dword numericAddress, char address[], dword count) 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 The address to be converted. address The buffer used to store the converted address. count The size of the address buffer. Return values 0: The function completed successfully. ERROR_NOT_ENOUGH_MEMORY (8): The address buffer was insufficient. WSA_INVALID_PARAMETER (87): The specified address was invalid. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetLastError IpGetLastError CAPL Function Overview » TCP/IP API » IpGetLastError Syntax long 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetLastSocketError IpGetLastSocketError CAPL Function Overview » TCP/IP API » IpGetLastSocketError Syntax long IpGetLastSocketError( dword socket) Method socket.GetLastSocketError() Function The function returns the Winsock 2 error code of the last operation that failed on the specified socket. Parameters socket The socket handle. Return values WSA_INVALID_PARAMETER (87): The specified socket was invalid. Any other value: The error code as provided by the Winsock 2 WSAGetLastError function. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpGetLastSocketErrorAsString IpGetLastSocketErrorAsString CAPL Function Overview » TCP/IP API » IpGetLastSocketErrorAsString Syntax long IpGetLastSocketErrorAsString( dword socket, Method socket.GetLastSocketErrorAsString( char text[], dword count) Function The function retrieves the error message of the last operation that failed on the specified socket (see Winsock 2 error code). Parameters socket char text[], dword count) The socket handle. text The buffer used to store the error message. count The size of the text buffer. 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. WSA_INVALID_PARAMETER (87): The specified socket was invalid. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: IpSetSocketOption IpSetSocketOption CAPL Function Overview » TCP/IP API » IpSetSocketOption Syntax long IpSetSocketOption( dword socket, long level, long name, long value) Method socket.SetSocketOption( long level, long name, long value) Function The function modifies a socket option. Parameters socket The socket handle. level The level at which the option is defined, e.g. SOL_SOCKET (0xFFFF). name The socket option name to be modified, e.g. SO_BROADCAST (0x0020). value The value to be set for the socket option. Return values 0: The function completed successfully. WSA_INVALID_PARAMETER (87): The specified socket was invalid. SOCKET_ERROR (-1): The function failed. Call IpGetLastError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TcpAccept TcpAccept CAPL Function Overview » TCP/IP API » TcpAccept Syntax dword TcpAccept( dword socket) As constructor function TcpSocket::Accept( dword socket) 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 The socket handle. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TcpClose TcpClose CAPL Function Overview » TCP/IP API » TcpClose Syntax long TcpClose( dword socket) Destructor socket.close() Function The function closes the TCP socket. Upon successful completion the passed socket is no longer valid. Parameters socket The socket to be closed. Return values 0: The function completed successfully. WSA_INVALID_PARAMETER (87): The specified socket was invalid. SOCKET_ERROR (-1): The function failed. Call IpGetLastError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TcpConnect TcpConnect CAPL Function Overview » TCP/IP API » TcpConnect Syntax long TcpConnect( dword socket, dword address, dword port) Method socket.Connect( dword address, dword port) 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 The socket handle. address The address of the destination in network-byte order. port The port of the destination in host-byte order. Return values 0: The function completed successfully. SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TCPGetRemoteAddress TCPGetRemoteAddress CAPL Function Overview » TCP/IP API » TCPGetRemoteAddress Syntax dword TcpGetRemoteAddress(dword socket) Function This function retrieves the remote address of the specified socket. Parameters socket The socket handle. Return values The address of the remote host in network-byte order. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TCPGetRemoteAddressAsString TCPGetRemoteAddressAsString CAPL Function Overview » TCP/IP API » TCPGetRemoteAddressAsString Syntax long TcpGetRemoteAddressAsString(dword socket, char buffer[], dword size) Function This function retrieves the remote address of the specified socket in Internet standard dotted-decimal format. Parameters socket The socket handle. buffer The buffer used to store the converted address. size The size of the address buffer. Return values 0: The function completed successfully. 1: The provided buffer is too small. 2: Anything else failed (e.g. wrong socket parameter). Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TcpListen TcpListen CAPL Function Overview » TCP/IP API » TcpListen Syntax long TcpListen( dword socket) 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 The socket handle. Return values 0: The function completed successfully. WSA_INVALID_PARAMETER (87): The specified socket was invalid. SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TcpOpen TcpOpen CAPL Function Overview » TCP/IP API » TcpOpen Syntax dword TcpOpen( dword address, dword port) As constructor function TcpSocket::Open( dword address, dword port) 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 The local address in network-byte order to be used with the socket. port The port in host-byte order to be used with the socket. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TcpReceive TcpReceive CAPL Function Overview » TCP/IP API » TcpReceive Syntax long TcpReceive( dword socket, char buffer[], dword size) Method socket.Receive( char buffer[], dword size) 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 The socket handle. buffer The buffer used to store the incoming data. size The size of the data buffer. Return values 0: The function completed successfully. WSA_INVALID_PARAMETER (87): The specified socket was invalid. SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TcpSend TcpSend CAPL Function Overview » TCP/IP API » TcpSend Syntax long TcpSend( dword socket, char buffer[], dword size) Method socket.Send( char buffer[], dword size) 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 The socket handle. buffer The buffer containing the data to be sent. size The size of the data to be sent. Return values 0: The function completed successfully. WSA_INVALID_PARAMETER (87): The specified socket was invalid. SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TcpShutdown TcpShutdown CAPL Function Overview » TCP/IP API » TcpShutdown Syntax long TcpShutdown( dword socket) Method socket.Shutdown( dword socket) Function The function disables send operations on the specified socket. This function may be used to shutdown a TCP connection. Parameters socket The socket handle. Return values 0: The function completed successfully. SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: UdpClose UdpClose CAPL Function Overview » TCP/IP API » UdpClose Syntax long UdpClose( dword socket) Destructor socket.Close() Function The function closes the UDP socket. Upon successful completion the passed socket is no longer valid. Parameters socket The socket to be closed. Return values 0: The function completed successfully. WSA_INVALID_PARAMETER (87): The specified socket was invalid. SOCKET_ERROR (-1): The function failed. Call IpGetLastError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: UdpOpen UdpOpen CAPL Function Overview » TCP/IP API » UdpOpen Syntax dword UdpOpen( dword address, dword port) As constructor function UdpSocket::Open( dword address, dword port) 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 The local address in network-byte order to be used with the socket. port The port in host-byte order to be used with the socket. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: UdpReceiveFrom UdpReceiveFrom CAPL Function Overview » TCP/IP API » UdpReceiveFrom Syntax long UdpReceiveFrom( dword socket, char buffer[], dword size) Method socket.ReceiveFrom( char buffer[], dword size) 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 The socket handle. buffer The buffer used to store the incoming data. size The size of the data buffer. Return values 0: The function completed successfully. WSA_INVALID_PARAMETER (87): The specified socket was invalid. SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: UdpSendTo 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 The socket handle. address The address of the destination in network-byte order. port The port of the destination in host-byte order. buffer The buffer containing the data to be sent. size The size of the data to be sent. Return values 0: The function completed successfully. WSA_INVALID_PARAMETER (87): The specified socket was invalid. SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific error code. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 — — • 7.0 SP5: methods — — • Example — | Classes and Objects in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: File Functions 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. | File Search Procedure | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: File Search Procedure File Search Procedure CAPL Function Overview » General » File Search Procedure Single host environment A file search procedure is used to determine the absolute file path. There are different procedures for writing and reading files. File search order on read access: 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. File search order on write access 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. Distributed simulation environment In a distributed simulation environment (CANoe RT or VN8900) it is required to pre-define all files to be accessed in CAPL programs in the CANoe simulation or test setup under Configuration|Options|Configuration Settings|User Files. 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Runtime Errors Runtime Errors CAPL Function Overview » General » Runtime Errors A number of runtime errors are monitored: • 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: String Literal String Literal CAPL Function Overview » General » String Literal A string literal is a character string in quotation marks: "This is a character string" Escape Sequences Certain characters are displayed as a combination of characters with a preceding backslash (escape sequence) within a character string, e.g: Description Display inside character strings New line \n Tabulator \t Backslash \\ Carriage return \r Backspace \b Double quotation mark \" Single quotation mark \' Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Example: writeProfileInt, writeProfileFloat, writeProfileString, getProfileInt, getProfileFloat, getProfileString, getProfileArray Example: writeProfileInt, writeProfileFloat, writeProfileString, getProfileInt, getProfileFloat, getProfileString, getProfileArray CAPL Function Overview » General » Example: writeProfileInt, writeProfileFloat, writeProfileString, getProfileInt, getProfileFloat, getProfileString, getProfileArray on key 'i' { int defaultPara1; int returnParaInt; int returnArray; int counter; double defaultPara2; double returnParaFloat; char buffer [1280]; char buffarray[640]; 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"); write("Integer: %d", returnParaInt); write("Float: %f", returnParaFloat); write("String: %s", buffer); if (returnArray == 0) { write("Non array content!"); } else { for (counter = 0; counter <= returnArray - 1; counter++) { write("Array: %d", buffarray[counter]); } } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Example: ReplayStart, ReplayStop, ReplaySuspend, ReplayResume, ReplayState Example: ReplayStart, ReplayStop, ReplaySuspend, ReplayResume, ReplayState CAPL Function Overview » General » Example: ReplayStart, ReplayStop, ReplaySuspend, ReplayResume, ReplayState 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; }; } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Example: Sequencial File Access Example: Sequencial File Access CAPL Function Overview » General » Example: Sequencial File Access // // // // // // In this CAPL programm, the test file test.dat will be opened on start of measurement. After pressing the key ‘a’, the data will be copied bytewise to the message 100 and is transmitted in blocks of 8 data bytes every 10 ms. Pressing the key ‘r’ rewinds the data file to the beginning and then restarts the transmission. variables { message 100 msg = {DLC=8}; char filename[50] = "test.dat"; long handle; msTimer ReadNextBlock; } // open data file on start of measurement on start { handle = seqFileLoad(filename); if (handle <= 0) { write ("error opening file"); write("Handle = %d", handle); } else { write ("file %s opened",filename); write ("Press key ‘a’ to start reading the file"); } } // close data file on stop of measurement on stopMeasurement { if (handle > 0) { if (seqFileClose(handle) == 0) { write ("file closed"); } else { write ("error closing file"); } } } // start file transmission on key 'a' { setTimer(ReadNextBlock,10); } // reset file transmission on key 'r' { seqFileRewind(handle); setTimer(ReadNextBlock,10); } // transmit data file in blocks of 8 bytes on timer ReadNextBlock { int n; char buffer[8]= " "; n = seqFileGetBlock(buffer,8,handle); msg.byte(0)= buffer[0]; msg.byte(1)= buffer[1]; msg.byte(2)= buffer[2]; msg.byte(3)= buffer[3]; msg.byte(4)= buffer[4]; msg.byte(5)= buffer[5]; msg.byte(6)= buffer[6]; msg.byte(7)= buffer[7]; output(msg); if (n >= 0) { setTimer(ReadNextBlock,10); } else { write("No character read"); } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Example: writeClear, writeCreate, writeDestroy, writeEx, writeLineEx Example: writeClear, writeCreate, writeDestroy, writeEx, writeLineEx CAPL Function Overview » General » Example: writeClear, writeCreate, writeDestroy, writeEx, writeLineEx variables { dword mNewPage; // Sink identifier } on start { //Create a new page at the write window mNewPage= writeCreate("New Page"); //Configure the page so that its content is logged writeConfigure(mNewPage, 20, 1, "c:\\temp\\writelog.txt"); //Clear content of CAPL page writeclear(1); //Show the description of the program writeLineEx(mNewPage,2,"This program shows the keyboard sequence in a new created Page "); writeLineEx(mNewPage,4,"\nKeyboard sequence: "); } 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Example: File Functions Example: File Functions CAPL Function Overview » General » Example: File Functions 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."); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Example: File Functions } } on StopMeasurement { fileClose (glbHandle); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: CAN CAPL Functions (Only available with CAN!) CAN CAPL Functions (Only available with CAN!) CAPL Function Overview » CAN CAPL Functions Functions Short Description BusLoad Returns the current busload of a channel. ChipState Returns the current chip state of the CAN controller. ErrorFrameCount Returns the number of error frames on a channel since start of measurement. ErrorFrameRate Returns the current rate of CAN error messages of a channel. ExtendedFrameCount Returns the number of extended CAN frames on a channel since start of measurement. ExtendedFrameRate Returns the current rate of extended CAN frames on a channel. 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. OverloadFrameRate Returns the current rate of CAN overload frames on a channel. PeakLoad Returns the peakload of a channel. RxChipErrorCount Returns the current Rx error count in the receiver of a channel. StandardFrameCount Returns the number of standard CAN frames on a channel since start of measurement. StandardFrameRate Returns the current rate of standard CAN frames on a channel. StandardRemoteFrameCount Returns the number of standard remote CAN frames on channel x since start of measurement. StandardRemoteFrameRate Returns the current rate of standard CAN frames on a channel. TxChipErrorCount Returns the current number of Tx errors in the CAN receiver of a channel. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: BusLoad BusLoad CAPL Function Overview » CAN » BusLoad Syntax long BusLoad () Method CANx.BusLoad Function Returns the current busload of channel x. Valid x values: 1 ... 32 Return values Current busload of channel x in percent. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("CAN1 busload = %d", CAN1.BusLoad); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ChipState ChipState CAPL Function Overview » CAN » ChipState Syntax long ChipState () Method CANx.ChipState Function Returns the current chip state of the CAN x controller. Valid x values: 1 ... 32 Return values Chip state of the CAN x controller. See the following table for a description of the return values. 0 Value not available 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Chip state of CAN1 = %d", CAN1.ChipState); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ErrorFrameCount ErrorFrameCount CAPL Function Overview » CAN » ErrorFrameCount Syntax long ErrorFrameCount () Method CANx.ErrorFrameCount Function Returns the number of error frames on channel x since start of measurement. Valid x values: 1 ... 32 Return values Number of error frames on channel x since start of measurement. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Number of error frames on CAN1 = %d", CAN1.ErrorFrameCount); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ErrorFrameRate ErrorFrameRate CAPL Function Overview » CAN » ErrorFrameRate Syntax long ErrorFrameRate () Method CANx.ErrorFrameRate Function Returns the current rate of CAN error messages of channel x. Valid x values: 1 ... 32 Return values Current rate of CAN error messages on channel x in messages per second. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Rate of error messages on CAN1 = %d", CAN1.ErrorFrameRate); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ExtendedFrameCount ExtendedFrameCount CAPL Function Overview » CAN » ExtendedFrameCount Syntax long ExtendedFrameCount () Method CANx.ExtendedFrameCount Function Returns the number of extended CAN frames on channel x since start of measurement. Valid x values: 1 ... 32 Return values Number of extended CAN frames on channel x since start of measurement Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Number of extended frames on CAN1 = %d", CAN1.ExtendedFrameCount); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ExtendedFrameRate ExtendedFrameRate CAPL Function Overview » CAN » ExtendedFrameRate Syntax long ExtendedFrameRate () Method CANx.ExtendedFrameRate Function Returns the current rate of extended CAN frames on channel x. Valid x values: 1 ... 32 Return values Current rate of extended CAN frames on channel x in messages per second. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Rate of extended frames on CAN1 = %d", CAN1.ExtendedFrameRate); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ExtendedRemoteFrameCount ExtendedRemoteFrameCount CAPL Function Overview » CAN » ExtendedRemoteFrameCount Syntax long ExtendedRemoteFrameCount () Method CANx.ExtendedRemoteFrameCount Function Returns the number of extended remote CAN messages on channel x since start of measurement. Valid x values: 1 ... 32 Return values Number of extended remote CAN messages on channel x since start of measurement. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Number of extended remote messages on CAN1 = %d", CAN1.ExtendedRemoteFrameCount); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ExtendedRemoteFrameRate ExtendedRemoteFrameRate CAPL Function Overview » CAN » ExtendedRemoteFrameRate Syntax long ExtendedRemoteFrameRate () Method CANx.ExtendedRemoteFrameRate Function Returns the current rate of extended remote CAN messages on channel x. Valid x values: 1 ... 32 Return values Current rate of extended remote CAN messages on channel x in frames per second. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Rate of extended remote messages on CAN1 = %d", CAN1.ExtendedRemoteFrameRate); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OverloadFrameCount OverloadFrameCount CAPL Function Overview » CAN » OverloadFrameCount Syntax long OverloadFrameCount () Method CANx.OverloadFrameCount Function Returns the number of CAN overload frames on channel x since start of measurement. Valid x values: 1 ... 32 Return values Number of CAN overload frames on channel x since start of measurement. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Number of overload frames on CAN1 = %d", CAN1.OverloadFrameCount); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OverloadFrameRate OverloadFrameRate CAPL Function Overview » CAN » OverloadFrameRate Syntax long OverloadFrameRate () Method CANx.OverloadFrameRate Function Returns the current rate of CAN overload frames on channel x. Valid x values: 1 ... 32 Return values Current rate of CAN overload frames on channel x in messages per second. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Rate of overload frames on CAN1 = %d", CAN1.OverloadFrameRate); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: PeakLoad PeakLoad CAPL Function Overview » CAN » PeakLoad Syntax long PeakLoad () Method CANx.PeakLoad Function Returns the peakload of channel x. Valid x values: 1 ... 32 Return values Peakload of channel x in percent. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("CAN1 peakload = %d", CAN1.PeakLoad); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: RxChipErrorCount RxChipErrorCount CAPL Function Overview » CAN » RxChipErrorCount Syntax long RxChipErrorCount () Method CANx.RxChipErrorCount Function Returns the current Rx error count in the receiver of channel x. Valid x values: 1 ... 32 Return values Current error count in the receiver of channel x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Rx error count in the receiver of CAN1 = %d", CAN1.RxChipErrorCount); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StandardFrameCount StandardFrameCount CAPL Function Overview » CAN » StandardFrameCount Syntax long StandardFrameCount () Method CANx.StandardFrameCount Function Returns the number of standard CAN frames on channel x since start of measurement. Valid x values: 1 ... 32 Return values Number of standard CAN frames on channel x since start of measurement. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Number of standard frames on CAN1 = %d", CAN1.StandardFrameCount); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StandardFrameRate StandardFrameRate CAPL Function Overview » CAN » StandardFrameRate Syntax long StandardFrameRate () Method CANx.StandardFrameRate Function Returns the current rate of standard CAN frames on channel x. Valid x values: 1 ... 32 Return values Current rate of standard CAN frames on channel x in messages per second. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Rate of standard frames on CAN1 = %d", CAN1.StandardFrameRate); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StandardRemoteFrameCount StandardRemoteFrameCount CAPL Function Overview » CAN » StandardRemoteFrameCount Syntax long StandardRemoteFrameCount () Method CANx.StandardRemoteFrameCount Function Returns the number of standard remote CAN frames on channel x since start of measurement. Valid x values: 1 ... 32 Return values Number of standard remote CAN frames on channel x since start of measurement. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Number of standard remote frames on CAN1 = %d", CAN1.StandardRemoteFrameCount); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: StandardRemoteFrameRate StandardRemoteFrameRate CAPL Function Overview » CAN » StandardRemoteFrameRate Syntax long StandardRemoteFrameRate () Method CANx.StandardRemoteFrameRate Function Returns the current rate of standard remote CAN frames of channel x. Valid x values: 1 ... 32 Return values Current rate of standard remote CAN frames of channel x in messages per second. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Rate of standard remote frames of CAN1 = %d", CAN1.StandardRemoteFrameRate); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: TxChipErrorCount TxChipErrorCount CAPL Function Overview » CAN » TxChipErrorCount Syntax long TxChipErrorCount () Method CANx.TxChipErrorCount Function Returns the current number of Tx errors in the CAN receiver of channel x. Valid x values: 1 ... 32 Return values Current number of errors in the CAN receiver of channel x. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 CAN • • Example write ("Number of Tx errors in receiver of CAN1 = %d", CAN1.TxChipErrorCount); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) LIN CAPL Functions (Only available with Option .LIN!) CAPL Function Overview » LIN CAPL Functions The following LIN CAPL functions are available: APIs for Configuring and Controlling a simulated LIN Master APIs Short description getSignal Gets the value of a signal. linActivateCollisionResolution Activates or deactivates the Master node’s automatic collision resolution of an event-triggered frame. linActivateSlot Reactivates a schedule table slot defined in the LIN database file. linChangeSchedTable Switches from the current schedule table to another one. linChangeWakeupSettings Changes the wake-up setting. linCheckRespError Queries the response_error flags of all Slave nodes defined in the LIN network. linDeactivateSlot Deactivates the specified slot of schedule table. linSendAsSporadic Configures an associated frame as being ready for transmission. linSendSleepModFrm Leads to a transmission of a go-to-sleep-command. linSendWakeup Sends Wakeup frames. linSetBreakLength Changes length of break/synch symbol parts. linSetGlobalInterByteSpace Changes the inter-byte space for all frame responses. 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. linSetInterframeSpace Sets the minimum inter-frame space. 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) linSimulateETFCollision Causes collisions for next coming header(s) of an event-triggered frame. linStartScheduler Starts the internal scheduler. linStopScheduler Stops the internal scheduler. output Applies frame header on the bus or reconfigures response data of LIN frame. setSignal Sets the transmitted signal to the accompanying value. APIs for Configuring and Controlling a simulated LIN Slave APIs Short description getSignal Gets the value of a signal. linActivateResps Reactivates all frame responses published by the calling Slave node according to the LIN database file. linActivateGlobalNetworkManagement Activates/deactivates network management for the entire LIN network. linChangeDlc Changes the Data Length Code of a LIN frame during the measurement. linDeactivateResps Deactivates frame responses for all frames published by the calling slave node. linETFSendOnSignalUpdate Activates/deactivates the automatic responses on a certain eventtriggered frame request in the case of a signal update on its associated frame(s). linETFSetDirtyFlag Sets/clears the dirty flag of an associated frame. linGetBusIdleTimeout Returns the currently set bus idle timeout. linGetOEMDataInd Queries the data indication bit of a Slave node. linGetOEMSleepInd Queries the sleep indication bit of a Slave node. linGetOEMWakeupInd Queries the wakeup indication bit of a Slave node. linGetRespError Queries the response error flag of the calling Slave node or of the Slave node. linResetRespBaudrate Resets a response baudrate for a specified frame to the master baudrate. linResetNAD Resets NAD of the Slave node determined by the CAPL program context to its initial NAD. linResetSlave Resets the NAD of the modeled Slave node. linSendWakeup Sends Wakeup frames. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) linSetRespBaudrate Sets a response baudrate for a specified frame. linSetBusIdleTimeout Sets a new bus idle timeout. linSetGlobalInterByteSpace Changes the inter-byte space for all frame responses. 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. linSetNAD Changes the node address of the calling simulated slave. linSetOEMDataInd Sets/resets the data indication bit for a calling slave node. linSetOEMDataIndTime Sets the time in milliseconds after which a simulated slave automatically sets its data indication bit. 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. output Applies frame header on the bus or reconfigures response data of LIN frame. setSignal Sets the transmitted signal to the accompanying value. APIs for Configuring and Controlling Network Management (Sleep/Wakeup) APIs Short description linActivateGlobalNetworkManagement Activates/deactivates network management for the entire LIN network. linActivateSlaveNetworkManagement Activates/deactivates network management for the calling Slave node. linBusIsAwake Inverts a specified bit when the next bus event for a specified ID occurs. linChangeWakeupSettings Changes the wake-up setting. linCheckOEMDataInd Checks the data indication bits of all slave nodes defined in the LIN network. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) 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. linGetOEMDataInd Queries the data indication bit of a Slave node. linGetOEMSleepInd Queries the sleep indication bit of a Slave node. linGetOEMWakeupInd Queries the wakeup indication bit of a Slave node. linGetRespError Queries the response error flag of the calling Slave node or of the Slave node. linSendSleepModFrm Leads to a transmission of a go-to-sleep-command. linSendWakeup Sends Wakeup frames. linSetOEMDataInd Sets/resets the data indication bit for a calling slave node. linSetOEMDataIndTime Sets the time in milliseconds after which a simulated slave automatically sets its data indication bit. 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. LIN Analysis Feature Set Functions Short description getSignal Gets the value of a signal. linBits2Time Converts specified bit time to an absolute time. linBits2Time_ns linBusIsAwake Queries the awake state of the LIN bus. linGetByteEndTime Retrieves a data byte timestamp of a certain LIN bus event. linGetChecksum Returns the checksum of a LIN frame or LIN checksum error. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) linGetDlc Queries the Data Length Code of a LIN frame. linGetEndOfHeader Retrieves a timestamp of the header part for a certain LIN bus event. linGetHWReceiveAccuracy Queries the receive resolution of the LIN hardware. linGetHWTransmitAccuracy Queries the transmit resolution of the LIN hardware. linGetMeasBaudrate Retrieves results of a last baud rate measurement. linGetMeasEdgeTimeDiffs Retrieves the time differences between edges. linGetProtectedID Calculates protected ID for the corresponding LIN frame identifier. linGetResponseData Queries LIN frame response data for specified FrameId on certain LIN channel. linGetStartOfFrame Retrieves a start timestamp of a LIN bus event. 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. linGetWakeupLength Retrieves a length of an occurred Wakeup frame. 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. linResetScopeTrigger Resets the oscilloscope trigger condition(s). linSetBaudrateDetectionRange Increases/decreases the baud rate detection range. linSetMaxHeaderLength Sets the maximum header length in bit times. linSetRespTolerance Sets the response tolerance for a specified frame in percent. linSetScopeTrigger Defines trigger conditions for an oscilloscope. linSetValidBreakLimits Sets limits for the accepted sync break and delimiter lengths. linTime2Bits Converts specified system time to bit time. linTime2Bits_ns Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) LIN Disturbance Feature Set APIs Short description linDetectMultipleErrors Instructs LIN Hardware to enable/disable detection of more than one error per a LIN frame. 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. linDisturbRespWithBitStream Configures the LIN hardware to disturb the specified response with a bit stream. linDisturbRespWithHeader Configures the LIN hardware to disturb the specified response with a new header. linDisturbRespWithVariableBitStream Configures the LIN hardware to disturb the specified response with a variable bit stream. linGetDominantTimeout Returns the dominant timeout of the current channel’s transceiver in nanoseconds. linInvertHeaderBit Inverts the specified bit in the next LIN header. linInvertHeaderBitEx Inverts the specified number of 1/16th bits at the specified position in the next LIN header. 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. linInvertRespBitEx Inverts the specified number of 1/16th bits at the specified position in the next LIN message’s response with the specified frame ID. linInvertMultipleRespBits Inverts the multiple bits in specified locations in the next LIN header. linDeactivateBitInversion Cancels a previously activated bits inversion for LIN header or response. linSendDominantSignal Sends a dominant signal of a specified length. linSetGlobalTimeoutPrevention Activates/deactivates the global timeout prevention for transceivers with a dominant timeout. linSetRespDisturbance Activates a disturbance in the response space of the specified LIN frame. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) linResetRespDisturbance Deactivates the disturbance in the response space of the specified frame. linStartDisturbance Starts a disturbance on the bus. linStopDisturbance Stops the disturbance on the bus. LIN Stress Feature Set Functions Short description linActivateFlashMode Activates the flash mode on high speed capable transceivers. linGetFallingEdgesOfDisturbedByte Retrieves timestamps of all falling edges in the disturbed byte or in the pseudo-byte caused by the last bit inversion. 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. linSetBaudrate Changes the baud rate during the measurement. linSetSchedulerJitter Sets/resets the jitter mode and the jitter of the LIN hardware scheduler. linSetBreakLength Changes length of break/synch symbol parts. linSendSamplingTestHeader Sends a slave response header. linSetChecksumError Sets/resets a checksum error of a LIN frame. linSetManualChecksum Sets a checksum (that is usually not a correct one) for a LIN frame. linResetManualChecksum Sets the correct checksum of 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. linSetGlobalInterByteSpace Changes the inter-byte space for all frame responses. linSetInterframeSpace Sets the minimum inter-frame space. 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. linResetRespBaudrate Resets a response baudrate for a specified frame to the master baudrate. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) linSetRespBaudrate Sets a response baudrate for a specified frame. linSendBitStream Sends an arbitrary bit stream on the LIN bus. linSendVariableBitStream Sends an arbitrary bit stream with bits of variable length. linSetRespBitStream Sets up a bit stream as the response to the specified frame. linResetRespBitStream Deactivates the bit stream response of the specified frame. Test Feature Set for LIN Functions Short description 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. TestGetWaitLinETFSingleResponseData Calls up the event content, if LIN Event-triggered frame with a single response for the specified associated frame is the last event that triggers a 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. TestGetWaitLinSyncErrorData Retrieves the data of a synchronisation error that triggered the last 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. TestJoinMessageEvent Adds an event of type LIN Unconditional/Event-triggered Frame to the set of joined events. TestJoinLinCSErrorEvent Adds an event of type checksum error to the set of joined events. TestJoinLinETFSingleResponseEvent Adds an event of type LIN event-triggered Frame with a single response for the specified associated frame 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) TestJoinLinWakeupEvent Adds an event of type LIN Wakeup frame to the set of joined events. TestJoinLinSyncErrorEvent Adds an event of type synchronisation error to the set of joined events. 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. TestWaitForLinReceiveError Waits for the occurrence of LIN Receive Error event. TestWaitForLinSyncError Waits for a synchronisation error for the specified amount of time. TestWaitForLinTransmError Waits for the occurrence of LIN Transmission Error event. TestWaitForLinWakeupFrame Waits for the occurrence of LIN Wakeup frame. TestWaitForMessage Waits for the occurrence of LIN frame with a valid response. Test Service Library for LIN Functions Short description 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_MsgDistViolation This check is useful for spontaneous messages where one message depends to another message; e.g. for token-ring initializations for network management. ChkStart_LINDiagDelayTimesViolation Checks the values of P2_min and ST_min. ChkStart_LINETFViolation Checks the format LIN Event-triggered frame response. ChkStart_LINHeaderToleranceViolation Checks the LIN header transmission time. ChkStart_LINMasterBaudrateViolation Checks the LIN Master baud rate. ChkStart_LINMasterInitTimeViolation Checks an initialization time of LIN Master. ChkStart_LINReconfRequestFormatViolation Checks the format of LIN configuration requests. ChkStart_LINRespErrorSignal Checks the LIN Response_Error signal. ChkStart_LINRespToleranceViolation Checks the LIN response transmission time. ChkStart_LINSchedTableViolation Checks a certain LIN schedule table for correspondence with the database definition. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) ChkStart_LINSyncBreakTimingViolation Checks the timing of the synchronization break field in LIN headers. ChkStart_LINSyncDelTimingViolation Checks the timing of the synchronization break field in LIN headers. ChkStart_LINWakeupReqLengthViolation Checks the length of LIN Wake-up request. ChkStart_LINWakeupRetryViolation Checks number of LIN wakeup signals and the time between them. ChkStart_MsgSignalValueRangeViolation This check is useful to supervise the value of signals. ChkStart_MsgSignalValueInvalid ChkStart_SignalCycleTimeViolation Checks the occurrences of a signal. ChkStart_SignalValueChange Checks the physical value of a signal or an environment variable. The following LIN event procedures are available: Event Procedures Access to the data of the corresponding event is possible in event procedures through this. The procedures are sub-divided into the following events: Message events Short description on linMessage Is called on the receipt of a valid LIN frame. Controller events Short description 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 linSchedulerModeChance Is called when an error occurred during a frame transmission. on linWakeupFrame Is called when the LIN hardware detects a wakeup signal on the bus. Error events Short description on linCsError Is called when a frame was transmitted without a failure, but with an incorrect checksum. on linReceiveError Is called when an error occurred during a frame transmission. on linSlaveTimeout Is called for SlaveTimeouts. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN CAPL Functions (Only available with Option .LIN!) on linSyncError Is called when the LIN hardware was unable to become synchronized to an external master. on linTransmError Is called when no Slave responded to a transmission request. The following LIN selectors are available: Selectors Selectors Short description linBaudrateEvent Detailed description of the linBaudrateEvent selectors. linCsError Detailed description of the linCsError selectors. linDlcInfo Detailed description of the linDlcInfo selectors. linHeader Detailed description of the linHeader selectors. linMessage Detailed description of the linMessage selectors. linReceiveError Detailed description of the linReceiveError selectors. linSchedulerModeChange Detailed description of the linSchedulerModeChange selectors. linSleepModeEvent Detailed description of the linSleepModeEvent selectors. linSyncError Detailed description of the linSyncError selectors. linTransmError Detailed description of the linTransmError selectors. linWakeupFrame Detailed description of the linWakeupFrame selectors. | Network Hardware | Timeout Prevention | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linActivateCollisionResolution linActivateCollisionResolution CAPL Function Overview » LIN » linActivateCollisionResolution Syntax long linActivateCollisionResolution(long etfId, long activate) Function Activates or deactivates the Master node's automatic collision resolution of an eventtriggered frame. Per default the automatic collision resolution is active. If a collision occurs for any eventtriggered 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 eventtriggered 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 Identifier of event-triggered frame. Value range: 0-59 activate 0: Disable 1: Enable Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 LIN — • Example — | linETFSendOnSignalUpdate | linETFSetDirtyFlag | linSetRespLength | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linActivateFlashMode linActivateFlashMode CAPL Function Overview » LIN » linActivateFlashMode Syntax dword linActivateFlashMode(byte activate) 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 1 will activate the flash mode, 0 will deactivated it. Return values On successful request returns 1, otherwise 0. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 SP2 • LIN — • • Real bus mode 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; } linInvertRespBitEx(0, 0, 8, 4, 8, 0); // invert the middle part of the stop bit of the // first byte of the response to id 0 ... } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linActivateFlashMode | linIsFlashModeActive | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linActivateGlobalNetworkManagement linActivateGlobalNetworkManagement CAPL Function Overview » LIN » linActivateGlobalNetworkManagement Syntax long linActivateGlobalNetworkManagement(long active) 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 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 LIN — • Example — | linActivateSlaveNetworkManagement | linCheckRespError | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linActivateResps linActivateResps CAPL Function Overview » LIN » linActivateResps Syntax int 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. Individual frame responses can be activated manually using the function linSetRespCounter. Context Slave node only Parameters — Return values Number of activated frame responses or -1 if an error occurs. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • Example — | linSetRespCounter | linDeactivateResps | linResetSlave | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linActivateSlaveNetworkManagement linActivateSlaveNetworkManagement CAPL Function Overview » LIN » linActivateSlaveNetworkManagement Syntax long linActivateSlaveNetworkManagement(long active) Function Activates/deactivates network management for the calling Slave node. 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 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 LIN • • Example — | linActivateGlobalNetworkManagement | linCheckRespError | linGetRespError | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linActivateSlot linActivateSlot CAPL Function Overview » LIN » linActivateSlot Syntax long linActivateSlot(dword tableIndex, dword slotIndex) 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 Slot index. First slot in a table has the index 0. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • Example — | linDeactivateSlots | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linBits2Time linBits2Time CAPL Function Overview » LIN » linBits2Time Syntax dword linBits2Time(dword bitTimes) dword linBits2Time(dword channel, dword bitTimes) Function Converts specified bit time to an absolute time. 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 Channel number, whose baud rate will be used. Return values Absolute time in 10 µs. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • 6.0 LIN • • Example Convert header bit time of a LIN frame to µs on linMessage * { dword headerTimeInMicroSeconds; // time in µs headerTimeInMicroSeconds = linBits2Time(this.LIN_HeaderTime)*10; } | linTime2Bits | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linBits2Time_ns linBits2Time_ns CAPL Function Overview » LIN » linBits2Time_ns Syntax int64 linBits2Time_ns(dword bitTimes) int64 linBits2Time_ns(dword channel, dword bitTimes) Function Converts specified bit time to an absolute time. The absolute time is calculated using the current baud rate on the channel determined by the CAPL program context. Context Master or Slave node Parameters bitTimes Time in bits. channel Channel number, whose baud rate will be used. Return values Absolute time in ns. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 LIN • • Example Convert header bit time of a LIN frame to ns on linMessage * { int64 headerTimeInNanoSeconds; // time in ns headerTimeInNanoSeconds = linBits2Time_ns(this.LIN_HeaderTime); } | linTime2Bits_ns | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linBusIsAwake linBusIsAwake CAPL Function Overview » LIN » linBusIsAwake Syntax long linBusIsAwake() Function Queries the awake state of the LIN bus. Parameters — Return values Returns a value unequal to zero if the bus is awake, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 LIN — • Example — | linChangeWakeupSettings | linSendSleepModFrm | linSendWakeup | linSilentWakeup | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linChangeDlc linChangeDlc CAPL Function Overview » LIN » linChangeDlc Syntax long linChangeDlc(long frameID, long dlc) 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. Context Master or Slave node Parameters frameID LIN frame identifier in the range 0 .. 63 dlc Frame length in bytes in the range 1 .. 8 Return values If successful a value unequal to zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • Example Change DLC of a frame from database ... linmessage MotorControl frameMotorControl; linChangeDLC(frameMotorControl.id, frameMotorControl.dlc-1); // now on transmitting the above frame a checksum error will come | linGetDlc | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linChangeSchedtable linChangeSchedtable CAPL Function Overview » LIN » linChangeSchedtable Syntax long linChangeSchedTable(dword tableIndex) long linChangeSchedTable(dword tableIndex, dword slotIndex) long linChangeSchedTable(dword tableIndex, dword slotIndex, dword onSlotIndex) Function This function switches from the current schedule table to another one. By calling this function in the event procedure on preStart, it is possible to specify in which schedule table the measurement should start. Info If the Master node is not simulated or no schedule tables are defined, then this function will have no effect. Parameters tableIndex Index of the schedule table to be changed to. Value range: 0..N-1, where N is a total number of defined schedule tables slotIndex Index of slot to be started within the new schedule table. 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. Default value: -2 - makes change immediately 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 LIN — • Example Change to schedule table with index 1 on pressing 'c' key ... on key 'c' { linChangeSchedTable(1); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linChangeWakeupSettings linChangeWakeupSettings CAPL Function Overview » LIN » linChangeWakeupSettings Syntax dword linChangeWakeupSettings(byte restartScheduler, long wakeupIdentifier) Function This function changes the wake-up setting. 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. In the case no schedule tables are defined this parameter is ignored. wakeupIdentifier LIN frame identifier to be sent additionally directly after sending a wakeup signal. If an invalid identifier is specified i.e. not in the range 0..63: • when schedule tables are defined no special wakeup identifier is sent; • when no schedule tables are defined a SynchBreak / SynchField pair without an identifier is sent; Value range: 0..0xFF Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • Example Change wake-up settings on getting Sleep mode event on linSleepModeEvent { linChangeWakeupSettings(0, 0x1); // do not restart scheduler, use 0x1 as wake-up identifier } | linSendSleepModFrm | linSendWakeup | linSilentWakeup | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linCheckOEMDataInd linCheckOEMDataInd CAPL Function Overview » LIN » linCheckOEMDataInd Info This function can be used for OEM specific variant of LIN protocol only. Syntax long linCheckOEMDataInd() 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 LIN — • Example — | linGetOEMDataInd | linSetOEMDataInd | linSetOEMDataIndTime | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linCheckOEMSleepInd linCheckOEMSleepInd CAPL Function Overview » LIN » linCheckOEMSleepInd Info This function can be used for OEM specific variant of LIN protocol only. Syntax long linCheckOEMSleepInd() 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 LIN — • Example — | linGetOEMSleepInd | linSetOEMSleepInd | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linCheckOEMWakeupInd linCheckOEMWakeupInd CAPL Function Overview » LIN » linCheckOEMWakeupInd Info This function can be used for OEM specific variant of LIN protocol only. Syntax long linCheckOEMWakeupInd() 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 LIN — • Example — | linGetOEMWakeupInd | linSetOEMWakeupInd | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linCheckRespError linCheckRespError CAPL Function Overview » LIN » linCheckRespError Syntax long 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 LIN — • Example — | linGetRespError | linSetRespError | linActivateGlobalNetworkManagement | linActivateSlaveNetworkManagement | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDeactivateBitInversion linDeactivateBitInversion CAPL Function Overview » LIN » linDeactivateBitInversion Syntax long 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 — Return values On success a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • LIN — • • Real bus mode Example Deactivate previous bit inversion on key 'd' { if (0==linDeactivateBitInversion()) { write("CAPL: Bit inversion deactivation failure!"); } } | linInvertHeaderBit | linInvertRespBit | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDeactivateResps linDeactivateResps CAPL Function Overview » LIN » linDeactivateResps Syntax int 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 — Return values Number of deactivated frame responses or -1 on failure. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • Example — | linSetRespCounter | linActivateResps | linResetSlave | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDeactivateSlot linDeactivateSlot CAPL Function Overview » LIN » linDeactivateSlot Syntax long linDeactivateSlot(dword tableIndex, dword slotIndex) Function This function deactivates the specified slot of schedule table. For example, it can be used to turn slots off in a diagnostic table. By calling this function in the event procedure on preStart, it is possible to configure initial state of schedule table. Info If the Master node is not simulated or no schedule tables are defined, then this function will have no effect. Parameters tableIndex Index of the schedule table to be configured. Value range: 0..N-1, where N is a total number of defined schedule tables slotIndex Index of slot to be deactivated within the specified schedule table. Value range: 0..Y-1, where Y is a total number of slots in the specified schedule table Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • Example — | linActivateSlot | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDetectMultipleErrors linDetectMultipleErrors CAPL Function Overview » LIN » linDetectMultipleErrors Syntax long linDetectMultipleErrors(long activate) 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 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDisturbHeaderWithBitStream linDisturbHeaderWithBitStream CAPL Function Overview » LIN » linDisturbHeaderWithBitStream Syntax dword linDisturbHeaderWithBitStream(dword byteIndex, dword bitIndex, byte bitStream[], dword numberOfBits, dword timeoutPrevention); Function Configures the LIN hardware to disturb the next header with a bit stream. Parameters byteIndex Start disturbance in byte with index <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. Value range: 0..255 bitStream The bit stream to be used for the interruption. Maximum number of bits: 2^31-1. numberOfBits The number of bits in the bitStream-array. timeoutPrevention 0: deactivates the timeout prevention for the 7259- or 7269-transceiver. 1: activates the timeout prevention for the 7259- or 7269-transceiver. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 • LIN — • • Real bus mode Example — | linDisturbHeaderWithHeader | linDisturbRespWithHeader | linDisturbRespWithBitStream | linDisturbHeaderWithVariableBitStream | linDisturbRespWithVariableBitStream | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDisturbHeaderWithHeader linDisturbHeaderWithHeader CAPL Function Overview » LIN » linDisturbHeaderWithHeader Syntax dword linDisturbHeaderWithHeader(dword byteIndex, dword bitIndex, long disturbingFrameId); Function Configures the LIN hardware to disturb the next header with a new header (id=<disturbanceHeaderID>). Parameters byteIndex Starts disturbance in byte with index <byteIndex>. 0: Sync Byte 1: ProtectedId Byte bitIndex Starts disturbance at bit position <bitIndex>. 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. Value range: 0..255 disturbanceHeaderID Frame ID to be used for the header disturbance. Info This is not the ID of the header to be disturbed, but the ID of the header disturbance itself. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 • LIN — • • Real bus mode Example — | linDisturbRespWithHeader | linDisturbHeaderWithBitStream | linDisturbRespWithBitStream | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDisturbHeaderWithVariableBitStream linDisturbHeaderWithVariableBitStream CAPL Function Overview » LIN » linDisturbHeaderWithVariableBitStream Syntax dword linDisturbHeaderWithVariableBitStream(dword byteIndex, dword bitIndex, byte dataBuffer[], int64 lengthInNS[], dword numberOfBits, dword roundUp, dword timeoutPrevention); Function Configures the LIN hardware to disturb the next header with a variable bit stream. Parameters byteIndex Start disturbance in byte with index <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. Value range: 0..255 bitStream The bit stream to be used for the interruption. Maximum number of bits: 2^31-1. lengthInNS The length of each bit in nanoseconds. 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 0: deactivates the timeout prevention for the 7259- or 7269-transceiver. 1: activates the timeout prevention for the 7259- or 7269-transceiver. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 • — • LIN Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDisturbHeaderWithVariableBitStream • Real bus mode Example — | linDisturbHeaderWithHeader | linDisturbRespWithHeader | linDisturbHeaderWithBitStream | linDisturbRespWithBitStream | linDisturbRespWithVariableBitStream | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDisturbRespWithBitStream linDisturbRespWithBitStream CAPL Function Overview » LIN » linDisturbRespWithBitStream Syntax dword linDisturbRespWithBitStream(long disturbedFrameId, dword byteIndex, dword bitIndex, byte bitStream[], dword numberOfBits, dword timeoutPrevention); Function Configures the LIN hardware to disturb the specified response with a bit stream. Parameters disturbedFrameID ID of the bus event to be disturbed. Value range: 0..63 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. Value range: 0..N, where N is frame length 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. Value range: 0..255 bitStream The bit stream to be used for the interruption. Maximum number of bits: 2^31-1. numberOfBits The number of bits in the bitStream-array. timeoutPrevention 0: deactivates the timeout prevention for the 7259- or 7269-transceiver. 1: activates the timeout prevention for the 7259- or 7269-transceiver. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 • LIN — • • Real bus mode Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDisturbRespWithBitStream | linDisturbHeaderWithHeader | linDisturbRespWithHeader | linDisturbHeaderWithBitStream | linDisturbHeaderWithVariableBitStream | linDisturbRespWithVariableBitStream | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDisturbRespWithHeader linDisturbRespWithHeader CAPL Function Overview » LIN » linDisturbRespWithHeader Syntax dword linDisturbRespWithHeader(long disturbedFrameId, dword byteIndex, dword bitIndex, long disturbingFrameId); Function Configures the LIN hardware to disturb the specified response with a new header (id=<disturbanceHeaderID>). Parameters disturbedFrameID ID of the bus event to be disturbed. Value range: 0..63 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. Value range: 0..N, where N is frame length 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. Value range: 0..255 disturbingFrameId The identifier of the header that will interrupt the specified header byte. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 • LIN — • • Real bus mode Example — | linDisturbHeaderWithHeader | linDisturbHeaderWithBitStream | linDisturbRespWithBitStream | linDisturbHeaderWithVariableBitStream | linDisturbRespWithVariableBitStream | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDisturbRespWithVariableBitStream linDisturbRespWithVariableBitStream CAPL Function Overview » LIN » linDisturbRespWithVariableBitStream Syntax dword linDisturbRespWithVariableBitStream(long disturbedFrameId, dword byteIndex, dword bitIndex, byte bitStream[], dword numberOfBits, dword timeoutPrevention); Function Configures the LIN hardware to disturb the specified response with a variable bit stream. Parameters disturbedFrameID ID of the bus event to be disturbed. Value range: 0..63 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. Value range: 0..N, where N is frame length 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. Value range: 0..255 bitStream The bit stream to be used for the interruption. Maximum number of bits: 2^31-1. lengthInNS The length of each bit in nanoseconds. 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 0: deactivates the timeout prevention for the 7259- or 7269-transceiver. 1: activates the timeout prevention for the 7259- or 7269-transceiver. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDisturbRespWithVariableBitStream Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 • LIN — • • Real bus mode Example — | linDisturbHeaderWithHeader | linDisturbRespWithHeader | linDisturbHeaderWithBitStream | linDisturbRespWithBitStream | linDisturbHeaderWithVariableBitStream | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linETFSendOnSignalUpdate linETFSendOnSignalUpdate CAPL Function Overview » LIN » linETFSendOnSignalUpdate Syntax long linETFSendOnSignalUpdate(long etfId, long active) Function With this function it is possible to activate/deactivate the automatic responses on a certain event-triggered frame request in the case of a signal update on its associated frame(s). This concerns all Slave tasks publishing the responses to the specified eventtriggered frame. Parameters etfId Identifier of event-triggered frame. Value range: 0-59 active 1: Activate 0: Deactivate Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 LIN — • Example — | linActivateCollisionResolution | linETFSetDirtyFlag | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linETFSetDirtyFlag linETFSetDirtyFlag CAPL Function Overview » LIN » linETFSetDirtyFlag Syntax long linETFSetDirtyFlag(long assocId, long dirty) 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 Identifier of unconditional frame LIN frame identifier of associated (unconditional) frame whose dirty flag should be set or cleared. Value range: 0 .. 63 dirty 1: Set the dirty flag. 0: Clear the dirty flag. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 LIN — • Example — | linActivateCollisionResolution | linETFSendOnSignalUpdate | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetBusIdleTimeout linGetBusIdleTimeout CAPL Function Overview » LIN » linGetBusIdleTimeout Syntax dword 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 LIN — • Example — | linSetBusIdleTimeout | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetByteEndTime linGetByteEndTime CAPL Function Overview » LIN » linGetByteEndTime Syntax dword linGetByteEndTime(linMessage busEvent, long index) dword linGetByteEndTime(linCSError busEvent, long index) dword linGetByteEndTime(linReceiveError busEvent, long index) 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 LIN bus event of type frame, checksum error or receive error. index Data byte 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN • • Example Retrieve timestamps of each data byte on analyzing a receive error event on linReceiveError { long byteIndex; dword byteTimestamp; if (0 == this.lin_ShortError) // .DLC selector only valid when .lin_ShortError is not set { for (byteIndex=1; byteIndex <= this.DLC; ++byteIndex) { byteTimestamp = linGetByteEndTime(this, byteIndex); ... } } } | linGetStartOfFrame | linGetEndOfHeader | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetChecksum linGetChecksum CAPL Function Overview » LIN » linGetChecksum Syntax byte linGetChecksum(linMessage linFrame) byte linGetChecksum(linCSError linCsError) Function Returns the checksum of a LIN frame or LIN checksum error. Checksum model (classic/enhanced) is determined automatically. Context Master or Slave node Parameters linFrame LIN message object linCsError LIN checksum error object Return values Calculated checksum Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 LIN • • Example Get the checksum of a received LIN frame with name myframe on linMessage myframe { byte checksum; checksum = linGetChecksum(this); } or // Calculate the checksum of a LIN frame object ... byte checksum; // create a LIN frame object linmessage 0x1 myLinFrame = { dlc = 1, byte(0) = 1 }; // calculate its checksum checksum = linGetChecksum(myLinFrame); | linSetChecksumError | linSetManualChecksum | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetDlc linGetDlc CAPL Function Overview » LIN » linGetDlc Syntax long linGetDlc(long frameID) 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. Context Master or Slave node (in on preStart only) Parameters frameID LIN frame identifier in the range 0 .. 63. Return values If successful the frame length [in bytes] or -1 on failure. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.1 LIN — • Example Verify correct DLC is used by a certain frame ... if ( linGetDLC(0x22) != 5) { linChangeDLC(0x22, 5); // set DLC of frame with identifier 0x22 to be 5 } | linChangeDlc | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetDominantTimeout linGetDominantTimeout CAPL Function Overview » LIN » linGetDominantTimeout Syntax int64 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 • LIN — • • Real bus mode Example — | linSetGlobalTimeoutPrevention | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetEndOfHeader linGetEndOfHeader CAPL Function Overview » LIN » linGetEndOfHeader Syntax dword linGetEndOfHeader(linMessage busEvent) dword linGetEndOfHeader(linCSError busEvent) dword linGetEndOfHeader(linReceiveError busEvent) 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 LIN bus event of type frame, checksum error or receive error. Return values Returns the retrieved timestamp [in units of 10 µsec] or 0 on failure. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetFallingEdgesOfDisturbedByte linGetFallingEdgesOfDisturbedByte CAPL Function Overview » LIN » linGetFallingEdgesOfDisturbedByte Syntax dword linGetFallingEdgesOfDisturbedByte(int64 fallingEdges[]) 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 An array which will receive the measured timestamps [in nanoseconds]. The array size is 6. Unused timestamps will be set to 0 (i.e. in case of less than 6 falling edges). Return values On successful request returns 1, otherwise 0. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 • LIN — • • Real bus mode Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetHWReceiveAccuracy linGetHWReceiveAccuracy CAPL Function Overview » LIN » linGetHWReceiveAccuracy Syntax dword linGetHWReceiveAccuracy() Function This function can be used to query the receive resolution of the LIN hardware in units of 1 Hz. Parameters — Return values Returns the receive resolution of the LIN hardware. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP3 • LIN — • • Real bus mode Example on key 't' { write("Transmit accuracy = %d", linGetHWTransmitAccuracy()); write("Receive accuracy = %d", linGetHWReceiveAccuracy()); } | linGetHWTransmitAccuracy | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetHWTransmitAccuracy linGetHWTransmitAccuracy CAPL Function Overview » LIN » linGetHWTransmitAccuracy Syntax dword linGetHWTransmitAccuracy() Function This function can be used to query the transmit resolution of the LIN hardware in units of 1 Hz. Parameters — Return values Returns the transmit resolution of the LIN hardware. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP3 • LIN — • • Real bus mode Example on key 't' { write("Transmit accuracy = %d", linGetHWTransmitAccuracy()); write("Receive accuracy = %d", linGetHWReceiveAccuracy()); } | linGetHWReceiveAccuracy | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetMeasBaudrate linGetMeasBaudrate CAPL Function Overview » LIN » linGetMeasBaudrate Syntax float 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetMeasBaudrate { 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetMeasEdgeTimeDiffs linGetMeasEdgeTimeDiffs CAPL Function Overview » LIN » linGetMeasEdgeTimeDiffs Syntax dword linGetMeasEdgeTimeDiffs(dword arrSize, float timeDiffs[]); 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 The size of the timeDiffs array. timeDiffs The array which will receive the measured time differences. Return values Returns the number of time differences copied into the timeDiffs-array. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 • LIN — • • Real bus mode Example See example for linMeasEdgeTimeDiffs. | LinMeasEdgeTimeDiffs | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetOEMDataInd linGetOEMDataInd CAPL Function Overview » LIN » linGetOEMDataInd Info This function can be used for OEM specific variant of LIN protocol only. Syntax long linGetOEMDataInd() long linGetOEMDataInd(char slaveName[]) 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 Name of the queried Slave node as specified in the database. Return values Returns non-zero if the queried data indication bit is set, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 LIN — • Example — | linCheckOEMDataInd | linSetOEMDataInd | linSetOEMDataIndTime | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetOEMSleepInd linGetOEMSleepInd CAPL Function Overview » LIN » linGetOEMSleepInd Info This function can be used for OEM specific variant of LIN protocol only. Syntax long linGetOEMSleepInd() long linGetOEMSleepInd(char slaveName[]) 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 Name of the queried Slave node as specified in the database. Return values Returns non-zero if the queried sleep indication bit is set, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 LIN — • Example — | linCheckOEMSleepInd | linSetOEMSleepInd | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetOEMWakeupInd linGetOEMWakeupInd CAPL Function Overview » LIN » linGetOEMWakeupInd Info This function can be used for OEM specific variant of LIN protocol only. Syntax long linGetOEMWakeupInd() long linGetOEMWakeupInd(char slaveName[]) 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 Name of the queried Slave node as specified in the database. Return values Returns non-zero if the queried wakeup indication bit is set, zero otherwise. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 LIN — • Example — | linCheckOEMWakeupInd | linSetOEMWakeupInd | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetProtectedID linGetProtectedID CAPL Function Overview » LIN » linGetProtectedID Syntax dword linGetProtectedID (long frameID) 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 LIN frame identifier whose protected ID will be calculated. Value range: 0 .. 63 Return values Returns the calculated protected identifier or -1 on failure. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetRespError linGetRespError CAPL Function Overview » LIN » linGetRespError Syntax long linGetRespError() long linGetRespError(long NAD) 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 Configured node address of the Slave node to be queried. 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 LIN — • Example — | linCheckRespError | linSetRespError | linActivateGlobalNetworkManagement | linActivateSlaveNetworkManagement | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetResponseData linGetResponseData CAPL Function Overview » LIN » linGetResponseData Syntax dword LinGetResponseData(linmessage frameObject) 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: Return values • ID • MsgChannel Non-zero on success. Zero on failure or when there is no response data defined. The non-zero value in real mode is the initial and in simulated mode the actual response counter value. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 SP2 LIN — • 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetStartOfFrame linGetStartOfFrame CAPL Function Overview » LIN » linGetStartOfFrame Syntax dword linGetStartOfFrame(linMessage busEvent) dword linGetStartOfFrame(linCSError busEvent) dword linGetStartOfFrame(linReceiveError busEvent) dword linGetStartOfFrame(linTransmError busEvent) dword linGetStartOfFrame(linSyncError busEvent) dword linGetStartOfFrame(linWakeupFrame busEvent) 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetSyncBreakLength linGetSyncBreakLength CAPL Function Overview » LIN » linGetSyncBreakLength Syntax dword linGetSyncBreakLength(linMessage busEvent) dword linGetSyncBreakLength(linCSError busEvent) dword linGetSyncBreakLength(linReceiveError busEvent) dword linGetSyncBreakLength(linTransmError busEvent) dword linGetSyncBreakLength(linSyncError busEvent) 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); time units bitlenBreak = linTime2Bits(timelenBreak); times timelenDel = linGetSyncDelLength(this); time units bitlenDel = linTime2Bits(timelenDel); times ... } // retrieve break length in // convert time units to bit // retrieve delimiter length in // convert time units to bit | linGetSyncDelLength | linSetBreakLength | linTime2Bits | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetSyncDelLength linGetSyncDelLength CAPL Function Overview » LIN » linGetSyncDelLength Syntax dword linGetSyncDelLength(linMessage busEvent) dword linGetSyncDelLength(linCSError busEvent) dword linGetSyncDelLength(linReceiveError busEvent) dword linGetSyncDelLength(linTransmError busEvent) dword linGetSyncDelLength(linSyncError busEvent) 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); time units bitlenBreak = linTime2Bits(timelenBreak); times timelenDel = linGetSyncDelLength(this); time units bitlenDel = linTime2Bits(timelenDel); times ... } // retrieve break length in // convert time units to bit // retrieve delimiter length in // convert time units to bit | linGetSyncBreakLength | linSetBreakLength | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linGetWakeupLength linGetWakeupLength CAPL Function Overview » LIN » linGetWakeupLength Syntax int linGetWakeupLength (linWakeupFrame wakeupFrame) Function With this function it is possible to retrieve a length of an occurred Wakeup-Frame. Parameters wakeupFrame Bus-event of type LIN Wakeup-Frame. Return values Returns the retrieved length [in units of 10 µsec] or zero on failure. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 LIN • • Example Query the length of the wakeup frames on linWakeupFrame { write("Wake-up frame length: %d µs", linGetWakeupLength(this)*10); } | linSendWakeup | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertHeaderBit linInvertHeaderBit CAPL Function Overview » LIN » linInvertHeaderBit Syntax dword linInvertHeaderBit(dword byteIndex, dword bitIndex) // form 1 dword linInvertHeaderBit(dword byteIndex, dword bitIndex, dword level) // form 2 dword linInvertHeaderBit(dword byteIndex, dword bitIndex, dword level, dword numberOfExecutions) // form 3 dword linInvertHeaderBit(dword byteIndex, dword bitIndex, dword level, dword numberOfExecutions, dword reportFallingEdges) // form 4 dword linInvertHeaderBit(dword byteIndex, dword bitIndex, dword level, dword numberOfExecutions, dword reportFallingEdges, long disturbAfterHeaderID, dword waitForHeaders) // form 5 Function Inverts the specified bit in the next LIN header. Parameters byteIndex Index of the byte. 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. Value range: 0..255 level Level of the disturbance 0: Dominant (inverts recessive bit) 1: Recessive (inverts dominant bit – requires mag-Cab/Piggy and external power supply) 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. Default: 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 1: Activate report Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertHeaderBit 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 See explanation for disturbAfterHeaderID. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 LIN — • 7.1: form 4 LIN — • 7.5: form 5 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertHeaderBitEx linInvertHeaderBitEx CAPL Function Overview » LIN » linInvertHeaderBitEx Syntax dword linInvertHeaderBitEx(dword byteIndex, dword bitIndex, dword bitOffsetInSixteenthBits, dword distLengthInSixteenthBits, dword level) dword linInvertHeaderBitEx(dword byteIndex, dword bitIndex, dword bitOffsetInSixteenthBits, dword distLengthInSixteenthBits, dword level, dword numberOfExecutions, dword reportFallingEdges) dword linInvertHeaderBitEx(dword byteIndex, dword bitIndex, dword bitOffsetInSixteenthBits, dword distLengthInSixteenthBits, dword level, dword numberOfExecutions, dword reportFallingEdges, long disturbAfterHeaderID, dword waitForHeaders) Function Inverts the specified number of 1/16th bits at the specified position in the next LIN header. Parameters byteIndex Index of the byte. 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. Value range: 0..255 bitOffsetInSixteenthBits The offset in 1/16th bits into the bit specified in bitIndex. Value range: 0..15 distLengthInSixteenthBits The length of the disturbance in units of 1/16th bit. Value range: 0..65535 Level Level of the disturbance. 0: Dominant (inverts recessive bit) 1: Recessive (inverts dominant bit – requires mag-Cab/Piggy and external power supply) 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertHeaderBitEx 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 See explanation for disturbAfterHeaderID. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 SP2 • LIN — • • Real bus mode • LIN — • • Real bus mode 7.5: form 3 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertMultipleHeaderBits linInvertMultipleHeaderBits CAPL Function Overview » LIN » linInvertMultipleHeaderBits Syntax dword linInvertMultipleHeaderBits(dword byteIndices[],dword bitIndices[],dword numberOfDisturbedBits[],dword levels[],dword arrSize) dword linInvertMultipleHeaderBits(dword byteIndices[],dword bitIndices[],dword numberOfDisturbedBits[],dword levels[],dword arrSize, dword numberOfExecutions) dword linInvertMultipleHeaderBits(dword byteIndices[],dword bitIndices[],dword numberOfDisturbedBits[],dword levels[],dword arrSize, dword numberOfExecutions, long disturbAfterHeaderID, dword waitForHeaders) 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 An array of the index of the bytes. 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. Value range: 0..255 numberOfDisturbedBits An array specifying how many consecutive bits shall be inverted at the specified locations. level An array of the levels of the disturbance 0: Dominant (inverts recessive bit) 1: Recessive (inverts dominant bit – requires mag-Cab/Piggy and external power supply) 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. Default: 1 (single shot). disturbAfterHeaderID Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertMultipleHeaderBits 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 See explanation for disturbAfterHeaderID. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 • LIN — • • Real bus mode • LIN — • • Real bus mode 7.5: form 3 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)) { } } | linInvertHeaderBit | linInvertRespBit | linDeactivateBitInversion | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertMultipleRespBits linInvertMultipleRespBits CAPL Function Overview » LIN » linInvertMultipleRespBits Syntax dword linInvertMultipleRespBit(long frameID, dword byteIndices[],dword bitIndices[],dword numberOfDisturbedBits[], dword levels[], dword arrSize) dword linInvertMultipleRespBit(long frameID, dword byteIndices[],dword bitIndices[],dword numberOfDisturbedBits[], dword levels[], dword arrSize, dword numberOfExecutions) 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 ID of the bus event to be manipulated. Value range: 0..63 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. Value range: 0..N, where N is frame length 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. Value range: 0..255 numberOfDisturbedBits An array specifying how many consecutive bits shall be inverted at the specified locations. levels An array of the levels of the disturbance 0: Dominant (inverts recessive bit) 1: Recessive (inverts dominant bit – requires mag-Cab/Piggy and external power supply) 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertMultipleRespBits will be executed. Default: 1 (single shot). Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); ... } | linInvertMultipleHeaderBits | linInvertHeaderBit | linInvertRespBit | linDeactivateBitInversion | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertRespBit linInvertRespBit CAPL Function Overview » LIN » linInvertRespBit Syntax dword linInvertRespBit (long frameID, dword byteIndex, dword bitIndex) dword linInvertRespBit (long frameID, dword byteIndex, dword bitIndex, dword level) word linInvertRespBit (long frameID, dword byteIndex, dword bitIndex, dword level, dword numberOfExecutions) dword linInvertRespBit (long frameID, dword byteIndex, dword bitIndex, dword level, dword numberOfExecutions, dword reportFallingEdges) 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 ID of the bus event to be manipulated. Value range: 0..63 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. Value range: 0..N, where N is frame length 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. Value range: 0..255 level Level of the disturbance 0: Dominant (inverts recessive bit) 1: Recessive (inverts dominant bit – requires mag-Cab/Piggy and external power supply) numberOfExecutions The number of consecutive frames with the specified identifier in which the bit inversion will be executed. Default: 1 (single shot). 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertRespBit 1: Activate report Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 • LIN — • • Real bus mode • LIN — • • Real bus mode 7.1: form 4 Example Invert response bits on keyboard event on key 'i' { ... // Invert first bit of byte field 8 for LIN frame with ID=0x33 linInvertRespBit(0x33, 7, 0); ... // Invert bit 7 of checksum byte field for LIN frame with ID=0x33 linInvertRespBit(0x33, 8, 6); ... // Invert stop bit of byte field 8 for LIN frame with ID=0x33 linInvertRespBit(0x33, 7, 8); ... } | linInvertHeaderBit | linDeactivateBitInversion | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertRespBitEx linInvertRespBitEx CAPL Function Overview » LIN » linInvertRespBitEx Syntax dword linInvertRespBitEx(long frameID, dword byteIndex, dword bitIndex, dword bitOffsetInSixteenthBits, dword distLengthInSixteenthBits, dword level) dword linInvertRespBitEx(long frameID, dword byteIndex, dword bitIndex, dword bitOffsetInSixteenthBits, dword distLengthInSixteenthBits, dword level, dword numberOfExecutions, dword reportFallingEdges) 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 ID of the bus event to be manipulated. Value range: 0..63 byteIndex Index of the byte. 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. Value range: 0..255 bitOffsetInSixteenthBits The offset in 1/16th bits into the bit specified in bitIndex. Value range: 0..15 distLengthInSixteenthBits The length of the disturbance in units of 1/16th bit. Value range: 0..65535 Level Level of the disturbance. 0: Dominant (inverts recessive bit) 1: Recessive (inverts dominant bit – requires mag-Cab/Piggy and external power supply) 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linInvertRespBitEx to be reported. The timestamps can be retrieved by calling linGetFallingEdgesOfDisturbedByte. 0: Deactivate report Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 SP2 • LIN — • • Real bus mode 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linIsFlashModeActive linIsFlashModeActive CAPL Function Overview » LIN » linIsFlashModeActive Syntax dword linIsFlashModeActive() Function This function reports the flash mode state on high speed capable transceivers. Parameters — Return values Returns 1 if flash mode is active, otherwise 0. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 SP2 • LIN — • • Real bus mode 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; } linInvertRespBitEx(0, 0, 8, 4, 8, 0); // invert the middle part of the stop bit of the // first byte of the response to id 0 ... } | linActivateFlashMode | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linMeasEdgeTimeDiffs linMeasEdgeTimeDiffs CAPL Function Overview » LIN » linMeasEdgeTimeDiffs Syntax dword linMeasEdgeTimeDiffs(dword numIndices, long indices[]) dword linMeasEdgeTimeDiffs(dword numIndices, long indices[], dword id) 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 The number of specified byte indices. indices An array containing the indices of the bytes to be measured. Note that the minimum size for this array is numIndices. id The lin-identifier of the message to be measured. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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..."); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linMeasEdgeTimeDiffs } | linGetMeasEdgeTimeDiffs | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linMeasHeaderBaudrate linMeasHeaderBaudrate CAPL Function Overview » LIN » linMeasHeaderBaudrate Syntax long linMeasHeaderBaudrate(int index) 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 Return values On successful request returns zero, otherwise -1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linMeasHeaderBaudrate | linGetMeasBaudrate | linMeasRespBaudrate | linSetBaudrate | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linMeasRespBaudrate linMeasRespBaudrate CAPL Function Overview » LIN » linMeasRespBaudrate Syntax long linMeasRespBaudrate(long frameID, int index) 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 LIN frame identifier whose baud rate will be measured. Value range: 0…63 index Data byte index. Value range: 0..N, where N = length [in bytes] of specified LIN frame [0..N-1]: data bytes 1..N N: checksum byte Return values On successful request returns zero, otherwise -1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linMeasRespBaudrate { 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 | linGetMeasBaudrate | linSetBaudrate | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: output output CAPL Function Overview » LIN » output Syntax void output(linmessage msg) Function This function can be used for two purposes: Parameters • 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. Msgext Variable of type linmessage. List of available selectors for this type of objects can be found under linMessage selectors. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: output Info When LIN hardware is not in Master mode calling this function will have no effect. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linResetManualChecksum linResetManualChecksum CAPL Function Overview » LIN » linResetManualChecksum Syntax void linResetManualChecksum(linMessage linFrame) 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 LIN • • Example Reset checksum error caused by previously called linSetManualChecksum() ... linmessage MotorControl frmMotorControl; linResetManualChecksum(frmMotorControl); output(frmMotorControl); // it is important to call output() to make the changes active Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linResetMaxHeaderLength linResetMaxHeaderLength CAPL Function Overview » LIN » linResetMaxHeaderLength Syntax dword linResetMaxHeaderLength() Function Resets the maximum header length to the protocol version dependent default. Parameters — Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 • LIN — • • Real bus mode Example — | linSetMaxHeaderLength | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linResetNAD linResetNAD CAPL Function Overview » LIN » linResetNAD Syntax long 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • Example CAPL program modeling Slave node // Force NAD reset on a keyboard event on key 'r' { linmessage 0x3C frameMasterReq; linmessage 0x3D frameSlaveResp; // reset NAD of the modeled Slave node // we assume that by default initial NAD differs from configured NAD linResetNAD(); } CAPL program modeling Master node ... // Test Slave node reaction after its NAD has been reset. // Prepare AssignFrameId command for one of the Slave's configurable frames // In this example it is assumed that the configured NAD differs from the initial // NAD // set command's data frameMasterReq.byte(0) = 0x02; // configured NAD frameMasterReq.byte(1) = 0x06; // PCI frameMasterReq.byte(2) = 0xB1; // SID frameMasterReq.byte(3) = 0x1E; // Supplier Id LSB frameMasterReq.byte(4) = 0x0; // Supplier Id MSB frameMasterReq.byte(5) = 0x22; // Message Id LSB frameMasterReq.byte(6) = 0x22; // Message Id MSB frameMasterReq.byte(7) = linGetProtectedID(0x33); // Protected ID // update response data frameMasterReq.RTR = 0; output(frameMasterReq); // send the command (issue request header) frameMasterReq.RTR = 1; output(frameMasterReq); // send header of SlaveResponse frame frameSlaveResp.RTR = 1; output(frameSlaveResp); // In Trace window transmission error shall occur for SlaveResponse frame because // Slave doesn’t know the configured NAD yet Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linResetNAD | linResetSlave | linActivateResps | linDeactivateResps | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linResetRespBaudrate linResetRespBaudrate CAPL Function Overview » LIN » linResetRespBaudrate Syntax long linResetRespBaudrate(long frameId) 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. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 • LIN — • • Real bus mode Example — | linSetRespBaudrate | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linResetRespBitStream linResetRespBitStream CAPL Function Overview » LIN » linResetRespBitStream Syntax long linResetRespBitStream (long frameId) Function Deactivates the bit stream response of the specified frame. Parameters frameId LIN frame identifier in the range 0 .. 63 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • LIN — • • Real bus mode Example — | linSetRespBitStream | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linResetRespDisturbance linResetRespDisturbance CAPL Function Overview » LIN » linResetRespDisturbance Syntax long linResetRespDisturbance (long frameId) Function Deactivates the disturbance in the response space of the specified frame. Parameters frameId LIN frame identifier in the range 0 .. 63 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • LIN — • • Real bus mode Example — | linSetRespDisturbance | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linResetScopeTrigger linResetScopeTrigger CAPL Function Overview » LIN » linResetScopeTrigger Syntax long linResetScopeTrigger () Function Resets the oscilloscope trigger condition(s) defined with linSetScopeTrigger. Info If this function is called from on-prestart part of the CAPL-program, then this function will have no effect. Parameters — Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • LIN — • • Real bus mode Example — | linSetScopeTrigger | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linResetSlave linResetSlave CAPL Function Overview » LIN » linResetSlave Syntax long linResetSlave () long linResetSlave(dword resetToLastConfiguration) 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 0: perform a complete reset non-zero: load last saved configuration Return values On success this function returns a value unequal to -1, otherwise -1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • Example Force Slave reset on a keyboard event on key 'r' { if ( linResetSlave() != -1) { // from now on the Slave node stops publishing responses ... } } | linResetNAD | linActivateResps | linDeactivateResps | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendAsSporadic linSendAsSporadic CAPL Function Overview » LIN » linSendAsSporadic Syntax long linSendAsSporadic (long frameID) 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 If LIN hardware is not in Master mode or there is no schedule table with corresponding sporadic frame defined then calling this function will have no effect. Parameters frameID Identifier of the associated LIN-frame to be transmitted in the next time slot of a corresponding sporadic frame. Value range: 0..59, 62 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendBitStream linSendBitStream CAPL Function Overview » LIN » linSendBitStream Syntax long linSendBitStream(byte bitStream[], long numberOfBits) long linSendBitStream(byte bitStream[], long numberOfBits, long timeoutPrevention) Function Sends an arbitrary bit stream on the LIN bus. Parameters bitStream The bit stream to be sent. Maximum number of bits: 2^31-1. numberOfBits The number of bits in the bitStream-array. timeoutPrevention 0: deactivates the timeout prevention for the 7259-transceiver. 1: activates the timeout prevention for the 7259-transceiver. Return values On success a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • LIN — • • Real bus mode Example This function sends LIN header as a bit stream int SendSpecialHeader(int breakLength, int delimiterLength, byte syncByte, byte idByte) { byte data[25]; int headerLength; int currentPosition; int i; // Header consists of Break, Sync and PID bytes headerLength = breakLength + delimiterLength + 20; if (headerLength > 200) { return 0; // maximum is exceeded } currentPosition = 0; for (i = 0; i < 25; ++i) { data[i] = 0xff; // initialize } for (i = breakLength; i > 0;) // set sync break { if (i >= 8) { data[currentPosition >> 3] = 0; i -= 8; currentPosition += 8; } else { data[currentPosition >> 3] &= ~(1 << (currentPosition & 0x7)); --i; Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendBitStream ++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; } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendDominantSignal linSendDominantSignal CAPL Function Overview » LIN » linSendDominantSignal Syntax dword linSendDominantSignal(dword lengthInMicroseconds); Function Sends a dominant signal of the specified length. Parameters lengthInMicroseconds The length of the dominant signal in microseconds. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 • LIN — • • Real bus mode Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendHeaderError linSendHeaderError CAPL Function Overview » LIN » linSendHeaderError Syntax dword linSendHeaderError(byte syncByte, byte idWithParity, byte StopAfterError) 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 Data value to be sent in the Synch Byte field. Correct value is 0x55 Value range: 0..0xFF 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. Value range: 0..0xFF 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. Value range: 0..1 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 SP2 • 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 linSendHeaderError(0x55, errPID, 0); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendHeaderError ... or ... // Force an error in header of LIN frame with ID=0x33 by setting wrong Synch byte linSendHeaderError(0x50, linGetProtectedID(0x33), 0); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendSamplingTestHeader linSendSamplingTestHeader CAPL Function Overview » LIN » linSendSamplingTestHeader Syntax long linSendSamplingTestHeader(dword startBitLengthInMicSec) 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. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 • LIN — • • Real bus mode Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendSleepModFrm linSendSleepModFrm CAPL Function Overview » LIN » linSendSleepModFrm Syntax long linSendSleepModFrm (long silent, long restartScheduler, long wakeupIdentifier) 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: • 0: LIN specification 1.1 and older Frame length is 2 bytes. The data bytes remain not changed. • 0x3C: LIN specification 1.2 and newer 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-tosleep-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 In the case no schedule tables are defined this parameter is ignored. Value range: 0 .. 1 wakeupIdentifier LIN frame identifier to be sent additionally directly after sending a wakeup signal. If an invalid identifier is specified i.e. not in the range 0 .. 63: • when schedule tables are defined no special wakeup identifier is sent; • when no schedule tables are defined a "SynchBreak / SynchField" pair without an identifier is sent; Value range: 0 .. 0xFF Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.1 LIN — • Example Start measurement in Sleep mode Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendSleepModFrm 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 | linChangeWakeupSettings | linSendWakeup | linSilentWakeup | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendVariableBitStream linSendVariableBitStream CAPL Function Overview » LIN » linSendVariableBitStream Syntax long linSendVariableBitStream(byte dataBuffer[], int64 lengthInNS[], dword numberOfBits, dword roundUp) long linSendVariableBitStream(byte dataBuffer[], int64 lengthInNS[], dword numberOfBits, dword roundUp, dword timeoutPrevention) Function Sends an arbitrary bit stream with bits of variable length on the LIN bus. Parameters dataBuffer The bit stream to be sent. Maximum number of bits: 2^31-1. lengthInNS The length of each bit in nanoseconds. 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 0: deactivates the timeout prevention for the 7259-transceiver. 1: activates the timeout prevention for the 7259-transceiver. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP3 • LIN — • • Real bus mode 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]; } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendVariableBitStream | linSendBitStream | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendWakeup linSendWakeup CAPL Function Overview » LIN » linSendWakeup Syntax long linSendWakeup() long linSendWakeup(long ttobrk, long count) long linSendWakeup(long ttobrk, long count, dword length) 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). Value range (for units expected in bit times): 20 .. 50000 Value range (for units expected in ms): 1 .. 65536 count Sets the number of Wakeup frame retransmissions. Value range: 1…255 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. This parameter is only used by LIN2.x slave nodes. Value range: 250...5000 µs Default value depends on the hardware settings: see Hardware Configuration: LIN Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.1 LIN — • Example Send wakeup frame on keyboard event on key 'w' Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSendWakeup { 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); ... | linSendSleepModFrm | linSetWakeupParams | linChangeWakeupSettings | linSilentWakeup | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetBaudrate linSetBaudrate CAPL Function Overview » LIN » linSetBaudrate Syntax void linSetBaudrate(long baudrate) Void linSetBaudrate(long minBaudrate, long maxBaudrate) Function With this function it is possible to change the baud rate during the measurement. It is also possible to activate automatic baudrate detection in a specified range. Info Parameters • It is recommended setting the baud rate via the database or the hardware configuration dialog. This function is especially useful for test cases (conformance test) which have to run at a number of different baud rates. • This function can be used also when LIN hardware is not in Master mode. • During automatic baudrate detection no bus event will be reported until the baudrate has been detected successfully. baudrate Baudrate to be set [in bit/sec]. Value range: 200 Baud – 30500 Baud minBaudrate The lower border of the automatic baudrate detection range. Value range: 200 Baud – maxBaudrate maxBaudrate The upper border of the automatic baudrate detection range. Value range: minBaudrate – 30500 Baud Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 • LIN — • • Real bus mode Example Change baud rate on keyboard event on key 'w' { linSetBaudrate(9600); } // change baudrate to 9600 bit/sec | linMeasHeaderBaudrate | linMeasRespBaudrate | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetBaudrateDetectionRange linSetBaudrateDetectionRange CAPL Function Overview » LIN » linSetBaudrateDetectionRange Syntax long linSetBaudrateDetectionRange(long rangeInPercent) 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. Context Slave mode only (in on preStart only) Parameters rangeInPercent The detection range in percent. Value range: 0-30 Default: 15 Return values If successful a value unequal to zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 LIN — • Example — | linSetBaudrate | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetBreakLength linSetBreakLength CAPL Function Overview » LIN » linSetBreakLength Syntax dword linSetBreakLength(dword syncBreakLen, dword syncDelLen) dword linSetBreakLength(float syncBreakLen, float syncDelLen) 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 Synch break length in bit times. Default value: 18 Value range: 10..30 syncDelLen Synch delimiter length in bit times. Default value: 2 Value range: 1..30 Values required for a LIN compliant header: • syncBreakLength >= 13 • syncDelimiterLength >= 1 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • Example — | linGetSyncBreakLength | linGetSyncDelLength | linTime2Bits | linSetValidBreakLimits | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetBusIdleTimeout linSetBusIdleTimeout CAPL Function Overview » LIN » linSetBusIdleTimeout Syntax dword linSetBusIdleTimeout(dword timeout) 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). Value range: 1 - 32767 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 LIN — • Example — | linGetBusIdleTimeout | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetChecksumError linSetChecksumError CAPL Function Overview » LIN » linSetChecksumError Syntax long linSetChecksumError(long frameId, long activate) 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 LIN frame identifier in the range 0 .. 63. activate 0: deactivate checksum error 1: activate checksum error Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetGlobalInterByteSpace linSetGlobalInterByteSpace CAPL Function Overview » LIN » linSetGlobalInterByteSpace Syntax dword linSetGlobalInterByteSpace(dword sixteenthBits) 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. By default the inter-byte space is 0. 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]. Value range: 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. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 ... } } | linSetInterByteSpace | linSetInterByteSpaces | linSetInterframeSpace | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetGlobalTimeoutPrevention linSetGlobalTimeoutPrevention CAPL Function Overview » LIN » linSetGlobalTimeoutPrevention Syntax dword linSetGlobalTimeoutPrevention(dword on); 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 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 • LIN — • • Real bus mode Example — | linGetDominantTimeout | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetInterByteSpace linSetInterByteSpace CAPL Function Overview » LIN » linSetInterByteSpace Syntax dword linSetInterByteSpace (long frameID, long index, dword sixteenthBits) 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. By default the inter-byte space is 0. Parameters frameID LIN frame identifier whose inter-byte space should be changed Value range: 0…63 index Index of the byte field, in front of which the inter-byte space should be inserted. Value range: 0..N+1, where N=frame length 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]. Value range: 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. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 ... } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetInterByteSpace | linSetGlobalInterByteSpace | linSetInterframeSpace | linSetInterByteSpaces | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetInterByteSpaces linSetInterByteSpaces CAPL Function Overview » LIN » linSetInterByteSpaces Syntax dword linSetInterByteSpaces(dword arrayOfSixteenthBits[]) dword linSetInterByteSpaces(long frameID, dword arrayOfSixteenthBits[]) 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. By default the inter-byte space between all byte fields is 0. Parameters frameID LIN frame identifier whose inter-byte space should be changed 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. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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; Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetInterByteSpaces } } if (linSetInterByteSpaces(0x33, arrayOfSixteenthBits) != 0) { // the inter-byte spaces successfully set ... } } | linSetGlobalInterByteSpace | linSetInterByteSpace | linSetInterframeSpace | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetInterframeSpace linSetInterframeSpace CAPL Function Overview » LIN » linSetInterframeSpace Syntax dword linSetInterframeSpace(dword bitTimes) Function This function sets the minimum inter-frame space. 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. By default the minimum inter-frame space is 0. 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 Length of the inter-frame space to set [in bit times]. Value range: 0..255 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 ... } } | linSetGlobalInterByteSpace | linSetInterByteSpace | linSetInterByteSpaces | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetManualChecksum linSetManualChecksum CAPL Function Overview » LIN » linSetManualChecksum Syntax void linSetManualChecksum(linMessage linFrame, byte csValue) Function Sets a checksum (that is usually not a correct one) for a LIN frame.Text Parameters linFrame LIN frame for which a checksum will be set. csValue The checksum value to be set. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 LIN • • Example ... linmessage MotorControl frmMotorControl; linSetManualChecksum(frmMotorControl, 0x1A); output(frmMotorControl); // it is important to call output() to make the changes active | linResetManualChecksum | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetMasterReqDirtyFlag linSetMasterReqDirtyFlag CAPL Function Overview » LIN » linSetMasterReqDirtyFlag Syntax dword linSetMasterReqDirtyFlag(dword dirty) Function Sets the dirty flag of the MasterRequest (0x3C). 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 New value for the dirty flag. Return values On success a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 LIN — • Example — | linInvertHeaderBit | linInvertRespBit | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetMasterRequestDirtyFlag linSetMasterRequestDirtyFlag CAPL Function Overview » LIN » linSetMasterRequestDirtyFlag Syntax dword linSetMasterRequestDirtyFlag (dword dirty) 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 0: clear the dirty flag 1: set the dirty flag Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 LIN — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetMaxHeaderLength linSetMaxHeaderLength CAPL Function Overview » LIN » linSetMaxHeaderLength Syntax dword linSetMaxHeaderLength(long bitTimes) Function Sets the maximum header length in bit times. 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. Value range: 31-255 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 • LIN — • • Real bus mode Example — | linResetMaxHeaderLength | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetNAD linSetNAD CAPL Function Overview » LIN » linSetNAD Syntax dword linSetNAD(dword nad) Function Changes the node address of the calling simulated slave. Parameters nad The new nad to be used by the simulated slave. Return values On success zero, otherwise -1. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 • LIN — • • Real bus mode Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetOEMDataInd linSetOEMDataInd CAPL Function Overview » LIN » linSetOEMDataInd Info This function can be used for OEM specific variant of LIN protocol only. Syntax long linSetOEMDataInd(long active) Function Sets/resets the data indication bit for a calling slave node. Parameters active 0: set 1: reset Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 LIN — • Example — | linCheckOEMDataInd | linGetOEMDataInd | linSetOEMDataIndTime | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetOEMDataIndTime linSetOEMDataIndTime CAPL Function Overview » LIN » linSetOEMDataIndTime Info This function can be used for OEM specific variant of LIN protocol only. Syntax long linSetOEMDataIndTime(long timeInMS) Function Sets the time in milliseconds after which a simulated slave automatically sets its data indication bit. Parameters timeInMS Time value. Unit: milliseconds Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 LIN — • Example — | linSetOEMDataInd | linGetOEMDataInd | linCheckOEMDataInd | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetOEMSleepInd linSetOEMSleepInd CAPL Function Overview » LIN » linSetOEMSleepInd Info This function can be used for OEM specific variant of LIN protocol only. Syntax long linSetOEMSleepInd(long active) Function Sets/resets the sleep indication bit for a calling slave node. Parameters active 0: set 1: reset Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 LIN — • Example — | linCheckOEMSleepInd | linGetOEMSleepInd | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetOEMWakeupInd linSetOEMWakeupInd CAPL Function Overview » LIN » linSetOEMWakeupInd Info This function can be used for OEM specific variant of LIN protocol only. Syntax long linSetOEMWakeupInd(long active) Function Sets/resets the wakeup indication bit for a calling slave node. Parameters active 0: set 1: reset Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 LIN — • Example — | linCheckOEMWakeupInd | linGetOEMWakeupInd | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetRespBaudrate linSetRespBaudrate CAPL Function Overview » LIN » linSetRespBaudrate Syntax long linSetRespBaudrate(long frameId, long baudrate) 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 The baudrate to be used for the response. Value range: 1000-20000 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 • LIN — • • Real bus mode Example — | linResetRespBaudrate | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetRespBitStream linSetRespBitStream CAPL Function Overview » LIN » linSetRespBitStream Syntax long linSetRespBitStream (long frameId, byte bitStream[], long numberOfBits) long linSetRespBitStream (long frameId, byte bitStream[], long numberOfBits, long timeoutPrevention) long linSetRespBitStream (long frameId, byte bitStream[], long numberOfBits, long timeoutPrevention, long count) Function Sets up a bit stream as the response to the specified frame. Parameters frameId LIN frame identifier in the range 0 .. 63 bitStream The bit stream array to be sent as a response. Maximum number of bits: 2^31-1. numberOfBits Number of bits in the bitStream array to be sent. timeoutPrevention 0: deactivates the timeout prevention for the 7259-transceiver. 1: activates the timeout prevention for the 7259-transceiver. count Number of times, the bit stream shall be sent as a response before deactivating itself. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • LIN — • • Real bus mode Example Send LIN response for the frame MotorControl as a bit stream. // The response consists of 8 data bytes and checksum byte. There are no interbyte spaces. // Response: [D0=0x1, D1=0x2, D2=0x4, D3=0x8, D4=0x10, D5=0x20, D6=0x40, D7=0x80, CS=0x52] on key 'r' { linmessage MotorControl mMotorControl; byte bitStream[12]; long numberOfBits; // binary stream = 0100000001 0010000001 0001000001 0000100001 0000010001 // binary stream (continue) = 0000001001 0000000101 0000000011 0010010101 bitStream[0] = 0x2; bitStream[1] = 0x12; bitStream[2] = 0x88; bitStream[3] = 0x20; Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetRespBitStream 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetRespCounter linSetRespCounter CAPL Function Overview » LIN » linSetRespCounter Syntax long linSetRespCounter(long frameID, long count) Function With this function it is possible to limit the number of responses sent for the specified frame identifier. By setting count = 0 it is possible to deactivate the frame response completely. 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 Identifier of the LIN-frame to be configured Value range: 0…63 count Number of responses to be sent. n-times: 0..254 unlimited: -1 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN — • Example — | linActivateResps | linDeactivateResps | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetRespDisturbance linSetRespDisturbance CAPL Function Overview » LIN » linSetRespDisturbance Syntax long linSetRespDisturbance (long frameId, long lengthInBits, long level, long offsetInSixteenthBits) 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 LIN frame identifier in the range 0 .. 63. lengthInBits The duration of the disturbance [in bit times]. level The level of the disturbance. 0: dominant disturbance (inverts recessive bits) 1: recessive disturbance (inverts dominant bits - requires mag-Cab/Piggy and external power supply) offsetInSixteenthBits The offset [in 1/16th bits] of the disturbance relative to the end of the header, i.e. to the PID byte. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetRespDisturbance | linResetRespDisturbance | linStartDisturbance | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetRespError linSetRespError CAPL Function Overview » LIN » linSetRespError Syntax long linSetRespError(long activate) Function Sets/resets the response error flag for a calling slave node. Info This function has no effect with LIN 1.x. Parameters activate 0: reset 1: set Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 LIN — • Example — | linGetRespError | linCheckRespError | linActivateGlobalNetworkManagement | linActivateSlaveNetworkManagement | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetRespLength linSetRespLength CAPL Function Overview » LIN » linSetRespLength Syntax long linSetRespLength(long frameID, long numberOfBytes) 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 This function can be used to simulate collisions during sending of a frame response e.g. after receiving an event triggered frame. Parameters frameID Identifier of the LIN-frame to be configured. Value range: 0…63 numberOfBytes Number of bytes to be sent in the frame response (including checksum). Value range: 0..DLC+1 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 ... } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetRespTolerance linSetRespTolerance CAPL Function Overview » LIN » linSetRespTolerance Syntax dword linSetRespTolerance(long frameId, long toleranceInPercent) Function Sets the response tolerance for a specified frame in percent. Parameters frameId The identifier of the frame for which the response tolerance shall be set. toleranceInPercent The response tolerance to be used for the specified frame. Value range: 0-255 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 • LIN — • • Real bus mode Example — | linResetMaxHeaderLength | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetSchedulerJitter linSetSchedulerJitter CAPL Function Overview » LIN » linSetSchedulerJitter Syntax long linSetSchedulerJitter (long mode) long linSetSchedulerJitter (long mode, long jitterInMicSecs) 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 0: deactivates the jitter; 1: sets the min-/max-mode; the minimum (0) and the maximum (specified value) jitter will be used alternatively 2: sets the random jitter-mode; the jitter-offset will be equally distributed in the min/max range jitterInMicSecs The jitter in microseconds to be used. Default: Jitter value from LDF. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetScopeTrigger linSetScopeTrigger CAPL Function Overview » LIN » linSetScopeTrigger Syntax long linSetScopeTrigger (long ID, long Position) long linSetScopeTrigger (long eventCount, long triggerCount, long triggerMask, byte idMask[8]) 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. The second function defines a set of trigger conditions. 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 0 Trigger on end of header 1-9 Trigger on databyte 1 - 8 or checksum (5 will trigger on the checksum if the length of the frame is 4) 10 Trigger on detection of receive error in response 11 Trigger on detection of checksum error 12 Trigger on detection of transmission error eventCount Number of occurred/fulfilled trigger conditions, which activate the triggering. E.g. a number of 5 will activate the triggering, after the trigger condition was fulfilled 5 times. A number of 0 is not allowed. 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. If the triggerCount is 0, the trigger will run indefinitely. triggerMask Definition of trigger conditions. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetScopeTrigger Meaning of the bits in the mask: 0 Sync break detection (about 9.6 bit times after start of sync break) 1 Start of sync delimiter 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) 3 End of sync field 4 Start of lin identifie 5 End of lin identifier 6 End of any data or checksum byte 715 End of data byte 1 - 8 or checksum byte (depending on dlc) 16 Detection of sync error 17 Detection of receive error in header/bus idle phase/sleep mode 18 Detection of receive error in response 19 Detection of checksum error 20 Detection of transmission error 21 Detection of sleep mode frame 22 Detection of sleep mode event 23 Detection of wakeup frame 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. Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • LIN — • • Real bus mode Example on key 'a' { long lresp; long position=0; // The fourth parameter is a Byte Array (8 Bytes). Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetScopeTrigger // -> 64 Bits for the setting of 64 Ids. byte idmask[8] = {0,0,0,0,0,0,0,0}; byte identifier = 0x30; // Byte Position: 6 // Bit Position: 0 idmask[identifier / 8] |= 1 << (identifier % 8); lresp = linSetScopeTrigger (0x30, position); lresp = linSetScopTrigger (1, 1, 1, idmaks); } | linResetScopeTrigger | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetValidBreakLimits linSetValidBreakLimits CAPL Function Overview » LIN » linSetValidBreakLimits Syntax dword linSetValidBreakLimits(dword breakMin16thBits, dword breakMax16thBits, dword delMin16thBits, dword delMax16thBits) 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. Range: 152 (9.5 bit times) – 784 (49 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. Range: 1 – 784 (49 bit times) delMax16thBits The maximum legal sync delimiter length, specified in units of 1/16th bit times. Range: 1 – 784 (49 bit times), has to be greater than delMin16thBits Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 • LIN — • • Real bus mode Example — | linSetBreakLength | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSetWakeupParams linSetWakeupParams CAPL Function Overview » LIN » linSetWakeupParams Syntax long linSetWakeupParams (long wakeupDelimiter, long numberOfWakeupFrames) 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 Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSilentWakeup linSilentWakeup CAPL Function Overview » LIN » linSilentWakeup Syntax long linSilentWakeup () Function Wakes up the LIN bus without sending any wakeup frames. Info • When called during Wakeup mode this function has no effect. • This function can be useful before issuing Go-to-Sleep command in order to ensure Wakeup mode. Parameters — Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 LIN — • Example — | linSendWakeup | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSimulateETFCollision linSimulateETFCollision CAPL Function Overview » LIN » linSimulateETFCollision Syntax dword linSimulateETFCollision (dword etfId) dword linSimulateETFCollision (dword etfId, dword respLength, dword numCollisions, byte dataBytes[]) Function This function can be used to cause collisions for next coming header(s) of an eventtriggered frame. Parameters etfId LIN frame identifier in the range 0 .. 59 respLength Number of databytes to be sent as the response on the header of the event-triggered frame. Value range: 1..9. Default: 1 numCollisions Number of times the specified response has to be applied. Value range: 1..255. Default: 1 Databytes Array of databytes to be sent as the response. The size of the array shall correspond to the respLength parameter. Default: NULL Return values On success, a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • LIN — • • Real bus mode Example — | linSetRespLength | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linStartDisturbance linStartDisturbance CAPL Function Overview » LIN » linStartDisturbance Syntax long linStartDisturbance(dword length, dword level) Function Starts a disturbance on the bus. Note that disturbances shorter than 64 bit times cannot be stopped with linStopDisturbance(). Parameters length Length of the disturbance in bit times. -1: permanent disturbance level The level of the disturbance. 0: dominant disturbance (inverts recessive bits) 1: recessive disturbance (inverts dominant bits - requires mag-Cab/Piggy and external power supply) Return values On success a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • LIN — • • Real bus mode Example — | linStopDisturbance | linSetRespDisturbance | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linStartScheduler linStartScheduler CAPL Function Overview » LIN » linStartScheduler Syntax void 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 LIN — • Example — | linStopScheduler | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linStopDisturbance linStopDisturbance CAPL Function Overview » LIN » linStopDisturbance Syntax long linStopDisturbance() Function Stops the disturbance on the bus which is started with linStartDisturbance(). Note that disturbances shorter than 64 bit times cannot be stopped. Parameters — Return values On success a value unequal to zero, otherwise zero. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • LIN — • • Real bus mode Example — | linStartDisturbance | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linStopScheduler linStopScheduler CAPL Function Overview » LIN » linStopScheduler Syntax void linStopScheduler() Function This function stops the internal scheduler. This way a cyclical traversal of the current schedule table is stopped. Scheduler can be started again by calling linStartScheduler() function. Info • Calling this function in the event procedure on preStart prevents the scheduler from starting at the beginning of the measurement. • If the Master node is not simulated or no schedule tables are defined, then this function will have no effect. Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 LIN — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linTime2Bits linTime2Bits CAPL Function Overview » LIN » linTime2Bits Syntax dword linTime2Bits(dword time) linTime2Bits(dword channel, dword time) 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 System time to be converted [in units of 10 µsec]. channel Channel number, whose baud rate will be used. Return values Resulting bit time. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 LIN — • 6.0 LIN • • Example Extract sync break length of LIN frames on linMessage * { dword sysTimeSyncBreak; // time in 10µs units dword bitTimeSyncBreak; // time in bit time units sysTimeSyncBreak = linGetSyncBreakLength(this); bitTimeSyncBreak = linTime2Bits(sysTimeSyncBreak); } | linBits2Time | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linTime2Bits_ns linTime2Bits_ns CAPL Function Overview » LIN » linTime2Bits_ns Syntax dword linTime2Bits_ns(int64 time) dword linTime2Bits_ns(dword channel, int64 time) 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 System time to be converted [in ns]. channel Channel number, whose baud rate will be used. Return values Resulting bit time. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 LIN • • Example Extract sync break length of LIN frames on linMessage * { ..dword bitTimeSyncBreak; bitTimeSyncBreak = linTime2Bits_ns(this.breakLen); } | linBits2Time_ns | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linBaudrateEvent 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linCsError 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN • • Example Simulate checksum error and check how it is handled. on key 'c' { int index; byte checksum; linmessage MotorControl frmMotorControl; // set data byte values and calculate resulting checksum for (index=0; index < frmMotorControl.DLC; ++index) { frmMotorControl.byte(index) = 0xFF; } // Set permanent CS error for the current frame linSetChecksumError(frmMotorControl.id, 1); // update response data frmMotorControl.RTR=0; output(frmMotorControl); // apply frame's header on the bus frmMotorControl.RTR=1; output(frmMotorControl); } ... on linCsError { int index; linmessage MotorControl frmMotorControl; // compare correct checksum and the received one if (this.ID == frmMotorControl.ID) { // set data byte values and calculate correct checksum for (index=0; index < frmMotorControl.DLC; ++index) { frmMotorControl.byte(index) = this.byte(index); } WriteLineEx(0,0,"received checksum=%d", getChecksum(this)); WriteLineEx(0,0,"correct checksum=%d", getChecksum(frmMotorControl)); } } | LINGetChecksum | LINSetChecksumError | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linDlcInfo 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linMessage on linMessage CAPL Function Overview » LIN » on linMessage Note This function is also used as a replacement for the function LINRcvFrame. 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 If for example a CAPL program contains the event procedures on linMessage 12 and on linMessage *, the procedure on linMessage 12 will be called up, when a frame with the identifier 12 is received. For all other frames the procedure on linMessage * will be called up. Selectors linMessage Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); } Propagate all frames to a next chain node // Warning: This code causes recursion when called from CANoe simulation setup node on linMessage * { this.RTR=1; output(this); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linReceiveError 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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; ... } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linSchedulerModeChange 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linSlaveTimeout 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. Selectors TIME (data type dword) 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. MsgOrigTime (data type dword) Time stamp generated by the LIN hardware. It will only prove useful in isolated cases to use this time stamp that is unsynchronized and thus still original. The time stamp should only be used to compare the time of two LIN hardware generated events. Unit: 10 microseconds. MsgTimeStampStatus (data type byte) Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN MsgChannel (data type ushort) The channel through which the timeout was received. lin_FsmID (data type byte) The Identifier of the FSM that initiated the timeout. lin_FsmState (data type byte) The status of the FSM in which the timeout occurred. lin_FollowStateID (data type byte) The status to which the FSM switched after the timeout. Write protected! Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linSlaveTimeout Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linSleepModeEvent on linSleepModeEvent CAPL Function Overview » LIN » on linSleepModeEvent Note This function is also used as a replacement for the function LINSleepModeEvent. 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linSyncError 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linTransmError on linTransmError CAPL Function Overview » LIN » on linTransmError Function The event procedure on linTransmError is called when no Slave responded to a transmission request. 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN • • Example Handle transmission error for a certain frame on channel 1: on linTransmError { if (this.MsgChannel == 1 && this.ID == 0x33) { … } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on linWakeupFrame on linWakeupFrame CAPL Function Overview » LIN » on linWakeupFrame Note This function is also used as a replacement for the function LINWakeupFrame. 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 LIN • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linBaudrateEvent Selectors linBaudrateEvent Selectors CAPL Function Overview » LIN » linBaudrateEvent Selectors Keyword Description Type Acess limitation Time Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). dword read only int64 read only dword read only byte read only Unit: 10µs Time_ns Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). Unit: nanoseconds MsgOrigTime Time stamp generated by the LIN hardware. This time 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 MsgTimeStampStatus MsgChannel Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN Channel through which the event was received. word Value range: 1..32 lin_Baudrate Measured baud rate. Unit: bits/sec. Version: 7.6 SP4 | © Vector Informatik GmbH int read only User Manual Topic: linCsError Selectors linCsError Selectors CAPL Function Overview » LIN » linCsError Selectors Keyword Description Type Acess limitation Time Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). dword read only int64 read only dword read only byte read only byte read only byte read only Unit: 10µs Time_ns Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). Unit: nanoseconds MsgOrigTime Time stamp generated by the LIN hardware. This time 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 MsgTimeStampStatus LIN_HeaderTime Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN Frame header transmission time. Unit: bit time LIN_Fulltime Entire frame transmission time. Unit: bit time ID LIN Frame identifier (6 bits) byte Value range: 0..63 DLC Number of data bytes contained in the frame (Data Length Code). byte read only word read only Value range: 0..8 MsgChannel Channel through which the checksum error has been received. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linCsError Selectors Value range: 1..32 DIR Direction of transmission: byte read only byte read only byte read only byte read only byte raed only word read only dword read only Tx: Frame was transmitted by LIN hardware Rx: Frame was received TxRequest: Transmission request SIMULATED This flag specifies whether the frame was simulated. Values: 0: Not simulated 1: Simulated lin_FsmID Identifier of the FSM that transmitted the frame response. Only valid if lin_FSMState <> 255. Value range: 0..63 lin_FsmState The status, in which the FSM transmitted the frame response. Value range: 0..255 If lin_FsmState = 255 no FSM was configured to respond to this frame. The value of lin_FSMId is thus also invalid. Byte(x) Frame data byte (8 bit). Possible values for x: 0..7 Word(x) Frame data word (16 bit). Possible values for x: 0-6. The index is byte-oriented. For example, word(1) references the data consisting of bytes 1-2 and not of bytes 2-3. Dword(x) Frame data double word (32 bit). Possible values for x: 0-4. The index is byte-oriented. For example, dword(1) references the data consisting of bytes 1-4 and not of bytes 4-7. breakLen Length of the sync break in ns int64 read only delimiterLen Length of the sync delimiter in ns int64 read only EOH End of header timestamp in ns int64 read only EOB End of byte timestamp of databyte <i> in ns int64 read only int64 read only Possible indexes: 0..7 SOF Start of Frame timestamp in ns Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linDlcInfo Selectors linDlcInfo Selectors CAPL Function Overview » LIN » linDlcInfo Selectors Keyword Description Type Acess limitation Time Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). dword read only int64 read only dword read only byte read only Unit: 10µs Time_ns Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). Unit: nanoseconds MsgOrigTime Time stamp generated by the LIN hardware. This time 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 MsgTimeStampStatus ID Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN LIN Frame identifier (6 bits) of the measured frame. byte Value range: 0..63 DLC Measured number of data bytes (Data Length Code). byte read only word read only Value range: 0..8 MsgChannel Channel through which the event was received. Value range: 1..32 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linHeader Selectors linHeader Selectors CAPL Function Overview » LIN » linHeader Selectors Keyword Description Type ID LIN Frame identifier (6 bits) byte Acess limitation Value range: 0..63 DLC Number of data bytes expected for the frame (Data Length Code). Value range: 0..8 Version: 7.6 SP4 | © Vector Informatik GmbH byte read only User Manual Topic: linMessage Selectors linMessage Selectors CAPL Function Overview » LIN » linMessage Selectors Keyword Description Type Acess limitation Time Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). dword read only int64 read only dword read only byte read only byte read only byte read only Unit: 10µs Time_ns Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). Unit: nanoseconds MsgOrigTime Time stamp generated by the LIN hardware. This time 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 MsgTimeStampStatus LIN_HeaderTime Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN Frame header transmission time. Unit: bit time LIN_Fulltime Entire event transmission time (transmission of the frame header by the master and waiting for the maximum frame duration). Unit: bit time ID LIN Frame identifier (6 bits) byte Value range: 0..63 DLC Number of data bytes contained in the frame (Data Length Code). byte Value range: 0..8 MsgChannel Transmission channel or channel through which the Version: 7.6 SP4 | © Vector Informatik GmbH word User Manual Topic: linMessage Selectors frame has been received. Value range: 1..32 DIR Direction of transmission: byte read only byte read only Tx: Frame was transmitted by LIN hardware Rx: Frame was received SIMULATED This flag specifies whether the frame was simulated. Values: 0: Not simulated 1: Simulated RTR This flag is only required when a frame is being sent with output(). byte Meaning: 0: Response data will be reconfigured. 1: Frame header is applied to the bus - only works with the LIN hardware in Master mode. Byte(x) Frame data byte (8 bit). byte Possible values for x: 0..7 Word(x) Frame data word (16 bit). word Possible values for x: 0-6. The index is byte-oriented. For example, word(1) references the data consisting of bytes 1-2 and not of bytes 2-3. Dword(x) Frame data double word (32 bit). dword Possible values for x: 0-4. The index is byte-oriented. For example, dword(1) references the data consisting of bytes 1-4 and not of bytes 4-7. breakLen Length of the sync break in ns int64 read only delimiterLen Length of the sync delimiter in ns int64 read only EOH End of header timestamp in ns int64 read only EOB[i] End of byte timestamp of databyte <i> in ns int64 read only int64 read only Possible indexes: 0..7 SOF Start of Frame timestamp in ns Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linReceiveError Selectors linReceiveError Selectors CAPL Function Overview » LIN » linReceiveError Selectors Keyword Description Type Acess limitation Time Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). dword read only int64 read only dword read only byte read only byte read only byte read only byte read only Unit: 10µs Time_ns Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). Unit: nanoseconds MsgOrigTime Time stamp generated by the LIN hardware. This time 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 MsgTimeStampStatus LIN_HeaderTime Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN Frame header transmission time. Unit: bit time LIN_Fulltime Entire event transmission time (transmission of the frame header by the master and waiting for the maximum frame duration). Unit: bit time ID LIN Frame identifier (6 bits) Value range: 0..63 DLC Number of data bytes expected in the frame (Data Length Code). Only valid if lin_ShortError is not set. byte Value range: 0..8 MsgChannel Transmission channel. Version: 7.6 SP4 | © Vector Informatik GmbH word read only User Manual Topic: linReceiveError Selectors Value range: 1..32 lin_ShortError Specifies the detail level of the event. byte read only byte read only byte read only byte read only Most selectors are not valid unless this selector is set. lin_StateReason The lower 4 bits indicate the LIN hardware state at the time the error has occurred, while the upper 4 bits indicate the reason of the error. Values for the state: 0 Bus idle 1 Waiting for SynchBreak 2 Waiting for SynchField 3 Waiting for frame ID 412 Waiting for data byte or checksum byte depending on the frame DLC. 4: DLC 0 12: DLC 8 - the checksum byte. 14 Consecutive event (i.e. event resulting from further data interpretation, after already notified error for first offending byte). 15 SleepMode. Only possible if the LIN hardware is in Master mode. In Slave mode, the LIN hardware can be wakened by any type of bus traffic. Values for the reason: lin_OffendingByte 0 Timeout 1 Received an unexpected byte violating protocol. In this case, lin_OffendingByte contains its value. 2 Received a byte with framing error (with dominant stop bit). In this case, lin_OffendingByte contains its value. 3 Unexpected Break field. 4 Unidentified error. The byte that resulted the protocol violation. Only valid for certain values of lin_StateReason. lin_FsmID Identifier of the FSM that transmitted the frame response. Only valid if lin_FSMState <> 255 and lin_ShortError is not set. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linReceiveError Selectors Value range: 0..63 breaklen Length of the sync break in ns int64 read only delimiterlen Length of the sync delimiter in ns int64 read only EOH End of header timestamp in ns int64 read only EOB[i] End of byte timestamp of databyte <i> in ns . Possible indexes: 0..7 int64 read only SOF Start of Frame timestamp in ns int64 read only lin_FsmState The status, in which the FSM transmitted the frame. Only valid if lin_ShortError is not set. byte read only Value range: 0..255 If lin_FsmState = 255 no FSM was configured to response to this frame. The value of lin_FSMId is thus also invalid. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSchedulerModeChange Selectors linSchedulerModeChange Selectors CAPL Function Overview » LIN » linSchedulerModeChange Selectors Keyword Description Type Acess limitation Time Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). dword read only int64 read only dword read only byte read only Unit: 10µs Time_ns Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). Unit: nanoseconds MsgOrigTime Time stamp generated by the LIN hardware. This time 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 MsgTimeStampStatus MsgChannel Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN Channel through which the event was received. word Value range: 1..32 lin_OldMode Index of a previously active schedule table. byte read only byte read only Value range: 0..255 lin_NewMode Index of the newly activated schedule table. Value range: 0..255 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linSleepModeEvent Selectors linSleepModeEvent Selectors CAPL Function Overview » LIN » linSleepModeEvent Selectors Keyword Description Type Acess limitation Time Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). dword read only int64 read only dword read only byte read only Unit: 10µs Time_ns Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). Unit: nanoseconds MsgOrigTime Time stamp generated by the LIN hardware. This time 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 MsgTimeStampStatus MsgChannel Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN Channel through which the event was received. word Value range: 1..32 lin_WasAwake lin_IsAwake lin_External Indicates which status the LIN hardware was in before the LinSleepModeEvent occurred: • In Awake status (selector set) or • In Sleep status (selector not set) Indicates the current state of the LIN hardware: • In Awake status (selector set) or • In Sleep status (selector not set) Indicates whether the change of state is the result of • an external event (selector set) or Version: 7.6 SP4 | © Vector Informatik GmbH byte read only byte read only byte read only User Manual Topic: linSleepModeEvent Selectors • lin_Reason an internal reason (selector not set) This value indicates the reason for an event. A variety of values can be transferred. General values: 0: Start state Values upon transition to Sleep mode: 1: SleepModeFrame 2: BusIdle Timeout 3: Silent SleepMode" command (for shortening the BusIdle Timeout) Values upon leaving Sleep mode: 9: External Wakeup signal 10: Internal Wakeup signal 11: Bus traffic (can only occur if the LIN hardware does not have a Master function) Values if the LIN hardware does not go into Sleep mode in spite of request to do so: 18: Bus traffic (can only occur if the LIN hardware does not have a Master function) Version: 7.6 SP4 | © Vector Informatik GmbH byte read only User Manual Topic: linSyncError Selectors linSyncError Selectors CAPL Function Overview » LIN » linSyncError Selectors Keyword Description Type Acess limitation Time Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). dword read only int64 read only dword read only byte read only Unit: 10µs Time_ns Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). Unit: nanoseconds MsgOrigTime Time stamp generated by the LIN hardware. This time 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 MsgTimeStampStatus MsgChannel Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN Channel through which the event was received. word Value range: 1..32 lin_SyncInterval [x] Time intervals detected between the falling signal edges 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. word Possible values for x: 0..3. Unit: Microsecond breaklen Length of the sync break in ns int64 read only delimiterlen Length of the sync delimiter in ns int64 read only SOF Start of Frame timestamp in ns int64 read only Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linTransmError Selectors linTransmError Selectors CAPL Function Overview » LIN » linTransmError Selectors Keyword Description Type Acess limitation Time Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). dword read only int64 read only dword read only byte read only byte read only byte read only byte read only Unit: 10µs Time_ns Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). Unit: nanoseconds MsgOrigTime Time stamp generated by the LIN hardware. This time 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 MsgTimeStampStatus LIN_HeaderTime Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN Frame header transmission time. Unit: bit time LIN_Fulltime Entire event transmission time (transmission of the frame header by the master and waiting for the maximum frame duration). Unit: bit time ID LIN Frame identifier (6 bits) Value range: 0..63 DLC Expected number of data bytes contained in the frame (Data Length Code). byte Value range: 0..8 MsgChannel Channel through which the event was received. Version: 7.6 SP4 | © Vector Informatik GmbH word read only User Manual Topic: linTransmError Selectors Value range: 1..32 lin_FsmID Identifier of the FSM that had to send frame response. byte read only Only valid if lin_FSMState <> 255. Value range: 0..63 lin_FsmState The status the FSM is currently in and in which it did not transmit the frame response. byte Value range: 0..255 If lin_FsmState = 255 no FSM was configured to responsd to this frame. The value of lin_FSMId is thus also invalid. breaklen Length of the sync break in ns int64 read only delimiterlen Length of the sync delimiter in ns int64 read only EOH End of header timestamp in ns int64 read only SOF Start of Frame timestamp in ns int64 read only Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linWakeupFrame Selectors linWakeupFrame Selectors CAPL Function Overview » LIN » linWakeupFrame Selectors Keyword Description Type Acess limitation Time Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). dword read only int64 read only dword read only byte read only Unit: 10µs Time_ns Time stamp synchronized with the global time base on the PC (CAN hardware or PC system clock). Unit: nanoseconds MsgOrigTime Time stamp generated by the LIN hardware. This time 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 MsgTimeStampStatus MsgChannel Status of MsgOrigTime: Bit 0 set Time stamp is valid Bit 0 not set Time stamp is invalid Bit 1 set Time stamp was generated by software Bit 1 not set Time stamp was generated by hardware Bit 4 Has a bus-specific meaning; not currently in use for LIN Channel through which the event was received. word Value range: 1..32 lin_Signal Signal actually received. byte read only byte read only int64 read only Because of different baud rates of transmitter and receiver in Sleep state, this signal can take on the legal values 0x00, 0x80 (signal actually transmitted) and 0xC0. lin_External length_ns indicates whether the wakeup signal was • received by an external device (selector set) or • transmitted by the LIN hardware itself (selector not set). Length of the wakeup signal in ns. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: linWakeupFrame Selectors SOF Start of wakeup signal timestamp in ns Version: 7.6 SP4 | © Vector Informatik GmbH int64 read only User Manual Topic: LIN: Hardware Configuration LIN: Hardware Configuration CAPL Function Overview » LIN » Hardware Configuration 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. Certain network parameters depend on the used protocol version: LIN 1.x • Wakeup frame retransmission delay (‘ttobrk’): 125 bit times • Number of Wakeup frame retransmissions: 3 • Length of Wakeup frame: 8 bit times • Wakeup delimiter length: 4 bit times • Byte order: Little-Endian LIN 2.x • Wakeup frame retransmission delay (‘ttobrk’): 150 ms • Number of Wakeup frame retransmissions: 3 • Length of Wakeup frame: 1000 µs • Wakeup delimiter length: 100 ms • Byte order: Little-Endian OEM variant • Wakeup frame retransmission delay (‘ttobrk’): 50 ms • Number of Wakeup frame retransmissions: 3 • Length of Wakeup frame: 600 µs • Wakeup delimiter length: 35 ms • Byte order: Big-Endian SAE-J2602 • Wakeup frame retransmission delay (‘ttobrk’): 150 ms • Number of Wakeup frame retransmissions: 3 • Length of Wakeup frame: 1000 µs • Wakeup delimiter length: 100 ms Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN: Hardware Configuration • Byte order: Little-Endian Cool-LIN • Settings identical LIN 1.x | linSendWakeup | linSetWakeupParams | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN: Notes to the Way initial NAD is determined LIN: Notes to the Way initial NAD is determined CAPL Function Overview » Notes to the Way initial NAD is determined 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: LIN: Timeout Prevention LIN: Timeout Prevention CAPL Function Overview » LIN » Timeout Prevention The 7259-transceiver implements a dominant timeout of 6 to 20 ms to prevent a faulty slave from disturbing the LIN bus for a prolonged time. This timeout, however, can lead to problems with low baud rates. For example, a timeout of 6 ms means that only 6 dominant bits can be sent at 1 kBaud. This excludes a null byte as well as any valid synch break. It is also impossible to create a dominant disturbance on the bus using the transceiver alone. 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) MOST CAPL Functions (Only available with Option .MOST!) CAPL Function Overview » MOST CAPL Functions The following MOST CAPL functions are available: MOST50 Function Short description output Sends a message on the MOST ring. MostAmsOutput Definition and direct dispatch of an AMS message using the syntax from the MOST specification and the description in the XML function catalog. OutputMostPkt Sends a packet on the MOST ring. 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. MostGetSpecVersion Returns the applied specification version of a MOST channel. MostGetSpeedGrade Returns the configured speed grade of a MOST channel. 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. MostShutDown Performs a network shutdown. MOST150 Function Short description output Sends a message on the MOST ring. MostAmsOutput Definition and direct dispatch of an AMS message using the syntax from the MOST specification and the description in the XML function catalog. OutputMostPkt Sends a packet on the MOST ring. OutputMostEthPkt Sends out an Ethernet packet over the asynchronous channel. OutputMostEthPktThis Passes the Ethernet packet on to the next node in the nodal sequence. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) 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. 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. MostGenerateBypassToggle Starts or stops generation of Bypass-open-close transitions. mostGenerateEclSequence Starts the generation of a signal sequence on the Electrical Control Line. MostGetShutdownFlag Returns the current state of the Shutdown flag. MostGetSpecVersion Returns the applied specification version of a MOST channel. MostGetSpeedGrade Returns the configured speed grade of a MOST channel. MostGetSystemLock Returns the number of channels of the respective entry (connection label) in the allocation table. mostSetEclGlitchFilter Configures the timing of the glitch filter for the ECL line. MostSetMacAdr, MostGetMacAdr Sets/gets the MAC address of the MOST interface. MostSetMasterMode, MostGetMasterMode Configures the timing master as static or non-static master. mostSetRxBufferAsync Starts or stops draining of the asynchronous receive buffer and allows to provoke low level retries. MostSetStressNodeParameter, MostGetStressNodeParameter Configures the stress network interface controller. 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. MostSetSystemLockFlagUsage, MostGetSystemLockFlagUsage Switches usage of system lock flag. MostShutDown Performs a network shutdown. MostSetShutDownFlagUsage, MostGetShutDownFlagUsage Switches usage of shutdown flag. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) Evaluation of event procedures Functions for MOST Controller Events Short description MostEventChannel Returns the channel of a MOST controller event. MostEventTime Returns the time stamp of a MOST controller event. MostEventOrigTime Returns the hardware-generated time stamp of a MOST controller event. Functions for OnMostPkt() Short description MostPktMsgChannel Returns the channel of the packet event. MostPktMsgTime Returns the time stamp of the packet event. MostPktOrigTime Returns the hardware generated time stamp of the packet event. MostPktSrcAdr Returns the source address of the packet event. MostPktDestAdr Returns the destination address of the packet event. MostPktDir Returns the direction of transmission. MostPktArbitration Returns the packet arbitration value. MostPktDlc Number of transported data bytes of the packet. MostPktGetData Copies the data bytes to a provided buffer. MostPktGetSelData Copies the data bytes starting at a given position to a provided buffer. MostPktTelID Returns the TelID of the packet. MostPktTelLen Returns the TelLen of the packet. MostPktIsSpy Returns wether the packet was received over the Spy of the asynchronous channel. Functions for OnMostReg() Short description MostRegChip Returns the chip identifier. MostRegOffset Returns the start address of the register. MostRegDataLen Returns the number of bytes. MostRegGetData Copies the data bytes to a provided buffer. MostRegGetByteAbs Returns the byte value at a given positon. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) MostRegGetWordAbs Returns the word value at a given positon. Hardware API Electrical Control Line Short description mostConfigureEclSequence Defines a signal sequence for the Electrical Control Line and prepares the hardware to start the generation. mostGenerateEclSequence Starts the generation of a signal sequence on the Electrical Control Line. MostGetEcl Returns the current state of the Electrical Control Line. MostSetEcl Switches the Electrical Control Line. mostSetEclGlitchFilter Configures the timing of the glitch filter for the ECL line. MostGetEclTermination Returns the current setting of the Electrical Control Line resistor. MostSetEclTermination Switches the Electrical Control Line resistor. Node Addresses - Node Mode Short description MostSetNodeAdr Sets the node address of the MOST interface. MostSetGroupAdr Sets the group address of the MOST interface. MostSetAltPktAdr Sets the alternative packet address of the MOST interface. MostSetOwnAdr Sets the node and group address of the MOST interface. MostSetMacAdr, MostGetMacAdr Sets/gets the MAC address of the MOST interface. MostGetNodeAdr Returns the current node address of the MOST interface. MostGetGroupAdr Returns the current group address of the MOST interface. MostGetAltPktAdr Returns the current alternative packet address of the MOST interface. MostGetNodePosAdr Returns the current node position address of the MOST interface. Ring State Short description MostGetLockEx Returns the current lock status (unlock, lock, stable lock, critical unlock). MostGetSBC Returns the current value of the SBC register. MostSetSBC Sets the value of the SBC register. MostGetMPR Returns the current value of the MPR register (number of nodes in the ring). Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) MostGetNPR Returns the current value of the NPR register (current node position in the ring). MostWakeup Generates an optical wake-up signal. MostGetRxLight Returns the current light status at the FOT input. MostSetTxLight Sets the light status at the FOT output. MostGetTxLight Returns the current light status at the FOT output. MostGetLock Returns the current lock status (unlock, lock) MostGetAllocTable Copies the MOST Allocation Table to a local buffer. MostGetCodingErrors Returns the number of coding errors. MostGetNceType Returns the type of NCE (can only be called within OnMostMPR). MostSetCorrectStartupSBC Activates or deactivates the correct setting of the 'Synchronous Bandwidth Control' register (SBC) in the MOST chip. MostShutDown Performs a network shutdown. Register Access Short description MostReadReg Initiates read-out of the registers of a MOST hardware chip. MostWriteReg Writes to one or more registers of a MOST hardware chip. Synchronous Channel Allocation Service Short description MostSyncAlloc Reserves bandwidth for sending data on the synchronous channel. MostSyncDealloc Releases reserved bandwidth on the synchronous channel. Operating Modes Short description Bypass Mode MostSetAllBypass Disables or enables the bypass of the MOST interface. MostGetAllBypass Returns the current bypass status of the MOST interface. Timing Mode MostSetMasterMode, MostGetMasterMode Configures the timing master as static or non-static master. MostSetTimingMode Sets the timing mode of the MOST interface. MostGetTimingMode Returns the current timing mode of the MOST interface. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) Spy Mode MostSetSpyAsync Disables or enables the asynchronous spy of the MOST interface. MostSetSpyCtrl Disables or enables the control spy of the MOST interface. 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. MostGenerateBusloadAsync Sends cyclical packets to the asynchronous channel. MostConfigureBusloadCtrl Configures the bus load generator for the control channel. MostGenerateBusloadCtrl Sends cyclical messages to the control channel. MostConfigureBusloadEthPkt Configures the bus load generator for the Ethernet channel. MostGenerateBusloadEthPkt Configures the bus load generator for the Ethernet channel. MostGenerateBypassToggle Starts or stops generation of Bypass-open-close transitions. mostSetRxBufferAsync Starts or stops draining of the asynchronous receive buffer and allows to provoke low level retries. MostSetShutDownFlagUsage, MostGetShutDownFlagUsage Switches usage of shutdown flag. MostSetStressNodeParameter, MostGetStressNodeParameter Configures the stress network interface controller. MostSetSystemLockFlagUsage, MostGetSystemLockFlagUsage Switches usage of system lock flag. MostSetTxLightPower Sets the intensity of the light at the Fiber Optical Transmitter (FOT). MostSetRxBufferCtrl Disables or enables the Rx buffer for messages of the control channel. MostGenerateLightError Starts or stops generation of Light-ON-OFF transitions. MostGenerateLockError Starts or stops generation of Light Unmodulated-Modulated transitions. MostSetRetryParameter, MostGetRetryParameter Provides access to the transceiver chip parameters for message transmission. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) Audio MostSetSyncAudio Programs the routing engine for the audio input or output of the MOST interface. MostSetSyncMute Activates or deactivates 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. MostSetSyncSpdifMode Sets the timing mode for the S/PDIF signal. MostGetSyncSpdifMode Returns the timing mode of the S/PDIF signal. MostSetClockSource Sets the clock source for the timing master. MostGetClockSource Returns the clock source of the timing master. Spy Filter - only for Optolyzer! MostSetHWFilter Activates or deactivates the hardware filter. MostGetHWFilter Returns the current status of the hardware filter. MostSetAndFilter Sets the AND filter. MostGetAndFilter Returns the current AND filter. MostSetXorFilter Sets the XOR filter. MostGetXorFilter Returns the current XOR filter. Other MostGetHWCapability Returns specific properties of the attached MOST interface. MostGetHWInfo Returns specific information of the attached MOST interface (e.g. hardware type). MostTwinklePowerLed Twinkles the power LED. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) Application Socket API Function blocks Short description Registering/ Unregistering MostApRegister Registers a CAPL node at the Application Socket as function block. MostApRegisterEx Registers a function block at the local function block list. 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 MostApIsAddressed Checks whether the functional MOST address {fblockID, instID} matches the CAPL node function blocks. MostApIsRegistered Checks whether a function block assigned to the CAPL node is registered at the Application Socket. MostApIsRegisteredEx Checks whether a function block is registered at the Application Socket. MostApGetFBlockID Returns the function block identifier (FBlockID) of the CAPL node. MostApGetInstID Returns the instance identifier (InstID) of the CAPL node. Read-Out of the Registries Short description The registries of the Application Socket may be read-out during the entire measurement cycle. For this purpose CAPL provides the following functions: MostAsRgGetSize Returns the number of entries in the desired registry. MostAsRgGetRxTxLog Returns the logical node address of a specific entry in the desired registry. MostAsRgGetFBlockID Returns the FBlockID of a specific entry in the desired registry. MostAsRgGetInstID Returns the InstID of a specific entry in the desired registry. The 'regsel' parameter is used to select the desired registry: regsel = 1: Local FBlockList regsel = 2: Bus 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. Changes to registries are signaled in CAPL by the OnMostAsRegistry() event procedure. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) Example Network State Short description MostGetNetState Returns the current network state of the MOST interface. Power Master Short description MostPMResetOverTemperature Signalizes the PowerMaster that the device has reached operating temperature again. MostPMSetOverTemperature Signalizes the PowerMaster that an over-temperature in its own device will be simulated. MostPMShutDownStart Initiates a system shutdown by the PowerMaster. MostPMShutDownCancel Aborts system shutdown of the PowerMaster. 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. See SetBusContext() regarding this. Notification Service Short description MostAsNtfDeviceIDListGetSize Returns the list size of all notification clients registered to a specific the function. MostAsNtfDeviceIDListGetDeviceID Returns the deviceID of a specific entry in the notification list. MostAsNtfEnable, MostAsNtfDisable Enables or disables the notification service for the function block assigned to the CAPL node. MostAsNtfEnableEx Enables the notification service for a function block. MostAsNtfDisableEx Disables the notification service for a function block. MostAsNtfFunctionCheck Checks whether a notification client (deviceID) is registered in the notification matrix for a function. MostAsNtfFunctionClear Clears a notification client entry from the notification matrix of a specific function. MostAsNtfFunctionClearAll Clears all notification clients from the notification matrix of a specific function. MostAsNtfFunctionEnable Enables the notification service for a specific function. MostAsNtfFunctionDisable Disables the notification service for a specific function. MostAsNtfFunctionIsEnabled Checks whether the notification service is enabled for a specific Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) function. MostAsNtfFunctionEnableEx Enables the notification service for a specific function of a function block not exclusively assigned to the CAPL node. MostAsNtfFunctionDisableEx Disables the notification service for a specific function of a function block not exclusively assigned to the CAPL node. MostAsNtfFunctionIsEnabledEx Checks whether the notification service is enabled for a specific function of a function block not exclusively assigned to the CAPL node. 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. MostAsNtfFunctionSet Registers a notification client in the notification matrix. MostAsNtfOutput Sends a message via the notification service to a stated address. Shadow Service: MostAsShdEnable Adds an entry to the list of shadowed function blocks. MostAsShdDisable Removes an entry from the list of shadowed function blocks. Notification Shadow Service Short description MostAsNtfShdFunctionEnable Registers a function to the notification shadow service. MostAsNtfShdFunctionDisable Removes a function from the notification shadow service. Function Service Short description 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. MostAsFsEnableEx Enables the function service for a function block. MostAsFsDisableEx Disables the function service for a function block. MostAsFsFunctionEnable Registers a function of the function block assigned to the CAPL node to the function service. MostAsFsFunctionEnableEx Registers a function of a given function block to the function service. NetBlock Short description MostNBSetAbilityToWake Sets the AbilityToWake flag in the NetBlock. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) Test functions Test functions Short description Message Events: TestGetWaitEventMostAMSMsgData Retrieves the AMS message data of a waiting condition. TestGetWaitEventMostPkt Provides access to packet data of a waiting condition. TestGetWaitEventMostRawMsgData Retrieves the CMS raw message data of a waiting condition. TestGetWaitEventMostMsgData Retrieves the CMS message data of a waiting condition. TestJoinMostAMSMessageEvent Adds an AMS message to the set of joined events. TestJoinMostAMSReportEvent Adds an AMS report message (OpType > 8) to the set of joined events. TestJoinMostAMSSpyMessageEvent Adds an AMS spy message to the set of joined events. TestJoinMostAMSSpyReportEvent Adds an AMS spy report message (OpType > 8) to the set of joined events. TestJoinMostMessageEvent Adds a CMS message to the set of joined events. TestJoinMostPktEvent Adds a packet to the set of joined events. TestJoinMostReportEvent Adds a CMS report message (OpType > 8) to the set of joined events. TestJoinMostSpyMessageEvent Adds a CMS spy message to the set of joined events. TestJoinMostSpyPktEvent Adds a spy packet to the set of joined events. TestJoinMostSpyReportEvent Adds a CMS spy report message (OpType > 8) to the set of joined events. TestSendMostAMSMessage Sends an AMS message an waits for Tx acknowledgement result. TestSendMostRawMessage Send a CMS raw message and waits for Tx acknowledgement result. TestWaitForMostAMSMessage Waits for specific AMS message. TestWaitForMostAMSReport Waits for specific AMS report message (OpType > 8). TestWaitForMostAMSRespons Sends a symbolically defined AMS message and waits for the appropriate response message. TestWaitForMostAMSResult Sends a symbolically defined AMS message with OpType ‘StartResult’ or ‘StartResultAck’ and waits for the reception of the appropriate ‘Result’ or ‘ResultAck’ message. TestWaitForMostAMSSpyMessage Waits for specific AMS spy message. TestWaitForMostAMSSpyReport Waits for specific AMS spy report message (OpType > 8). TestWaitForMostMessage Waits for specific CMS message. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) TestWaitForMostPkt Waits for a specific packet. TestWaitForMostRawSpyMessage Waits for specific CMS raw spy message. TestWaitForMostReport Waits for specific CMS report message (OpType > 8). TestWaitForMostSpyMessage Waits for specific CMS spy message. TestWaitForMostSpyPkt Waits for a specific spy or node packet. TestWaitForMostSpyReport Waits for specific CMS spy report message (OpType > 8). Controller Events: TestWaitForMostAllBypass Wait for a bypass change event. TestWaitForMostCriticalUnlock Wait for the occurrence of a LightLock event indicating a critical unlock state. TestWaitForMostGroupAdr Waits for group address change event. TestWaitForMostLightOff Wait for the occurrence of a LightLock event indicating a no light & no lock state. TestWaitForMostMPR Waits for a MPR event (NCE). TestWaitForMostNetState Waits for NetState change event. TestWaitForMostNodeAdr Waits for a node address change event. TestWaitForMostNPR Waits for a NPR change event. TestWaitForMostSBC Wait for SBC change event. TestWaitForMostShortUnlock Wait for the occurrence of a LightLock event indicating a light & no lock state. TestWaitForMostStableLock Wait for the occurrence of a LightLock event indicating a stable unlock state. TestMostReadReg Reads one or several MOST chip registers and waits for the result. TestMostRegGetData Retrieve the register values after a TestMostReadReg or TestMostWriteReg function was called. Test MostWriteReg Writes one or several MOST chip registers and waits for the result. | TestWaitForAllJoinedEvents | TestWaitForAnyJoinedEvent | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) Transmission and receipt settings of nodes Transmission and receipt settings of nodes Short description 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 Message access Short description MostPrepareReport Preparation of an AMS message as response (OpType>=9) to a received command message (OpType<9). getThisMessage Copies the data of an AMS message into a message variable - Obsolete - see Initialization of Message Variables! Message transmission Message transmission Short description output Sends a message on the MOST ring. OutputMostPkt Sends a packet on the MOST ring. 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. MostAmsClearTxQueue Clears all entries in the AMS send buffer. MostSendError Generates and sends an error message directly based on a received command message. Function catalogue Function catalogue Short description MostParamGet Query of a parameter value from an AMS message using the parameter name from the XML function catalog. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) 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). MostStringToAscii Convert MOST string to ASCII string. 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 Fault injection Short description MostAsFiEnable Enables/disables fault injection for CANoe’s Application Socket services. MostFiAmsReceive Pretends an AMS message reception to the Application Socket or CAPL node. MostNwmFiEnableRingScan Changes the ring scan behavior of CANoe’s Network Master. MostNwmFiSetConfigState Forces the network configuration status to be set in CANoe’s Network Master. MostNwmFiSetParameter, Provide access to the timing parameters of CANoe’s Network Master Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) MostNwmFiGetParameter implementation. Trace highlighting Fault injection Short description mostEthPktSetTraceColors (MOST150) Sets the text and background color for displaying the MOST event in the Trace window. mostMHPBlockSetTraceColors mostMHPConnectionSetTraceColors mostMHPConnectionSetTraceColors mostMHPPacketSetTraceColors mostPktSetTraceColors traceSetEventColors The following MOST event procedures are available: Event procedures The following event procedures are available with MOST: General message / packet event procedures Short description on mostAMSMessage Is called when a message is received from the Application Message Service (AMS). on mostMessage Is called on the receipt of a function catalog conform MOST frame. on mostRawMessage Is called on the receipt of MOST frames whose type isn't Normal. OnMostPkt Is called when a packet is received over the Asynchronous Channel. OnMostEthPkt Is called when an Ethernet packet is received over the Packet Data channel. MOST High Protocol observer and combiner event procedures Short description OnMostMHPBlock Is called up as soon as a block from a MOST High connection has been fully transmitted. OnMostMHPPacket Is called up as soon as a MOST High packet is finished. OnMostMHPConnection Is called as soon as a MOST High connection version 2.2 or higher is terminated. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) OnMostMHPError Is called up as soon as a MOST High protocol violation is observed. MOST Controller Event Short description OnMostAllBypass Is called if the bypass of the MOST chip was opened or closed. OnMostAllocTable Is called as soon as the hardware interface detects a change in the MOST Allocation Table. OnMostCriticalUnlock Is called when a critical unlock is detected. OnMostEcl Is called when the state of the Electrical Control Line changed. OnMostGroupAdr Is called when the group address changed. OnMostMacAdr Is called when the MAC address 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. OnMostNodeAdr Is called when the node address changed. OnMostNPR Is called when the value of node position register changed. OnMostReg Is called in response to read or write requests to registers of a MOST hardware interface chip. OnMostSBC Is called when the value of the synchronous bandwidth control register changed. OnMostStableLock Is called when stable lock is detected. 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. OnMostTxLight Is called as soon as the light at the output goes on/off. on mostLightLockError Is called on controller events. MOST Application Events Short description OnMostNetOn / OnMostInitReady Is called when the NetOn / InitReady event (first "Stable Lock" after he loop has been woken up) has occurred. OnMostNetState Is called when the network status is changed. OnMostApInstID Is called when the InstID of the associated function block changes. OnMostAsRegistry Is called when the Local FBlockList or Bus Registry is changed. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) Fault injection Fault injection Short description OnMostFiAmsPreReceive Is called before an AMS message is received. OnMostFiAmsPreSend Is called before an AMS message is sent. MOST50 Function Short description on mostAMSMessage Is called when a message is received from the Application Message Service (AMS). on mostMessage Is called on the receipt of a function catalog conform MOST frame. OnMostPkt Is called when a packet is received over the Asynchronous 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. 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 Function Short description on mostAMSMessage Is called when a message is received from the Application Message Service (AMS). on mostMessage Is called on the receipt of a function catalog conform MOST frame. OnMostPkt Is called when a packet is received over the Asynchronous channel. 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. OnMostMacAdr Is called when the MAC address changed. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST CAPL Functions (Only available with Option .MOST!) 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAllocTableGetCL MostAllocTableGetCL CAPL Function Overview » MOST » MostAllocTableGetCL Syntax MOST50 / MOST150: long MostAllocTableGetCL(long channel, long idx) Function Returns the connection label of the respective entry in the allocation table. Parameters channel Application channel number. idx Index of the entry in the allocation table. Return values >= 0: Connection label of the concerning entry. < 0: MOST CAPL error codes. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 • MOST150 • • • After measurement start • Not in Stopmeasurement • MOST150, MOST50 • • • After measurement start • Not in Stopmeasurement 7.2 SP3 Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAllocTableGetSize MostAllocTableGetSize CAPL Function Overview » MOST » MostAllocTableGetSize Syntax MOST50 / MOST150: long MostAllocTableGetSize(long channel) Function Returns the number of entries (connection labels) in the allocation table. Parameters channel Application channel number. Return values >= 0: Number of entries. < 0: MOST CAPL error codes. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 • MOST150 • • • After measurement start • Not in Stopmeasurement • MOST150, MOST50 • • • After measurement start • Not in Stopmeasurement 7.2 SP3 Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAllocTableGetWidth MostAllocTableGetWidth CAPL Function Overview » MOST » MostAllocTableGetWidth Syntax MOST50 / MOST150: long MostAllocTableGetWidth(long channel, long idx) Function Returns the number of channels of the respective entry (connection label) in the allocation table. Parameters channel Application channel number. idx Index of the entry in the allocation table. Return values > 0: Number of channels. < 0: MOST CAPL error codes. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 • MOST150 • • • After measurement start • Not in Stopmeasurement • MOST150, MOST50 • • • After measurement start • Not in Stopmeasurement 7.2 SP3 Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAmsClearTxQueue MostAmsClearTxQueue CAPL Function Overview » MOST » MostAmsClearTxQueue Syntax long mostAmsClearTxQueue(long channel) Function Clears all entries in the AMS send buffer. 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 Channel of the connected interface. Return values <= 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 MOST — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAmsOutput MostAmsOutput CAPL Function Overview » MOST » MostAmsOutput Syntax mostAmsOutput(long channel, long destAdr, char symbolicMessage[], long instId) mostAmsOutput(long channel, char symbolicMessage[], long instId) mostAmsOutput(long channel, char symbolicMessage[]) 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 Channel of the connected interface. destAdr Destination address. symbolicMessage Description of the message content in the following formats: FBlock.InstanceId.Function.OpType(Parameterlist) 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAmsOutput | 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAmsSetSizePrefixed MostAmsSetSizePrefixed CAPL Function Overview » MOST » MostAmsSetSizePrefixed Syntax MOST50 / MOST150: long MostAmsSetSizePrefixed(long channel, long minlength); Function Configures the minimum length of an AMS message above which an initiating message with TelID==4 is sent. Parameters channel Channel of the connected hardware interface. minlength Minimum length of an AMS message. 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 <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST150 — • 7.2 SP3 MOST150, MOST50 — • 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); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostApGetFBlockID MostApGetFBlockID CAPL Function Overview » MOST » MostApGetFBlockID Syntax long MostApGetFBlockID() Function MostApGetFBlockID returns the FBlockID of the CAPL node. The function block must be Parameters — Return values >0: Valid FBlockID assigned to the CAPL program exclusively via MostApRegister(fblockID, instIDDefault) or the database. <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostApGetInstID MostApGetInstID CAPL Function Overview » MOST » MostApGetInstID Syntax long MostApGetInstID() Function MostApGetInstID returns the InstID of the CAPL node. The function block must be Parameters — Return values >0: Valid InstID assigned to the CAPL program exclusively via MostApRegister (fblockID, instIDDefault) or the database. <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — | OnMostApInstID | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostApIsAddressed MostApIsAddressed CAPL Function Overview » MOST » MostApIsAddressed Syntax long MostApIsAddressed(long fblockID, long instID) long MostApIsAddressed(mostAmsMessage * msgCommand) 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. This function can be used to determine whether an incoming command message is destined for the CAPL node. Parameters fblockID Function block identifier of the functional address. instID Instance identifier of the functional address. msgCommand Received command message containing the functional address. Return values 1: If a MOST application simulated by this CAPL node is addressed. 0: Otherwise <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 • MOST — • • While Application Socket is active Example — | MostApRegister | MostApRegisterEx | MostPrepareReport | MostSendError | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostApIsRegistered MostApIsRegistered CAPL Function Overview » MOST » MostApIsRegistered Syntax long 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 — Return values 1: Function block is registered 0: Function block is not registered <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — | MostApRegister | MostApUnregister | MostApGetInstId | MostApGetFBlockId | MostApIsRegisteredEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostApIsRegisteredEx MostApIsRegisteredEx CAPL Function Overview » MOST » MostApIsRegisteredEx Syntax long MostApIsRegisteredEx(long fblockID, long instID) 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 Function block identifier to be queried. instID Instance identifier to be queried. Return values 1: Function block is registered. 0: Function block is not registered. <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — | MostApRegisterEx | MostApUnregisterEx | MostApIsRegistered | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostApplicationNode MostApplicationNode CAPL Function Overview » MOST » MostApplicationNode Syntax void MostApplicationNode() Function This CAPL function can only be called in on preStart and switches the CAPL node into application mode. The node will • not receive Spy messages any more, • only receive messages (mostMessages, mostAmsMessage)from channels to which it is connected in the simulation setup and • send messages on the channel to which it is connected in the simulation setup 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostApRegister MostApRegister CAPL Function Overview » MOST » MostApRegister Syntax long MostApRegister(long fblockID, long instIDDefault) 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. The second function re-registers a previously de-registered CAPL node. 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. As a result of the call of MostApRegister(), if the network status is 'ConfigOk' the device's NetBlock reports the new Local FBlockList to the Network Master. Parameters fblockID Function block identifier to be registered. instdIDDefault Default instance identifier. The actual registered InstID can be retrieved with MostApGetInstID(). Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — | MostApUnregister | MostApIsRegistered | MostApGetInstId | MostApGetFBlockId | OnMostApInstID | MostApRegisterEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostApRegisterEx MostApRegisterEx CAPL Function Overview » MOST » MostApRegisterEx Syntax long MostApRegisterEx(long fblockID, long instID) Function MostApRegisterEx() registers the function block with the Application Socket using the functional address (fblockID, instID). It has to be checked in advance, if the functional address already exists (MostApIsRegisteredEx). If so, another instID has to be selected. In network status 'ConfigOk' the device's NetBlock reports the new Local FBlockList to the Network Master. Parameters fblockID Function block identifier to be registered. instID Instance identifier to be registered. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — | MostApUnregisterEx | MostApIsRegisteredEx | MostApRegister | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostApUnregister MostApUnregister CAPL Function Overview » MOST » MostApUnregister Syntax long 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 — Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — | MostApRegister | MostApUnregisterEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostApUnregisterEx MostApUnregisterEx CAPL Function Overview » MOST » MostApUnregisterEx Syntax long MostApUnregisterEx(long fblockID, long instID) 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 Function block identifier to be logged out. instID Instance identifier to be logged out. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsFiEnable MostAsFiEnable CAPL Function Overview » MOST » MostAsFiEnable Syntax long MostAsFiEnable(long mode) Function This function allows to temporarily switch the Application Socket Fault Injection on and off. Info To allow Fault Injection in general, the main switch in the Network Hardware Configuration dialog has to be activated for the corresponding channel. 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 Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsFsEnableEx, MostAsFsDisableEx MostAsFsEnableEx, MostAsFsDisableEx CAPL Function Overview » MOST » MostAsFsEnableEx, MostAsFsDisableEx Syntax long MostAsFsEnableEx(long fblockId, long instId) long MostAsFsDisableEx(long fblockId, long instId) 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. MostAsFsDisableEx() disables the function service for a function block. Parameters fblockId Function block ID instId Instance ID Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • MOST — • • While Application Socket is active Example — | MostAsFsFunctionEnableEx | MostAsFsEnable | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsFsEnable, MostAsFsDisable MostAsFsEnable, MostAsFsDisable CAPL Function Overview » MOST » MostAsFsEnable, MostAsFsDisable Syntax long MostAsFsEnable() 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. MostAsFsDisable() disables the function service. Parameters — Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • MOST — • • While Application Socket is active Example — | MostAsFsEnableEx | MostAsFsFunctionEnable | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsFsFunctionEnable MostAsFsFunctionEnable CAPL Function Overview » MOST » MostAsFsFunctionEnable Syntax long MostAsFsFunctionEnable(long functionId, long opTypes) long MostAsFsFunctionEnable(long functionId, long opTypes, char cbSendStatus[]) 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. If functionID=-1, cbSendStatus designates the prefix of the CAPL send functions to be defined. If an empty character string is specified, the default prefix "SendStatus_" is used. opTypes (Property/Method) Bit 0 OpType = 0x0 (Set/Start) Bit 1 OpType = 0x1 (Get/Abort) Bit 2 OpType = 0x2 (SetGet/StartResult) Bit 3 OpType = 0x3 (Increment/-) Bit 4 OpType = 0x4 (Decrement/-) Bit 5 OpType = 0x5 (GetInterface/GetInterface) Bit 6 OpType = 0x6 (-/StartResultAck) Bit 7 OpType = 0x7 (-/AbortAck) Bit 8 OpType = 0x8 (-/StartAck) Bit 9 OpType = 0x9 (-/ErrorAck) Bit 10 OpType = 0xA (-/ProcessingAck) Bit 11 OpType = 0xB (-/Processing) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsFsFunctionEnable Bit 12 OpType = 0xC (Status/Result) Bit 13 OpType = 0xD (-/ResultAck) Bit 14 OpType = 0xE (Interface/Interface) Bit 15 OpType = 0xF (Error) Bit 16 All OpTypes corresponding to 0-15, if they are defined in the XML function catalog. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • MOST — • • While Application Socket is active Example • MostAsFsFunctionEnable(0x123, 0x8002) enables the 0x123 function with the "Get" and "Error" operations. The Command Interpreter will then send the error 'OpType not available' for the remaining command OpTypes of the function only. • MostAsFsFunctionEnable(0x123, 0xFFFF) enables the 0x123 function and all its operations. The command interpreter will never send 'OpType not available' for this function. • MostAsFsFunctionEnable(0x123, 0x01FFFF) enables the 0x123 function and all operations defined in the XML function catalog. • MostAsFsFunctionEnable(0x123, 0) disables the 0x123 function • MostAsFsFunctionEnable(-1, 0x01FFFF) enables all functions and all operations • MostAsFsFunctionEnable(-1, 0) disables all operations of all functions defined in • MostAsFsFunctionEnable(-1, 0x01FFFF, "SendStatus_") enables all functions and all operations defined in the XML function catalog. Additionally, functions of type 'property' will be registered at the Notification Service if a corresponding CAPL function for sending the status message is defined. de-fined in the XML function catalog. the XML function catalog. | MostAsFsEnable, MostAsFsDisable | MostAsFsFunctionEnableEx | MostAsNtfFunctionEnable | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsFsFunctionEnableEx MostAsFsFunctionEnableEx CAPL Function Overview » MOST » MostAsFsFunctionEnableEx Syntax long MostAsFsFunctionEnableEx(long fblockId, long instId, long functionId, long opTypes) long MostAsFsFunctionEnableEx(long fblockId, long instId, long functionId, long opTypes, char cbSendStatus[]) 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. If functionID=-1, cbSendStatus designates the prefix of the CAPL send functions to be defined. If an empty character string is specified, the default prefix "SendStatus_" is used. opTypes (Property/Method) Bit 0 OpType = 0x0 (Set/Start) Bit 1 OpType = 0x1 (Get/Abort) Bit 2 OpType = 0x2 (SetGet/StartResult) Bit 3 OpType = 0x3 (Increment/-) Bit 4 OpType = 0x4 (Decrement/-) Bit 5 OpType = 0x5 (GetInterface/GetInterface) Bit 6 OpType = 0x6 (-/StartResultAck) Bit 7 OpType = 0x7 (-/AbortAck) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsFsFunctionEnableEx Bit 8 OpType = 0x8 (-/StartAck) Bit 9 OpType = 0x9 (-/ErrorAck) Bit 10 OpType = 0xA (-/ProcessingAck) Bit 11 OpType = 0xB (-/Processing) Bit 12 OpType = 0xC (Status/Result) Bit 13 OpType = 0xD (-/ResultAck) Bit 14 OpType = 0xE (Interface/Interface) Bit 15 OpType = 0xF (Error) Bit 16 All OpTypes corresponding to 0-15, if they are defined in the XML function catalog. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • MOST — • • While Application Socket is active Example • MostAsFsFunctionEnableEx(0x22, 0x01,0x123, 0x8002) enables the 0x123 function with the "Get" and "Error" operations. The Command Interpreter will then send the error 'OpType not available' for the remaining command OpTypes of the function only. • MostAsFsFunctionEnableEx(0x22, 0x01, 0x123, 0xFFFF) enables the 0x123 function and all its operations. The command interpreter will never send 'OpType not available' for this function. • MostAsFsFunctionEnableEx(0x22, 0x01, 0x123, 0x01FFFF) enables the 0x123 • MostAsFsFunctionEnableEx(0x22, 0x01, 0x123, 0) disables the 0x123 function • function and all operations defined in the XML function catalog. MostAsFsFunctionEnableEx(0x22, 0x01, -1, 0x01FFFF) enables all functions and all operations defined in the XML function catalog. • MostAsFsFunctionEnableEx(0x22, 0x01, -1, 0) disables all operations of all functions defined in the XML function catalog. | MostAsFsEnableEx, MostAsFsDisableEx | MostAsFsFunctionEnable | MostAsNtfFunctionEnableEx | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfDeviceIDListGetSize, MostAsNtfDeviceIDListGetDeviceID MostAsNtfDeviceIDListGetSize, MostAsNtfDeviceIDListGetDeviceID CAPL Function Overview » MOST » MostAsNtfDeviceIDListGetSize, MostAsNtfDeviceIDListGetDeviceID Syntax long MostAsNtfDeviceIDListGetSize(long fblockID, long instID, long functionID) long MostAsNtfDeviceIDListGetDeviceID(long fblockID, long instID, long functionID, long index) 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 Index in the function list Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostAsNtfFunctionCheck | MostAsNtfFunctionListGetSize, MostAsNtfFunctionListGetFunction | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfEnable, MostAsNtfDisable MostAsNtfEnable, MostAsNtfDisable CAPL Function Overview » MOST » MostAsNtfEnable, MostAsNtfDisable Syntax long MostAsNtfEnable() 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. MostAsNtfDisable() disables the notification service. The notification matrix is thereby deleted. Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostApIsRegistered | MostAsNtfEnableEx, MostAsNtfDisableEx | MostApplicationNode | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfEnableEx, MostAsNtfDisableEx MostAsNtfEnableEx, MostAsNtfDisableEx CAPL Function Overview » MOST » MostAsNtfEnableEx, MostAsNtfDisableEx Syntax long MostAsNtfEnableEx(long fblockID, long instID) long MostAsNtfDisableEx(long fblockID, long instID) Function MostAsNtfEnableEx() enables the notification service for the function block. MostAsNtfDisableEx() disables the notification service. The notification matrix is thereby deleted. Parameters fblockID Function block ID instID Instance ID Return values Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostApRegisterEx | MostAsNtfEnable, MostAsNtfDisable | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfFunctionCheck MostAsNtfFunctionCheck CAPL Function Overview » MOST » MostAsNtfFunctionCheck Syntax long MostAsNtfFunctionCheck(long deviceID, long fblockID, long instID, long functionID) Function Checks whether a notification client (deviceID) is registered in the notification matrix for a function. Parameters deviceID Addess of the notification client fblockID Function block ID instID Instance ID functionID Function ID Return values 0: deviceID is not registered 1: deviceID is registered Other values: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostAsNtfFunctionListGetSize, MostAsNtfFunctionListGetFunction | MostAsNtfDeviceIDListGetSize, MostAsNtfDeviceIDListGetDeviceID | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfFunctionClear MostAsNtfFunctionClear CAPL Function Overview » MOST » MostAsNtfFunctionClear Syntax long MostAsNtfFunctionClear(long deviceID, long fblockID, long instID, long functionID) 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 Addess of the notification client fblockID Function block ID instID Instance ID functionID Function ID Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostAsNtfFunctionCheck | MostAsNtfFunctionSet | MostAsNtfFunctionClearAll | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfFunctionClearAll MostAsNtfFunctionClearAll CAPL Function Overview » MOST » MostAsNtfFunctionClearAll Syntax long MostAsNtfFunctionClearAll(long deviceID, long fblockID, long instID) 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 Address of the notification client Exception: -1 clears the entire notification matrix fblockID Function block ID instID Instance ID Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostAsNtfFunctionSet | MostAsNtfFunctionClear | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfFunctionEnable, MostAsNtfFunctionDisable, MostAsNtfFunctionIsEnabled MostAsNtfFunctionEnable, MostAsNtfFunctionDisable, MostAsNtfFunctionIsEnabled CAPL Function Overview » MOST » MostAsNtfFunctionEnable, MostAsNtfFunctionDisable, MostAsNtfFunctionIsEnabled Syntax long MostAsNtfFunctionEnable(long functionID, char cbSendStatus[]) long MostAsNtfFunctionDisable(long functionID) long MostAsNtfFunctionIsEnabled(long functionID) Function MostAsNtfFunctionEnable() enables the notification service for a function. The notification service must be enabled with MostAsNtfEnable() for the function block beforehand. 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. MostAsNtfFunctionDisable() disables the notification service for the function. MostAsNtfFunctionIsEnabled() returns 1, if the notification service is enabled for the function. 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 • The MOST function must be of the "Property" type. • A function with the name cbSendStatus+<MOST function name> needs to be defined in the CAPL program to generate and send the status message. 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. If functionID=-1, cbSendStatus designates the prefix of the CAPL send functions to be defined. If an empty character string is specified, the default prefix "SendStatus_" is used. The name of the CAPL function is case sensitive! Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfFunctionEnable, MostAsNtfFunctionDisable, MostAsNtfFunctionIsEnabled Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostApRegister | MostAsNtfEnable, MostAsNtfDisable | MostAsNtfFunctionEnableEx, MostAsNtfFunctionDisableEx, MostAsNtfFunctionIsEnabledEx | MostAsNtfOutput | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfFunctionEnableEx, MostAsNtfFunctionDisableEx, MostAsNtfFunctionIsEnabledEx MostAsNtfFunctionEnableEx, MostAsNtfFunctionDisableEx, MostAsNtfFunctionIsEnabledEx CAPL Function Overview » MOST » MostAsNtfFunctionEnableEx, MostAsNtfFunctionDisableEx, MostAsNtfFunctionIsEnabledEx Syntax long MostAsNtfFunctionEnableEx(long fblockID, long instID, long functionID, char cbSendStatus[]) long MostAsNtfFunctionDisableEx(long fblockID, long instID, long functionID) long MostAsNtfFunctionIsEnabledEx(long fblockID, long instID, long functionID) Function The behavior corresponds to the functions MostAsNtfFunctionEnable, MostAsNtfFunctionDisable, MostAsNtfFunctionIsEnabled. The functions ending with 'Ex' can also be used, if the CAPL node is not assigned to a function block exclusively. 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. If functionID=-1, cbSendStatus designates the prefix of the CAPL send functions to be defined. If an empty character string is specified, the default prefix "SendStatus_" is used. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostApIsRegisteredEx | MostAsNtfEnableEx, MostAsNtfDisableEx | MostAsNtfFunctionEnable, MostAsNtfFunctionDisable, MostAsNtfFunctionIsEnabled | MostAsNtfOutput | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfFunctionListGetSize, MostAsNtfFunctionListGetFunction MostAsNtfFunctionListGetSize, MostAsNtfFunctionListGetFunction CAPL Function Overview » MOST » MostAsNtfFunctionListGetSize, MostAsNtfFunctionListGetFunction Syntax long MostAsNtfFunctionListGetSize(long deviceID, long fblockID, long instID) long MostAsNtfFunctionListGetFunction(long deviceID, long fblockID, long instid, long index) 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 Address of the notification client. Exception: -1 outputs a list of all enabled functions. fblockID Function block ID instID Instance ID index Index in the function list Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostAsNtfFunctionCheck | MostAsNtfDeviceIDListGetSize, MostAsNtfDeviceIDListGetDeviceID | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfFunctionSet MostAsNtfFunctionSet CAPL Function Overview » MOST » MostAsNtfFunctionSet Syntax long MostAsNtfFunctionSet(long deviceID, long fblockID, long instID, long functionID) Function Registers a notification client in the notification matrix. Functionality is similar to command message FBlock.Notification.Set(SetFunction, deviceID, functionID). 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 Address of the notification client fblockID Function block ID instID Instance ID functionID Function ID Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostAsNtfFunctionCheck | MostAsNtfFunctionClear | MostAsNtfFunctionClearAll | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfOutput MostAsNtfOutput CAPL Function Overview » MOST » MostAsNtfOutput Syntax long MostAsNtfOutput(long destAdr, mostMessage msg) long MostAsNtfOutput(long destAdr, mostAmsMessage msg) Function destAdr != 0xFFFF: The command sends the message to the stated address. 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 Message destination address or 0xFFFF to send to all notification clients. msg Message to be sent. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — | MostAsNtfFunctionEnable, MostAsNtfFunctionDisable, MostAsNtfFunctionIsEnabled | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsNtfShdFunctionEnable, MostAsNtfShdFunctionDisable MostAsNtfShdFunctionEnable, MostAsNtfShdFunctionDisable CAPL Function Overview » MOST » MostAsNtfShdFunctionEnable, MostAsNtfShdFunctionDisable Syntax long MostAsNtfShdFunctionEnable(long fblockId, long instId, long functionId) long MostAsNtfShdFunctionDisable(long fblockId, long instId, long functionId) Function MostAsNtfShdFunctionEnable() registers a MOST function with the notification shadow service. As soon as the specified function block (fblockId, instId) appears in the bus registry of the simulated device, the notification shadow service enters the simulated device in the notification matrix of the function block, i.e., it sends the FBlockId.InstId.Notification.Set(SetFunction, functionId) message. MostAsNtfShdFunctionDisable() removes a MOST function from the notification shadow service. Parameters fblockId Function block ID instId Instance ID functionId Function ID of a "Property" type function. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • MOST — • • While Application Socket is active Example — | MostAsShdEnable, MostAsShdDisable | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsRgGetFBlockID MostAsRgGetFBlockID CAPL Function Overview » MOST » MostAsRgGetFBlockID Syntax long MostAsRgGetFBlockID(long regsel, long i) Function Returns the FBlockID at position i of the registry. Indexing starts at 0. Parameters regsel 1: Local FBlockList 2: Bus registry i Position of the registry entry. Return values >=0: FBlockID <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — | MostAsRgGetSize | OnMostAsRegistry | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsRgGetInstID MostAsRgGetInstID CAPL Function Overview » MOST » MostAsRgGetInstID Syntax long MostAsRgGetInstID(long regsel, long i) Function Returns the InstID at position i of the registry. Indexing starts at 0. Parameters regsel 1: Local FBlockList 2: Bus registry i Position of the registry entry. Return values >=0: InstID <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — | MostAsRgGetSize | OnMostAsRegistry | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsRgGetRxTxLog MostAsRgGetRxTxLog CAPL Function Overview » MOST » MostAsRgGetRxTxLog Syntax long MostAsRgGetRxTxLog(long regsel, long i) long MostAsRgGetRxTxLog(long regsel, long fblockId, long instId) 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 i Position of the registry entry. fblockId Function block ID instId Instance ID Return values >=0: Logical device address <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — | MostAsRgGetSize | OnMostAsRegistry | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsRgGetSize MostAsRgGetSize CAPL Function Overview » MOST » MostAsRgGetSize Syntax long MostAsRgGetSize(long regsel) Function Determines the number of entries in the registry. Parameters regsel 1: Local FBlockList 2: Bus registry Return values >=0: Number <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — | MostAsRgGetRxTxLog | MostAsRgGetFBlockID | MostAsRgGetInstID | OnMostAsRegistry | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostAsShdEnable, MostAsShdDisable MostAsShdEnable, MostAsShdDisable CAPL Function Overview » MOST » MostAsShdEnable, MostAsShdDisable Syntax long MostAsShdEnable(long fblockId, long instId) long MostAsShdDisable(long fblockId, long instId) 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. Registration with MostAsShdEnable(fblockId, 0xFF) causes the service to request the device addresses of all function blocks with the appropriate FBlockId at the NetworkMaster. MostAsShdDisable() removes an entry from the list of searched function blocks. Parameters fblockId Function block ID instId Instance ID Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • MOST — • • While Application Socket is active Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostConfigureBusloadAsync MostConfigureBusloadAsync CAPL Function Overview » MOST » MostConfigureBusloadAsync Note This function is only available with MOST hardware VN2600/VN2610 and VN2640. Syntax long MostConfigureBusloadAsync (long channel, long rate, long countertype, long counterpos, long destadr, long pktdatalen, BYTE pktdata[]) 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. As an option, the packets can be supplied with a sequence counter. Load generation can be started with the MostGenerateBusloadAsync() function. 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 Channel of the connected MOST hardware. 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 Sequence counter type: 0 No sequence counter 1 1 byte counter 2 2 byte counter (higher quality byte first) 3 3 byte counter (higher quality bytes first) 4 4 byte counter (higher quality bytes first) counterpos Position of the lowest value sequence counter byte. destadr Destination address Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostConfigureBusloadAsync pktdatalen Number of user data bytes (MOST25: 0 <= pktdatalen <= 1014; MOST150: 0 <= pktdatalen <= 1524) pktdata[] User data Return values <= 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • Not in StopMeasurement Example — | MostGenerateBusloadAsync | MostConfigureBusloadCtrl | OutputMostPkt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostConfigureBusloadCtrl 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. Syntax MOST25: long MostConfigureBusloadCtrl(long channel, long rate, long countertype, long counterpos, long prio, long rtype, long destadr, BYTE pdata[]) MOST150: MOST150: MostConfigureBusloadCtrl(long rate, mostMessage msg) 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. Info for VN2600/VN2610 Repeated transmissions on the control channel can be eliminated by setting the OS8104 transmit retry register (XRTY) to 1 (MostWriteReq()). Info for VN2640 and Optolyzer G2 3150o A sequence counter in the stress pattern can be configured with MostSetStressNodeParameter. Parameters channel Channel of the connected MOST hardware. rate • VN2600/VN2610: Number of messages per second. At best (optimal arbitration), the chip can send (frequency * 21 / 1024) messages per second. • VN2640: Number of messages per second. • Optolyzer G2 3150o: Control busload speed. Specifies the delay between two messages: 1 means 10 ms, 2 means 20 ms and so on. countertype Sequence counter type: Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostConfigureBusloadCtrl 0 No sequence counter 1 1 byte counter 2 2 byte counter (higher quality byte first) 3 3 byte counter (higher quality bytes first) 4 4 byte counter (higher quality bytes first) counterpos Position of the lowest value sequence counter byte. prio Sending priority (standard value: 1) rtype Message type: 0 Normal 1 RemoteRead 2 RemoteWrite 3 Alloc 4 Dealloc 5 GetSource See also mostRawMessage - Selectors destadr Destination address of the messages. pdata[] 17 user data bytes; for rtype=normal pdata[0] is the message FBlockID. msg Variable of type mostMessage; control busload custom message. Return values <= 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • Not in StopMeasurement Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostConfigureBusloadCtrl Example for VN2600/VN2610 // message data byte data[17] = { 0x01,0x00,0xCC,0xC1,0x04,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00 }; // configure busload // channel, rate, countertype, counterpos, prio, rtype, destadr, data MostConfigureBusloadCtrl(MostGetChannel(), 10, 4, 8, 1, 0, 0x1234, data); // start busload MostGenerateBusloadCtrl(MostGetChannel(), 3); Transmits the following messages: DestAdr message data 1234 1234 1234 |- counter -| 01 00 CC C1 04 00 00 00 00 00 00 00 00 00 00 00 00 01 00 CC C1 04 00 00 00 01 00 00 00 00 00 00 00 00 01 00 CC C1 04 00 00 00 02 00 00 00 00 00 00 00 00 Example for VN2640 Configure and start bus load stress on keyboard event. on key 's' { long channel, rate; mostmessage NetBlock.DeviceInfo.Get msg; channel = 1; rate = 50; // msgs/s // set counter type: 1-byte mostSetStressNodeParameter(channel, 16, 1); // set counter in byte6 (first user data byte) mostSetStressNodeParameter(channel, 17, 6); // configure stress pattern msg.MsgChannel = channel; msg.DA = 0x100; mostConfigureBusloadCtrl(rate, msg); } // start stress: send 10 messages mostGenerateBusloadCtrl(channel, 10); | MostGenerateBusloadCtrl | MostConfigureBusloadAsync | MostSetStressNodeParameter, MostGetStressNodeParameter | OnMostStress | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostConfigureBusloadEthPkt MostConfigureBusloadEthPkt CAPL Function Overview » MOST » MostConfigureBusloadEthPkt Note This function is only available with MOST hardware VN2640. Syntax MOST150: long MostConfigureBusloadEthPkt(long channel, long rate, long countertype, long counterpos, int64 srcadr, int64 destadr, long datalen, BYTE data[]) Function The function configures the bus load generator for the Ethernet channel. As an option, the packets can be supplied with a sequence counter. Load generation can be started with the MostGenerateBusloadEthPkt function. Info Bus load can also be generated without CAPL programming using the MOST Stress program window. Parameters channel Channel of the connected interface. 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 Sequence counter type: 0 No sequence counter 1 1 byte counter 2 2 byte counter (higher quality byte first) 3 3 byte counter (higher quality bytes first) 4 4 byte counter (higher quality bytes first) counterpos Position of the lowest counter byte. srcadr Source MAC address. (6 Byte). Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostConfigureBusloadEthPkt 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 Target MAC address (6 Byte). dataLen Number of data bytes to be sent (2 <= dataLen <= 1506). data Data bytes of the Ethernet packet. 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). Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 SP2 MOST150 — • Example See MostGenerateBusloadEthPkt | MostGenerateBusloadEthPkt | MostSetStressNodeParameter | MostSetMacAdr | MostSetSBC | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mostConfigureEclSequence mostConfigureEclSequence CAPL Function Overview » MOST » mostConfigureEclSequence Note This function is only available with MOST hardware VN2640. Syntax MOST150: long mostConfigureEclSequence (long channel, long numIntervals, dword[] state, dword[] duration100us) 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 Channel of the connected interface. numIntervals number of intervals described in the following arrays state For each time interval 0: dominant 1: recessive duration100us Duration of interval with a resolution of 100 µs. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6 SP3 • — • MOST150 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); } | mostGenerateEclSequence | MostSetEcl | OnMostEcl | MostSetEclTermination | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mostEthPktSetTraceColors mostEthPktSetTraceColors CAPL Function Overview » MOST » mostEthPktSetTraceColors Syntax MOST150: mostEthPktSetTraceColors(long font, long bkgnd) 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 Parameters • 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. font Font color (RGB value) bkgnd Background color (RGB value) Return values 0: OK -1: Invalid RGB value of a color. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostEventChannel, MostEventTime, MostEventOrigTime, MostEventTimeNs MostEventChannel, MostEventTime, MostEventOrigTime, MostEventTimeNs CAPL Function Overview » MOST » MostEventChannel, MostEventTime, MostEventOrigTime, MostEventTimeNs Note The following functions can be use within the event procedures for MOST controller events to call up further information on events. Syntax long MostEventChannel() 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). DWORD MostEventOrigTime() returns the hardware-generated time stamp of the event (Units: 10 µs). float MostEventTimeNs() returns the time stamp of the event (Units: 1 ns). Parameters — Return values Time stamp Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST • • Example OnMostNodeAdr(long nodeadr) { write("Node address changed to %04X on channel %d at %fs", nodeadr, MostEventChannel(), MostEventTime() / 100000.0); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Example: Read-Out of the Registries Example: Read-Out of the Registries CAPL Function Overview » MOST » Example: Read-Out of the Registries 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostFiAmsReceive MostFiAmsReceive CAPL Function Overview » MOST » MostFiAmsReceive Syntax MostFiAmsReceive(mostAmsMessage * msg) Function Simulates the receipt of an AMS message to the simulation node (CAPL program or node layer module). MostFiAmsReceive can only be used within the callback OnMostFiAmsPreReceive or OnMostFiAmsPreSend. If MostFiAmsReceive is called more than once within the callback, only the last fed-in message is passed on to the simulation node. 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 AMS message that is to be received by the simulation node. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST — • Example See OnMostFiAmsPreReceive Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGenerateBusloadAsync 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. Syntax long MostGenerateBusloadAsync (long channel, long pkts) Function The function sends cyclical packets to the asynchronous channel. Use the MostConfigureBusloadAsync() function to specify the send parameters and contents of the packets. Info for Optolyzer G2 3150o 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 Channel of the connected MOST hardware. pkts 0 Stops the busload generation >0 Sends the given number of packets -1 Sends continual packets Return values <= 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostGenerateBusloadCtrl | MostGenerateLightError | MostGenerateLockError | MostConfigureBusloadAsync | OutputMostPkt | OnMostStress | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGenerateBusloadCtrl 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. Syntax long MostGenerateBusloadCtrl (long channel, long msgs) Function The function sends cyclical messages to the control channel. Use the MostConfigureBusloadCtrl() function to specify the send parameters and contents of the message. Info for Optolyzer G2 3150o 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 Channel of the connected MOST hardware. pkts 0 Stops the busload generation >0 Sends the given number of packets -1 Sends continual packets Return values <= 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostGenerateBusloadAsync | MostGenerateLightError | MostGenerateLockError | MostConfigureBusloadCtrl | OnMostStress | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGenerateBusloadEthPkt MostGenerateBusloadEthPkt CAPL Function Overview » MOST » MostGenerateBusloadEthPkt Note This function is only available with MOST hardware VN2640. Syntax MOST150: long MostGenerateBusloadEthPkt(long channel, long pkts) Function The function sends cyclical packets on the Ethernet channel. Use the MostConfigureBusloadEthPkt function to specify the send parameters and payload pattern. Parameters channel Channel of the connected interface. pkts 0 Stops the busload generation >0 Sends the given number of packets -1 Sends continual packets Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 SP2 MOST150 — • Example Configure and start bus load stress on keyboard event. on key 's' { long i, channel, rate, countertype, counterpos, datalen; int64 srcadr, destadr; byte data[1506]; channel srcadr destadr rate countertype counterpos datalen = 1; = -1LL; // use own MAC address as source = 0x010203040506LL; = 50; // packets per second = 4; // 4 byte counter = 9; // counter in byte6..byte9 =300; // fill payload of stress packet for(i = 0; i < datalen; ++i) data[i] = (byte)i; // configure stress pattern mostConfigureBusloadEthPkt(channel, rate, countertype, counterpos, srcadr, destadr, datalen, data); } // start generation of 500 packets mostGenerateBusloadEthPkt(channel, 500); | MostConfigureBusloadEthPkt | OnMostStress | MostSetMacAdr | OutputMostEthPkt | MostSetSBC | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGenerateBypassToggle MostGenerateBypassToggle CAPL Function Overview » MOST » MostGenerateBypassToggle Note This functionality is only available for • VN2640 • OptoLyzer G2 3150o (At least firmware version V1.5.3 is required) Syntax MOST150: long MostGenerateBypassToggle(long channel, long invistime, long vistime, long repeat) Function Starts (repeat > 0) or stops (repeat = 0) generation of Bypass-open-close transitions. 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 Channel of the connected interface invistime Time during which node has its bypass closed (in ms) vistime Time with opened bypass (in ms) repeat 0: Stop stress >0: Number of transitions 0xFFFF: Generate transitions continually Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGenerateBypassToggle | OnMostStress | OnMostMPR | MostGenerateLockError | MostSetAllBypass | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mostGenerateEclSequence mostGenerateEclSequence CAPL Function Overview » MOST » mostGenerateEclSequence Note This function is only available with MOST hardware VN2640. Syntax MOST150: long mostGenerateEclSequence (long channel, long startstop) 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 Channel of the connected interface. startstop 0: stops the generation of the sequence 1: starts the generation of the sequence Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6 SP3 • — • MOST150 Example See mostConfigureEclSequence | mostConfigureEclSequence | MostSetEcl | OnMostEcl | MostSetEclTermination | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGenerateLightError MostGenerateLightError CAPL Function Overview » MOST » MostGenerateLightError Note This functionality is available for VN2600/VN2610 hardware and OptolyzerOL3150o (firmware version >= V1.5.3). Syntax long MostGenerateLightError(long channel, long lightofftime, long lightontime, long repeat) Function Starts (repeat > 0) or stops (repeat = 0) generation of Light-ON-OFF transitions. For OptolyzerOL3150o: The stress network interface controller (NIC) must have active bypass or bypass opened (see MostSetStressNodeParameter). Parameters channel Channel of the connected interface. lightofftime Time during which no light is emitted (in ms). lightontime Time during which modulated light is emitted (in ms). repeat 0 Stop Light-Off-On transitions >0 Number of Light-Off-On transitions 0xFFFF Generate Light-Off-On transitions continually Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostGenerateBusloadAsync | MostGenerateBusloadCtrl | MostGenerateLockError | OnMostStress | MostGetChannel | on mostLightLockError | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGenerateLockError MostGenerateLockError CAPL Function Overview » MOST » MostGenerateLockError Note This functionality is only available for VN2600/VN2610 hardware, OptolyzerOL3150o (firmware version >= V1.5.3) and OptolyzerOL3050e (firmware version >= V1.5). Syntax long MostGenerateLockError(long channel, long unmodtime, long modtime, long repeat) Function Starts (repeat > 0) or stops (repeat = 0) generation of Light Unmodulated-Modulated transitions. For OptolyzerOL3150o: The stress network interface controller (NIC) must have its bypass opened (see MostSetStressNodeParameter). Parameters channel Channel of the connected interface. unmodtime Time during which unmodulated light is emitted (in ms). modtime Time during which modulated light is emitted (in ms). repeat 0 Stops the generation of Unmodulated-Modulated transitions >0 Number of transitions 0xFFFF Generate Unmodulated-Modulated transitions continually Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostGenerateBusloadAsync | MostGenerateBusloadCtrl | MostGenerateLightError | OnMostStress | MostGetChannel | on mostLightLockError | MostGenerateBypassToggle | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetAllBypass MostGetAllBypass CAPL Function Overview » MOST » MostGetAllBypass Syntax long MostGetAllBypass(long channel) Function Return indicates whether the MOST hardware bypass is closed (Return value = 1) or open (Return value = 0). Parameters channel Channel of the connected hardware. Return values 0: Bypass is opened 1: Bypass is closed <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • Not in StopMeasurement Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetAllocTable MostGetAllocTable CAPL Function Overview » MOST » MostGetAllocTable Note This functionality is only available for VN2600/VN2610 and Optolyzer hardware. Syntax long MostGetAllocTable(long channel, byte buffer[], long buffersize) 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 Channel of the connected Interface. buffer Destination buffer buffersize Destination buffer size Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetAndFilter MostGetAndFilter CAPL Function Overview » MOST » MostGetAndFilter Note Works only if an Optolyzer box is assigned to the channel as interface. AND-Filter Syntax long MostGetAndFilter( long channel, long arb, long targetAdr, long sourceAdr, long type, byte msg[17], long crc, long ack) Function Retrieves the status of the AND filter. Parameters channel Channel of the connected interface. arb Arbitration byte targetAdr Destination address sourceAdr Source address type Message type msg Use data bytes of the MOST frame crc CRC code ack Acknowledge field of the MOST frame Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 • MOST — • • Not in StopMeasurement Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetAndFilter | MostGetChannel | MostSetAndFilter | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetChannel 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 1..16: the allocated MOST channel 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST — • Example — | getBusNameContext | getBusContext | MostStrictChannelMapping | MostApplicationNode | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetClockSource MostGetClockSource CAPL Function Overview » MOST » MostGetClockSource Note This function is only available with MOST hardware VN2610. Syntax long MostGetClockSource(long channel) Function Returns the clock source for the MOST timing master. Parameters channel Channel of the connected interface Return values 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. <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 MOST — • Example — | MostSetTimingMode | MostSetSyncSpdifMode | MostGetSyncSpdifMode | MostSetClockSource | MostSetSyncAudio | MostSetSyncSpdif | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetCodingErrors MostGetCodingErrors CAPL Function Overview » MOST » MostGetCodingErrors Note This function is only available with MOST hardware VN2600/VN2610. Syntax long MostGetCodingErrors (long channel) 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 Channel of the connected interface Return values >= 0: Number of coding errors. < 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • MOST — • • Not in StopMeasurement Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetHWCapability MostGetHWCapability CAPL Function Overview » MOST » MostGetHWCapability Syntax long MostGetHWCapability(long channel, long capID) Function MostGetHWCapability()can be used to query the properties of the MOST interface used. Parameters channel Channel of the connected interface. capID The ID decides the meaning of the return value. ID Return value Description of the return value kMostHWCap_MaxNumberOfInstances = 0 >0 Number of interfaces of this type being used simultaneously kMostHWCap_MaxWriteOS8104Registers = 1 >=0 Number of OS8104 registers that can be written with a command kMostHWCap_MaxReadOS8104Registers = 2 >=0 Number of OS8104 registers that can be read with a command 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 kMostHWCap_CtrlNode = 8 0, 1 1: Can be operated in Node Mode for the control channel (sending/receiving control messages) kMostHWCap_CtrlSpy = 9 0, 1 1: Can be operated in Spy Mode for the control channel Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetHWCapability Return values kMostHWCap_CtrlNodeAndSpySimultaneous = 10 0, 1 1: Can be operated simultaneously in Node and Spy Mode (control channel) kMostHWCap_CtrlNodeAndSpyEventDoubling = 11 0, 1 1: Always generates node and spy message for a received message from the control channel kMostHWCap_CtrlRxBufferFullSimulation = 12 0, 1 1: The MostSetRxBufferCtrl command functions with the interface kMostHWCap_AsyncNode = 16 0, 1 1: Can be operated in Node Mode for the asynchronous channel kMostHWCap_AsyncSpy = 17 0, 1 1: Can be operated in Spy Mode for the asynchronous channel kMostHWCap_AsyncNodeAndSpySimultaneous = 18 0, 1 1: Can be operated simultaneously in Node and Spy Mode (asynchronous channel) kMostHWCap_AsyncNodeAndSpyEventDoubling = 19 0, 1 1: Always generates node and spy message for a received message from the asynchronous channel kMostHWCap_SyncAnalogInChannels = 24 >=0 Number of analog-in channels (16 bit stereo) kMostHWCap_SyncAnalogOutChannels = 25 >=0 Number of analog-out channels (16 bit stereo) kMostHWCap_SyncAnalogInMute = 26 0, 1 1: Can mute the analog-in channel kMostHWCap_SyncAnalogOutMute = 27 0, 1 1: Can mute the analog-out channel kMostHWCap_SyncAllocTableReporting = 28 0, 1 1: Reports changes to the allocation table >=0: Property value <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetHWCapability | MostGetChannel | MostGetHWInfo | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetHWFilter MostGetHWFilter CAPL Function Overview » MOST » MostGetHWFilter Note Works only if an Optolyzer box is assigned to the channel as interface. Filter Mode Syntax long MostGetHWFilter(long Function Returns 1 if hardware filter is active, otherwise 0. Parameters channel channel) Channel of the connected interface Return values 0: HW filter inactive 1: HW filter active <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 • MOST — • • Not in StopMeasurement Example — | MostGetChannel | MostSetHWFilter | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetHWInfo MostGetHWInfo CAPL Function Overview » MOST » MostGetHWInfo Syntax long MostGetHWInfo(long channel, long infoID) long MostGetHWInfo(long channel, long infoID, char infostring[], long buffersize) Function Provides information about the MOST interface used. Parameters channel Channel of the connected interface. infoID The ID decides the meaning of the return value. ID Return value Description of the return value kMostHWInfo_Type = 0 >0 Interface type: 1: VN2600/VN2610 2: Optolyzer 3: — 4: OptoLyzer G2 3150o 5: VN2640 6: OptoLyzer G2 3050e 7: PCI Interface 50e kMostHWInfo_SimulationMode =1 0, 1 kMostHWInfo_Manufacturer = 2 kMostHWInfo_SyncMode = 3 0: real 1: simulated Manufacturer: "Vector", "SMSC" >=0 Synchronization mode: 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) kMostHWInfo_SyncStatus = 4 >=0 Synchronization status: 0: HW Sync not active 1: HW Sync active 2: HW Sync works correctly infostring Target buffer to which text information is copied. buffersize Size of the target buffer. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetHWInfo Return values >=0: Informations value <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example — | MostGetChannel | MostGetHWCapability | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetLock MostGetLock CAPL Function Overview » MOST » MostGetLock Syntax long MostGetLock(long channel) Function Queries the Lock Status of the MOST hardware. Parameters channel Channel of the interface to be queried. Return values 1: Lock 0: Unlock <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostGetLockEx | MostSetTxLight | MostGetTxLight | on mostLightLockError | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetLockEx MostGetLockEx CAPL Function Overview » MOST » MostGetLockEx Syntax long MostGetLockEx (long channel) 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 Channel of the connected MOST hardware. Return values 0: Unlock 1: Lock 2: Stable Lock 3: Critical Unlock <= 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostGetLock | OnMostStableLock | OnMostCriticalUnlock | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetMPR MostGetMPR CAPL Function Overview » MOST » MostGetMPR Syntax long MostGetMPR (long channel) 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 Channel of the connected MOST hardware. Return values > 0: MPR value <= 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • After measurement start • Not in Stopmeasurement Example — | OnMostMPR | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetNceType MostGetNceType CAPL Function Overview » MOST » MostGetNceType Syntax long 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 MOST • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetNetState MostGetNetState CAPL Function Overview » MOST » MostGetNetState Syntax long MostGetNetState() Function Returns the current network state. For definition of network states see OnMostNetState. Parameters — Return values Network status: see OnMostNetState Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetNodeAdr, MostGetGroupAdr, MostGetAltPktAdr, MostGetNodePosAdr MostGetNodeAdr, MostGetGroupAdr, MostGetAltPktAdr, MostGetNodePosAdr CAPL Function Overview » MOST » MostGetNodeAdr, MostGetGroupAdr, MostGetAltPktAdr, MostGetNodePosAdr Syntax long MostGetNodeAdr(long channel) long MostGetGroupAdr(long channel) long MostGetAltPktAdr(long channel) long MostGetNodePosAdr(long channel) 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 Channel of the connected interface. Return values NodeAdr: Logical node address GroupAdr: Group address AltPktAdr: Alternative packet address NodePosAdr: Node position address <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 • MOST — • • Not in StopMeasurement • MOST — • • Not in StopMeasurement 5.0: MostGetAltPktAdr Example — | MostSetNodeAdr, MostSetGroupAdr, MostSetAltPktAdr, MostSetOwnAdr | OnMostNodeAdr | OnMostGroupAdr | OnMostNPR | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetNPR MostGetNPR CAPL Function Overview » MOST » MostGetNPR Syntax long MostGetNPR (long channel) Function This function returns the "Node Position Register (NPR)" value of the MOST hardware chip connected to the channel. Parameters channel Channel of the connected MOST hardware. Return values > 0: NPR value <= 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostGetNodeAdr, MostGetGroupAdr, MostGetAltPktAdr, MostGetNodePosAdr | OnMostNPR | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetRxLight MostGetRxLight CAPL Function Overview » MOST » MostGetRxLight Syntax long MostGetRxLight(long channel) Function Queries the Light Status at the Fiber Optical Receiver (FOR). Parameters channel Channel of the interface to be queried. Return values 1: Light on 0: Light out <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostSetTxLight | MostGetTxLight | on mostLightLockError | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetSBC MostGetSBC CAPL Function Overview » MOST » MostGetSBC Syntax long MostGetSBC (long channel) Function This function returns the "Synchronous Bandwidth Control (SBC) Register" value of the MOST hardware chip connected to the channel. Parameters channel Channel of the connected MOST hardware. Return values >= 0: Current value of the SBC register < 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • Not in StopMeasurement Example — | MostSetSBC | OnMostSBC | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetShutdownFlag MostGetShutdownFlag CAPL Function Overview » MOST » MostGetShutdownFlag Syntax MOST150: long MostGetShutdownFlag(long channel) Function Returns the current state of the Shutdown flag. Parameters channel Application channel number. Return values 1: Shutdown Flag set. 0: Shutdown Flag not set. < 0: MOST CAPL error codes. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 • MOST150 — • • After measurement start • Not in Stopmeasurement Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetSpecVersion MostGetSpecVersion CAPL Function Overview » MOST » MostGetSpecVersion Syntax long MostGetSpecVersion(long channel) Function Returns the applied specification version of a MOST channel. Parameters channel Application channel number. Return values Version of MOST Specification 0x0205: version 2.5 0x0300: version 3.0 Info Currently the MOST Specification version depends on the chosen speed grade: Availability • MOST25: Version 2.5 • MOST50 / MOST150: Version 3.0 Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP2 • MOST — • • After measurement start • Not in Stopmeasurement Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetSpeedGrade MostGetSpeedGrade CAPL Function Overview » MOST » MostGetSpeedGrade Syntax long MostGetSpeedGrade(long channel) Function Returns the configured speed grade of a MOST channel. Parameters channel Application channel number. Return values Speed grade 1: MOST25 2: MOST50 3: MOST150 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP2 • MOST — • • After measurement start • Not in Stopmeasurement Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetSpyCtrl, MostGetSpyAsync, MostGetSpyEthPkt MostGetSpyCtrl, MostGetSpyAsync, MostGetSpyEthPkt CAPL Function Overview » MOST » MostGetSpyCtrl, MostGetSpyAsync, MostGetSpyEthPkt Syntax long MostGetSpyCtrl(long channel) long MostGetSpyAsync(long channel) MOST150: long MostGetSpyEthPkt(long channel) 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 Channel of the connected interface. Return values 0: Spy inactive 1: Spy activated <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • Not in StopMeasurement • MOST150 — • • Not in StopMeasurement 7.6 SP2 Example — | MostGetChannel | MostSetSpyCtrl, MostSetSpyAsync, MostSetSpyEthPkt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetSyncMute MostGetSyncMute CAPL Function Overview » MOST » MostGetSyncMute Syntax long MostGetSyncMute(long channel, long device) Function Returns the mute status of the audio input or output. Parameters channel Channel of the connected interface. device 0: Line-In 1: Line-Out 2: S/PDIF In (VN2640 only) 3: S/PDIF Out (VN2640 only) Return values 0: mute off 1: mute on <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostGetChannel | MostSetSyncAudio | MostSetSyncVolume | MostSetSyncMute | MostGetSyncVolume | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetSyncSpdifMode MostGetSyncSpdifMode CAPL Function Overview » MOST » MostGetSyncSpdifMode Note This function is only available with MOST hardware VN2610. Syntax long MostGetSyncSpdifMode(long channel) Function Gets the timing mode for the S/PDIF signal. Parameters channel Channel of the connected interface. Return values 0: S/PDIF slave 1: S/PDIF master <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 MOST — • Example — | MostSetSyncSpdif | MostSetSyncSpdifMode | MostSetSyncSpdifLock | MostSetClockSource | MostGetClockSource | MostSetSyncAudio | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetSyncVolume MostGetSyncVolume CAPL Function Overview » MOST » MostGetSyncVolume Syntax long MostGetSyncVolume(long channel, long device) Function Returns the volume of the audio input or output. Parameters channel Channel of the connected interface. device 0: Line-In 1: Line-Out Return values 0...255: Volume (255 = 100%) <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostGetChannel | MostSetSyncAudio | MostSetSyncVolume | MostSetSyncMute | MostGetSyncMute | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetSystemLock MostGetSystemLock CAPL Function Overview » MOST » MostGetSystemLock Syntax MOST150: long MostGetSystemLock(long channel) Function Returns the current state of the System Lock Flag. Parameters channel Application channel number. Return values 1: System Lock Flag set 0: System Lock Flag not set < 0: MOST CAPL error codes. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 MOST150 — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: getThisMessage getThisMessage CAPL Function Overview » MOST » getThisMessage Syntax GetThisMessage(mostAMSMessage msg, long count); Function Copies the data of a AMS message into the msg variable. This function must be used exclusively within a an event procedure on mostAMSMessage. Parameters msg Variable of the type MostAmsMessage. count Number of use data bytes that have to be copied. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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)); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetTimingMode MostGetTimingMode CAPL Function Overview » MOST » MostGetTimingMode Syntax long MostGetTimingMode(long channel) Function Returns the Timing Mode of the MOST hardware. Parameters channel Channel of the connected interface. Return values 0: Timing Slave 1: Timing Master <0: See error codes If the bypass is closed this function returns the mode that would have been set if the bypass were opened (see MostSetAllBypass). Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • Not in StopMeasurement Example — | MostSetTimingMode | OnMostTimingMode | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetTxLight MostGetTxLight CAPL Function Overview » MOST » MostGetTxLight Syntax long MostGetTxLight(long channel) Function Queries the Light Status at the Fiber Optical Transmitter (FOR). Parameters channel Channel of the interface to be queried. Return values 0: Light out 1: Modulated light • Bypass/Slave: Tx has light modulation of the Rx • Master: Master light 2: Constant light <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 • MOST — • • Not in StopMeasurement Example — | MostSetTxLight | MostGetRxLight | MostGetChannel | OnMostTxLight | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetXorFilter MostGetXorFilter CAPL Function Overview » MOST » MostGetXorFilter Note Works only if an Optolyzer box is assigned to the channel as interface. XOR-Filter Syntax long MostGetXorFilter( long channel, long arb, long targetAdr, long sourceAdr, long type, byte msg[17], long crc, long ack) Function Retrieves the status of the XOR filter. Parameters channel Channel of the connected interface arb Arbitration byte targetAdr Destination address sourceAdr Source address type Message type msg Use data byte of the MOST frame crc CRC code ack Acknowledge field of the MOST frame Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 • MOST — • • Not in StopMeasurement Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostGetXorFilter | MostGetChannel | MostSetXorFilter | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mostMHPBlockSetTraceColors mostMHPBlockSetTraceColors CAPL Function Overview » MOST » mostMHPBlockSetTraceColors Syntax mostMHPBlockSetTraceColors(long font, long bkgnd) 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 Parameters • 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. font Font color (RGB value) bkgnd Background color (RGB value) Return values 0: OK -1: Invalid RGB value of a color. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mostMHPConnectionSetTraceColors mostMHPConnectionSetTraceColors CAPL Function Overview » MOST » mostMHPConnectionSetTraceColors Syntax mostMHPConnectionSetTraceColors(long font, long bkgnd) 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 Parameters • 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. font Font color (RGB value) bkgnd Background color (RGB value) Return values 0: OK -1: Invalid RGB value of a color. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mostMHPConnectionSetTraceColors mostMHPConnectionSetTraceColors CAPL Function Overview » MOST » mostMHPConnectionSetTraceColors Syntax mostMHPErrorSetTraceColors(long font, long bkgnd) 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 Parameters • 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. font Font color (RGB value) bkgnd Background color (RGB value) Return values 0: OK -1: Invalid RGB value of a color. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mostMHPPacketSetTraceColors mostMHPPacketSetTraceColors CAPL Function Overview » MOST » mostMHPPacketSetTraceColors Syntax mostMHPPacketSetTraceColors(long font, long bkgnd) 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 Parameters • 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. font Font color (RGB value) bkgnd Background color (RGB value) Return values 0: OK -1: Invalid RGB value of a color. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostMsgDecodeRLE MostMsgDecodeRLE CAPL Function Overview » MOST » MostMsgDecodeRLE Syntax long MostMsgDecodeRLE(mostAmsMessage * msg, long fktIds[], long buffersize) Function MostMsgDecodeRLE() decodes the data area of a message and saves the function IDs in a Parameters msg 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. Message fktIds[] Destination buffer buffersize Size of the destination buffer Return values >=0: Number of valid function IDs in fktIds[] <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 MOST • • Example — | MostMsgEncodeRLE | MostMsgSet | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostMsgEncodeRLE MostMsgEncodeRLE CAPL Function Overview » MOST » MostMsgEncodeRLE Syntax long MostMsgEncodeRLE(mostAmsMessage * msg, long fktIds[], long size) Function MostMsgEncodeRLE() encodes a list of function IDs and saves it in the data area of a Parameters msg 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. Message, which is to have data input into it. fktIds[] List of function IDs (can be unsorted). size Number of function IDs in fktIds[]. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 MOST • • Example — | MostMsgDecodeRLE | MostMsgSet | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostMsgGetSymbols MostMsgGetSymbols CAPL Function Overview » MOST » MostMsgGetSymbols Syntax long mostMsgGetSymbols(mostAmsMessage * msg, char[] fblock, char[] function, char[] optype, long bufferSize) long mostMsgGetSymbols(mostMessage * msg, char[] fblock, char[] function, char[] optype, long bufferSize) 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 Message from which the symbolic names are determined. fblock Destination buffer for the function block name. function Destination buffer for the function name. optype Destination buffer for the optype name. bufferSize Destination buffer size. Valid for fblock, function and optype! Return values 0: None of the three symbolic names could be determined. 1: Function block name determined. 2: Function block and function name determined. 3: Function block, function and optye name determined. <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 MOST • • Example — | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostMsgSet MostMsgSet CAPL Function Overview » MOST » MostMsgSet Syntax long mostMsgSet(mostAmsMessage * msg, long destAdr, char symbolicMessage[], long instId) long mostMsgSet(mostAmsMessage * msg, char symbolicMessage[], long instId) long mostMsgSet(mostAmsMessage * msg, char symbolicMessage[]); Function Populating an AMS message using the syntax from the MOST specification and the description in the XML function catalog. PosDescription, TelLen and StreamCases are checked in addition to Funktionsblock, FunktionsID and OpType. See also Option .MOST: Symbolic Identification of Messages Parameters msg Message to be populated destAdr Destination address symbolicMessage Description of the message content in the following formats: FBlock.InstanceId.Function.OpType(Parameterlist) FBlock.InstanceId.Function.OpType FBlock.Function.OpType(Parameterlist) FBlock.Function.OpType InstId InstanceID of the function block Return values 0: OK (Parameter is available) <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example — | MostParamGet | MostParamGetData | MostParamGetString | MostParamSet | MostParamSetString | MostAMSOutput | output | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostNBSetAbilityToWake MostNBSetAbilityToWake CAPL Function Overview » MOST » MostNBSetAbilityToWake Note The property "AbilityToWake" is renamed in NetBlock version 2V5 to "PermissionToWake". The behavior remains the same. Syntax MostNBSetAbilityToWake(long wakestatus) Function Sets the AbilityToWake flags in NetBlock. 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 Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostNwmFiEnableRingScan MostNwmFiEnableRingScan CAPL Function Overview » MOST » MostNwmFiEnableRingScan Syntax long MostNwmFiEnableRingScan(long mode) 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 0: disable network scan 1: enable normal network scan behaviour 2: terminate currently running network scan 3: trigger network scan once Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST — • Example — | OnMostFiAmsPreSend | OnMostFiAmsPreReceive | MostNwmFiSetConfigState | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostNwmFiSetConfigState MostNwmFiSetConfigState CAPL Function Overview » MOST » MostNwmFiSetConfigState Syntax long MostNwmFiSetConfigState(long state, long sendConfigStatusMsg) 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 0: set the configuration status without sending a message 1: set configuration status and broadcast NetworkMaster.Configuration.Status Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST — • Example — | OnMostFiAmsPreSend | OnMostFiAmsPreReceive | MostNwmFiEnableRingScan | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostNwmFiSetParameter, MostNwmFiGetParameter MostNwmFiSetParameter, MostNwmFiGetParameter CAPL Function Overview » MOST » MostNwmFiSetParameter, MostNwmFiGetParameter Syntax long MostNwmFiSetParameter(long paramID, long value) long MostNwmFiGetParameter(long paramID) Function In order to modify timing parameters the functions MostNwmFiSetParameter and MostNwmFiGetParameter provide access to the timing parameters of CANoe’s Network Master implementation. 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 -1: set default for all parameter values 1: timer value tWaitBeforeScan (value range: 1…20000 ms) 2: timer value tWaitAfterNCE (value range: 1…20000 ms) 3: timer value tWaitForAnswer (value range: 1…20000 ms) 4: timer value tDelayCfgRequest1 (value range: 1…200000 ms) 5: timer value tDelayCfgRequest2 (value range: 1…200000 ms) value New value to be set. Return values MostNwmFiSetParameter See error codes MostNwmFiGetParameter >=0: value of the parameter identified by paramID Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST — • Example // set the timer value for tDelayCfgRequest2 to 15 s MostNwmFiSetParameter(5, 15000); | OnMostFiAmsPreSend | OnMostFiAmsPreReceive | MostNwmFiEnableRingScan | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: output output CAPL Function Overview » MOST » output Syntax void output (mostMessage msg) void output (mostAmsMessage msg) void output (mostRawMessage msg) Function Sends a message on the MOST ring. Parameters Variable of type mostMessage, mostAmsMessage or mostRawMessge Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.1 MOST • • Example — | MostAMSOutput | Initialization of Message Variables | OutputMostPkt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OutputMostEthPkt OutputMostEthPkt CAPL Function Overview » MOST » OutputMostEthPkt Syntax MOST150: outputMostEthPkt(long channel, int64 destMacAdr, long dataLen, BYTE[] data) MOST150: outputMostEthPkt(long channel, long prio, long retryCount, int64 sourceMacAdr, int64 destMacAdr, long dataLen, BYTE[] data) Function Sends out an Ethernet packet over the asynchronous channel. Parameters channel Application channel number. destMacAdr Destination MAC address (6 Byte). dataLen Number of data bytes to be sent (2 <= dataLen <= 1506). Data Data bytes of the Ethernet packet. 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 Sending priority of the Ethernet packet. Info Value range: 0x01..0x07. The value "-1" is also valid and used as wildcard to set the default priority (0x07). retryCount Number of retries. Info Value range: 0x00..0x07. The value "-1" is also valid and used as wildcard to set the number of retries configured for the asynchronous channel (s. MostSetRetryParamater()). sourceMacAdr Source MAC address. (6 Byte). Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OutputMostEthPkt 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 • MOST150 — • • After measurement start • Not in Stopmeasurement Example — | MostSetMasterMode | MostGenerateBusloadEthPkt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OutputMostEthPktThis OutputMostEthPktThis CAPL Function Overview » MOST » OutputMostEthPktThis Note OutputMostEthPktThis() may only be called within the OnMostEthPkt() event procedure. Syntax MOST150: outputMostEthPktThis() Function Passes the Ethernet packet on to the next node in the nodal sequence. Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 • MOST150 — • • After measurement start • Not in Stopmeasurement Example — | output | OutputMostEthPkt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OutputMostPkt OutputMostPkt CAPL Function Overview » MOST » OutputMostPkt Syntax OutputMostPkt(long channel, long destadr, long pktdatalen, BYTE pktdata[]) Function Sends out packets over the asynchronous MOST channel. Parameters channel Channel number destadr Destination address pktdatalen Number of bytes to be sent. MOST25/MOST50: 0 < pktdatalen = 1014 MOST150: 0 < pktdatalen = 1524 pktdata[] Useful data Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST • • • After measurement start Example — | output | OutputMostPktThis | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OutputMostPktThis OutputMostPktThis CAPL Function Overview » MOST » OutputMostPktThis Note OutputMostPktThis() may only be called within the OnMostPkt() event procedure. Syntax OutputMostPktThis() Function Passes the packet on to the next node in the nodal sequence. Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • After measurement start Example Packet filter in CAPL: OnMostPkt(long pktdatalen) { // filter destination address 0x100 if(MostPktDestAdr() == 0x100) { // forward packet to the successor OutputMostPktThis(); } } | output | OutputMostPkt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamGet MostParamGet CAPL Function Overview » MOST » MostParamGet Syntax double MostParamGet (mostAmsMessage msg, char paramAdr[]) double MostParamGet (mostAmsMessage msg, char paramAdr[], long arrayIndex) Function Query of a parameter value from an AMS message using the parameter name from the XML function catalog. Suitable for parameter types 'Number', 'Enum', 'BitField' and 'Bool'. Info For parameters of type 'Array' or 'Sequence' the size (number of elements) of the parameter is retrieved. The array size cannot be determined, if the parameter 'Pos' selects only one array element. 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 Message from which the parameter value should be read. paramAdr Identification of parameters (see symbolic identification of parameters). arrayIndex Parameter index in arrays or sequences. This declaration overwrites the indexing in the brackets of <paramAdr>. Return values Value of the parameter Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamGet Example — | MostParamIsAvailable | MostParamGetData | MostParamGetString | MostParamSet | MostParamSetData | MostParamSetString | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamGetData MostParamGetData CAPL Function Overview » MOST » MostParamGetData Syntax long mostParamGetData(mostAmsMessage msg, char paramAdr[], byte buffer[], long buffersize) long mostParamGetData(mostAmsMessage msg, char paramAdr[], long arrayIndex, byte buffer[], long buffersize) 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 Message from which the parameter value should be read. paramAdr Identification of parameters (see Symbolic Identification of Parameters). arrayIndex Parameter index in arrays or sequences. This declaration overwrites the indexing in the brackets of <paramAdr>. buffer Buffer to which the parameter bytes are copied. buffersize Maximum number of copied parameter bytes (can be specified with (elcount(buffer))). Return values >=0: Number of copied bytes. <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamGetData | MostParamIsAvailable | MostParamGet | MostParamGetString | MostParamSet | MostParamSetData | MostParamSetString | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamGetString MostParamGetString CAPL Function Overview » MOST » MostParamGetString Syntax long mostParamGetString (mostAmsMessage msg, char paramAdr[], char buffer[], long buffersize) long mostParamGetString (mostAmsMessage msg, char paramAdr[], long arrayIndex, char buffer[], long buffersize) Function Query of parameters of the String type from an AMS message using the parameter name from the XML function catalog. Info This function supports ASCII-coded strings only. In case of other string encoding use the function mostParamGetData. 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 Message from which the parameter should be read. paramAdr Identification of parameters (see Symbolic Identification of Parameters). arrayIndex Parameter index in arrays or sequences. This declaration overwrites the indexing in the brackets of <paramAdr>. buffer Buffer to which the parameter bytes are copied. buffersize Maximum number of copied parameter bytes (can be specified with (elcount(buffer))). Return values >=0: Number of copied bytes. <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamGetString Example — | MostParamIsAvailable | MostParamGet | MostParamGetData | MostParamSet | MostParamSetData | MostParamSetString | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamGetStringAscii MostParamGetStringAscii CAPL Function Overview » MOST » MostParamGetStringAscii Syntax long mostParamGetStringAscii(mostAmsMessage msg, char paramAdr[], char buffer[], long buffersize) long mostParamGetStringAscii(mostAmsMessage msg, char paramAdr[], long arrayIndex, char buffer[], long buffersize)Syntax 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 Message in which the parameter value should be described. paramAdr Identification of parameters (see Symbolic Identification of Parameters). arrayIndex Parameter index in arrays or sequences. This declaration overwrites the indexing in the brackets of <paramAdr>. buffer Buffer to which the ASCII string parameter is copied. bufferSize Maximum number of copied ASCII string parameter bytes (can be specified with (elcount(buffer))). Return values >=0: number of converted characters <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST • • Example on mostAmsMessage AmFmTuner.RadioText.Status { char buffer[200]; long dataLen; // get string parameter data datalen = mostParamGetStringAscii(this, "TextA", buffer, Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamGetStringAscii elcount(buffer)); if(datalen >= 0) { write("Radiotext: %s", buffer); } } Input: Message parameter bytes: 00 00 61 00 62 00 63 00 00 Output: Radiotext: abc | OnMostApInstID | MostParamGet | MostParamGetData | MostParamGetString | MostParamSet | MostParamSetData | MostParamSetStringEnc | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamIsAvailable MostParamIsAvailable CAPL Function Overview » MOST » MostParamIsAvailable Syntax long mostParamIsAvailable(mostAmsMessage * msg, char paramadr[]) long mostParamIsAvailable(mostAmsMessage * msg, char paramadr[], long arrayIndex) Function Check whether a described parameter with the parameter name from the XML function catalog is in an AMS message. PosDescription, TelLen and StreamCases are checked in addition to FblockID, FunktionID and OpType. 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 Message to which parameter access should be applied. paramAdr Identification of parameters (see Symbolic Identification of Parameters). arrayIndex Parameter index in arrays or sequences. This declaration overwrites the indexing in the brackets of <paramAdr>. Return values 1: Parameter is available 0: Parameter is not available Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example Assure access to a parameter In the following sample, access to a parameter is assured in a received message. If the status message is partially transmitted, either through targeted use of the Pos parameter or erroneous assignment of TelLen, it can happen that StartTrack is not part of the received message. On mostAmsMessage DiskPlayer.MediaInfo.Status { int firstTrack; // check whether message was transmitted including FirstTrack of third array element (third media here) if(mostParamIsAvailable(this, “Data.Record[].FirstTrack”, 3)) { // read FirstTrack from message firstTrack = mostParamGet (this, “Data.Record[].FirstTrack”, 3); } else { // do error handling, either // a) Pos did not indicate existence of FirstTrack (only subset transmitted) // b) TelLen was not sufficient (erroneous message transmission) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamIsAvailable // c) Message is no MediaInfo (would only be applicable if ‘On mostAmsMessage’ handler // were not so specific as in this example, error in implementation of model) // d) Parameter description was erroneous (error in implementation of model) // (Hint: Check if an appropriate XML Function Catalog is assigned to the configuration) } } | MostParamGet | MostParamGetData | MostParamGetString | MostParamSet | MostParamSetString | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamSet MostParamSet CAPL Function Overview » MOST » MostParamSet Syntax long mostParamSet(mostAmsMessage msg, char paramAdr[], double value) long mostParamSet(mostAmsMessage msg, char paramAdr[], long arrayIndex, double value) Function Setting of a parameter value in an AMS message using the parameter name from the XML function catalog. Suitable for parameter types 'Number', 'Enum', 'BitField' and 'Bool'. For parameters of the 'Enum' type, the numeric value can be specified. The mostParamSetString function can be used to set the symbolic value. 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. When using function mostParamSet to build a message dump, the parameters must be populated in the order specified by the MOST Function Catalog, particularly for messages with StreamCases. Parameters msg Message in which the parameter value should be described. paramAdr Identification of parameters (see Symbolic Identification of Parameters). arrayIndex Parameter index in arrays or sequences. This declaration overwrites the indexing in the brackets of <paramAdr>. value Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamSet Value of the parameter with whole-number parameter types, decimal places are truncated. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example — | MostParamIsAvailable | MostParamGet | MostParamGetData | MostParamGetString | MostParamSetData | MostParamSetString | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamSetData MostParamSetData CAPL Function Overview » MOST » MostParamSetData Syntax long mostParamSetData(mostAmsMessage msg, char paramadr[], byte data[], long datalen) long mostParamSetData(mostAmsMessage msg, char paramadr[], long arrayIndex, byte data[], long datalen) 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. When using function mostParamSetData to build a message dump, the parameters must be populated in the order specified by the MOST Function Catalog, particularly for messages with StreamCases. Parameters msg Message in which the parameter bytes should be written. paramAdr Identification of parameters (see Symbolic Identification of Parameters). arrayIndex Parameter index in arrays or sequences. This declaration overwrites the indexing in the brackets of <paramAdr>. buffer Buffer from which the parameter bytes are copied. datalen Number of valid parameter bytes that are copied to the message. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamSetData — | MostParamIsAvailable | MostParamGet | MostParamGetData | MostParamGetString | MostParamSet | MostParamSetString | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamSetString MostParamSetString CAPL Function Overview » MOST » MostParamSetString Syntax long mostParamSetString (mostAmsMessage msg, char paramAdr[], char value[]) long mostParamSetString (mostAmsMessage msg, char paramAdr[], long arrayIndex, char value[]) 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 This function supports ASCII-coded strings only. In case of other string encoding use the function mostParamSetData. For enumerations, the parameter value can be indicated symbolically. The mostParamSet function can be used to set the numeric value. 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. When using function mostParamSetString to build a message dump, the parameters must be populated in the order specified by the MOST Function Catalog, particularly for messages with StreamCases. Parameters msg Message in which the parameter value should be described. paramAdr Identification of parameters (see Symbolic Identification of Parameters). arrayIndex Parameter index in arrays or sequences. This declaration overwrites the indexing in the brackets of <paramAdr>. value String: Characters that should be copied to the message. Enumeration: Symbolic name of the parameter value. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamSetString Example — | OnMostApInstID | MostParamSetStringEnc | MostParamGet | MostParamGetData | MostParamGetString | MostParamSet | MostParamSetData | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamSetStringEnc MostParamSetStringEnc CAPL Function Overview » MOST » MostParamSetStringEnc Syntax long mostParamSetStringEnc (mostAmsMessage msg, char paramAdr[], long encoding, char asciiStr[]) long mostParamSetStringEnc (mostAmsMessage msg, char paramAdr[], long arrayIndex, long encoding, char asciiStr[]) 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 Message in which the parameter value should be described. paramAdr Identification of parameters (see Symbolic Identification of Parameters). arrayIndex Parameter index in arrays or sequences. This declaration overwrites the indexing in the brackets of <paramAdr>. enconding Specifies the target encoding. Supported target encodings: 0x00 Unicode, UTF16 0x01 ISO 8859/15 8 bit 0x02 Unicode, UTF8 0x03 RDS 0x04 DAB Charset 0001 0x05 DAB Charset 0010 0x06 DAB Charset 0011 0x07 SHIFT_JIS asciiStr String that should be encoded and copied to the message. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostParamSetStringEnc Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST • • Example mostAmsMessage AmFmTuner.RadioText.Status msg; mostParamSetString(msg, "TextA", 0x00, "abc"); -> Message parameter bytes: 00 00 61 00 62 00 63 00 00 | OnMostApInstID | MostParamSetString | MostParamGet | MostParamGetData | MostParamGetString | MostParamSet | MostParamSetData | MostParamGetStringAscii | General Tips on XML Function Catalog Support in CAPL | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mostPktSetTraceColors mostPktSetTraceColors CAPL Function Overview » MOST » mostPktSetTraceColors Syntax mostPktSetTraceColors(long font, long bkgnd) 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 Parameters • 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. font Font color (RGB value) bkgnd Background color (RGB value) Return values 0: OK -1: Invalid RGB value of a color. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostPMSetOverTemperature, MostPMResetOverTemperature MostPMSetOverTemperature, MostPMResetOverTemperature CAPL Function Overview » MOST » MostPMSetOverTemperature, MostPMResetOverTemperature Syntax long MostPMSetOverTemperature () 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 — Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • While Application Socket is active • Only in device with Power Master Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostPMShutDownCancel MostPMShutDownCancel CAPL Function Overview » MOST » MostPMShutDownCancel Syntax long MostPMShutDownCancel() Function Aborts shutdown of the system by the Power Master. Parameters — Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active • Only in device with Power Master Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostPMShutDownStart MostPMShutDownStart CAPL Function Overview » MOST » MostPMShutDownStart Syntax long MostPMShutDownStart() Function Initiates a shutdown of the system by the Power Master (see MOST Specification 2.2). Parameters — Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • While Application Socket is active • Only in device with Power Master Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostPMTempShutdownWakeupTimeout MostPMTempShutdownWakeupTimeout CAPL Function Overview » MOST » MostPMTempShutdownWakeupTimeout Syntax long MostPMTempShutdownWakeupTimeout (long timeout) Function As described in the MOST specification in the chapter "Over-Temperature Management", the PowerMaster may try to wake-up the MOST ring, after a temperature shutdown, after a certain time. This function sets the timeout duration. The default value is 60s. Info By setting the "over temperature status" in the device of the PowerMaster, the wake-up attempt will not be performed after the timeout. After resetting the "over temperature status" the application has to perform the wake-up, if necessary. Parameters timeout Timeout in [ms]. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • MOST — • • While Application Socket is active • Only in device with Power Master Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostPrepareReport MostPrepareReport CAPL Function Overview » MOST » MostPrepareReport Syntax mostPrepareReport(mostAmsMessage * msgCommand, mostAmsMessage * msgReport) Function Preparation of an AMS message as response (OpType>=9) to a received command message (OpType<9). 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: Command OpType Report OpType GetInterface Interface any other Status For Methods: Command OpType Report OpType Start, StartResult Result GetInterface Interface Abort Error StartAck, StartResultAck ResultAck 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 Command message to be answered. msgReport Message that should serve as a response. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostPrepareReport Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST — • Example — | MostSendError | on mostAMSMessage | output(mostAmsMessage * msg) | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostRcvSpyMessagesOnly MostRcvSpyMessagesOnly CAPL Function Overview » MOST » MostRcvSpyMessagesOnly Note MostRcvSpyMessagesOnly() may only be called within the on preStart function of the CAPL program! 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST — • Example — | MostGetChannel | MostStrictChannelMapping | MostApplicationNode | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostReadReg MostReadReg CAPL Function Overview » MOST » MostReadReg Note Register structure of the OS8104: The registers of the OS8104 chip are distributed among pages. Read and write actions are not possible across several register pages. The offset is calculated as follows: offset = page << 8 + address Syntax long MostReadReg(long channel, long chip, DWORD offset, long regdatalen) Function Initiates read-out of the registers of a MOST hardware chip. Parameters channel Channel to which the hardware is connected. chip Number of the chip in the MOST hardware (1 = OS8104; other chips cannot be accessed yet). offset Address of the first register. regdatalen Number of registers to be read (1 <= regdatalen <= 16). Return values See error codes A read request by MostReadReg() causes the CAPL event procedure OnMostReg to be called. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostWriteReg | OnMostReg | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSendError MostSendError CAPL Function Overview » MOST » MostSendError Syntax mostSendError_Code (mostAmsMessage * msgcmd, byte code) (Suitable for error codes: 0x01, 0x02, 0x03, 0x05, 0x0B, 0x40, 0x41, 0x42, 0x43) mostSendError_CodeByte (mostAmsMessage * msgcmd, byte code, byte byte1) (Suitable for error codes: 0x04, 0x0C, 0x20, 0x06, 0x07) mostSendError_CodeByteByte(mostAmsMessage * msgcmd, byte code, byte byte1, byte byte2) (Suitable for error codes: 0x06, 0x07) mostSendError_CodeByteWord(mostAmsMessage * msgcmd, byte code, byte byte1, word word1) (Suitable for error codes: 0x06, 0x07) void SendError_CodeBytes(mostAMSMessage * msgcmd, byte code, byte data[], long datalen) (Suitable for error codes: 0x06, 0x07) 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 Received command message to be responded to code Error Code (see MOST specification) byte1 First ancillary information as byte byte2 Second ancillary information as byte word1 Second ancillary information as word data Ancillary information as byte array datalen Number of valid bytes in the array with the ancillary information Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSendError Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST — • Example — | on mostAMSMessage | output(mostAMSMessage * msg) | MostPrepareReport | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetAllBypass MostSetAllBypass CAPL Function Overview » MOST » MostSetAllBypass Syntax long MostSetAllBypass(long channel, long bypassmode) 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 Channel of the connected interface Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • Not in StopMeasurement Example — | MostGetAllBypass | OnMostAllBypass | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetAndFilter MostSetAndFilter CAPL Function Overview » MOST » MostSetAndFilter Note Works only if an Optolyzer box is assigned to the channel as interface. 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 Channel of the connected interface arb Arbitration byte targetAdr Destination address sourceAdr Source address type Message type msg Use data bytes of the MOST frame crc CRC code ack Acknowledge field of the MOST frame Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 • MOST — • • Not in StopMeasurement Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetAndFilter Example — | MostGetChannel |MostGetAndFilter | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetClockSource MostSetClockSource CAPL Function Overview » MOST » MostSetClockSource Note This function is only available with MOST hardware VN2610. Syntax long MostSetClockSource(long channel, long source) 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 Channel of the connected interface 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()). Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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; // configure hardware interface as S/PDIF slave MostSetSyncSpdifMode( channel, 0 ); MostSetSyncSpdifLock( channel, 1 ); } // set the clock source MostSetClockSource( channel, 0 ); 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; // configure hardware interface as S/PDIF slave MostSetSyncSpdifMode( channel, 0 ); // set the clock source MostSetClockSource( channel, 1 ); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetClockSource } More S/PDIF examples see CANoe online help MOST Access to Digital Audio Channels (S/PDIF In and Out). | MostSetTimingMode | MostSetSyncSpdifMode | MostGetSyncSpdifMode | MostGetClockSource | MostSetSyncAudio | MostSetSyncSpdif | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetCorrectStartupSBC MostSetCorrectStartupSBC CAPL Function Overview » MOST » MostSetCorrectStartupSBC Note This function is only available for VN2600/VN2610. Syntax long MostSetCorrectStartupSBC (long channel, long mode) 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 • This function has only an effect if the connected VN2600/VN2610 is configured as Timing Master. • This function should only be executed if the connected VN2600/VN2610 is not in the start-up phase. channel Channel of the connected MOST interface. mode 0 inactive 1 active Return values Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.0 SP2 MOST — • Example — | MostSetTimingMode | MostWakeup | MostSetSBC | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mostSetEclGlitchFilter mostSetEclGlitchFilter CAPL Function Overview » MOST » mostSetEclGlitchFilter Note This function is only available with MOST hardware VN2640. Syntax MOST150: long mostSetEclGlitchFilter (long channel, long durationus) 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 Channel of the connected interface. durationus Minimum duration of a pulse in µs required to generate an event which calls <OnMostECL>. The value ranges from 50 µs to 50 ms (Default: 1 ms) Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6 SP3 • — • MOST150 Example — | MostSetEclTermination | MostWakeup | OnMostEcl | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetEcl, MostGetEcl MostSetEcl, MostGetEcl CAPL Function Overview » MOST » MostSetEcl, MostGetEcl Note This function is only available with MOST hardware VN2640. Syntax MOST150: long MostSetEcl(long channel, long eclState) MOST150: long MostGetEcl(long channel) Function MostSetEcl switches the Electrical Control Line which can be used for wake-up and diagnosis purposes. MostGetEcl returns the current state of the Electrical Control Line. Parameters channel Channel of the connected interface. eclState 0: low 1: high Return values MostSetEcl See error codes MostGetEcl >=0: See eclState parameter <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 SP2 MOST150 — • Example — | OnMostEcl | MostSetEclTermination | MostWakeup | mostGenerateEclSequence | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetEclTermination, MostGetEclTermination MostSetEclTermination, MostGetEclTermination CAPL Function Overview » MOST » MostSetEclTermination, MostGetEclTermination Note This function is only available with MOST hardware VN2640. Syntax MOST150: long MostSetEclTermination(long channel, long eclTermination) MOST150: long MostGetEclTermination (long channel) Function Sets and gets the state of the termination resistor of the Electrical Control Line. Parameters channel Channel of the connected interface. eclTermination 0: pull-up not active 1: pull-up active Return values MostSetEclTermination See error codes MostGetEclTermination >=0: See eclState parameter <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 SP2 MOST150 — • Example — | MostSetEcl | mostSetEclGlitchFilter | mostConfigureEclSequence | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetMacAdr, MostGetMacAdr 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). Syntax MOST150: long MostSetMacAdr(long channel, int64 macAdr) MOST150: int64 MostGetMacAdr(long channel) Function The functions set and retrieve the 48 bit MAC address of the network interface controller. The MAC address identifies the network node during Ethernet-over-MOST150 communication (see OnMostEthPkt, OutputMostEthPkt). Parameters channel Channel of the connected interface macAdr 48 bit MAC address. Return values MostSetMacAdr: See error codes MostGetMacAdr: >=0: 48 bit MAC address <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST150 — • Example // Set MAC address on channel MOST 1 to 01:02:03:04:05:06 MostSetMacAdr(1, 0x010203040506LL); | OnMostMacAdr | OnMostEthPkt | OutputMostEthPkt | MostSetNodeAdr | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetMasterMode, MostGetMasterMode 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). Syntax MOST150: long MostSetMasterMode(long channel, long mode) MOST150: long MostGetMasterMode(long channel) 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. MostSetMasterMode becomes operative with the next call of MostSetTimingMode. Parameters channel Channel of the connected interface mode 0: static master 1: non-static master Return values MostSetMasterMode: See error codes MostGetMasterMode: >=0: See mode parameter <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST150 — • Example // configure bus interface as non-static timing master MostSetMasterMode(1, 1); MostSetTimingMode(1, 1); | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetRetryParameter, MostGetRetryParameter MostSetRetryParameter, MostGetRetryParameter CAPL Function Overview » MOST » MostSetRetryParameter, MostGetRetryParameter Syntax long MostSetRetryParameter(long channel, long id, long value) long MostGetRetryParameter(long channel, long id) 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 Channel of the connected interface. id Parameter identification (see table below). ID Meaning VN26x0 (MOST25) Optolyzer (MOST25) VN2640 (MOST150) OptoLyzer G2 3150o (MOST150) 0 Transmission attempts on the control channel. 1..255 1..255 1..16 1..16 1 Time between send retries on the control channel. 3..255 3..255 3..31 3..15 2 Transmission attempts on the asynchronous channel. — — 1..16 1..16 3 Time between send retries on the asynchronous channel. — — 0..255 0..255 value Value to be set. Return values MostSetRetryParameter: See error codes. MostGetRetryParameter: >=0: Retry parameter value. <0: See error codes. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 MOST — • Example // configure MOST transceiver for 5 low-level transmission attempts on Control channel MostSetRetryParameter(1, 0, 5); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetRetryParameter, MostGetRetryParameter | mostGetChannel |output | mostReadReg | OnMostReg | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetShutDownFlagUsage, MostGetShutDownFlagUsage MostSetShutDownFlagUsage, MostGetShutDownFlagUsage CAPL Function Overview » MOST » MostSetShutDownFlagUsage, MostGetShutDownFlagUsage Note At least OptoLyzer G2 3150o firmware version V1.2 is required. Syntax MOST150: long MostSetShutDownFlagUsage(long channel, long mode) MOST150: long MostGetShutDownFlagUsage(long channel) Function For test purposes the stress network interface controller in the OptoLyzer G2 3150o is able to suppress the shutdown flag for the next node by calling. MostSetShutDownFlagUsage with mode 0. Parameters channel Channel of the connected interface mode 0: clear shutdown flag 1: default mode Return values MostSetShutDownFlagUsage: See error codes MostGetShutDownFlagUsage: >=0: See mode parameter <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST150 — • Example — | OnMostShutdownFlag | MostWakeup | MostShutDown | MostSetSystemLockFlagUsage | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetStressNodeParameter, MostGetStressNodeParameter 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). Syntax MOST150: long MostSetStressNodeParameter(long channel, long id, long value) MOST150: long MostGetStressNodeParameter(long channel, long id) Function VN2640: Additional parameters of the stress generators (MostGenerateBusloadCtrl, MostGenerateBusloadAsync, MostGenerateBusloadEthPkt) can be set with MostSetStressNodeParameter. 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 Channel of the connected interface. id Parameter identification: ID Description Value range / meaning Availability 1 Node address 0...0xFFFF OptoLyzer G2 3150o 2 Group address 0x300...0x3FF OptoLyzer G2 3150o 3 Bypass values: 0: open bypass, 1: retimed bypass, 2: active bypass OptoLyzer G2 3150o 10 Control busload destination address 0...0xFFFF VN2640 OptoLyzer G2 3150o 11 Control busload speed VN2640: Messages per second Version: 7.6 SP4 | © Vector Informatik GmbH VN2640 User Manual Topic: MostSetStressNodeParameter, MostGetStressNodeParameter 12 Control busload pattern: specifies what message is sent as busload G2 3150o: Specifies the delay between two messages: 1 means 10 ms delay, 2 means 20 ms delay and so on. 0: as fast as possible OptoLyzer G2 3150o 0: FBlockID: 0xF1 InstID: 0x00 FuncID: 0xFFF OpType: 0xC Length OptoLyzer G2 3150o 2: FBlockID: 0x01 InstID: 0x00 FuncID: 0x000 OpType: 0x1 16: custom message (to specify custom message use function mostConfigureBusloadCtrl) 13 Control busload pattern length: amount of payload sent as busload, applies for pattern 0x00 only 6...51 OptoLyzer G2 3150o 14 Control busload burst count: amount of messages sent as busload per (10 ms) cy-cle. For further information regarding the burst mode please refer to SMSC socket protocol specification. 1...65535 OptoLyzer G2 3150o 15 Control busload send attempts 1...16 VN2640 OptoLyzer G2 3150o 16 17 50 Control busload counter type 0: no counter 1: 1 byte counter 2...4: 2-4 byte counter (VN2640 only) VN2640 Control busload counter position: specifies the position of the payload byte that is incremented 6...50 VN2640 Data packet channel busload destination address 0...0xFFFF OptoLyzer G2 3150o OptoLyzer G2 3150o Version: 7.6 SP4 | © Vector Informatik GmbH VN2640 OptoLyzer G2 3150o User Manual Topic: MostSetStressNodeParameter, MostGetStressNodeParameter 51 Data packet channel busload speed VN2640: Packets per second G2 3150o: Specifies the delay between two packets: 1 means 10 ms delay, 2 means 20 ms delay and so on. 0: as fast as possible VN2640 OptoLyzer G2 3150o 52 Data packet channel busload pattern: specifies what a message is sent as busload 0: FBlockID: 0xF1 InstID: 0x00 FuncID: 0xFFF OpType: 0xC Length (2 Byte) OptoLyzer G2 3150o 53 Data packet channel busload pattern length 6...48 OptoLyzer G2 3150o 55 Send attempts for data packet bus load 1...16 VN2640 56 Data packet bus load counter type 0: no counter 1...4: 1-4 byte counter VN2640 57 Data packet bus load counter position 0...1523 VN2640 75 Send attempts for Ethernet bus load packet 1...16 VN2640 76 Ethernet bus load counter type 0: no counter 1...4: 1-4 byte counter VN2640 77 Ethernet bus load counter position 0...1505 VN2640 value Parameter value to be set. Return values MostSetStressNodeParameter: See error codes MostGetStressNodeParameter: >=0: Parameter value <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST150 — • Example VN2640 See MostConfigureBusloadCtrl Example G2 3150o // configure stress controller as visible network node with logical address 0x123 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetStressNodeParameter, MostGetStressNodeParameter MostSetStressNodeParameter(1, 1, 0x123); // set node address MostSetStressNodeParameter(1, 3, 0); // open bypass | MostSetAllBypass | MostSetNodeAdr | MostGetChannel | MostSyncDealloc | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSystemLockFlagUsage, MostGetSystemLockFlagUsage MostSetSystemLockFlagUsage, MostGetSystemLockFlagUsage CAPL Function Overview » MOST » MostSetSystemLockFlagUsage, MostGetSystemLockFlagUsage Note At least OptoLyzer G2 3150o firmware version V1.2 is required. Syntax MOST150: long MostSetSystemLockFlagUsage(long channel, long mode) MOST150: long MostGetSystemLockFlagUsage(long channel) Function For test purposes the stress network interface controller in the OptoLyzer G2 3150o is able to suppress the system lock flag for the next node by calling. MostSetSystemLockFlagUsage with mode 0. Parameters channel Channel of the connected interface mode 0: clear system lock flag 1: default mode Return values MostSetSystemLockFlagUsage: See error codes MostGetSystemLockFlagUsage: >=0: See mode parameter <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST150 — • Example — | OnMostSystemLock | MostWakeup | MostShutDown | MostSetShutDownFlagUsage | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetHWFilter MostSetHWFilter CAPL Function Overview » MOST » MostSetHWFilter Note Works only if an Optolyzer box is assigned to the channel as interface. Filter Mode Syntax long MostSetHWFilter(long Function Effects the Optolyzer only when in spy mode. Parameters mode = 1 HW filter on mode = 0 HW filter off channel, long mode) channel Channel of the connected interface Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 • MOST — • • Not in StopMeasurement Example — | MostGetChannel | MostGetHWFilter | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetNodeAdr, MostSetGroupAdr, MostSetAltPktAdr, MostSetOwnAdr MostSetNodeAdr, MostSetGroupAdr, MostSetAltPktAdr, MostSetOwnAdr CAPL Function Overview » MOST » MostSetNodeAdr, MostSetGroupAdr, MostSetAltPktAdr, MostSetOwnAdr Syntax long MostSetNodeAdr(long channel, long nodeadr) long MostSetGroupAdr(long channel, long grpadr) long MostSetAltPktAdr(long channel, long altpktadr) long MostSetOwnAdr(long channel, long grpadr, long nodeadr) Function These functions set the node address, group address or alternative packet address of the MOST hardware to the specified values. Parameters channel Channel of the connected interface nodeadr Logical node address groupadr Group address altpktadr Alternative packet address (not with Optolyzer box) nodeposadr Node position address Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 • MOST — • • Not in StopMeasurement • MOST — • • Not in StopMeasurement 5.0: MostSetAltPktAdr Example — | MostGetNodeAdr, MostGetGroupAdr, MostGetAltPktAdr, MostGetNodePosAdr | OnMostNodeAdr | OnMostGroupAdr | OnMostNPR | MostGetChannel | MostSetMacAdr | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: mostSetRxBufferAsync mostSetRxBufferAsync CAPL Function Overview » MOST » mostSetRxBufferAsync Note This function is only available with MOST hardware VN2640. Syntax MOST150: long mostSetRxBufferAsync (long channel, long buffermode) 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 reenabling the draining. Parameters channel Channel of the connected interface. buffermode 0: stops draining the Rx buffer for MDP and MEP 1: starts draining the buffer again. Return values 0 <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.6 SP3 • — • MOST150 Example — | MostSetRxBufferCtrl | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetRxBufferCtrl MostSetRxBufferCtrl CAPL Function Overview » MOST » MostSetRxBufferCtrl Note This functionality is only available for • VN2640 • VN2600/VN2610 • Optolyzer (MOST25) • OptolyzerOL3150o (firmware version >= V1.5.3) • OptolyzerOl3050e (firmware version >= V1.5) Syntax long MostSetRxBufferCtrl(long channel, long mode) 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). After the measurement start the receive buffer is always enabled. 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 Channel of the connected interface mode 0 Disable receive buffer 1 Enable receive buffer 2 Enable receive buffer exactly once for one message Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 • MOST — • • After measurement start Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetRxBufferCtrl • Not in Stopmeasurement Example — | MostGetChannel | mostSetRxBufferAsync | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSBC MostSetSBC CAPL Function Overview » MOST » MostSetSBC Syntax long MostSetSBC (long channel, long sbcvalue) 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 Channel of the connected MOST hardware sbcvalue New SBC register value. Values between 0 and 15 are permitted. Return values Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • Not in StopMeasurement Example — | MostGetSBC | OnMostSBC | MostGetChannel | MostSetCorrectStartupSBC | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSpyCtrl, MostSetSpyAsync, MostSetSpyEthPkt MostSetSpyCtrl, MostSetSpyAsync, MostSetSpyEthPkt CAPL Function Overview » MOST » MostSetSpyCtrl, MostSetSpyAsync, MostSetSpyEthPkt Syntax long MostSetSpyCtrl(long channel, long mode) long MostSetSpyAsync(long channel, long mode) MOST150: long MostSetSpyEthPkt(long channel, long mode) Function Spy mode is activated (mode = 1) or deactivated (mode = 0) for the Control, Asynchronous or Ethernet transmission channel using these functions. Parameters channel Channel of the connected interface mode Return values 0 Spy inactive 1 Spy active See error codes 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). Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • Not in StopMeasurement • MOST150 — • • Not in StopMeasurement 7.6 SP2: form 3 Example — | MostGetChannel | MostGetSpyCtrl, MostGetSpyAsync, MostGetSpyEthPkt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSyncAudio MostSetSyncAudio CAPL Function Overview » MOST » MostSetSyncAudio Syntax long MostSetSyncAudio(long channel, long channels[4], long device, long mode) MOST50 / MOST150: long MostSetSyncAudio(long channel, long label, long width, long device, long mode) 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 MostSetSyncAudio automatically allocates new channels to which Line-In is routed. (Device==0). This function is only available if the connected hardware interface has its bypass opened. Parameters channel Channel of the connected interface 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: channels[0]: MSB left audio channel channels[1]: LSB left audio channel channels[2]: MSB right audio channel channels[3]: LSB right audio channel Info This parameter is ignored in case the routing is canceled (mode==0). device 0 Line-In: Audio input signals are put on synchronous channels. 1 Line-Out: Synchronous channel signals are grabbed for audio output. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSyncAudio mode 0 Cancels the routing. 1 Executes the routing. label Connection label. In case of Line-In routing (device=0; mode=1) the label parameter has no meaning. width Number of channels to be routed. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST • • • Not in Stopmeasurement • MOST, MOST150 • • • Not in Stopmeasurement • MOST, MOST150, MOST50 • • • Not in Stopmeasurement 7.1 SP2 7.2 SP3 Example See CANoe online help MOST Access to Analog Audio Channels (Line In/ Headphone Out). | MostGetChannel | MostSetSyncVolume | MostSetSyncMute | MostGetSyncVolume | MostGetSyncMute | MostSetSyncSpdif | MostSyncAlloc | MostSyncDealloc | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSyncMute MostSetSyncMute CAPL Function Overview » MOST » MostSetSyncMute Syntax long MostSetSyncMute(long channel, long device, long mute) Function Activates or deactivates the audio input or output of the bus interface. Parameters channel Channel of the connected interface device 0 Line-In 1 Line-Out 2 S/PDIF In (VN2640 only) 3 S/PDIF Out (VN2640 only) mute 0 Active (mute off) 1 Inactive (mute on) Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • Not in StopMeasurement Example See CANoe online help MOST Access to Analog Audio Channels (Line In/ Headphone Out). | MostGetChannel | MostSetSyncAudio | MostSetSyncVolume | MostGetSyncVolume | MostGetSyncMute | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSyncSpdif 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. Syntax long MostSetSyncSpdif(long channel, long channels[8], long device, long mode) MOST50 / MOST150: long MostSetSyncSpdif(long channel, long label, long width, long device, long mode) 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 MostSetSyncSpdif automatically allocates new channels to which the S/PDIF In is routed. (Device==0). SPDIF In (device==0) is only available if the connected hardware interface has its bypass opened. Call MostSetSyncMute to mute/demute the signal. Parameters channel Channel of the connected interface 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: channels[0]: MSB left audio channel channels[1]: LSB left audio channel channels[2]: AUX left audio channel channels[3]: VUCP left audio channel channels[4]: MSB right audio channel channels[5]: LSB right audio channel Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSyncSpdif channels[6]: AUX right audio channel channels[7]: VUCP right audio channel Info This parameter is ignored in case the routing is canceled (mode==0). device 0 S/PDIF in: S/PDIF input signals are put on synchronous channels. 1 S/PDIF out: Synchronous channel signals are grabbed for S/PDIF output. mode 0 Cancels the routing. 1 Executes the routing. label Connection label. In case of S/PDIF-In routing (device=0; mode=1) the label parameter has no meaning. width Number of channels to be routed. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 MOST — • 7.1 SP2 MOST, MOST150 — • 7.2 SP3 MOST, MOST150, MOST50 — • Example See CANoe online help MOST Access to Digital Audio Channels (S/PDIF In and Out). | MostSetSyncSpdifLock | MostSetSyncSpdifMode | MostGetSyncSpdifMode | MostSetClockSource | MostGetClockSource | MostSetSyncAudio | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSyncSpdifLock MostSetSyncSpdifLock CAPL Function Overview » MOST » MostSetSyncSpdifLock Note This function is only available with MOST hardware VN2610. Syntax long MostSetSyncSpdifLock(long channel, long mode) 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 Channel of the connected interface mode 0 Separates the timing generator from the S/PDIF input data stream. 1 Locks the timing generator on the S/PDIF input data stream. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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). Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSyncSpdifLock | MostSetSyncSpdif | MostSetSyncSpdifMode | MostGetSyncSpdifMode | MostSetClockSource | MostGetClockSource | MostSetSyncAudio | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSyncSpdifMode MostSetSyncSpdifMode CAPL Function Overview » MOST » MostSetSyncSpdifMode Note This function is only available with MOST hardware VN2610. Syntax long MostSetSyncSpdifMode(long channel, long mode) Function Sets the timing mode for the S/PDIF signal. Parameters channel Channel of the connected interface mode 0 S/PDIF slave. 1 S/PDIF master. Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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). | MostSetSyncSpdif | MostSetSyncSpdifLock | MostGetSyncSpdifMode | MostSetClockSource | MostGetClockSource | MostSetSyncAudio | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetSyncVolume MostSetSyncVolume CAPL Function Overview » MOST » MostSetSyncVolume Syntax long MostSetSyncVolume(long channel, long device, long volume) Function Sets the volume of the audio input or output of the bus interface. Parameters channel Channel of the connected interface device 0 Line-In 1 Line-Out volume Value range: 0...255 (0...100%) Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • After measurement start • Not in Stopmeasurement Example See CANoe online help MOST Access to Analog Audio Channels (Line In/ Headphone Out). | MostGetChannel | MostSetSyncAudio | MostSetSyncMute | MostGetSyncVolume | MostGetSyncMute | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetTimingMode MostSetTimingMode CAPL Function Overview » MOST » MostSetTimingMode Syntax long MostSetTimingMode(long channel, long mode) 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 If the bypass is closed (see MostSetAllBypass()) this function has no effect until the bypass is opened. Parameters channel Channel of the connected interface mode 0 Slave 1 Master Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • Not in StopMeasurement Example — | MostGetTimingMode | OnMostTimingMode | MostGetChannel | MostSetMasterMode | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetTxLight MostSetTxLight CAPL Function Overview » MOST » MostSetTxLight Note This functionality is available for • VN2600/VN2610 • Optolyzer (MOST25) • OptolyzerOL3150o (firmware version >= V1.5.3) Syntax long MostSetTxLight(long channel, long txlight) Function Sets the Light Status at the Fiber Optical Transmitter (FOT). Parameters channel Channel of the interface to be queried txlight 0 disable FOT: Tx light off 1 enable FOT: TimingMaster: Modulated light on TimingSlave/Bypass: Tx light = Rx light 2 enable FOT: Constant light on (only available for VN2600/VN2610/OptolyzerOL3150o) For OptolyzerOL3150o: The stress network interface controller (NIC) must have its bypass opened ( see MostSetStressNodeParameter ). Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 • MOST — • • Not in StopMeasurement Example — | MostGetRxLight | MostGetTxLight | MostSetTxLightPower | MostGetChannel | OnMostTxLight | MostShutDown | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetTxLightPower MostSetTxLightPower CAPL Function Overview » MOST » MostSetTxLightPower Note This functionality is only available for VN2600/VN2610 hardware. Syntax long MostSetTxLightPower(long channel, long power) Function Sets the intensity of the light at the Fiber Optical Transmitter (FOT). The result is reported by means of the callback function OnMostStress(). Parameters channel Channel of the interface to be driven power valid values: 50 3db attenuated to normal intensity 100 normal intensity Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 • MOST — • • Not in StopMeasurement Example — | MostSetTxLight | MostGetTxLight | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetXorFilter MostSetXorFilter CAPL Function Overview » MOST » MostSetXorFilter Note Works only if an Optolyzer box is assigned to the channel as interface. 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 Channel of the connected interface arb Arbitration byte targetAdr Destination address sourceAdr Source address type Message type msg Use data byte of the MOST frame crc CRC code ack Acknowledge field of the MOST frame Return values <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 3.2 • MOST — • • Not in StopMeasurement Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSetXorFilter | MostGetChannel | MostGetXorFilter | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostShutDown MostShutDown CAPL Function Overview » MOST » MostShutDown Syntax MOST50 / MOST150: long MostShutDown(long channel) Function Performs a regular network shutdown. Parameters channel Channel of the connected interface Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 MOST150 — • 7.2 SP3 MOST150, MOST50 — • Example — | MostWakeup | MostSetTxLight | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostStrictChannelMapping MostStrictChannelMapping CAPL Function Overview » MOST » MostStrictChannelMapping Note MostStrictChannelMapping() may only be called within the on preStart function of the CAPL program! 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST — • Example — | MostGetChannel | MostApplicationNode | mostRcvSpyMessagesOnly | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostStringToAscii MostStringToAscii CAPL Function Overview » MOST » MostStringToAscii Syntax long mostStringToAscii(byte sourceData[], long sourceDatalen, char buffer[], long buffersize) Function Convert MOST string to ASCII string. Unsupported characters in the input data are ignored. Info Supported encodings: Parameters 0x00 Unicode, UTF16 0x01 ISO 8859/15 8 bit 0x02 Unicode, UTF8 0x03 RDS 0x04 DAB Charset 0001 0x05 DAB Charset 0010 0x06 DAB Charset 0011 0x07 SHIFT_JIS sourceData A buffer containing the MOST string to be decoded. sourceDataLen The size of the buffer containing the MOST string. buffer Buffer to which the ASCII string is copied. bufferSize Maximum number of copied ASCII string bytes (can be specified with (elcount(buffer))). Return values >=0: number of converted characters <0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSyncAlloc MostSyncAlloc CAPL Function Overview » MOST » MostSyncAlloc Syntax long MostSyncAlloc(long numChannels) Function MOST25: This function reserves synchronous bandwidth by sending an Alloc system message to the MOST TimingMaster. The result is reported by means of the callback function OnMostSyncAllocResult(). This requires defining OnMostSyncAllocResult() in the CAPL program using the following signature: OnMostSyncAllocResult(long allocResult, long numChannels, long channels[]) 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: Allocates synchronous bandwidth on MOST150. Info • The callback function OnMostSyncAllocResult (see below) will not be called on completion. MostAllocTableGetCL can be applied to check the allocation result. • Channels will be allocated only (e.g. for resource shortage tests). It is not possible to put any data on these channels. • Specific for VN2640: • Parameters • The bypass of the network interface controller (NIC) has to be open (see MostSetAllBypass). • At most ten labels can be allocated at a time. Specific for OptolyzerOL3150o: • The bypass of the OptolyzerOL3150o’s stress NIC has to be open (see MostSetStressNodeParameter). • At most eight labels can be allocated at a time. numChannels The number of channels to be reserved: MOST25: 1 <= numChannels <= 8 MOST150: 1 <= numChannels <= MaxSyncBandwidth (depends on boundary settings - max. value: 372) Return values See error codes Availability Since Version Restricted to Measurement Setup Version: 7.6 SP4 | © Vector Informatik GmbH Simulation / Test Setup User Manual Topic: MostSyncAlloc 6.0 • MOST • After measurement start • Not in Stopmeasurement — • Example — Callback function: Syntax void OnMostSyncAllocResult(long allocResult, long numChannels, long channels[]) 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 Result of the operation. kGrant = 0x01 The channels were reserved 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 kWrong = 0x04 The reservation request contains invalid parameters kUnknown = 0xFF Unspecified error (e.g. a timeout while waiting for the TimingMaster to respond) numChannels The number of reserved channels. (1 <= numChannels <= 8). 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup MOST — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSyncAlloc | OnMostAllocTable | MostSyncDealloc | MostSetSyncAudio | MostSetSBC | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSyncDealloc MostSyncDealloc CAPL Function Overview » MOST » MostSyncDealloc Syntax long MostSyncDealloc(long label) Function MOST25: This function releases reserved bandwidth for synchronous channels by sending a Dealloc system message to the TimingMaster. The result is reported by means of the callback function OnMostSyncDeallocResult. This requires defining OnMostSyncDeallocResult in the CAPL program using the following signature: OnMostSyncDeallocResult(long deallocResult, long label) 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: Deallocates synchronous bandwidth on MOST150. Info • Parameters In contrast to MOST25 the callback function OnMostSyncDeallocResult (see below) will not be called on completion. MostAllocTableGetCL can be applied to check the de-allocation result. label Channel label. MOST25: content of channels[0] in OnMostSyncAllocResult, see MostSyncAlloc. Value 0x7F (=DeallocAll) releases all synchronous channels. MOST150: Label number (see MostAllocTableGetCL) Value 0xFFF releases all synchronous channels previously reserved with MostSyncAlloc (VN2640 only). Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 • MOST — • • After measurement start • Not in Stopmeasurement Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostSyncDealloc Example — Callback function: Syntax void OnMostSyncDeallocResult(long deallocResult, long label) 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 Result of the operation. kGrant = 0x01 The channels were reserved kBusy = 0x02 The channels were not reserved, because the TimingMaster is busy processing another request kWrong = 0x04 The specified channel label is invalid kUnknown = 0xFF Unspecified error (e.g. a timeout while waiting for the TimingMaster to respond) label Channel label (content of channels[0] in OnMostSyncAllocResult, see MostSyncAlloc). Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup MOST — • Example — | OnMostAllocTable | MostSyncAlloc | MostSetSyncAudio | MostSetStressNodeParameter | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostWakeup MostWakeup CAPL Function Overview » MOST » MostWakeup Syntax long MostWakeup (long channel, long duration) 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 Channel of the connected MOST hardware duration Length of the wake up impulse [ms] Return values <= 0: See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostSetTxLight | MostGetTxLight | on mostLightLockError | MostGetChannel | MostSetCorrectStartupSBC | MostShutDown | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostTwinklePowerLed MostTwinklePowerLed CAPL Function Overview » MOST » MostTwinklePowerLed Note This function is available for the VN2600/VN2610 hardware only. Syntax long MostTwinklePowerLed(long channel) Function Causes the power LED of the interface to briefly twinkle. Parameters channel Channel of the connected interface Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 • MOST — • • After measurement start • Not in Stopmeasurement Example — | MostGetChannel | MostGetHWCapability | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MostWriteReg MostWriteReg CAPL Function Overview » MOST » MostWriteReg Note Changes to registers may lead to unpredicatable behavior of the hardware interface. Register layout of the OS8104: 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[]) Function Writes to one or more registers of a MOST hardware chip. Parameters channel Channel to which the hardware is connected chip Number of the MOST hardware chip (1 = OS8104; other chips cannot be accessed yet) offset Address of the first register regdatalen Number of registers to be written (maximum 16; for the Optolyzer Interface Box maximum 1) regdata[] A byte buffer at least regdatalen in size with the data to be written Return values See error codes Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 • MOST — • • After measurement start • Not in StopMeasurement Example — | MostReadReg | OnMostReg | MostGetChannel | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostAllBypass(long mode) OnMostAllBypass(long mode) CAPL Function Overview » MOST » OnMostAllBypass(long mode) Syntax 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. Supplemental information can be called up within this procedure by the MostEventChannel, MostEventTime and MostEventOrigTime functions. 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: The bypass is opened. 1: The bypass is closed. The MOST hardware is transparent to other devices on the ring. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 MOST • • Example — | MostSetAllBypass | MostGetAllBypass | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostAllocTable OnMostAllocTable CAPL Function Overview » MOST » OnMostAllocTable Note This functionality is only available for VN2600/VN2610 and Optolyzer hardware. 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. Supplemental information can be called up within this procedure by the MostEventChannel, MostEventTime and MostEventOrigTime functions. 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 — Availability Since Version Restricted to Measurement Setup Simulation Setup 5.1 MOST • • 7.1 SP4 MOST, MOST150 • • 7.2 SP3 MOST, MOST50 MOST150, • • Example — | MostGetAllocTable | Version: 7.6 SP4 | © Vector Informatik GmbH / Test User Manual Topic: on mostAMSMessage 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostApInstID 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)). The new valid InstID may be polled by MostApGetInstID. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostAsRegistry(long regsel) 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. Causes for a change to the Local FBlockList: • Registration or unregistration of one or more function blocks • Change to the InstID of a function block by the Network Master (NetBlock.FBlockIDs.SetGet). Causes for a change to the Bus Registry: • In a device with Network Master: Change in network status • In a device without Network Master: Receipt of the NetworkMaster.CentralRegisrty.Status message Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. 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 1: Changes in Local FBlockList 2: Changes in Bus Registry Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST — • Example Read-Out of the Registries 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) { Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostAsRegistry(long regsel) 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 | MostAsRgGetSize | MostAsRgGetRxTxLog | MostAsRgGetFBlockID | MostAsRgGetInstID | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostCriticalUnlock 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example — | OnMostStableLock | MostGetLockEx | on mostLightLockError | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostEcl OnMostEcl CAPL Function Overview » MOST » OnMostEcl Note This function is only available with MOST hardware VN2640. Syntax MOST150: OnMostEcl(long eclState) Function The event procedure is called when the state of the Electrical Control Line has changed. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. Parameters eclState 0: Low 1: High Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.5 SP2 MOST • • Example Output of ECL changes with time stamp. OnMostEcl(long eclState) { write(„ECL state at %fs: %d“, MostEventTimeNs() / 1.0e9, eclState); } | MostSetEcl | mostSetEclGlitchFilter | mostConfigureEclSequence | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostEthPkt OnMostEthPkt CAPL Function Overview » MOST » OnMostEthPkt Syntax MOST150: OnMostEthPkt(long pktDataLen) Function When an Ethernet packet is received over the Packet Data Channel the OnMostEthPkt event procedure is called. The following functions are available for evaluating the event: • long MostEventChannel() Returns the channel of the packet event. • long MostEventTime() Returns the time stamp of the event (Units: 10 µs). • float MostEventTimeNs() Returns the time stamp of the event (Units: 1 ns). • long MostEventOrigTime() Returns the hardware generated time stamp of the event (Units: 10 µs). • int64 MostEthPktSrcMacAdr(), int64 MostEthPktDestMacAdr() Returns the 48 bit source or destination Ethernet address. • long MostEthPktDir() Returns the direction of transmission (Rx=0, Tx=1, TxRe-quest=2). • long MostEthPktDlc() Number of transported data bytes. • long MostEthPktGetData(byte[] buffer, long cnt) Tries to copy cnt data bytes to a provided buffer. Returns the actual number of copied bytes. • long MostEthPktGetSelData(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 MostEthPktIsSpy() Returns 1 if the packet was received over the Spy of the Packet Data Channel, otherwise 0. • long MostEthPktAck() Returns the acknowledge code. • long mostEthPktPAck() Returns the preemptive acknowledge code (for MostEthPktIsSpy()=1 only). Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostEthPkt (0x00: No Response; 0x01: Buffer full; 0x04: OK) • dword MostEthPktCRC() Returns the CRC value (for MostEthPktIsSpy()=1 only). • long MostEthPktCAck() Returns the CRC acknowledge code (for MostEthPktIsSpy()=1 only). (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 OutputMostEthPktThis command. Parameters pktDataLen Number of data bytes of the packet. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP2 MOST150 • • Example — | MostSetMacAdr | OnMostMacAdr | mostEthPktSetTraceColors | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostEthPktFragment OnMostEthPktFragment CAPL Function Overview » MOST » OnMostEthPktFragment Syntax MOST150: OnMostEthPktFragment() Function The event procedure OnMostEthPktFragment is called when the spy detects an incomplete Ethernet packet transmission. The following functions are available for evaluating the event: • long MostEventChannel() Returns the channel of the packet event. • long MostEventTime() Returns the time stamp of the event (Units: 10 µs). • float MostEventTimeNs() Returns the time stamp of the event (Units: 1 ns). • long MostEventOrigTime() Returns the hardware generated time stamp of the event (Units: 10 µs). • long MostEthPktFragmentDlc() Number of transported data bytes. • long MostEthPktFragmentGetData(byte[] buffer, long cnt) 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). • int64 MostEthPktSrcMacAdr(), int64 MostEthPktDestMacAdr() Returns the 48 bit source or destination Ethernet address. • long MostEthPktFragmentAck() Returns the acknowledge code. • long MostEthPktFragmentPAck() Returns the preemptive acknowledge from the potential packet receiver(s) to the packet transmitter. • dword MostEthPktFragmentCRC() Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostEthPktFragment Returns the CRC value. • long MostEthPktFragmentCAck() Returns the CRC acknowledge code. • 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP2 MOST150 • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostFiAmsPreReceive OnMostFiAmsPreReceive CAPL Function Overview » MOST » OnMostFiAmsPreReceive Syntax long OnMostFiAmsPreReceive(mostAmsMessage * msg) 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 • All CAPL functions are available within the callback. When output(mostAmsMessage) and MostFiAmsReceive are used, attention must be paid that recursions are not programmed. This can be ensured through appropriate message filtering (see example below). • The callback is only called for the AMS messages for which the simulation node has implemented a mostAmsMessage handler (i.e., for the messages whose receipt the node is intended for). 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. 0: Original message is not received. 1: Original message is received without alteration Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); // do not forward the original message return 0; Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostFiAmsPreReceive } } else { // forward the original message return 1; } | OnMostFiAmsPreSend | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostFiAmsPreSend OnMostFiAmsPreSend CAPL Function Overview » MOST » OnMostFiAmsPreSend Syntax long OnMostFiAmsPreSend(mostAmsMessage * msg) 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 This variable contains the send request of the simulation node. 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. 0: Original message is not sent 1: Original message is sent without alteration Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); // do not send original message return 0; } } else { // send original message return 1; } | OnMostFiAmsPreReceive | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostGroupAdr(long groupadr) OnMostGroupAdr(long groupadr) CAPL Function Overview » MOST » OnMostGroupAdr(long groupadr) Syntax 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. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. 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 New value of the group address. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST • • Example — | MostSetGroupAdr | MostGetGroupAdr | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on mostLightLockError on mostLightLockError CAPL Function Overview » MOST » on mostLightLockError Syntax on mostLightLockError Function On controller events on mostLightLockError is called. Light, Lock and Error events will be forwarded automatically. If the event procedure should only react to events on channel 1 this is defined as follows: on MsgChannel1.mostLightLockError Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.0 MOST • • Example — | MostGetRxLight | MostGetLock | OnMostTxLight | mostLightLockError - Selectors | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMacAdr OnMostMacAdr CAPL Function Overview » MOST » OnMostMacAdr Syntax MOST150: OnMostMacAdr(int64 macAdr) Function The MAC address (48 bit) of the hardware interface to the MOST bus has changed. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. CAPL nodes are transparent to the controller events. Please use the MOST application filter, to filter these events in nodal sequences. Parameters macAdr New value of the MAC address. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 MOST150 • • Example — | MostSetMacAdr | OutputMostEthPkt | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on mostMessage 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPBlock 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. Syntax long OnMostMHPBlock(long sourceDevID, long destDevID, long fBlockID, long instID, long functionID, long opType) Function The event procedure is called up as soon as a block from a MOST High connection has been fully transmitted. Within this event procedure the following functions are available • long MostMHPBlockGetData(byte buffer[], long bufferSize) Copies the reference data of the block in a provided buffer. Parameter: buffer (buffer for the data bytes) bufferSize (size of the buffer) Returns: Number of data bytes copied • long MostMHPBlockIsSpy() Indicates whether the block was made up of Spy messages. Parameter: None Returns: 0: Comprised of node messages 1: Comprised of Spy messages • long MostMHPBlockNumberOfFrames() Provides the number of Data Frames of the block. Parameter: None Returns: Number of actual Data Frames • 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() Provides the size of the block. Parameter: None Returns: Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPBlock Number of data bytes (reference data only) • long MostMHPBlockTransportMode() Provides the transmission mode of the block. Parameter: None Returns: 1: Transmission on the control channel 2: Transmission on the asynchronous channel • long MostMHPBlockCnt() Provides the sequence number of the block. Parameter: None Returns: Cnt field of the 0 frame (see MHP specification) • long MostMHPBlockOptions() Provides the options for the transmission of the block. Parameter: None Returns: Options field of the 0 frame (see MHP specification) • long MostMHPBlockSegID() Provides the segmentation ID of the block. Parameter: None Returns: Options field of the 0 frame (see MHP specification) The functions MostEventChannel, MostEventTime and MostEventTimeNS can be used to call up supplemental information. Parameters sourceDevID Address of the transmitter destDevID Address of the receiver fBlockID FBlockID of the receiver instID Instance ID of the receiver functionID FunctionID of the receiver opType OpType of the receiver Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPBlock 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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; } | OnMostMHPPacket | OnMostMHPError | mostMHPBlockSetTraceColors | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPConnection OnMostMHPConnection CAPL Function Overview » MOST » OnMostMHPConnection Note OnMostMHPConnection 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. Syntax long OnMostMHPConnection(long sourceDevID, long destDevID, long fBlockID, long instID, long functionID, long opType) Function The event procedure is called up as soon as a MOST High connection version 2.2 or higher is terminated. Within this event procedure the following functions are available • long MostMHPOnMostMHPConnectionIsSpy() Indicates whether the connection was made up of Spy messages. Parameters: None Returns: 0: Comprised of node messages 1: Comprised of Spy messages • long MostMHPOnMostMHPConnectionVersion() Indicates the used MOST High Protocol version. Parameters: None Returns: 0: Version 2.1 1: Version 2.2 • long MostMHPOnMostMHPConnectionNegAcks() Indicates the number of negative frame acknowledge messages. Parameter: None Returns: Number of NegAcks (see MHP specification) • long MostMHPOnMostMHPConnectionFrameRequests() Indicates the number of single or multiple frame request messages. Parameter: None Returns: Number of (multiple) frame requests • long MostMHPPOnMostMHPConnectionBlockRequests() Indicates the number of block request messages. Parameter: None Returns: Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPConnection Number of block requests • long MostMHPOnMostMHPConnectionWarnings() Indicates the number of MHP observer warnings. Warnings may indicate communication problems. Parameter: None Returns: Number of Observer warnings • long MostMHPOnMostMHPConnectionErrors() Indicates the number of MHP Observer errors. Errors indicate MOST High Protocol violations. Parameter: None Returns: Number of Observer errors • long MostMHPConnectionPackets() Indicates the number of connections transmitted during the MHP connection. Parameter: None Returns: Number of packets The functions MostEventChannel(), MostEventTime() and MostEventTimeNS() can be used to call up supplemental information. Parameters sourceDevID Address of the transmitter destDevID Address of the receiver fBlockID FBlockID of the receiver instID Instance ID of the receiver functionID FunctionID of the receiver opType OpType of the receiver 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPConnection Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 MOST • — Example — | OnMostMHPBlock | OnMostMHPError | mostMHPConnectionSetTraceColors | MOST High Observer and Combiner | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPError 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. Syntax long OnMostMHPError(long sourceDevID, long destDevID, long fBlockID, long instID, long functionID, long opType) Function The event procedure is called up as soon as a MOST High protocol violation is observed. Within this event procedure the following functions are available • long MostMHPErrorCode() Indicates the MHP observer error number. See possible MHP observer error codes. Parameter: None Returns: Observer error number • long MostMHPErrorValue() Indicates the error value. Not supported by all error codes. Parameter: None Returns: Error value or 0 • long MostMHPErrorExpectedValue() Indicates the expected value. Not supported by all error codes. Parameter: None Returns: Expected value or 0 • long MostMHPErrorIsWarning() Indicates if this is a warning. Warnings may indicate a communication problem. Parameter: None Returns: Error value or 0 The functions MostEventChannel, MostEventTime and MostEventTimeNS can be used to call up supplemental information. Parameters sourceDevID Address of the transmitter destDevID Address of the receiver Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPError fBlockID FBlockID of the receiver instID Instance ID of the receiver functionID FunctionID of the receiver opType OpType of the receiver 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPPacket 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. Syntax long OnMostMHPPacket(long sourceDevID, long destDevID, long fBlockID, long instID, long functionID, long opType) Function The event procedure is called up as soon as a MOST High packet is finished. Within this event procedure the following functions are available • long MostMHPPacketIsSpy() Indicates whether the packet was made up of Spy messages. Parameters: None Returns: 0: Comprised of node messages 1: Comprised of Spy messages • long MostMHPPacketVersion() Indicates the used MOST High Protocol version. Parameters: None Returns: 0: Version 2.1 1: Version 2.2 • long MostMHPPacketNegAcks() Indicates the number of negative frame acknowledge messages. Parameter: None Returns: Number of NegAcks (see MHP specification) • long MostMHPPacketFrameRequests() Indicates the number of single or multiple frame request messages. Parameter: None Returns: Number of (multiple) frame requests • long MostMHPPacketBlockRequests() Indicates the number of block request messages. Parameter: None Returns: Number of block requests Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPPacket • long MostMHPPacketWarnings() Indicates the number of MHP observer warnings. Warnings may indicate communication problems. Parameter: None Returns: Number of Observer warnings • long MostMHPPacketErrors() Indicates the number of MHP Observer errors. Errors indicate MOST High Protocol violations. Parameter: None Returns: Number of Observer errors The functions MostEventChannel(), MostEventTime() and MostEventTimeNS() can be used to call up supplemental information. Parameters sourceDevID Address of the transmitter destDevID Address of the receiver fBlockID FBlockID of the receiver instID Instance ID of the receiver functionID FunctionID of the receiver opType OpType of the receiver 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 Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 MOST • — Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMHPPacket | OnMostMHPBlock | OnMostMHPError | mostMHPPacketSetTraceColors | MOST High Observer and Combiner | MOST High Protocol: Simulation of Sender and Receiver | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMPR(long value) OnMostMPR(long value) CAPL Function Overview » MOST » OnMostMPR(long value) Syntax 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. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. 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 New value of the Maximum Position Register of the MOST chip. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST • • Example — | MostGetMPR | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMPRDelayed(long mpr) OnMostMPRDelayed(long mpr) CAPL Function Overview » MOST » OnMostMPRDelayed(long mpr) Syntax 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. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. 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 Value of the Maximum Position Register in the MOST chip. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example — | OnMostMPR | MostGetNceType | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMsgFragment OnMostMsgFragment CAPL Function Overview » MOST » OnMostMsgFragment Syntax MOST50 / MOST150: OnMostMsgFragment() Function The event procedure OnMostMsgFragment is called when the spy detects an incomplete transmission on the Control channel. The following functions are available for evaluating the event: • long MostEventChannel() Returns the channel of the packet event. • long MostEventTime() Returns the time stamp of the event (Units: 10 µs). • float MostEventTimeNs() Returns the time stamp of the event (Units: 1 ns). • long MostEventOrigTime() Returns the hardware generated time stamp of the event (Units: 10 µs). • long MostMsgFragmentDlc() Number of transported data bytes. • long MostMsgFragmentGetData(byte[] buffer, long cnt) 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 MostMsgFragmentSrcAdr(), long MostMsgFragmentDestAdr() Returns the source or destination address. • long MostMsgFragmentAck() Returns the acknowledge code. • long MostMsgFragmentPAck() Returns the preemptive acknowledge from the potential packet receiver(s) to the packet transmitter. • long MostMsgFragmentPriority() Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostMsgFragment Returns the message priority. • long MostMsgFragmentPIndex() Returns the packet index. The packet index increments by one per message from a node. • dword MostMsgFragmentCRC() Returns the CRC value. • long MostMsgFragmentCAck() Returns the CRC acknowledge code. • 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP2 MOST150 • • 7.2 SP3 MOST150, MOST50 • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostNetOn / OnMostInitReady 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example — | OnMostStableLock | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostNetState(long oldstate, long newstate) OnMostNetState(long oldstate, long newstate) CAPL Function Overview » MOST » OnMostNetState(long oldstate, long newstate) Syntax OnMostNetState(long oldstate, long newstate) 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. Value Symbol Meaning <0 Error code See Error codes in CAPL functions 0 MostNetState_Undefined Before the first event (shortly after measurement start) the network status is unknown. 2 MostNetState_PowerOff The network interface to the MOST ring is deactivated. The Tx FOT is not emitting any light. 3 MostNetState_NetInterfaceInit The network interface is initializing, e.g. after it has been woken by "light on". 4 MostNetState_ConfigNotOk The network interface is in normal operating mode (stable lock). On application level the MOST ring is in state ConfigNotOk. ConfigNotOk is entered on device initialization or when the NetworkMaster broadcasts Configuration.Status(NotOk). 5 MostNetState_ConfigOk The network interface is in normal operating mode (stable lock). On application level the MOST ring is in state ConfigOk. ConfigOk is entered when the NetworkMaster broadcasts Configuration.Status(Ok). Info Each device or each MOST hardware forms its own network state from the perspective of a node in the MOST ring. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. 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 Old network status. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostNetState(long oldstate, long newstate) newstate Current network status. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST • • Example — | MostGetNetState | OnMostNetOn | OnMostStableLock | OnMostCriticalUnlock | MostGetLockEx| Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostNodeAdr(long nodeadr) OnMostNodeAdr(long nodeadr) CAPL Function Overview » MOST » OnMostNodeAdr(long nodeadr) Syntax 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. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. 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 New value of the node address. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST • • Example — | MostGetNodeAdr | MostSetNodeAdr | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostNPR(long value) OnMostNPR(long value) CAPL Function Overview » MOST » OnMostNPR(long value) Syntax OnMostNPR(long npr) 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. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. 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 New value of the Node Position Register in the MOST chip. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST • • Example — | MostGetNPR | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostPkt(long pktdatalen) OnMostPkt(long pktdatalen) CAPL Function Overview » MOST » OnMostPkt(long pktdatalen) Syntax OnMostPkt(long pktdatalen) Function When a packet is received over the Asynchronous Channel the OnMostPkt() event procedure is called. The following functions are available for evaluating the event: • • • • • 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() • long MostPktArbitration() • long MostPktDlc() • Returns the direction of transmission (Rx=0, Tx=1, TxRequest=2) Returns the packet arbitration value 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) • long MostPktTelID() • Tries to copy cnt data bytes starting at byte position 'begin' to a provided buffer. Returns the actual number of copied bytes. 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() • 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) Returns 1 if the packet was received over the Spy of the asynchronous channel, otherwise 0. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostPkt(long pktdatalen) In nodal sequences (Measurement Setup) a received packet can be passed to the next node by the OutputMostPktThis command. Parameters pktdatalen Number of data bytes of the packet. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST • • 7.1 SP2 MOST, MOST150 • • 7.2 SP3 MOST, MOST150, MOST50 • • Example Access to packet data: OnMostPkt(long pktDataLen) { byte data[1524]; long i, bytesdisp; write("Packet detected on channel %d", MostPktMsgChannel()); // copy packet data to local buffer MostPktGetData(data, pktDataLen); // output first data bytes bytesdisp = pktDataLen > 10 ? 10 : pktDataLen; for(i = 0; i < bytesdisp; i++) { write("Byte %03d: %02X", i, data[i]); } // forward packet to the next node OutputMostPktThis(); } | OutputMostPkt | OutputMostPktThis | mostPktSetTraceColors | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostPktFragment OnMostPktFragment CAPL Function Overview » MOST » OnMostPktFragment Syntax MOST50 / MOST150: OnMostPktFragment() Function The event procedure OnMostPktFragment is called when the spy detects an incomplete transmission on the Packet Data channel. The following functions are available for evaluating the event: • long MostEventChannel() Returns the channel of the packet event. • long MostEventTime() Returns the time stamp of the event (Units: 10 µs). • float MostEventTimeNs() Returns the time stamp of the event (Units: 1 ns). • long MostEventOrigTime() Returns the hardware generated time stamp of the event (Units: 10 µs). • long MostPktFragmentDlc() Number of transported data bytes. • long MostPktFragmentGetData(byte[] buffer, long cnt) 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 MostPktFragmentSrcAdr(), long MostPktFragmentDestAdr() Returns the source or destination address. • long MostPktFragmentAck() Returns the acknowledge code. • 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostPktFragment node. • dword MostPktFragmentCRC() Returns the CRC value. • long MostPktFragmentCAck() Returns the CRC acknowledge code. • 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP2 2MOST150 • • 7.2 SP3 2MOST150, MOST50 • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on mostRawMessage 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 4.0 MOST • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostReg OnMostReg CAPL Function Overview » MOST » OnMostReg Syntax OnMostReg() Function OnMostReg() is called in response to read or write requests to registers of a MOST hardware interface chip. The following functions are available for evaluating the event: • • • • 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. For further information on this event see Supplemental Information on Event Procedures for MOST Controller Events. Parameters — Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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]); } } Output in the Write Window: OnMostReg() called for chip 1 on channel 1 Map Value 0080 E2 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostReg 0081 0082 ... 42 16 | MostReadReg | MostWriteReg | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostSBC(long value) OnMostSBC(long value) CAPL Function Overview » MOST » OnMostSBC(long value) Syntax 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). Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. 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 New value of Synchronous Bandwidth Register of the MOST chip. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 MOST • • Example — | MostGetSBC | MostSetSBC | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostShutdownFlag OnMostShutdownFlag CAPL Function Overview » MOST » OnMostShutdownFlag Syntax MOST150: OnMostShutdownFlag(long oldstate, long newstate) Function This event procedure is called each time the state of the Shutdown flag changes. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. Parameters oldstate Old state of the Shutdown Flag. newstate New state of the Shutdown Flag. Return values 1: Shutdown Flag set. 0: Shutdown Flag not set. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 MOST • • Example — | MostSetShutDownFlagUsage | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostStableLock 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Example — | OnMostCriticalUnlock | MostGetLockEx | on mostLightLockError | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostStress(long mode, long state) OnMostStress(long mode, long state) CAPL Function Overview » MOST » OnMostStress(long mode, long state) Syntax OnMostStress(long mode, long state) Function The event procedure OnMostStress() will be called before the beginning and after the end of the stress generation. Parameters mode 1 Stress generation with MostGenerateLightError 2 Stress generation with MostGenerateLockError 3 Stress generation with MostGenerateBusloadCtrl 4 Stress generation with MostGenerateBusloadAsync 5 Stress generation with MostSetRxBufferCtrl 6 Stress generation with MostSetTxLightPower 7 MostGenerateBypassToggle 8 MostSetSystemLockFlagUsage 9 MostSetShutDownFlagUsage 10 MostGenerateBusloadEthPkt 11 mostSetRxBufferAsync state 0 Stress mode is stopped Note: mode = 5: Rx buffer enabled mode = 6: normal light intensity 1 Stress mode is started Note: mode = 5: Rx buffer disabled mode = 6: 3db attenuation Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 MOST • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostStress(long mode, long state) Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostSyncAudio OnMostSyncAudio CAPL Function Overview » MOST » OnMostSyncAudio Syntax OnMostSyncAudio(long label, long device, long mode) 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 0: Line-In: Audio input signals are put on synchronous channels. 1: Line-Out: Synchronous channel signals are grabbed for audio output. mode 0: Routing canceled. 1: Routing executed. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 MOST • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostSyncSpdif OnMostSyncSpdif CAPL Function Overview » MOST » OnMostSyncSpdif Syntax OnMostSyncSpdif(long label, long device, long mode) 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 0: S/PDIF-In: Audio input signals are put on synchronous channels. 1: S/PDIF-Out: Synchronous channel signals are grabbed for audio output. mode 0: Routing cancelled. 1: Routing executed. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 MOST • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostSystemLock OnMostSystemLock CAPL Function Overview » MOST » OnMostSystemLock Syntax MOST150: OnMostSystemLock(long oldstate, long newstate) Function This event procedure is called each time the state of the System-Lock flag changes. Within this event procedure the functions MostEventChannel, MostEventTime and MostEventOrigTime can be used to call up supplemental information. Parameters oldstate Old state of the System Lock Flag. newstate New state of the System Lock Flag. Return values 1: System Lock Flag set. 0: System Lock Flag not set. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 SP4 MOST150 • • Example — | MostSetSystemLockFlagUsage | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostTimingMode(long mode) OnMostTimingMode(long mode) CAPL Function Overview » MOST » OnMostTimingMode(long mode) Syntax OnMostTimingMode(long mode) Function The OnMostTimingMode() event procedure is called if the timing mode of the MOST hardware has been changed. Supplemental information can be called up within this procedure by the MostEventChannel, MostEventTime and MostEventOrigTime functions. 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.1 MOST • • Example — | MostSetTimingMode | MostGetTimingMode | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: OnMostTxLight OnMostTxLight CAPL Function Overview » MOST » OnMostTxLight Note Only available with VN2600/VN2610! Syntax OnMostTxLight(long mode) 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 Light status of the FOT: 0 FOT disabled: Tx light off 1 FOT enabled: TimingMaster: Modulated light on TimingSlave/Bypass: Tx light = Rx light 2 FOT enabled: Constant light on Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 MOST • • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Selectors Selectors CAPL Function Overview » MOST » Selectors mostMessage and mostAMSmessage Selectors Keyword Description Range/Valid values Access limitations ACK Acknowledgement information 0...0xFF read only Arbitration Bus arbitration bytes 0...0xFFFFFFFF read only, Spy DA Destination address 0...0xFFFF DIR Direction of transmission Tx, Rx, TxRequest FBlockID Function block identifier 0...0xFF FunctionID Function identifier 0...0xFFF ID Message ID (CANdb lookup key) (see Database Support) 0...0xFFFFFF InstanceID Instance identifier 0...0xFF SA Source address 0...0xFFFF OpType Operation type 0...0xF PIndex PIndex is a node-based counter (1 byte) which increments per message sent. All low-level retries of a message have the same PIndex. 0..0xFF MsgChannel Transmission channel 1...16 MsgOrigTime Unsynchronized hardware time stamp (unit: 10 µs) Most_IsSpy Message was received by: 1: Spy 0: Node 0, 1 Most_RType Message types: 0...0x5 obsolete! Most_InstanceID read only, Spy read only read only When receiving always Normal, other message types are received with mostRawMessage. When applying a mostMessage variable the type can be set to Normal, RemRead, RemWrite, Alloc, Dealloc or GetSource. Most_State Status information Version: 7.6 SP4 | © Vector Informatik GmbH 0...0xFF read only User Manual Topic: Selectors Most_TelID TelID 0...0xF Time Synchronized time (unit: 10 µs) read only These selectors are only valid for mostAMSMessage Keyword Description Range/Valid values BYTE(idx) Provides access to the data bytes of the complex MOST message. 0 <= idx <= 65534 (BYTE(0) is the first parameter byte) DLC Data length code (Number of user data bytes for mostAMSMessages) Access limitations 0..0xFF 0..65535 These selectors are only valid for mostMessage Keyword Description Range/Valid values Access limitations Arbitration Bus arbitration bytes 0...0xFFFFFFFF read only, Spy BYTE(idx) Provides access to the data bytes of the MOST frame. 0 ≤ idx ≤ 11 (BYTE(0) is the first byte behind the TelLen) CAck Returns the CRC acknowledge code 0...0xFF 0...0xFF read only, Spy, MOST150 only 0x00: No Response 0x01: CRC error 0x04: OK DLC Data length code (TelLen) 0...45 Most_TelID TelID 0...0xF MsgCRC CRC code 0...0xFFFF read only, Spy Most_RType Message types: 0...0x5 MOST25 only 0...0xFF read only, Spy, MOST150 only When receiving always Normal, other message types are received with mostRawMessage. When applying a mostMessage variable the type can be set to Normal, RemRead, RemWrite,Alloc, Dealloc or GetSource. PAck Returns the preemptive acknowledge code 0x00: No Response Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Selectors 0x01: Buffer full 0x04: OK PIndex PIndex is a node-based counter (1 byte) which increments per message sent. All low-level retries of a message have the same PIndex. 0..0xFF read only, Spy, MOST150 only 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 Keyword Description Range/Valid values Access limitations ACK Acknowledgement information 0...0xFF read only, Spy Arbitration Bus arbitration bytes 0...0xFFFFFFFF read only, Spy BYTE(idx) Provides the access to the data bytes of the MOST frame. 0 ≤ idx ≤ 16 0...0xFF Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Selectors DA Destination address 0...0xFFFF DIR Direction of transmission Tx, Rx, TxRequest MsgChannel Transmission channel 1...16 MsgCRC CRC code 0...0xFFFF MsgOrigTime Unsynchronized hardware time stamp (unit: 10µs) Most_IsSpy Message was received by: 1: Spy 0: Node 0, 1 Most_RType Message type (Normal, RemRead, RemWrite, Alloc, Dealloc, GetSource) 0...5 Most_State Status information 0...0xFF SA Source address 0...0xFFFF Time Synchronized time (unit: 10µs) read only, Spy read only read only read only read only Byte contents of mostRawMessages (see data sheet of MOST transceiver OS8104): Byte RemoteRead RType=1 RemoteWrite RType=2 Alloc RType=3 Dealloc RType=4 GetSource RType=5 0 rsvd rsvd rsvd rsvd rsvd 1 MAP MAP Request CL CL 2 rsvd LENGTH rsvd rsvd rsvd 3 D0 D0 Answer1 Answer1 rsvd 4 D1 D1 Answer2 0x0 rsvd 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 11 rsvd rsvd P6 rsvd rsvd Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: Selectors 12 rsvd rsvd P7 rsvd rsvd 13 ... 16 rsvd rsvd rsvd rsvd rsvd mostLightLockError Selectors Keyword Description Range/Valid values Access limitations Most_Light Light state of controller 0, 1 read only, mostLightLockError Most_Lock Lock state of controller 0, 1 read only, mostLightLockError Most_Error 0: as long as lock exists 1: as soon as lock does not exists 0, 1 read only, mostLightLockError Time Synchronized time (unit: 10µs) read only MsgOrigTime Unsynchronized hardware time stamp (unit: 10µs) read only Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: Database Support in CAPL MOST: Database Support in CAPL CAPL Function Overview » MOST » Database Support in CAPL Symbols from MOST function catalogs can be used in CAPL. The most common applications are outlined on this page. • Initializing a MOST message variable and Sending mostAmsMessage AudioDiskPlayer.TrackPosition.Get msg; output(msg); • Declaration of event procedures (see on mostMessage or on mostAmsMessage) 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. mostAmsMessage AudioDiskPlayer.TrackPosition.Status msg; msg.Track = 5; • Populating complex message parameters with data (parameters with variable length/position, all nested parameters): mostAmsMessage AudioDiskPlayer.MediaInfo.Status msg; mostParamSetString(msg, “Data.Record[].MediaTitle", idx, “Rolling Stones”); mostParamSet(msg, “Data.Record[].LastTrack", idx, 10); 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. mostAmsMessage AudioDiskPlayer.Random.Status msg; msg.RandomState = AudioDiskPlayer.Random.Status.RandomState::Off; • Functions of test feature sets for MOST if(1 == TestWaitForMostAMSMessage("AudioDiskPlayer.TrackPosition.Status(5)", 1, 200)) TestStepPass(“1”, “TrackPosition=5 reported”); • Complete data population of messages (mostMsgSet, mostAmsOutput) mostMsgSet(msg, "AudioDiskPlayer.SourceActivity.StartResult(1,On)", 1); or mostAmsOutput(1, "AudioDiskPlayer.SourceActivity.StartResult(1,On)", 1); | General Tips on XML Function Catalog Support in CAPL | Input Assistant | MOST: Symbolic Identification of Messages | MOST: Symbolic Identification of Parameters | Selectors | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: Error Codes of CAPL Functions MOST: Error Codes of CAPL Functions CAPL Function Overview » MOST » Error Codes of CAPL Functions kMostOK = 0 No Error occurred. kMostInvalidChannel = -1 The operation was requested for an invalid channel number. kMostNoConnection = -2 The driver was unable to establish a connection to the MOST interface hardware. Check the connection settings in the Harware Configuration dialog under the menu item Configuration|Hardware Configuration. 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. kMostHWBusy = -7 Unable to perform the desired action due to hardware overload. kMostWrongHWType = -8 This functionality is not supported by the hardware used. 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. kMostAsInvalidChannel = -21 The function was called for an invalid channel. 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. kMostAsParamNotAvailable = -24 The requested parameter value is unavailable. kMostAsNotAvailable = -25 The function is unavailable or the MOST Application Socket is inactive. kMostAsBeforeNetOn = -26 This function can not be called before NetOn. kMostAsInvalidParameter = -29 At least one parameter passed with the function lies outside of its Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: Error Codes of CAPL Functions valid value range. kMostXML4CAPLGeneralExecError = 30 General execution error. kMostXML4CAPLUnknownMsg = -31 The specified message cannot be dissolved with the available function catalogs. kMostXML4CAPLMsgSizeExceeded = 32 The function cannot be executed, since the size of the specified message is exceeded. kMostXML4CAPLUnknownParamAdr = -33 The specified parameter address cannot be dissolved with the available function catalogs. kMostXML4CAPLParamNotFoundInMsg = -34 A parameter with the indicated address cannot be found in the message. kMostXML4CAPLParamTypeMismatch = -35 The function has attempted to read a value that does not have the compatible data type. kMostXML4CAPLEncodingMismatch = -36 The function cannot read the string or raw data, since the coding does not match. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: General Tips on XML Function Catalog Support in CAPL MOST: General Tips on XML Function Catalog Support in CAPL CAPL Function Overview » MOST » General Tips on XML Function Catalog Support in CAPL 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; • The symbols are checked and resolved during compilation. • Compile time access is very efficient. Runtime Examples mostAmsOutput(1, "AudioDiskPlayer.SourceActivity.StartResult(1,On)", 1); testWaitForMostAMSMessage("AudioDiskPlayer.TrackPosition.Status(5)", 1, 200); mostParamSet(msg, "Data.Record[].LastTrack", idx, 10); • 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: High Observer and Combiner MOST: High Observer and Combiner CAPL Function Overview » MOST » High Observer and Combiner 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: High Observer Error Codes MOST: High Observer Error Codes CAPL Function Overview » MOST » High Observer Error Codes Errors Error code Meaning Erroneous value Expected value 0 Data Frame has unexpected FrameID. yes yes 1 0-Frame has an unexpected Block Nr. yes yes 2 Data Frames without prior 0-Frame. no no 3 FrameID of Ack/Nack Frame does not match FrameID of the last Data Frame. yes yes 4 Block Nr of Ack/Nack Frame does not match Nr of the block. yes yes 5 Frame Acknowledge in Block Acknowledge Mode. no no 6 (Multiple) Frame or Block Request not allowed. no no 7 MHP message without existing connection. no no 8 Observer Timeout, observing of connection stopped. no no 9 Invalid MHP message. no no 10 Too many REQUEST CONNECTION retries (R_Request). yes yes 11 Timeout violation between REQUEST CONNECTION attempts (T_Send). yes (ms) yes (ms) 12 Too many START CONNECTION retries (R_Start). yes yes 13 Timeout violation between START CONNECTION attempts (T_Ready). yes (ms) yes (ms) 14 Illegal value of Options field in 0-Frame. yes no 15 Timeout of 0-Frame retry (T_Frame). yes (ms) yes (ms) 16 Timeout violation sending NegAck on missing 0-Frame (T_Frame). yes (ms) yes (ms) 17 Too many NegAck retries on missing 0-Frame (R_NegAck). yes yes 18 Too many retransmission attempts (R_Trans). yes yes 19 Timeout violation between retransmission attempts (T_Retrans). yes (ms) yes (ms) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: High Observer Error Codes 20 Timeout transmitting one block (T_Trans). yes (ms) yes (ms) 21 Timeout violation between Data Frames (T_AIR_Delay). yes (ms) yes (ms) 22 Too many END CONNECTION TX retries (R_End). yes yes 23 Timeout violation between END CONNECTION attempts (T_End). yes (ms) yes (ms) 24 Timeout violation closing the connection (T_Delay_End). yes (ms) yes (ms) 25 Timeout violation between HOLD CONNECTION messages (T_Hold_Resend). yes (ms) yes (ms) 26 Timeout after last HOLD CONNECTION message (T_Hold). yes (ms) yes (ms) 27 Timeout of HOLD CONNECTION cycle (T_Hold_Max_Buf). yes (ms) yes (ms) 28 Timeout violation sending NegAck (T_Receive). yes (ms) yes (ms) 29 Timeout violation between Data Frame and NegAck (T_dwn_NegAck). yes (ms) yes (ms) 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 (increase) messages (T_TxSpeedRecovery). yes (ms) yes (ms) 33 ADJUST TRANSMISSION RATE is only allowed for block acknowledge mode using the asynchronous channel. no no 34 Total number of frames changed. yes yes 35 MHP message not expected. no no 40 Usage of control channel not allowed with MHP 2.3 or newer no no 41 Field MaxBlkSize not allowed in MHP version < 2.3 no no yes yes (Scale << 16 + NDF_ACK) 42 Illegal value of MaxBlkSize: Value must be between Scale * NDF_ACK and (Scale+1) * NDF_ACK 43 Frame Interleave not allowed for connections with different priorities no no 44 Frame Interleave not allowed for multiple connections to one device no no 45 Field HoldFlag not allowed in MHP version < 2.3 or Negative Acknowledge Frames no no Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: High Observer Error Codes Warnings Error code Meaning Erroneous value Expected value 36 Negative Acknowledge Frame observed. yes (block no.) no 37 (Multiple) Frame Request observed. no no 38 Block Request observed. no no 39 Receiver refused connection by sending PrioAck with higher value than Prio. yes yes | OnMostMHPError | MOST High Observer and Combiner | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: Initialization of Message Variables MOST: Initialization of Message Variables CAPL Function Overview » MOST » Initialization of message variables There are the following types of message variable for MOST: Message variable Description mostMessage Variables describe MOST frames which are compliant with the function catalog. Example With XML function catalog support: mostMessage NetBlock.FBlockIDs.Get msg; With CANdb database support : mostMessage NetBlock_FBlockIDs_Get msg; mostMessage * msg; // Initialization with wildcard -> The parameters FBlockID..OpType have to be set explicitly (msg.FBlockID, msg.InstanceID, msg.FunctionID, msg.OpType) mostMessage 0x010001 msg; // Initialization with FBlockID..OpType (see also Message-ID) 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 With XML function catalog support: mostAMSMessage NetBlock.FBlockIDs.Get msg; With CANdb database support : mostAMSMessage NetBlock_FBlockIDs_Get msg; mostAMSMessage * msg; // Initialization with wildcard -> The parameters FBlockID..OpType have to be set explicitly (msg.FBlockID, msg.InstanceID, msg.FunctionID, msg.OpType) mostAMSMessage 0x010001 msg; // Initialization with FBlockID..OpType (see also Message-ID) 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: Initialization of Message Variables 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: Input Assistance MOST: Input Assistance CAPL Function Overview » MOST » Input Assistance 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. It is also possible to enter the parameters of a MOST message. If you enter a left parenthesis, you can - depending on parameter type - manually enter values or select valid parameter values via a selection list. Note, that parameters cannot be set in message and event procedure declarations. 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. Function description Key combination Marks an entry of the selection list < Handing over the marked entry. <Tab>, <Return> Handing over FBlockID and FunctionID. <.> Handing over OpType, start of parameter entry. <(> Handing over the current parameter value. <,> Version: 7.6 SP4 | © Vector Informatik GmbH ↑>, <↓>, <Page ↑>, < Page User Manual Topic: MOST: Input Assistance Function description Key combination Finishing parameter entry, handing over the entry and closing the dialog. <)> Closing the selection list. <Esc> Closing the dialog without handing over the entry (with closed selection list) <Esc> Closing the dialog and handing over the entry (with closed selection list). <Return> Switching between input format with or without Instance ID. <F2> 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. | General Tips on XML Function Catalog Support in CAPL | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: Symbolic Identification of Messages MOST: Symbolic Identification of Messages CAPL Function Overview » MOST » Symbolic Identification of Messages 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. | MostAMSOutput | MostMsgSet | Symbolic Identification of Parameters | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: Symbolic Identification of Parameters MOST: Symbolic Identification of Parameters CAPL Function Overview » MOST » Symbolic Identification of Parameters 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. Parameter type: Number Property: DeckStatus (0x200) Parameter name: DeckStatus Parameter type: Record Property: TimePosition (0x201) Parameter name: Data.TrackTime 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. Parameter type: Array of Record Property: MediaInfo (0x413) Parameter name: Data.Record[2].MediaType 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 Parameter type: Array Property: MediaInfo (0x413) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: Symbolic Identification of Parameters Parameter name: Data 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 "Data" parameter now contains 3 elements (here: 3 records). Parameter type: Sequence Property: FBlockIDs (0x000) from function block NetBlock Parameter name: FBlockIDList 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}). The parameters can be set as follows: MostParamSet(msg, MostParamSet(msg, MostParamSet(msg, MostParamSet(msg, "FBlockIDList.FBlockID[]", 1, 0x02); "FBlockIDList.InstID[]", 1, 0x00); "FBlockIDList.FBlockID[]", 2, 0x04); "FBlockIDList.InstID[]", 2, 0x01); 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MOST: Symbolic Identification of Parameters 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 | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FlexRay CAPL Functions (Only available with Option .FlexRay!) FlexRay CAPL Functions (Only available with Option .FlexRay!) CAPL Function Overview » FlexRay CAPL Functions In Option .FlexRay several APIs are provided for receiving and transmitting FlexRay frames: Objects Short description FRFrame Creates a FlexRay frame object. FRConfiguration Create a FlexRay parameter object. FrPDU Creates a FlexRay PDU object. Functions Short description FRGetConfiguration Copies the FlexRay protocol parameters to a FlexRay parameter object. FRGetFrameCRC Returns the CRC of a received FlexRay frame. FROutputDynFrame Updates the FlexRay Communication Controller’s (CC) send buffer with the current data from the send object. FRSendFrame Generates a FlexRay message and sends it to the hardware. FRSendSymbol Sends an MTS symbol in the next possible symbol window if the Communication Controller is in normal mode (synchronized). FRSetAutoIncrement Part of the payload of a frame will be incremented automatically on each transmission. FRSetConfiguration Writes the FlexRay protocol parameters from the FlexRay parameter object to the FlexRay interface’s Communication Controller. FRSetKeySlot This function configures one of two possible key slots that are to be sent for a FlexRay bus. FRSetMode Initializes the FlexRay bus transceivers. FRSetPayloadLengthInByte Sets the payload (data) length of the object in bytes. FRSetPOCState Puts the FlexRay Communication Controller into the desired Protocol Operation Mode. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FlexRay CAPL Functions (Only available with Option .FlexRay!) FRSetSendFrame Configures the hardware for sending the specified message. FRSetSendGroup All frames in the group are sent in the current cycle, or all frames are not sent until the next possible cycle. FRSetSendPDU Configures the hardware to transmit the specified PDU. FRSetTrigger Activates the Trigger Output of the selected VN interface. FRUpdatePDU Updates the PDU payload in the assigned FlexRay frames. FRUpdateStatFrame Updates the FlexRay Communication Controller’s (CC) send buffer with the current data from the send object. MessageTimeNS Returns the receive time of the frame or slot in nanoseconds. output Outputs the object from the program block of the analysis branch. ResetFlexRayCC Initializes the FlexRay Communication Controller (CC) and begins a new startup phase for the cluster or a new integrations phase in the cluster. ResetFlexRayCCEx Initializes the FlexRay Communication Controller (CC) and generates the specified wakeup pattern before reintegration in the cluster or the startup. Event procedures Short description on FRError Is called in the event of a general error being detected on the FlexRay bus. on FRFrame Is called up after a frame has been received in the specified slot and cycle. It is recommended to use on FRFrame only for the reception of valid data frames. To receive Null frames and erroneous frames, please use the on FRNullFrame or on FRFrameError event procedures, since these events will not be received anymore with on FRFrame from version 6.1. on FRFrameError Is called if a erroneous frame is received in the specified slot and cycle. on FRNullFrame Is called if a Null frame is received in the specified slot and cycle. on FrPDU Is called when a PDU with the Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FlexRay CAPL Functions (Only available with Option .FlexRay!) corresponding name is received. on FRPOCState Is called whenever there is a change of state on the FlexRay Communication Controller's protocol operation state machine. on FRSlot Is called up in each cycle after the Slot is past. on FRStartCycle Can be generated by FlexRay at the beginning of each communication cycle and contains the NM vector valid for this cycle. on FRSymbol Is called whenever a symbol (wakeup, CAS, MTS) is received. Callbacks Short description FlexRayRcvStatusEvent The callback occurs when the FlexRay Communication Controller (CC) has synchronized with the bus or the synchronization fails. Test Feature Set for FlexRay Short description Waiting for valid FlexRay frames TestWaitForFrFrame Waits for the occurrence of the valid specified FlexRay frame. TestGetWaitFrFrameData If a valid FlexRay frame is the last event that triggers a wait instruction, the frame’s content can be called up. TestJoinFrFrameEvent Completes the current set of "joined events" with the FlexRay frame. Waiting for FlexRay Null frame TestWaitForFrNullFrame Waits for the occurrence of the specified FlexRay Null frame. TestGetWaitFrNullFrameData If a FlexRay Null-Frame is the last event that triggers a wait instruction, the frame’s content can be called up. TestJoinFrNullFrameEvent Completes the current set of "joined events" with the FlexRay null frame. Waiting for FlexRay start cycle event TestWaitForFrStartCycle Waits for the occurrence of the specified FlexRay start cycle event. TestGetWaitFrStartCycleData If a FlexRay start cycle is the last event that triggers a wait instruction, the Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FlexRay CAPL Functions (Only available with Option .FlexRay!) event’s content can be called up. TestJoinFrStartCycleEvent Completes the current set of "joined events" with the FlexRay start cycle event. Waiting for FlexRay PDU TestWaitForFrPDU Waits for the occurrence of the specified FlexRay PDU event. TestGetWaitFrPDUData If a valid FlexRay PDU is the last event that triggers a wait instruction, the PDU’s content can be called up. TestJoinFrPDUEvent Completes the current set of "joined events" with the FlexRay PDU. Waiting for FlexRay POC state event TestWaitForFrPOCState Waits for the occurrence of change of state on the FlexRay Communication Controller's protocol operation state machine. TestGetWaitFrPOCStateData If an event indicating a change of state on the FlexRay Communication Controller's protocol operation state machine is the last event that triggers a wait instruction, the event’s content can be called up. TestJoinFrPOCState Completes the current set of "joined events" with the change of state event on the FlexRay Communication Controller's protocol operation state machine. Waiting for FlexRay erroneous frame TestWaitForFrFrameError Waits for the occurrence of FlexRay erroneous frame event (frame error). TestGetWaitFrFrameErrorData If a FlexRay erroneous frame is the last event that triggers a wait instruction, the event’s content can be called up. TestJoinFrFrameErrorEvent Completes the current set of "joined events" with the FlexRay erroneous frame event. Waiting for FlexRay symbol event TestWaitForFrSymbol Waits for the occurrence of a FlexRay symbol on the bus. TestGetWaitFrSymbolData If a FlexRay symbol event is the last event that triggers a wait instruction, the event’s content can be called up. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FlexRay CAPL Functions (Only available with Option .FlexRay!) TestJoinFrSymbolEvent Completes the current set of "joined events" with the FlexRay symbol event. Test Service Library for FlexRay Short description DLC monitoring TestCheck::CreateInconsistentDLC, TestCheck::StartInconsistentDLC The check condition is violated if the payload length of the message does not agree with the specified payload length of the database (useful for dynamic frames). Cycle time TestCheck::CreateMsgAbsCycleTimeViolation, TestCheck::StartMsgAbsCycleTimeViolation Checks the occurrences of cyclic messages. TestCheck::CreateMsgRelCycleTimeViolation, TestCheck::StartMsgRelCycleTimeViolation Checks the occurrences of cyclic messages. Occurrence of a message TestCheck::CreateMsgRelOccurrenceViolation, TestCheck::StartMsgRelOccurrenceViolation Checks are used to monitor the sending delay of messages which allow both cyclic and spontaneous transmission. TestCheck::CreateNodeMsgsRelOccurrenceViolation, TestCheck::StartNodeMsgsRelOccurrenceViolation Message distance TestCheck::CreateMsgDistViolation, TestCheck::StartMsgDistViolation This check is useful for spontaneous messages where one message is a result of another message; e.g. the check is used to check the processing time of the reference message. Absence of defined messages TestCheck::CreateMsgOccurrenceCount, TestCheck::StartMsgOccurrenceCount Checks the absence of the specified message on the bus. Absence of a FlexRay Erroneous Frame TestCheck::CreateFlexRayFrameErrorOccurrenceCount, TestCheck::StartFlexRayFrameErrorOccurrenceCount, TestCheck::CreateNodeFlexRayFrameErrorsOccurrenceCount, TestCheck::StartNodeFlexRayFrameErrorsOccurrenceCount Checks the absence of erroneous frames for the specified frame/slot on the bus. Absence of a FlexRay Null Frame TestCheck::CreateFlexRayNullFrameOccurrenceCount, TestCheck::StartFlexRayNullFrameOccurrenceCount, TestCheck::CreateNodeFlexRayNullFramesOccurrenceCount, TestCheck::StartNodeFlexRayNullFramesOccurrenceCount Checks the absence of Null frames for the specified frame/slot on the bus. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FlexRay CAPL Functions (Only available with Option .FlexRay!) Message Count Observation TestCheck::CreateMsgSendCountViolation, TestCheck::StartMsgSendCountViolation, TestCheck::CreateNodeMsgSendCountViolation, TestCheck::StartNodeMsgSendCountViolation Check is used to monitor the minimum and/or maximum number for each of the defined messages within a specified cyclic time interval. Node active TestCheck::CreateAllNodesDead, TestCheck::StartAllNodesDead This check reports a problem, if the node has not send any of its Tx messages within a given time-interval. TestCheck::CreateNodeDead, TestCheck::StartNodeDead Node inactive TestCheck::CreateAllNodesBabbling, TestCheck::StartAllNodesBabbling This check allows the observation of the end of the activity of nodes. TestCheck::CreateNodeBabbling, TestCheck::StartNodeBabbling Signal value TestCheck::CreateMsgSignalValueInvalid, TestCheck::StartMsgSignalValueInvalid This check is useful to supervise the value of signals. TestCheck::CreateMsgSignalValueRangeViolation, TestCheck::StartMsgSignalValueRangeViolation Signal value constancy TestCheck::CreateSignalValueChange, TestCheck::StartSignalValueChange The check is useful to observe the constancy of a signal value. Timeout TestCheck::CreateTimeout, TestCheck::StartTimeout This check creates an error event if particular time is expired. Unknown message received TestCheck::CreateUndefinedMessageReceived, TestCheck::StartUndefinedMessageReceived This check listens to the bus and reports a violation, if a message was received that is not defined in any of the databases that are associated to the current bus. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRConfiguration FRConfiguration CAPL Function Overview » FlexRay » FRConfiguration Syntax FRConfiguration <configuration var>; 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. Initially, all protocol parameters are set to a value of 0. The FRGetConfiguration or FRSetConfiguration functions are used to read or set parameters from or in the FlexRay interface’s Communication Controller. Parameters <configuration var> Character string defining the object’s variable name. Selectors FRBaudrate Baud rate in kBit/s. gdMacrotick FlexRay protocol parameter. See FlexRay specification. Data type: double gMacroPerCycle FlexRay protocol parameter. See FlexRay specification. gdNIT FlexRay protocol parameter. See FlexRay specification. gdSampleClockPeriod FlexRay protocol parameter. See FlexRay specification. Data type: double gdTSSTransmitter FlexRay protocol parameter. See FlexRay specification. gPayloadLengthStatic FlexRay protocol parameter. See FlexRay specification. gdActionPointOffset FlexRay protocol parameter. See FlexRay specification. gdStaticSlot FlexRay protocol parameter. See FlexRay specification. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRConfiguration gNumberOfStaticSlots FlexRay protocol parameter. See FlexRay specification. gdMinislotActionPointOffset FlexRay protocol parameter. See FlexRay specification. gdMinislot FlexRay protocol parameter. See FlexRay specification. gNumberOfMinislots FlexRay protocol parameter. See FlexRay specification. gClusterDriftDamping FlexRay protocol parameter. See FlexRay specification. gListenNoise FlexRay protocol parameter. See FlexRay specification. gColdstartAttempts FlexRay protocol parameter. See FlexRay specification. gSyncNodeMay FlexRay protocol parameter. See FlexRay specification. gOffsetCorrectionStart FlexRay protocol parameter. See FlexRay specification. gdDynamicSlotIdlePhase FlexRay protocol parameter. See FlexRay specification. gdSymbolWindow FlexRay protocol parameter. See FlexRay specification. gdCASRxLowMax FlexRay protocol parameter. See FlexRay specification. gdCASRxLowMax FlexRay protocol parameter. See FlexRay specification. gdWakeupSymbolRxIdle FlexRay protocol parameter. See FlexRay specification. gdWakeupSymbolRxLow FlexRay protocol parameter. See FlexRay specification. gdWakeupSymbolRxWindow Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRConfiguration FlexRay protocol parameter. See FlexRay specification. gdWakeupSymbolTxIdle FlexRay protocol parameter. See FlexRay specification. gdWakeupSymbolTxLow FlexRay protocol parameter. See FlexRay specification. gMaxWithoutClockCorrectionFatal FlexRay protocol parameter. See FlexRay specification. gMaxWithoutClockCorrectionPassive FlexRay protocol parameter. See FlexRay specification. gNetworkManagementVectorLength FlexRay protocol parameter. See FlexRay specification. pChannels FlexRay protocol parameter. See FlexRay specification. pMicroPerCycle FlexRay protocol parameter. See FlexRay specification. pSamplesPerMicrotick FlexRay protocol parameter. See FlexRay specification. pPayloadLengthDynMax FlexRay protocol parameter. See FlexRay specification. pPayloadLengthFIFO Size of the maximum data length that can be received via the FIFO buffer in 16-bit words. pLatestTx FlexRay protocol parameter. See FlexRay specification. pdMaxDrift FlexRay protocol parameter. See FlexRay specification. pdAcceptedStartupRange FlexRay protocol parameter. See FlexRay specification. pClusterDriftDamping FlexRay protocol parameter. See FlexRay specification. pDecodingCorrection FlexRay protocol parameter. See FlexRay specification. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRConfiguration pDelayCompensation_A FlexRay protocol parameter. See FlexRay specification. pDelayCompensation_B FlexRay protocol parameter. See FlexRay specification. pOffsetCorrectionOut FlexRay protocol parameter. See FlexRay specification. pRateCorrectionOut FlexRay protocol parameter. See FlexRay specification. pExternOffsetCorrection FlexRay protocol parameter. See FlexRay specification. pExternRateCorrection FlexRay protocol parameter. See FlexRay specification. 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRConfiguration 13 • Disable 14 • — 15 • • Possible values are: 0, 5, 10, 11, 14 and 15. pMacroInitialOffset_A FlexRay protocol parameter. See FlexRay specification. pMacroInitialOffset_B FlexRay protocol parameter. See FlexRay specification. pMicroInitialOffset_A FlexRay protocol parameter. See FlexRay specification. pMicroInitialOffset_B FlexRay protocol parameter. See FlexRay specification. pWakeupChannel FlexRay protocol parameter. See FlexRay specification. pWakeupPattern FlexRay protocol parameter. See FlexRay specification. pAllowHaltDueToClock FlexRay protocol parameter. See FlexRay specification. pAllowPassiveToActive FlexRay protocol parameter. See FlexRay specification. pBGTick FlexRay protocol parameter. See FlexRay specification. pPhysicalLayer Defines the physical layer to be used: Value Meaning 0 RS485_0 1 RS485_1 2 FlexRay Electrical Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRConfiguration pSingleSlotEnabled FlexRay protocol parameter. See FlexRay specification. pBGEnable FlexRay protocol parameter. See FlexRay specification. pDynamicSegmentEnable FlexRay protocol parameter. See FlexRay specification. pChannelsMTS FlexRay protocol parameter. See FlexRay specification. pCCVersion Indicates the selected FlexRay interface type: Value Meaning 2 BusDoctor 3 FlexCard Cyclone 4 FlexCard Cyclone II 5 VN Write protected! pStrobePointPosition E-Ray parameter. See E-Ray specification. pdMicrotick FlexRay protocol parameter. See FlexRay specification. Data type: double In function FRSetConfiguration this parameter is ignored! Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 FlexRay • • Example For an example see functions FRGetConfiguration and FRSetConfiguration. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRFrame FRFrame CAPL Function Overview » FlexRay » FRFrame Syntax FRFrame <frame name> <frame var>; Uses a symbolic frame name from the database. FRFrame MsgChannel<num>.<frame name> <frame var>; Uses a symbolic frame name from the database and specifies the send channel/cluster. FRFrame (<slot ID>, <base cycle>, <cycle repetition>) <frame var>; Can be used to define the transmission time without database. FRFrame MsgChannel<num>.(<slot ID>, <base cycle>, <cycle repetition>) <frame var>; 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> Defines the send channel/cluster. <num> must be an integer (e.g. 1, 2, 3, etc.) defining the channel number of the corresponding FlexRay interface. <frame name> Character string corresponding to a frame name from the database. The required parameters (<slot ID>, <base cycle>, <cycle repetition> and <channel mask>) are taken from the corresponding frame definition in the database. <frame var> Character string defining the object’s variable name. <slot ID> This number designates a specific slot. Its value must be between 1 and 2047. <base cycle> 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". <cycle repetition> Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRFrame 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". Selectors General use 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 The frame has to be transmitted in this slot. FR_CycleOffset FlexRay cycle number of the base cycle. This value must be less than FR_CycleRepetition. FR_CycleRepetition Repetition factor for transmission times in multiples of a FlexRay cycle. This value must come from the value set {1, 2, 4, 8, 16, 32, 64}. FR_PayloadLength Length of the payload to be sent in 16 Bit words (data type: word). byte(index), word(index), dword(index), qword(index), char(index), int(index), long(index), int64(index), <signal name> Direct access to the payload/data of the frame. The number of valid data bytes is specified by the selector 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: Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRFrame Bit mask Meaning 0x01 Sets the sync bit in the header. Only a frame in the static segment may have set this bit. Caution Bit is only evaluated in function FRSetSendFrame. This flag is deprecated (for CANoe ≥ 7.2)! Use instead function FRSetKeySlot. 0x02 Sets the startup bit in the header. If this bit is set, then the sync bit must also be set. Caution Bit is only evaluated in function FRSetSendFrame. This flag is deprecated (for CANoe ≥ 7.2)! Use instead function FRSetKeySlot. 0x10 Sets the send mode to event-triggered. If not set, the frame will be transmitted in time-triggered mode. 0x20 Sets the payload preamble bit. 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 The frame is no longer sent, the corresponding slots remain empty. The flag can only be used with VN interfaces. 0x200 Disable use of In-Cycle-Repetition 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. CANoe Version ≥ 7.1 SP3 0x400 Sets the null frame indicator in the header. The flag can only be used with VN interfaces. All other bits of the flags are reserved. Caution If the FRFrame object is used as a parameter for the function FRSetSendFrame, then consider the flags that are defined to be used for this function! Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRFrame FR_Payload This selector allows the access of the payload array (for using as a byte array parameter in functions). Available from CANoe 7.2. Selectors Test environment 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). Timer unit: 10 microseconds, data type: dword 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. Timer unit: nanoseconds, data type: int64 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 The frame was received in this FlexRay slot. FR_Cycle The frame was received in this FlexRay slot. FR_PayloadLength Length of the payload that was received in 16 Bit words (data type: word). byte(index), word(index), dword(index), qword(index), char(index), int(index), long(index), int64(index), <signal name> Direct access to the payload/data of the frame. The number of valid data bytes is specified by the selector FR_PayloadLength. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRFrame 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: Bit mask Meaning 0x01 The sync bit is set in the header. 0x02 The startup bit is set in the header. 0x20 The payload preamble bit is set in the header. 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). Available from CANoe 7.2. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 FlexRay • • 7.5: enhanced for usage in arrays and as function parameter FlexRay • • Example 1 For an example see function FRUpdateStatFrame. Example 2 This is an example for forwarding the payload to other functions. variables { const dword cFrTTFlag = 0x00; const dword cFrETFlag = 0x10; const dword cFrPPFlag = 0x20; Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRFrame } const dword cFrStopFlag = 0x80; // only for VN const dword cFrNullFlag = 0x400; // only for VN void foo (byte[] data, int bytecount) { // evaluate or set the contents of the data array } 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 This is an example for using the frame object as a function parameter. variables { const dword const dword const dword const dword const dword cFrTTFlag = cFrETFlag = cFrPPFlag = cFrStopFlag cFrNullFlag 0x00; 0x10; 0x20; = 0x80; // only for VN = 0x400; // only for VN FrFrame (1,0,1) myFrame = { FR_Flags = cFrTTFlag | cFrPPFlag, FR_ChannelMask = 1, FR_PayloadLength = 2 }; } void foo (FrFrame * frame) { // evaluate or set the contents of the frame object } void example () { foo (myFrame); } Example 4 This is an example for using the Frame object in arrays. Caution All objects of an array must be initialized with an appropriate frame definition! variables { FrFrame (1,0,1) frm1; // All objects are equal: FrFrame (2,0,1) frArray1[10]; } // All objects may be different: FrFrame * frArray2[3] = { (3,0,1), <FrameNameFromDB>, frm1 }; Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrPDU FrPDU CAPL Function Overview » FlexRay » FrPDU Syntax FrPDU <FIBEX PDU name> <PDU var>; Uses a symbolic PDU name from the database to create a transmission object. FrPDU MsgChannel<num>.< FIBEX PDU name> <PDU var>; Uses a symbolic PDU name from the database to create a transmission object and additionally specifies the transmission channnel/cluster. FrPDU <PDU var>; 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. Parameters <FIBEX PDU name> String that corresponds to a PDU name in the database. The parameters needed to uniquely identify the PDU are taken from the corresponding PDU definition in the database. <PDU var> String that specifies the variable name of the object. MsgChannel<num> Specifies the transmission channel/cluster <num> must be a whole number (e.g. 1, 2, 3, ...) that specifies the channel number of the corresponding FlexRay interface. Selectors General use The symbolically defined transmission object contains the following selectors: 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). Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrPDU 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 Length of the PDU's payload to be sent in bytes (data type: word). Write protected! byte(index), word(index), dword(index), qword(index), char(index), int(index), long(index), int64(index), <signal name> Direct access to the payload/data of the PDU. The number of valid data bytes is specified by the selector FR_PDULength. 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. 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). Available from CANoe 7.2. Write protected! Selectors Test environment 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). Timer unit: 10 microseconds, data type: dword 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). Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrPDU 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. Timer unit: nanoseconds, data type: int64 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 The PDU was received in this FlexRay slot. Write protected! FR_Cycle The PDU was received in this FlexRay cycle. Write protected! FR_PayloadLength Length of the payload that is received for the PDU in bytes (data type: word). Write protected! byte(index), word(index), dword(index), qword(index), char(index), int(index), long(index), int64(index) Direct access to the payload/data of the PDU. The number of valid data bytes is specified by the selector 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. Write protected! FR_Payload This selector allows the access of the payload array (for using as a byte array parameter in functions). Available from CANoe 7.2. Write protected! Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 FlexRay • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrPDU 7.5: enhanced for usage in arrays and as function parameter FlexRay • • Example 1 For an example see function FrUpdatePDU. Example 2 This is an example for forwarding the payload to other functions. void foo (byte[] data, int count) { // evaluate the contents of the data array } void example () { FrPDU EngineData myPDU; foo (myPDU.FR_Payload, myPDU.FR_PDULength); } Example 3 This is an example for using the PDU object as a function parameter. variables { FrPDU EngineData myPDU; } void foo (FrPDU * pdu) { // evaluate or set the contents of the PDU object } void example () { foo (myPDU); } Example 4 This is an example for using the PDU object in arrays. Caution All objects of an array must be initialized with an appropriate PDU definition! variables { FrPDU EngineData pdu1; // All objects are equal: FrPDU EngineData frPDUArray1[10]; } // All objects may be different: FrPDU * frPDUArray2[2] = { EngineStatus, pdu1 }; Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRGetConfiguration FRGetConfiguration CAPL Function Overview » FlexRay » FRGetConfiguration Syntax FRGetConfiguration( int channel, FRConfiguration<configuration var> ); Function This function copies the FlexRay protocol parameters to <configuration var>. Parameters channel FlexRay channel (cluster number). <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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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"); Write("%33s = %6d %s", "gNumberOfStaticSlots", gFRParams.gNumberOfStaticSlots, "#"); Write("%33s = %6d %s", "gdMinislotActionPointOffset", gFRParams.gdMinislotActionPointOffset, "MT"); Write("%33s = %6d %s", "gdMinislot", gFRParams.gdMinislot, "MT"); Write("%33s = %6d %s", "gNumberOfMinislots", gFRParams.gNumberOfMinislots, "#"); Write("%33s = %6d %s", "gClusterDriftDamping", gFRParams.gClusterDriftDamping, ""); Write("%33s = %6d %s", "gListenNoise", gFRParams.gListenNoise, ""); Write("%33s = %6d %s", "gColdStartAttempts", gFRParams.gColdStartAttempts, "#"); Write("%33s = %6d %s", "gSyncNodeMax", gFRParams.gSyncNodeMax, "#"); Write("%33s = %6d %s", "gOffsetCorrectionStart", gFRParams.gOffsetCorrectionStart, "MT"); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRGetConfiguration Write("%33s = %6d %s", "gdDynamicSlotIdlePhase", gFRParams.gdDynamicSlotIdlePhase, "MS"); Write("%33s = %6d %s", "gdSymbolWindow", gFRParams.gdSymbolWindow, "MT"); Write("%33s = %6d %s", "gdCASRxLowMax", gFRParams.gdCASRxLowMax, "Bit"); Write("%33s = %6d %s", "gdCASRxLowMin", gFRParams.gdCASRxLowMin, "Bit"); Write("%33s = %6d %s", "gdWakeupSymbolRxIdle", gFRParams.gdWakeupSymbolRxIdle, "Bit"); Write("%33s = %6d %s", "gdWakeupSymbolRxLow", gFRParams.gdWakeupSymbolRxLow, "Bit"); Write("%33s = %6d %s", "gdWakeupSymbolRxWindow", gFRParams.gdWakeupSymbolRxWindow, "Bit"); Write("%33s = %6d %s", "gdWakeupSymbolTxIdle", gFRParams.gdWakeupSymbolTxIdle, "Bit"); Write("%33s = %6d %s", "gdWakeupSymbolTxLow", gFRParams.gdWakeupSymbolTxLow, "Bit"); Write("%33s = %6d %s", "gMaxWithoutClockCorrectionFatal", gFRParams.gMaxWithoutClockCorrectionFatal, "double cycles"); Write("%33s = %6d %s", "gMaxWithoutClockCorrectionPassive", gFRParams.gMaxWithoutClockCorrectionPassive, "double cycles"); Write("%33s = %6d %s", "gNetworkManagementVectorLength", gFRParams.gNetworkManagementVectorLength, "Bytes"); Write("%33s = %6d %s", "pChannels", gFRParams.pChannels, ""); Write("%33s = %6d %s", "pMicroPerCycle", gFRParams.pMicroPerCycle, "uT"); Write("%33s = %6d %s", "pSamplesPerMicrotick", gFRParams.pSamplesPerMicrotick, "#"); Write("%33s = %6d %s", "pPayloadLengthDynMax", gFRParams.pPayloadLengthDynMax, "Words"); Write("%33s = %6d %s", "pPayloadLengthFIFO", gFRParams.pPayloadLengthFIFO, "Words"); Write("%33s = %6d %s", "pLatestTx", gFRParams.pLatestTx, "MS"); Write("%33s = %6d %s", "pdMaxDrift", gFRParams.pdMaxDrift, "uT"); Write("%33s = %6d %s", "pdAcceptedStartupRange", gFRParams.pdAcceptedStartupRange, "uT"); Write("%33s = %6d %s", "pdListenTimeout", gFRParams.pdListenTimeout, "uT"); Write("%33s = %6d %s", "pClusterDriftDamping", gFRParams.pClusterDriftDamping, "uT"); Write("%33s = %6d %s", "pDecodingCorrection", gFRParams.pDecodingCorrection, "uT"); Write("%33s = %6d %s", "pDelayCompensation_A", gFRParams.pDelayCompensation_A, "uT"); Write("%33s = %6d %s", "pDelayCompensation_B", gFRParams.pDelayCompensation_B, "uT"); Write("%33s = %6d %s", "pOffsetCorrectionOut", gFRParams.pOffsetCorrectionOut, "uT"); Write("%33s = %6d %s", "pRateCorrectionOut", gFRParams.pRateCorrectionOut, "uT"); Write("%33s = %6d %s", "pExternOffsetCorrection", gFRParams.pExternOffsetCorrection, "uT"); Write("%33s = %6d %s", "pExternRateCorrection", gFRParams.pExternRateCorrection, "uT"); Write("%33s = %6d %s", "pExternCorrectionMode", gFRParams.pExternCorrectionMode, ""); Write("%33s = %6d %s", "pMacroInitialOffset_A", gFRParams.pMacroInitialOffset_A, "MT"); Write("%33s = %6d %s", "pMacroInitialOffset_B", gFRParams.pMacroInitialOffset_B, "MT"); Write("%33s = %6d %s", "pMicroInitialOffset_A", gFRParams.pMicroInitialOffset_A, "uT"); Write("%33s = %6d %s", "pMicroInitialOffset_B", gFRParams.pMicroInitialOffset_B, "uT"); Write("%33s = %6d %s", "pWakeupChannel", gFRParams.pWakeupChannel, ""); Write("%33s = %6d %s", "pWakeupPattern", gFRParams.pWakeupPattern, "#"); Write("%33s = %6d %s", "pAllowHaltDueToClock", gFRParams.pAllowHaltDueToClock, "Boolean"); Write("%33s = %6d %s", "pAllowPassiveToActive", gFRParams.pAllowPassiveToActive, "cycles"); Write("%33s = %6d %s", "pBGTick", gFRParams.pBGTick, "Boolean"); Write("%33s = %6d %s", "pPhysicalLayer", gFRParams.pPhysicalLayer, ""); Write("%33s = %6d %s", "pSingleSlotEnabled", gFRParams.pSingleSlotEnabled, "Boolean"); Write("%33s = %6d %s", "pBGEnable", gFRParams.pBGEnable, "Boolean"); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRGetConfiguration Write("%33s = %6d %s", "pDynamicSegmentEnable", gFRParams.pDynamicSegmentEnable, "Boolean"); Write("%33s = %6d %s", "pStrobePointPosition", gFRParams.pStrobePointPosition, ""); Write("%33s = %6f %s", "pdMicrotick", gFRParams.pdMicrotick, "us");" } | FRSetConfiguration | Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrGetFrameCRC FrGetFrameCRC CAPL Function Overview » FlexRay » FrGetFrameCRC Syntax dword FrGetFrameCRC(this); Function This function returns the CRC of a received FlexRay frame. 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 this references the corresponding receive object in the event procedure. Return values Frame CRC (data type WORD). 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. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: output output CAPL Function Overview » FlexRay » output Syntax void output(flexraymessage msg); // form 1 void output(flexraystartcycle msg); // form 2 void output(flexraysymbol msg); // form 3 void output(flexraypocstate msg); // form 4 void output(flexrayerror msg); // form 5 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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2: form 1, 2 FlexRay • — 6.1: form 3 - 5 FlexRay • — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: output 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FROutputDynFrame FROutputDynFrame CAPL Function Overview » FlexRay » FROutputDynFrame Syntax int ret = FROutputDynFrame( <frame var> ); 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! Parameters <frame var> Name of the variable referenced by the frame object. The variable name was defined when the object was created using FrFrame. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 FlexRay — • Example For an example see function FRUpdateStatFrame. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FlexRayRcvStatusEvent FlexRayRcvStatusEvent CAPL Function Overview » FlexRay » FlexRayRcvStatusEvent Note The callback function FlexRayRcvStatusEvent is deprecated! Use the event procedures on FRSymbol and on FRPOCState instead. Syntax FlexRayRcvStatusEvent (long msgTime, int channel, long statusType, long infomask1, long infomask2, long infomask3); Function This function is a callback and is called by the tool! The callback occurs when the FlexRay Communication Controller (CC) has synchronized with the bus or the synchronization fails. Parameters msgTime Event time stamp. channel Channel in the tool that selects the CC. Should be set to 1 by default (since the tool currently only supports one FlexRay CC). statusType The bits signal the type of status event concerned. 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 0x0001 "Bus Synchronization" status is included. 0x0002 Received symbol infomask1 If statusType == 1: The bits signal the value of an special status event. Type Bit value Meaning 0x0001 0 CC unable to synchronize with the bus. 1 CC is synchronized to the bus. If statusType == 2: Symbol type (in bits 0-15): Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FlexRayRcvStatusEvent 1 CAS 2 MTS 3 Wakeup 4 Not specified Symbol length (in bits 16-30) in bit times. Example 0x00260004: not specified signal with the length 38. 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: Symbol receiving cycle. infomask3 If statusType == 1: Not used. If statusType == 2: Channel mask (A=1 / B=2 / AB = 3): Channel the symbol was received. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FlexRayRcvStatusEvent } } } if (busIsSynchronized == 1) ResetFlexRayCC(channel); busIsSynchronized = 0; Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSendFrame FrSendFrame CAPL Function Overview » FlexRay » FrSendFrame Note This function is deprecated! Use function FRUpdateStatFrame or FROutputDynFrame instead. Syntax FrSendFrame( <frame name>, dword flags, byte dataBytes[] ); Uses a symbolic frame name from the database. 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 ); If no database is available, all necessary parameters can be set separately, too. 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). Parameters <frame name> String that corresponds to a frame name of the database. The necessary parameters slotId, channelMask, len, cycleStart and cycleRepetition are taken from the corresponding frame definition of the database. slotId Identifier of the time slot in which the message should be sent. channelMask Channel of the transmission message. Values: 1 Channel A 2 Channel B 3 Channel A+B (should correspond to the registered value; see FRSetSendFrame function) len Number of data bytes (maximum 254 bytes). 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSendFrame 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: Bit mask Meaning 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 The frame is no longer sent, the corresponding slots remain empty. The flag can only be used with VN interfaces. 0x200 Disable use of In-Cycle-Repetition 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. CANoe Version ≥ 7.1 SP3 0x400 Sets the null frame indicator in the header. The flag can only be used with VN interfaces. databytes Array of data bytes (payload) channel Channel number (or cluster number) Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSendFrame // 4 | 16 | TT flag (1 == event-triggered, 0 = time-triggered) // BYTE gSta1Id = 9; // 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 BYTE gSta1Channel = %CHANNEL%; // FR interface const long gPeriodSine = 8000; const long gPeriodRect = 1000; const long gAmplitudeSine = 1000; const int cMaxFRBufSize = 254; BYTE gSta1Msg[cMaxFRBufSize]; // message buffer } on preStart { int i; // Declare TX buffer in interface: FRSetSendFrame(gSta1Id /*frameId*/, gSta1Chan /*channelMask*/, gSta1Dlc /*len*/, gSta1Base /*cycleStart*/, gSta1Rep /*cycleRepetition*/, gSta1Flags /*flags*/, gSta1Channel /*cluster*/); // Initialize payload: for(i=0; i<gSta1Dlc; ++i) { gSta1Msg[i] = i; } } on FRStartCycle * { if (this.FR_Cycle % gSta1Rep == gSta1Base) { doCalc(); FRSend(); } } FRSend () { FRSendFrame(gSta1Id /*frameId*/, gSta1Chan /*channelMask*/, gSta1Dlc /*len*/, gSta1Base /*cycleStart*/, gSta1Rep /*cycleRepetition*/, gSta1Flags /*flags*/, gSta1Msg /*dataBytes*/, gSta1Channel /*cluster*/); } doCalc () { float sine BYTE rect; long sinel; // Calculating sine wave and rectangle values: sine = gAmplitudeSine*sin((timeNow()/100)*2*PI/gPeriodSine); if (sin((timeNow()/100)*2*PI/gPeriodRect)<0) rect = 0; else rect = 1; sinel = sine; // assigning values to message buffer: gSta1Msg[0] = (sinel & 0x000000FF); gSta1Msg[1] = (sinel & 0x0000FF00) >> 8; gSta1Msg[2] = rect; gSta1Msg[3] = 0; } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRSendSymbol FRSendSymbol CAPL Function Overview » FlexRay » FRSendSymbol Syntax FRSendSymbol( long <type>, long <param>, int channel ); 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 Channel number (or cluster number) Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 The cluster parameters must define a symbol window! A CAS cannot be sent explicitly. It is reserved for the start-up procedure. For sending a wakeup see function ResetFlexRayCCEx. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRSetAutoIncrement FRSetAutoIncrement CAPL Function Overview » FlexRay » FRSetAutoIncrement Note This function can only be used with VN3300 and VN3600. 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 Channel number (or cluster number) slotId Slot number of the frame used. channelMask FlexRay channel mask Possible values: 1 Channel A 2 Channel B 3 Channel A+B cycleStart, cycleRepetition Cycle multiplexing parameter flags 1: Payload increment is switched on. All other values are reserved and must not be used. increment_size Number of bits used for the increment. 8, 16 and 32 are valid values. increment_offset Byte position after which the payload is incremented. Possible values: increment_size increment_offset Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRSetAutoIncrement 8 0,1,2,3... 16 0,2,4,6,... 32 0,4,8,... Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRSetConfiguration FRSetConfiguration CAPL Function Overview » FlexRay » FRSetConfiguration Note When using the BusDoctor, this function is ignored. Syntax FRSetConfiguration( int channel, <configuration var> ); 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 FlexRay channel (cluster number) <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 — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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" Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRSetConfiguration gFRParams.gdSymbolWindow = 35; // "MT" gFRParams.gdCASRxLowMax = 0; // "Bit" gFRParams.gdCASRxLowMin = 0; // "Bit" gFRParams.gdWakeupSymbolRxIdle = 59; // "Bit" gFRParams.gdWakeupSymbolRxLow = 51; // "Bit" gFRParams.gdWakeupSymbolRxWindow = 301; // "Bit" gFRParams.gdWakeupSymbolTxIdle = 180; // "Bit" gFRParams.gdWakeupSymbolTxLow = 60; // "Bit" gFRParams.gMaxWithoutClockCorrectionFatal = 10; // "double cycles" gFRParams.gMaxWithoutClockCorrectionPassive = 6; // "double cycles" gFRParams.gNetworkManagementVectorLength = 0; // "Bytes" gFRParams.pChannels = 3; // "A+B" gFRParams.pMicroPerCycle = 200000; // "uT" gFRParams.pSamplesPerMicrotick = 2; // "#" gFRParams.pPayloadLengthDynMax = 10; // "Words" gFRParams.pPayloadLengthFIFO = 10; // "Words" gFRParams.pLatestTx = 272; // "MS" gFRParams.pdMaxDrift = 89; // "uT" gFRParams.pdAcceptedStartupRange = 189; // "uT" gFRParams.pdListenTimeout = 401202; // "uT" gFRParams.pClusterDriftDamping = 1; // "uT" gFRParams.pDecodingCorrection = 52; // "uT" gFRParams.pDelayCompensation_A = 10; // "uT" gFRParams.pDelayCompensation_B = 10; // "uT" gFRParams.pOffsetCorrectionOut = 143; // "uT" gFRParams.pRateCorrectionOut = 601; // "uT" gFRParams.pExternOffsetCorrection = 0; // "uT" gFRParams.pExternRateCorrection = 0; // "uT" gFRParams.pExternCorrectionMode = 0; // "" gFRParams.pMacroInitialOffset_A = 9; // "MT" gFRParams.pMacroInitialOffset_B = 9; // "MT" gFRParams.pMicroInitialOffset_A = 18; // "uT" gFRParams.pMicroInitialOffset_B = 18; // "uT" gFRParams.pWakeupChannel = 1; // 1 (A) or 2 (B) gFRParams.pWakeupPattern = 0; // "#" gFRParams.pAllowHaltDueToClock = 1; // "Boolean" gFRParams.pAllowPassiveToActive = 1; // "cycles" //gFRParams.pBGTick = 0; // "Boolean" //gFRParams.pPhysicalLayer = 0; // "" gFRParams.pSingleSlotEnabled = 0; // "Boolean" //gFRParams.pBGEnable = 0; // "Boolean" //gFRParams.pDynamicSegmentEnable = 0; // "Boolean" } FRSetConfiguration(%CHANNEL%, gFRParams); ResetFlexRayCC(%CHANNEL%); // in order to apply the new values Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetKeySlot FrSetKeySlot CAPL Function Overview » FlexRay » FrSetKeySlot Note When using the BusDoctor, this function is unnecessary and is ignored. 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 Channel number (or cluster number) channelMask Channel of the transmission frame. Values: 1 Channel A 2 Channel B 3 Channel A+B kyeSlotIndex Addresses the desired key slot (1 or 2). keySlotId This number designates a specific FlexRay slot in the static segment. Its value must be between 1 and 1023. keySlotUsage Defines the mode of the key slot: Value Meaning 0 Off 1 Startup/Sync (Allowing Leading Coldstart) 2 Sync 3 Startup/Sync Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetKeySlot Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.2 FlexRay — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRSetMode FRSetMode CAPL Function Overview » FlexRay » FRSetMode Note The function is only supported by FlexCard Cyclone II or the Vector FlexRay hardware interface. Syntax FRSetMode( int channel, int channelMask, dword mode ); 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 FlexRay channel (cluster number). channelMask Determines which bus driver is being programmed. Value: 1 Channel A 2 Channel B 3 Channel A+B mode Defines the bus driver state: Mode Meaning 0x0000 Normal mode, when starting the Communication Controller a Wakeup will be sent if this is defined in the hardware configuration dialog. 0x0001 Sleep mode 0x0002 Normal mode, when starting the Communication Controller no Wakeup will be sent. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 FlexRay — • Example 1 The following CAPL program deactivates or activates the physical drivers according to key Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRSetMode 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); } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRSetMode void gotoNormal () { FRSetMode( %CHANNEL%, cFrChanMask, cFrModeGoNormal); write("FR: Wakeup Time: %.6f", timenowns()/1000000000.0); } void receiveWakeup () { gotoNormal(); gCntWakeups++; } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRSetPayloadLengthInByte FRSetPayloadLengthInByte CAPL Function Overview » FlexRay » FRSetPayloadLengthInByte Syntax FRSetPayloadLengthInByte( <frame var>, dword <dlc> ); 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! Parameters <frame var> Name of the variable referenced by the frame object. The variable name was defined when the object was created using FrFrame. <dlc> Defines the payload (data length) in bytes. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 FlexRay • • Example For an example see function FRUpdateStatFrame. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetPOCState FrSetPOCState CAPL Function Overview » FlexRay » FrSetPOCState Note The function is supported by VN interfaces only! Syntax long FrSetPOCState( long channel, long ccNumber, long pocState ) 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 FlexRay channel (cluster number). ccNumber 1: E-Ray 2: Second Startup Controller/Coldstart helper (Fujitsu) pocState Desired POC state: Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetPOCState Return values POC state Meaning 0 wakeup 1 normal active 2 halt 3 ready 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 — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetSendFrame FrSetSendFrame CAPL Function Overview » FlexRay » FrSetSendFrame Note When using the BusDoctor, this function is unnecessary and is ignored. This function is not available when executing CAPL programs directly on an interface hardware (CAPL on Board). Syntax FrSetSendFrame( <frame name>, dword flags ); Uses a symbolic frame name from the database. FrSetSendFrame( int slotId, int channelMask, int len, int cycleStart, int cycleRepetition, dword flags, int channel ); If no database is available all necessary parameters can be set separately, too. FrSetSendFrame( <frame object> ); If a FRFrame object was created with FRFrame, with this function the object can be registered for sending. Function Configures the hardware for sending the specified message. The call must take place in the On PreStart routine in the simulation setup / transmission branch. Parameters <frame name> String that corresponds to a frame name of the database. The necessary parameters slotId, channelMask, len, cycleStart and cycleRepetition are taken from the corresponding frame definition of the database. slotId Identifier of the time slot in which the message should be sent. channelMask Channel of the transmission message. Values: 1 Channel A 2 Channel B 3 Channel A+B len Number of databytes (maximum 254 bytes). 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetSendFrame bus) 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 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: Bit mask Meaning 0x01 Sets the sync bit in the header. Only a frame in the static segment may have set this bit. Caution This flag is deprecated (for CANoe ≥ 7.2)! Use instead function FRSetKeySlot. 0x02 Sets the startup bit in the header. If this bit is set, then the sync bit must also be set. Caution This flag is deprecated (for CANoe ≥ 7.2)! Use instead function FRSetKeySlot. 0x10 Sets the send mode to event-triggered. If not set, the frame will be transmitted in time-triggered mode. 0x20 Sets the payload preamble bit. 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. 0x40 Enable TX Check. 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. The flag can only be used with VN3300 and VN3600. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetSendFrame 0x100 Inhibit leading cold start. If set, the CC is not allowed to initialize the cluster communication. Caution This flag is deprecated (for CANoe ≥ 7.2)! Use instead function FRSetKeySlot. channel Channel number (or cluster number) Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.2 FlexRay — • Example For an example see functions FRUpdateStatFrame and FRSendFrame. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetSendGroup FrSetSendGroup CAPL Function Overview » FlexRay » FrSetSendGroup Note This function can only be used with VN3300 and VN3600. 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 Slot number of the frame used channelMask FlexRay channel mask Possible values: 1 Channel A 2 Channel B 3 Channel A+B cycleStart, cycleRepetition Cycle multiplexing parameter groupNo Group number can be selected as required. flags Reserved, must be 0 channel Channel number (or cluster number) Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetSendGroup Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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; int groupNo int Cnt = 66; = 0; } on preStart { // register frame 1: gSta1Msg.FR_Channelmask = channelMask; gSta1Msg.FR_Flags = flags; FRSetPayloadLengthInByte(gSta1Msg, payloadlength); FRSetSendFrame( gSta1Msg ); // add to send group: FRSetSendGroup( gSta1Msg.FR_SlotID, gSta1Msg.FR_ChannelMask, groupNo, gSta1Msg.FR_CycleOffset, gSta1Msg.FR_CycleRepetition, 0 ); // register frame 2: gSta2Msg.FR_Channelmask = channelMask; gSta2Msg.FR_Flags = flags; FRSetPayloadLengthInByte(gSta2Msg, payloadlength); FRSetSendFrame( gSta2Msg ); // add to send group: FRSetSendGroup( gSta2Msg.FR_SlotID, gSta2Msg.FR_ChannelMask, groupNo, gSta2Msg.FR_CycleOffset, gSta2Msg.FR_CycleRepetition, 0 ); } on FRFrame (10, 0, 1) { // we assume that we receive at least a message // in slot 10 in cycle 0 on channel A: if ((this.FR_Cycle == 0) && (this.FR_ChannelMask == 1)) { // Update is done in cycle 0 only: gSta1Msg.byte(0) = Cnt; gSta2Msg.byte(0) = Cnt; FRupdateStatFrame(gSta1Msg); FRupdateStatFrame(gSta2Msg); Write(„Update of Frames in cycle %d with data %d.“, this.FR_Cycle, Cnt); if (++Cnt > 255) Cnt = 0; } } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetSendPDU FrSetSendPDU CAPL Function Overview » FlexRay » FrSetSendPDU Syntax FrSetSendPDU( <PDU object> ); If a FrPDU object was created using FrPDU, it can be submitted for transmission with this function. Function Configures the hardware to transmit the specified PDU. All relevant slots are submitted for transmission. This submission must take place in the OnPreStart routine in the transmit branch. Parameters <PDU object> Specifies the PDU object that is to be submitted for transmission. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 FlexRay — • Example For an example see function FRUpdatePDU. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrSetTrigger FrSetTrigger CAPL Function Overview » FlexRay » FrSetTrigger Note The function is supported by VN interfaces only! Syntax long FrSetTrigger( long channel, long portNo ) 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. Return values 0: Error 1: Ok Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 7.1 FlexRay — • Example — Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrUpdatePDU FrUpdatePDU CAPL Function Overview » FlexRay » FrUpdatePDU Syntax FrUpdatePDU(<PDU var>, dword flags, int updateCounter); Function This function updates the PDU payload in the assigned FlexRay frames. The update bit can also be set. Parameters <PDU var> Name of the variable referenced by the PDU object. The variable name was defined via FrPDU when the object was created. flags Bit mask Meaning 0x01 Update bit is set on transmission. All other bits are reserved and must be set to a value of 0. updateCounter Value Meaning -1 The PDU is transmitted in every configured slot. 0 The PDU's default value is transmitted. N (>0) The PDU is transmitted at least n times. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FrUpdatePDU } 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRUpdateStatFrame FRUpdateStatFrame CAPL Function Overview » FlexRay » FRUpdateStatFrame Syntax int ret = FRUpdateStatFrame( <frame var> ); 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! Parameters <frame var> Name of the variable referenced by the frame object. The variable name was defined when the object was created using FrFrame. Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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. FRFrame ( 60, 0, 1) gMsg1; const BYTE gMsg1Flags = 3; // state-driven with sync and startup const BYTE gMsg1Channel = %CHANNEL%; // send on network the CAPL node is assigned to const BYTE gMsg1ChanMask = 3; // send on FlexRay channel A+B const BYTE gMsg1Len = 32; // 32 byte user data BYTE gCycle; // remember current FlexRay cycle } on preStart { // Optionally prepare buffer for message gMsg1: gMsg1.MsgChannel = gMsg1Channel; gMsg1.FR_ChannelMask = gMsg1ChanMask; gMsg1.FR_Flags = gMsg1Flags; FRSetPayloadLengthInByte(gMsg1, gMsg1Len); FRSetSendFrame( gMsg1 ); } DoFRCalc () { int i; gMsg1.byte(0) = gCycle; // or gMsg1.signame = value; if frame is symbolically declared for (i = 1; i < gMsg1.FR_PayloadLength * 2; ++i) { gMsg1.byte(i) = i; } } DoFRSend () { // Update the message buffer: FRUpdateStatFrame(gMsg1); // or FROutputDynFrame(gMsg1); } on FRStartCycle * { gCycle = this.FR_Cycle; DoFRCalc(); // calculate and set message contents Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: FRUpdateStatFrame } DoFRSend(); // commit buffer for sending 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: MessageTimeNS MessageTimeNS CAPL Function Overview » FlexRay » MessageTimeNS Syntax float ns = MessageTimeNS( this ); 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 this references the corresponding receive object in the event procedure. Return values Receive time in nanoseconds since start of message. Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 FlexRay • • Example For an example see event procedure on FRFrame. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ResetFlexRayCC ResetFlexRayCC CAPL Function Overview » FlexRay » ResetFlexRayCC Note When using the BusDoctor this function is ignored. 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 ResetFlexRayCC (int channel); 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 FlexRay channel (cluster number). Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ResetFlexRayCCEx ResetFlexRayCCEx CAPL Function Overview » FlexRay » ResetFlexRayCCEx Note When using the BusDoctor this function is ignored. 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 FlexRay channel (cluster number) wuChMask Channel for the wakeup pattern. Values: 1 Channel A 2 Channel B wuCount Number of repetitions (2 – 63) of the wakeup symbol in a wakeup pattern. wuTxIdle This number designates the number of idle bits in a wakeup symbol. According to protocol specification, this should result in 18 µs. wuTxLow This number designates the number of low bits in a wakeup symbol. According to protocol specification, this should result in 6 µs. cfg Character data array. This is currently not used and is of no importance. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: ResetFlexRayCCEx Return values — Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 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. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRError 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 — Selectors Time (data type dword) 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 Channel in the tool that the FlexRay CC determines. Write protected! FR_HWTag Identifies the type of the FlexRay hardware (data type: DWORD): 0 HW independent 1 Invalid 2 FlexCard Cyclone I 3 BusDoctor 4 FlexCard Cyclone II 5 Vector FlexRay hardware Write protected! FR_Code Identifies the error type (data type: LONG) -1 Unknown error 0 NO error Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRError 1 FlexCard Overflow 2 POC Error Mode Changed 3 Sync Frames Below Minimum 4 Sync Frame Overflow 5 Clock Correction Failure 6 Parity Error 7 Receive FIFO Overrun 8 Empty FIFO Access 9 Illegal Input Buffer Access 10 Illegal Output Buffer Access 11 Syntax Error 12 Content Error 13 Slot Boundary Violation 14 Transmission Across Boundary Channel A 15 Transmission Across Boundary Channel B 16 Latest Transmit Violation Channel A 17 Latest Transmit Violation Channel B 18 Error Detection on Channel A 19 Error Detection on Channel B 20 Message Handler Constraints Flag Error 21 NIT SENA (Syntax Error during NIT Channel A) 22 NIT SBNA (Slot Boundary Violation during NIT Channel A) 23 NIT SENB (Syntax Error during NIT Channel B) 24 NIT SBNB (Slot Boundary Violation during NIT Channel B) 25 Internal Error Overflow 26 Wrong Frame 27 Bus Guardian Error Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRError 28 CHI Error 29 Error Handling Level Changed 30 Symbol Received Write protected! FR_Data0 Contains extended information (data type: DWORD): Not used. Write protected! FR_Data1 Contains extended information (data type: DWORD): Not used as yet. Write protected! FR_Data2 Contains extended information (data type: DWORD): Not used as yet. Write protected! FR_Data3 Contains extended information (data type: DWORD): Not used as yet. Write protected! FR_Data4 Contains extended information (data type: DWORD): Not used as yet. Write protected! Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.1 SP2 FlexRay • • 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 Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRError 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"); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRError r = code; } else if (code == 20) { snprintf(name, nameSize, r = code; } else if (code == 21) { snprintf(name, nameSize, r = code; } else if (code == 22) { snprintf(name, nameSize, r = code; } else if (code == 23) { snprintf(name, nameSize, r = code; } else if (code == 24) { snprintf(name, nameSize, r = code; } else if (code == 25) { snprintf(name, nameSize, r = code; } else if (code == 26) { snprintf(name, nameSize, r = code; } else if (code == 27) { snprintf(name, nameSize, r = code; } else if (code == 28) { snprintf(name, nameSize, r = code; } else if (code == 29) { snprintf(name, nameSize, r = code; } else if (code == 30) { snprintf(name, nameSize, r = code; } else { snprintf(name, nameSize, r = -1; } return r; } "Message Handler Constraints Flag Error"); "NIT SENA"); "NIT SBNA"); "NIT SENB"); "NIT SBNB"); "Internal Error Overflow"); "Wrong Frame"); "Bus Guardian Error"); "CHI Error"); "Error Handling Level Changed"); "Symbol Received"); "Unknown"); Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRFrame 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. on FRFrame <frame name> Uses a symbolic frame name from the database. on FRFrame (<slot ID>, <base cycle>, <cycle repetition>) This function is only called for a frame in a certain slot. This event procedure is called after a frame in the slot <slot ID> - in a cycle that corresponds to the Cycle Multiplexing - has been received. Potentially frames from the <z> cycles are received that conform to the following formula: <z> modulo <cycle repetition> = <base cycle>. 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) An optional qualifier can be used to assign the handler to a specific network: 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> Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRFrame String that corresponds to a frame name of the database. The necessary parameters <slot ID>, <base cycle>, and <cycle repetition> are taken from the corresponding frame definition of the database. <slot ID> This number describes a certain slot. Value range: 1...2047. <base cycle> This number describes the base cycle. This value must be less than the repetition factor and be in the following range: 0...63. This value, together with the repetition factor, 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 to 2 (1, 2, 4, 8, 16, 32 or 64). This value, together with the base cycle, determines the Cycle Multiplexing. 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). Timer unit: 10 microseconds, data type: dword 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. Timer unit: nanoseconds, data type: int64 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! Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRFrame FR_SlotID The frame was received in this slot. Write protected! FR_Cycle The frame was received in this cycle. Write protected! FR_PayloadLength Length of the present payload in 16 Bit words (data type: word). Write protected! byte(index), word(index), dword(index), qword(index), char(index), int(index), long(index), int64(index), <signal name> Direct access to the payload/data of the frame. The number of valid data bytes is specified by the selector 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 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: Bit mask Meaning 0x1 Null frame 0x2 Payload valid = msg contains valid data 0x4 Frame set the sync bit. 0x8 Frame set the startup bit. 0x10 Frame set the payload preamble bit. 0x20 Frame set the reserved bit. 0x40 Frame is faulty. 0x80 — 0x100 — 0x200 Only with TX frames: The TX cycle is not the expected one. 0x400 Only with TX frames: An update has overwritten a preceding update. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRFrame 0x800 Only with TX frames: New data was sent. 0x1000 — 0x2000 — 0x4000 The frame was sent/simulated. 0x8000 The frame was received in asynchronous mode. 0x10000 — 0x20000 — 0x40000 — 0x80000 — 0x100000 Frame is part of the dynamic segment. 0x400000 — All other bits of the flags are reserved. Write protected! FR_HeaderCRC Retrieves the CRC in the header of the frame received. Write protected! FR_Segment Identifies the segment that this frame is assigned to. Value Meaning 0 Frame belongs to the static segment 1 Frame belongs to the dynamic segment Write protected! FR_Status Additional status information about the reception buffer of the CC. Caution The value is hardware dependant according to the selected interface type. The selected interface type can be determined by calling FRGetConfiguration. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRFrame Bit mask VN FlexCard Cyclone II FlexCard Cyclone BusDoctor 0x0001 Syntax Error (SERR) Syntax Error (SERR) TX Conflict (TXCON) Decoding Error (CODERR) 0x0002 Content Error (CERR) Content Error (CERR) Boundary Violation (BVIOL) TSS Violation Error (TSSVIOL) 0x0004 Slot Boundary Violation (BVIOL) Slot Boundary Violation (BVIOL) Content Error (CERR) Header CRC Error (HCRCERR) 0x0008 Empty Slot (SLEMPTY) Empty Slot (SLEMPTY) Syntax Error (SERR) Frame CRC Error (FCRCERR) 0x0010 Message Lost (MLOST) Message Lost (MLOST) Startup Frame Indication (SUPF) Frame End Sequence Error (FESERR) 0x0020 Valid Frame (VAL) Valid Frame (VAL) NULL Frame Indication (NULLF, NF) Symbol (SYMB) 0x0040 TX Conflict Hdr (TXCON) — SYNC Frame Indication (SYNCF, SF) Valid Frame (VAL) 0x0080 Framing Error (FrmERR) — Valid Communication Element (VCE) Boundary Violation Error (MASB) 0x0100 Header CRC Error (HdrERR) — — NIT Violation Error (NITVIOL) 0x0200 Frame CRC Error (FrmCRC) — — Symbol Window Violation Error (SWVIOL) 0x0400 — — — Slot Overbooked Error (SOVERR) 0x0800 TX Conflict (TXCONFLICT) — — Null Frame Error (INFE) Due to the bus physics a transmission conflict is not detected in any case. Available from CANoe 7.2. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRFrame 0x1000 — — — Syncframe or Start-up Error (ISFE) 0x2000 — — — Frame ID Error (FIDE) 0x4000 — — — Cycle Counter Error (CCE) 0x8000 — — — Static Payload Length Error (PLSE) All other bits of the status are reserved. Write protected! DIR Transmission direction of the message. Value Meaning TX Message was sent by this node. RX Message was received by this node. TXRequest Transmit request Write protected! SIMULATED This flag indicates whether the message was 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). Available from CANoe 7.2. Write protected! Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 5.0 SP2 FlexRay • • Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRFrame 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 } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRFrameError 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! on FRFrameError <frame name> Uses a symbolic frame name from the database. on FRFrameError (<slot ID>, <base cycle>, <cycle repetition>) This function is only called for an erroneous frame in a specific slot. 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: <z> modulo <cycle repetition> = <base cycle> 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) An optional qualifier can be used to assign the handler to a specific network: 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> Character string corresponding to a frame name from the database. The required parameters (<slot ID>, <base cycle> and <cycle repetition>) are taken from the corresponding frame definition in the database. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRFrameError <slot ID> This number designates a specific slot. Its value must be between 1 and 2047. <base cycle> 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. <cycle repetition> 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. Selectors The same selectors as for on FRFrame can be applied. All selectors are write protected! Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 SP2 FlexRay • • 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 } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRNullFrame 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! on FRNullFrame <frame name> Uses a symbolic frame name from the database. on FRNullFrame (<slot ID>, <base cycle>, <cycle repetition>) This function is only called for a null frame in a specific slot. 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: <z> modulo <cycle repetition> = <base cycle> 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) An optional qualifier can be used to assign the handler to a specific network: 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 * Specifies the default procedure. This procedure is called for all received null frames for which there is no explicit event procedure. <frame name> Character string corresponding to a frame name from the database. The required parameters <slot ID>, <base cycle>, and <cycle repetition> are taken from the corresponding frame definition in the database. Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FRNullFrame <slot ID> This number designates a specific slot. Its value must be between 1 and 2047. <base cycle> 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. <cycle repetition> 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. Selectors The same selectors as for on FRFrame can be applied. All selectors are write protected! Availability Since Version Restricted to Measurement Setup Simulation / Test Setup 6.0 SP2 FlexRay • • 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 } Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FrPDU on FrPDU CAPL Function Overview » FlexRay » on FrPDU Syntax on FrPDU <PDU name> This handler is called on reception of the symbolically defined PDU. 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. on FrPDU <ID> is not allowed! 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> An optional qualifier can be used to assign the handler to a specific network: 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> Selectors Time (data type dword) Time_ns (data type int64) 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. Timer unit: 10 microseconds. NS timer unit: nanoseconds. Note: The Time selector is not available when executing CAPL programs directly on an interface hardware (CAPL on Board). Write protected! Version: 7.6 SP4 | © Vector Informatik GmbH User Manual Topic: on FrPDU 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 The PDU's frame was received in this slot. Write protected! FR_Cycle The PDU was received in this cycle. Write protected! FR_PayloadLength Length of the present payload in bytes (data type: word). Write protected! byte(index), word(index), dword(index), qword(index), char(index), int(index), long(index), int64(index), <signal name> Direct access to the payload/data of the PDU. The number of valid data bytes is specified by the selector 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 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. Possi