Extensions.DiagComPlus.CreateComChannel

From emotive
Jump to navigation Jump to search

Classification

Name CreateComChannel
Short Description Create a communication channel to an ECU
Class Term
Extension OTX DiagComPlus extension
Group DiagComPlus related terms
Exceptions LossOfComException
UnknownTargetException
Checker Rules -
Standard Compliant Yes

OTL Syntax

ComChannelTerm DiagComPlus.CreateComChannel(StringTerm identifier, StringTerm ecuVariableName);

Description

This term will create a communication channel to an ECU. The term is needed, because the diag:GetComChannel term does not guarantee, that the communication is not started. For exchangeability the usage of this term is recommended instead of diag:GetComChannel, if the user wants to set communication parameters before starting communication.

Exclamation.png Important: The channel is created at the time this term is executed.
Exclamation.png Important: If a diag:GetComChannel was executed before CreateComChannel the state of the diag:ComChannel will not be changed by this term.
Exclamation.png Important: In case an ODX/MVCI system is used, a StartCommunication on the logical link is not executed. In this case the logical link state is ONLINE.

The term CreateComChannel will 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 diag:CloseComChannel action. This is up to the author of a diagnostic sequence, an OTX runtime system is expected to clean up open ComChannel handles at the end of a diagnostic session.

Icons Note.png The appropriate MVCI system operation is MCDProject::createLogicalLink.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
ComChannel A handle to the same ComChannel for a given ECU.

Properties

Name Data Type Class Default Cardinality Description
identifier String Term - [1..1] This element represents a string identifying the communication channel, which will be created.
Icons Note.png In case a MVCI/ODX system is used the identifier specifies the SHORT-NAME of the MCDLogicalLink to be used for communication.
ecuVariantName String Term - [0..1] This optional element allows an OTX sequence to explicitly specify a particular ECU variant that the ComChannel will be associated with. It is provided in addition to the identifier attribute based on the assumption that the ComChannel identifier specifies a connection to a base variant of an ECU. The <ecuVariantName> element can be used to directly create a ComChannel to a specific ECU variant without needing to perform the ECU variant identification step.
Icons Note.png In case a MVCI/ODX system is used the <ecuVariantName> element specifies the SHORT-NAME of the MCDDbEcuVariant to be associated with the logical link.

OTL Examples

/// Local Declarations

Exception Exception1;
DiagCom.ComChannel ComChannel1;

/// Flow

ComChannel1 = DiagCom.GetComChannel("LL_GatewUDS", "EV_GatewLear_006", false);

try
{
	[#DiagMetaData , <#Data>
		<dmd:diagMetaData xmlns:dmd="http://iso.org/OTX/1.0.0/Auxiliaries/DiagMetaData">
		  <dmd:comChannelName value="LL_GatewUDS" />
		  <dmd:ecuVariantName value="EV_GatewLear_006" />
		</dmd:diagMetaData></#Data>]
	DiagComPlus.StartCommunication(ComChannel1);
	ComChannel1 = DiagComPlus.CreateComChannel("LL_GatewUDS", "EV_GatewLear_006");
	[#DiagMetaData , <#Data>
		<dmd:diagMetaData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dmd="http://iso.org/OTX/1.0.0/Auxiliaries/DiagMetaData">
		  <dmd:comChannelName value="LL_GatewUDS" />
		  <dmd:ecuVariantName value="EV_GatewLear_006" />
		</dmd:diagMetaData></#Data>]
	DiagComPlus.StopCommunication(ComChannel1);
}
catch (DiagCom.LossOfComException Exception1)
{
}

See also

ExecuteHexDiagServiceFunctional
StartCommunication
StopCommunication
GetComChannelState
GetComParameterList