Important
The retrieved value must be converted to the ChannelCondition type. Example (C#): ChannelCondition condition = (ChannelCondition)uintBuffer;
This parameter is used to identify the state of use of a PCAN Channel by returning a flag value. For example, a connection is only possible when a PCAN Channel is available, which means:
It is valid: The PCAN Channel is one of the listed in the section "Supported By" below.
It is present: The hardware associated to a PCAN Channel is attached to the PC, recognized and registered by the device driver.
It is connectible: The PCAN Channel is not yet initialized, or it is currently connected by a PCAN-View application.
This parameter is useful when the availability status of a channel registered in a system at a given time must be known.
Available since PCAN-Basic version 1.0.0. Nevertheless, usability improved significantly since version 1.0.4, due to bug fixes.
The behavior of this parameter was modified with the version 4.0.0.
This parameter can only be retrieved. It cannot be modified.
The information about the condition of a Channel is returned as a numeric value, that matches the type ChannelCondition.
Does not apply.
Get: Not relevant, since this parameter is used to ask the status of a PCAN Channel.
The following code shows how to ask the condition of 4 PCI Channels:
PcanChannel[] channelsToCheck = { PcanChannel.Pci01, PcanChannel.Pci02, PcanChannel.Pci03, PcanChannel.Pci04 };
uint buffer;
for (int i = 0; i < 4; i++)
{
if (Api.GetValue(channelsToCheck[i], PcanParameter.ChannelCondition, out buffer) == PcanStatus.OK)
{
ChannelCondition condition = (ChannelCondition)buffer;
if ((condition & ChannelCondition.ChannelAvailable) == ChannelCondition.ChannelAvailable)
Console.WriteLine($"The Channel {channelsToCheck[i]} is available.");
else
Console.WriteLine($"The Channel {channelsToCheck[i]} is NOT available.");
}
}Dim channelsToCheck As PcanChannel() = {PcanChannel.Pci01, PcanChannel.Pci02, PcanChannel.Pci03, PcanChannel.Pci04}
Dim buffer As UInteger
For i = 0 To 3
If Api.GetValue(channelsToCheck(i), PcanParameter.ChannelCondition, buffer) = PcanStatus.OK Then
Dim condition As ChannelCondition = CType(buffer, ChannelCondition)
If (condition And ChannelCondition.ChannelAvailable) = ChannelCondition.ChannelAvailable Then
Console.WriteLine($"The Channel {channelsToCheck(i)} is available.")
Else
Console.WriteLine($"The Channel {channelsToCheck(i)} is NOT available.")
End If
End If
Nextarray<PcanChannel>^ channelsToCheck = { PcanChannel::Pci01, PcanChannel::Pci02, PcanChannel::Pci03, PcanChannel::Pci04 };
UInt32 buffer;
for (int i = 0; i < 4; i++)
{
if (Api::GetValue(channelsToCheck[i], PcanParameter::ChannelCondition, buffer) == PcanStatus::OK)
{
ChannelCondition condition = (ChannelCondition)buffer;
if ((condition & ChannelCondition::ChannelAvailable) == ChannelCondition::ChannelAvailable)
Console::WriteLine("The Channel {0} is available.", channelsToCheck[i]);
else
Console::WriteLine("The Channel {0} is NOT available.", channelsToCheck[i]);
}
}