Caution
The Virtual PCAN-Gateway product is available only for Windows systems. It is not supported under Linux.
This parameter is used to get the communication flow currently supported by a PCAN-LAN device associated with a PCAN Channel.
Since the logical connection of PCAN-LAN device is done using routes, it is possible to configure channels to don’t transport data in a bidirectional way, like usual CAN devices.
It is available since version 4.9.0.
This parameter can only be read. It cannot be modified.
The information about the direction of the communication within a PCAN-LAN channel is returned as a numeric “flag” value, that matches the type LanDirection.
Important: The retrieved value must be converted to the LanDirection type. Example (C#): LanDirection direction = (LanDirection)uintBuffer;
Does not apply.
Get: It can be read on initialized or uninitialized PCAN Channels.
The following code shows how to retrieve the direction of the communication for a PCAN-LAN device:
PcanChannel channelUsed = PcanChannel.Lan01;
PcanStatus stsResult = Api.GetValue(channelUsed, PcanParameter.LanChannelDirection, out uint iChannelDirection);
if (stsResult == PcanStatus.OK)
{
if (((LanDirection)iChannelDirection & LanDirection.Write) == LanDirection.Write)
Console.WriteLine("The channel can forward messages to the PCAN-LAN device.");
else
Console.WriteLine("The channel CANNOT forward messages to the PCAN-LAN device.");
}
else
Console.WriteLine("Error! Could not get the direction information for channel 0x{0:X}.", channelUsed);Dim channelUsed As PcanChannel = PcanChannel.Lan01
Dim iChannelDirection As UInt32
Dim stsResult As PcanStatus = Api.GetValue(channelUsed, PcanParameter.LanChannelDirection, iChannelDirection)
If (stsResult = PcanStatus.OK) Then
If ((iChannelDirection And LanDirection.Write) = LanDirection.Write) Then
Console.WriteLine("The channel can forward messages to the PCAN-LAN device.")
Else
Console.WriteLine("The channel CANNOT forward messages to the PCAN-LAN device.")
End If
Else
Console.WriteLine("Error! Could not get the direction information for channel 0x{0:X}.", channelUsed)
End IfPcanChannel channelUsed = PcanChannel::Lan01;
UInt32 iChannelDirection;
PcanStatus stsResult = Api::GetValue(channelUsed, PcanParameter::LanChannelDirection, iChannelDirection);
if (stsResult == PcanStatus::OK)
{
if (((LanDirection)iChannelDirection & LanDirection::Write) == LanDirection::Write)
Console::WriteLine("The channel can forward messages to the PCAN-LAN device.");
else
Console::WriteLine("The channel CANNOT forward messages to the PCAN-LAN device.");
}
else
Console::WriteLine("Error! Could not get the direction information for channel 0x{0:X}.", channelUsed);