CAPL Syntax Reference
This reference collection includes Vector documentation reproduced with permission. Snippets may require configuration-specific symbols and are not all standalone programs. Sources and validation limits.
Use this reference when you have a specific programming task or a function name to investigate. If you are setting up your first node, start with the development-environment tutorial before copying individual function calls.
Find a starting point by task
| Task | Reference entry | Check before using it |
|---|---|---|
| Declare data | Variables and types | Range, signedness and where the variable is initialized |
| Send a CAN frame | output | Channel, identifier, data length and database mapping |
| React to a received frame | on message | The event filter and payload length before reading bytes |
| Schedule work | setTimer | Whether the variable is timer or msTimer and which units the overload expects |
| Inspect message time | TIME selector | Timestamp units before comparing or displaying values |
| Work with several buses | Bus-context functions | The difference between the current context, a bus-name lookup and a temporary switch |
| Handle strings | String functions | Buffer capacity, encoding and termination behavior |
| Read or write a file | File I/O | File path, access mode and error/close handling |
Distinguish similar-looking operations
A function name is not enough to determine where a call belongs. A simulation node reacts to events; a test module follows a test flow and can use supported wait functions. When adapting code, identify the intended context before investigating a compiler error as if it were a spelling mistake.
For example, GetBusContext inspects the context active now. GetBusNameContext resolves a configured bus name and returns 0 if it is absent. SetBusContext changes the current context and returns the previous one. Treating the last result as a success flag would discard information you need to restore the caller's context. The linked function pages explain the distinction with a small inspection example.
A practical reference-reading sequence
- Read the signature and identify which overload matches your arguments. Similar names do not guarantee identical parameter types or units.
- Check the applicable tool version, license and node type against the help shipped with your installation.
- Check every configuration-dependent symbol: bus names, database messages, signals and diagnostic qualifiers must exist in your project.
- Read the return-value description before writing the success branch. A zero value, a positive handle and a negative error code can mean different things for different APIs.
- Compile a minimal example in an isolated configuration, inspect its behavior, and exercise a failure case before embedding it in a larger test.
Sources and corrections
This collection includes Vector documentation reproduced with permission and site-written explanations. Authorization to reproduce reference material is separate from validation of a particular example. We do not claim that every excerpt has been compiled in every CANoe/CANalyzer version.
Use the search button for a function name, or the sidebar to browse related APIs. If a snippet is damaged, ambiguous or incompatible with your version, send the page URL and compiler message. See source information and the technical disclaimer.