GetBusNameContext
Valid for: CANoe DE • CANoe4SW DE 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 network 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.
Function Syntax
Description
Returns the context of the specified bus.Parameters
-
name: The name of the bus. The bus name can be taken from the CANoe DE product Simulation Setup:
- Open the System View
- Select a network
- Select the Rename… shortcut menu command
- Copy the name from the dialog
- busType: Bus system of the bus. The predefined enum BusType should be used for the value of this parameter.
- channelNumer: Number of the channel for the specified bus. Channel numbering starts with 1.
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.
Example
This is an example for a simulation node. Test nodes should copy the bus context to a CAPL variable in theMain() function because all global variables are cleared when a test module is started.