Extensions.DiagCom.CloseComChannel

From emotive
Revision as of 08:52, 4 February 2015 by Tl (talk | contribs) (→‎OTL Syntax)
Jump to navigation Jump to search

Classification

Name CloseComChannel
Short Description Closes a communication channel
Class Action
Extension OTX DiagCom extension
Group ComChanel related actions
Exceptions InvalidReferenceException
Checker Rules -
Standard Compliant Yes

OTL Syntax

DiagCom.CloseComChannel(ComChannelVariable);

Description

OTX CloseComChannel activity is used for the Diagnosis Runtime System to announce that an open communication channel that all relevant resources can be released and closed.

Exclamation.png 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!

Exclamation.png Important: Please note that the use of a shared ComChannel can bring the OTX runtime system in an undefined state and that is this case is not validated at design time!

Properties

Name Data Type Class Default Cardinality Description
ComChannel ComChannel Variable - [1] Communication Channel (Control unit).

OTL Examples

DiagCom.ComChannel myComCannel;

myComCannel = DiagCom.GetComChannel("DiagnosticsCan_ECU_1", null, false);

// Code example using the variable myComChannel
// ...
DiagCom.CloseComChannel(myComCannel);

</syntaxhighlight>

See also

GetComChannel