LanChannelDirection

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.

  Caution

The Virtual PCAN-Gateway product is available only for Windows systems. It is not supported under Linux.

Availability

It is available since version 4.9.0.

Supported By

Access Mode

This parameter can only be read. It cannot be modified.

Possible Values

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;

Default Value

Does not apply.

Initialization Status

Get: It can be read on initialized or uninitialized PCAN Channels.

Example

The following code shows how to retrieve the direction of the communication for a PCAN-LAN device:

C#
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);

See Also