Extensions.DiagCom.GetComChannel
Contents
Classification
Name | GetComChannel |
Short Description | Represents a connection to the control unit at runtime |
Class | Term |
Extension | OTX DiagCom extension |
Group | ComChannel related terms |
Exceptions | UnknownTargetException LossOfComException |
Checker Rules | DiagCom_Chk100 DiagCom_Chk101 |
Standard Compliant | Yes |
OTL Syntax
ComChannelTerm DiagCom.GetComChannel(StringTerm identifier, StringTerm ecuVariantName, BooleanTerm performVariantSelection);
Description
GetComChannel is a term to create a new communication channel to an ECU. The communication channel represents a connection to only one control unit (Logical Link).
To create a connection to the ECU, the following rules are applied:
- The ComChannel is created at the time this term is executed.
- If the ComChannel already exists, no additional action is carried out by the execution of this term.
- The ComChannel is created when it is first needed for actual diagnostic communication.
No matter which approach is chosen, the term GetComChannel shall always return a handle to the same ComChannel for a given ECU. It is possible to manually control the lifecycle of a ComChannel object by closing a ComChannel handle using the CloseComChannel action. The OTX runtime environment will clean up all opened ComChannel handlesat the end of a diagnostic session.
Important: Long-time running procedures should note that the OTX runtime will close open ComChannels (see GetComChannel) solely via the CloseComChannel activity! This has an impact on the long-time stability of the runtime environment. To avoid memory leaks, ComChannels should not be opened implicitly, like
ExecuteDiagService(CreateDiagServiceByName(GetComChannel("LL_AirbaUDS","",false), "DiagnServi_ReadDataByIdentECUIdent"), ...);
because the resources cannot be released until the completion of runtime execution. Better use: ComChannel comChannel = GetComChannel("LL_AirbaUDS","",false);
DiagService diagService = CreateDiagServiceByName(comChannel, "DiagnServi_ReadDataByIdentECUIdent"));
ExecuteDiagService(diagService, ...);
...
CloseComChannel(comChannel);
For the short-dated execution of procedures, this is of minor importance! |
An ECU variant selection can be performed, see below.
Return Value
The Term returns the value, see table below.
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
ComChannel | Returns a handle to the ComChannel for a given ECU |
Properties
Name | Data Type | Class | Default | Cardinality | Description | |||
Identifier | String | Term | - | [1] | This element represents a string identifying the communication channel which shall be created.
| |||
EcuVariantName | String | Term | "" | [0..1] | This optional element allows an OTX sequence to explicitly specify a particular ECU variant that the ComChannel shall be associated with.
| |||
PerformVariantSelection | Boolean | Term | false | [0..1] | This optional element can be used by the OTX author for controlling whether an implicit variant selection shall be done. |
ECU variant selection
An ECU variant selection can be performed after opening the channel and returns a handle to the selected ECU-Variant. The variant identification functionality also exists as a separate action called IdentifyAndSelectVariant.
EcuVariantName | PerformVariantSelection | |
Empty | False | No ECU variant selection is performed |
Empty | True | An ECU variant selection is performed for the BaseVariant descriped in Identifier |
NotEmpty | True | An ECU variant selection is performed. The channel is created to point at the desired ECUVariant and variant selection is performed on the link afterwards. |
OTL Examples
/// Local Declarations
DiagCom.ComChannel ComChannel1;
/// Flow
ComChannel1 = DiagCom.GetComChannel("LL_GatewUDS", "EV_GatewLear_006", false);
See also
GetComChannelIdentifierFromResponse
GetComChannelEcuVariantName
IsVariant
ExecuteDiagService