BitFlow.NET
Source code documentation of the BitFlow .NET interface.
CLComm.CLAllSerial Class Reference

C# Wrapper class around the clAllSerial functions. More...

Public Types

enum class  ErrorCodes { CL_ERR_NO_ERR = ManagedCLErrors.CLErrNoErr , CL_ERR_TIMEOUT = ManagedCLErrors.CLErrTimeout }
 Error codes used in CLAllSerial.

  • CL_ERR_NO_ERR – No errors.
  • CL_ERR_TIMEOUT – Timeout while reading characters.
More...
 
enum class  BFCLErrorCodes { BF_OK = ManagedBFCLReturnCodes.BFCLOk , BFCL_WARN_SIG_CANCEL = ManagedBFCLReturnCodes.BFCLWarnSigCancel }
 Error codes used by the BFSerial library.

  • BF_OK – No errors.
  • BFCL_WARN_SIG_CANCEL – BFSerialRead operation was canceled.
More...
 
enum class  Versions { CL_DLL_VERSION_NO_VERSION = 1 , CL_DLL_VERSION_1_0 = 2 , CL_DLL_VERSION_1_1 = 3 }
 Camera link versions.

  • CL_DLL_VERSION_NO_VERSION – Not a CL dll.
  • CL_DLL_VERSION_1_0 – Oct 2000 compliant.
  • CL_DLL_VERSION_1_1 – Oct 2001 compliant.
More...
 
enum class  BaudRates {
  CL_BAUDRATE_9600 = ManagedCLBaudRate.CLBaudRate9600 , CL_BAUDRATE_19200 = ManagedCLBaudRate.CLBaudRate19200 , CL_BAUDRATE_38400 = ManagedCLBaudRate.CLBaudRate38400 , CL_BAUDRATE_57600 = ManagedCLBaudRate.CLBaudRate57600 ,
  CL_BAUDRATE_115200 = ManagedCLBaudRate.CLBaudRate115200 , CL_BAUDRATE_230400 = ManagedCLBaudRate.CLBaudRate230400 , CL_BAUDRATE_460800 = ManagedCLBaudRate.CLBaudRate460800 , CL_BAUDRATE_921600 = ManagedCLBaudRate.CLBaudRate921600
}
 Camera link baud rates.

  • CL_BAUDRATE_9600 – 9600 baud
  • CL_BAUDRATE_19200 – 19200 baud
  • CL_BAUDRATE_38400 – 38400 baud
  • CL_BAUDRATE_57600 – 57600 baud
  • CL_BAUDRATE_115200 – 115200 baud
  • CL_BAUDRATE_230400 – 230400 baud
  • CL_BAUDRATE_460800 – 460800 buud
  • CL_BAUDRATE_921600 – 921600 baud
More...
 
enum class  DataBits { DataBits_5 = ManagedCLDataBits.CLDataBits5 , DataBits_6 = ManagedCLDataBits.CLDataBits6 , DataBits_7 = ManagedCLDataBits.CLDataBits7 , DataBits_8 = ManagedCLDataBits.CLDataBits8 }
 Camera link data bits. This is the number of bits for each character received or transmitted.

  • DataBits_5 – 5 bits
  • DataBits_6 – 6 bits
  • DataBits_7 – 7 bits
  • DataBits_8 – 8 bits
More...
 
enum class  Parity { ParityEven = ManagedCLParity.CLParityEven , ParityOdd = ManagedCLParity.CLParityOdd , ParityNone = ManagedCLParity.CLParityNone }
 Specifies the parity to be used if any. The parity can be set to one of the following:

  • ParityEven – Even parity.
  • ParityOdd – Odd parity.
  • ParityNone – No parity.
More...
 
enum class  StopBits { StopBits_1 = ManagedCLStopBits.CLStopBits1 , StopBits_15 = ManagedCLStopBits.CLStopBits15 , StopBits_2 = ManagedCLStopBits.CLStopBits2 }
 Specifies the number of stop bits transmitted and received in each serial character. The number of stop bits can be set to one of the following:

  • StopBits_1 – One stop bit.
  • StopBits_15 – One and a half stop bits.
  • StopBits_2 – Two stop bits.
More...
 

Public Member Functions

void SerialInit (uint SerialIndex)
 Initializes the device referred to by serialIndex. Only CL boards are considered a serial device. More...
 
void BFSerialInit (uint BoardIndex)
 Alternate initializer, initializing from a BitFlow board index, rather than from the CLSerial port index, which may or may not directly correspond. More...
 
void BFSWConnectorSerialInit (uint Switch, uint Connector)
 Alternate initializer, initializing from a BitFlow board switch and connector, rather than from the CLSerial port index, which may or may not directly correspond. More...
 
void GetBoardSWConnector (ref uint Switch, ref uint Connector)
 Return the BitFlow board's Switch and Connector for the currently Initialized port. This is only valid if initialized with More...
 
void SerialClose ()
 Closes the serial device and cleans up resources associated with it. Does nothing, if the device is not Initialized. More...
 
uint SerialWrite (string Message, uint SerialTimeout)
 This method writes a string of characters to the serial device. More...
 
ErrorCodes SerialWrite (byte[] Buffer, ref uint BufferSize, uint SerialTimeout)
 This method writes a data to the serial device. More...
 
uint SerialWrite (sbyte[] Buffer, uint SerialTimeout)
 This method writes a buffer of signed bytes to the serial device. More...
 
uint SerialWrite (byte[] Buffer, uint SerialTimeout)
 This method writes a buffer of unsigned bytes to the serial device. More...
 
string SerialRead (uint NumBytesToRead, uint SerialTimeout)
 Reads data from the serial device. More...
 
ErrorCodes SerialRead (byte[] Buffer, ref uint BufferSize, uint SerialTimeout)
 Reads data from the serial device. More...
 
sbyte[] SerialReadArray (uint NumBytesToRead, uint SerialTimeout)
 Reads data from the serial device and return it directly. More...
 
string SerialReadEx (uint NumBytesToRead, uint SerialTimeout)
 Reads data from the serial device. Returns data even on timeout. More...
 
string SerialReadEx (uint NumBytesToRead, uint SerialTimeout, out bool TimeoutExceeded)
 Reads data from the serial device. Returns data even on timeout. More...
 
ErrorCodes SerialReadEx (byte[] Buffer, ref uint BufferSize, uint SerialTimeout)
 Reads data from the serial device. Returns data even on timeout. More...
 
sbyte[] SerialReadArrayEx (uint NumBytesToRead, uint SerialTimeout)
 Reads data from the serial device and return it directly. Returns data even on timeout. More...
 
sbyte[] SerialReadArrayEx (uint NumBytesToRead, uint SerialTimeout, out bool TimeoutExceeded)
 Reads data from the serial device and return it directly. Returns data even on timeout. More...
 
void FlushPort ()
 Discards any bytes that are available in the input buffer. More...
 
uint GetNumBytesAvail ()
 Returns the number of bytes that are received, but not yet read out of the the serial device. More...
 
BaudRates GetSupportedBaudRates ()
 Returns the valid baud rates of the interface. The return value is represented as a bitfield with the bitfield values be as follows:
CL_BAUDRATE_9600 - bit 1
CL_BAUDRATE_19200 - bit 2
CL_BAUDRATE_38400 - bit 3
CL_BAUDRATE_57600 - bit 4
CL_BAUDRATE_115200 - bit 5
CL_BAUDRATE_230400 - bit 6
CL_BAUDRATE_460800 - bit 7
CL_BAUDRATE_921600 - bit 8
More...
 
void SetBaudRate (BaudRates BaudRate)
 Sets the Baud Rate for the serial port. More...
 
void BFSerialSettings (BaudRates baudRate, DataBits dataBits, Parity parity, StopBits stopBits)
 Set the BF CLSerial settings. More...
 
string BFSerialRead (uint MaxBytesToRead)
 Reads data from the serial device. This method will wait efficiently for data to become available on the port, then return that length of data. No more than MaxBytesToRead will be read at a time, but the length read may be less than that. More...
 
BFCLErrorCodes BFSerialRead (byte[] Buffer, ref uint BufferSize)
 Reads data from the serial device. This method will wait efficiently for data to become available on the port, then return that length of data. More...
 
sbyte[] BFSerialReadArray (uint MaxBytesToRead)
 Reads data from the serial device and return it directly. More...
 
void BFSerialCancelRead ()
 Cancel the active call to clBFSerialRead. More...
 
BaudRates BFGetBaudRate ()
 Return the current baud-rate of the CLSerial port. More...
 

Static Public Member Functions

static string GetErrorText (ErrorCodes ErrorCode)
 Converts an error code to error text which can be displayed in a dialog box or in the standard I/O window. More...
 
static uint GetNumPorts ()
 Returns the number of Camera Link serial ports in this machine that are supported by clallserial.dll. More...
 
static void GetPortInfo (uint SerialIndex, ref string ManufacturerName, ref string PortID, ref uint Version)
 This function provides information about the port specified by the serial index. More...
 
static void BFSVersion (ref UInt32 majorVersionRef, ref UInt32 minorVersionRef)
 Retrieve the version of the loaded BFS library. More...
 

Properties

bool Initialized [get]
 Retrieve the initialization status. More...
 
bool PortIsBF [get]
 Return the support status for the BitFlow CLSerial extensions. More...
 
uint PortIndex [get]
 Return the index of the currently Initialized port. This is only valid if initialized with the More...
 
uint BoardNumber [get]
 Return the BitFlow board number of the currently Initialized port. This is only valid if initialized with the More...
 
uint BoardSwitch [get]
 Retrieve the BitFlow board's Switch for the currently Initialized port. This is only valid if initialized with More...
 
uint BoardConnector [get]
 Retrieve the BitFlow board's Connector for the currently Initialized port. This is only valid if initialized with More...
 

Detailed Description

C# Wrapper class around the clAllSerial functions.

Member Enumeration Documentation

◆ BaudRates

Camera link baud rates.

  • CL_BAUDRATE_9600 – 9600 baud
  • CL_BAUDRATE_19200 – 19200 baud
  • CL_BAUDRATE_38400 – 38400 baud
  • CL_BAUDRATE_57600 – 57600 baud
  • CL_BAUDRATE_115200 – 115200 baud
  • CL_BAUDRATE_230400 – 230400 baud
  • CL_BAUDRATE_460800 – 460800 buud
  • CL_BAUDRATE_921600 – 921600 baud

Enumerator
CL_BAUDRATE_9600 
CL_BAUDRATE_19200 
CL_BAUDRATE_38400 
CL_BAUDRATE_57600 
CL_BAUDRATE_115200 
CL_BAUDRATE_230400 
CL_BAUDRATE_460800 
CL_BAUDRATE_921600 

◆ BFCLErrorCodes

Error codes used by the BFSerial library.

  • BF_OK – No errors.
  • BFCL_WARN_SIG_CANCEL – BFSerialRead operation was canceled.

Enumerator
BF_OK 
BFCL_WARN_SIG_CANCEL 

◆ DataBits

Camera link data bits. This is the number of bits for each character received or transmitted.

  • DataBits_5 – 5 bits
  • DataBits_6 – 6 bits
  • DataBits_7 – 7 bits
  • DataBits_8 – 8 bits

Enumerator
DataBits_5 
DataBits_6 
DataBits_7 
DataBits_8 

◆ ErrorCodes

Error codes used in CLAllSerial.

  • CL_ERR_NO_ERR – No errors.
  • CL_ERR_TIMEOUT – Timeout while reading characters.

Enumerator
CL_ERR_NO_ERR 
CL_ERR_TIMEOUT 

◆ Parity

Specifies the parity to be used if any. The parity can be set to one of the following:

  • ParityEven – Even parity.
  • ParityOdd – Odd parity.
  • ParityNone – No parity.

Enumerator
ParityEven 
ParityOdd 
ParityNone 

◆ StopBits

Specifies the number of stop bits transmitted and received in each serial character. The number of stop bits can be set to one of the following:

  • StopBits_1 – One stop bit.
  • StopBits_15 – One and a half stop bits.
  • StopBits_2 – Two stop bits.

Enumerator
StopBits_1 
StopBits_15 
StopBits_2 

◆ Versions

Camera link versions.

  • CL_DLL_VERSION_NO_VERSION – Not a CL dll.
  • CL_DLL_VERSION_1_0 – Oct 2000 compliant.
  • CL_DLL_VERSION_1_1 – Oct 2001 compliant.

Enumerator
CL_DLL_VERSION_NO_VERSION 
CL_DLL_VERSION_1_0 
CL_DLL_VERSION_1_1 

Member Function Documentation

◆ BFGetBaudRate()

BaudRates CLComm.CLAllSerial.BFGetBaudRate ( )

Return the current baud-rate of the CLSerial port.

Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown if an error occurs while reading the baud-rate.
System.NotSupportedExceptionThrown if the initialied port is not a BF port.

◆ BFSerialCancelRead()

void CLComm.CLAllSerial.BFSerialCancelRead ( )

Cancel the active call to clBFSerialRead.

Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown if an error occurs while canceling the read.
System.NotSupportedExceptionThrown if the initialied port is not a BF port.

◆ BFSerialInit()

void CLComm.CLAllSerial.BFSerialInit ( uint  BoardIndex)

Alternate initializer, initializing from a BitFlow board index, rather than from the CLSerial port index, which may or may not directly correspond.

Parameters
BoardIndexThe BitFlow board number who's CLSerial device we want to open. This is the index of the correspoding BitFlow board, and not necessarily the index used by the CLSerial library.
Exceptions
System.InvalidOperationExceptionThrown if a port has already been initailized.
System.ApplicationExceptionThrown when there is a problem initializing the serial device.
See also
SerialInit, BFSWConnectorSerialInit

◆ BFSerialRead() [1/2]

BFCLErrorCodes CLComm.CLAllSerial.BFSerialRead ( byte[]  Buffer,
ref uint  BufferSize 
)

Reads data from the serial device. This method will wait efficiently for data to become available on the port, then return that length of data.

Parameters
BufferPoints to a user-allocated buffer. Upon a successful call, contains the data read from the serial device.
BufferSizeAs an input parameter, BufferSize contains the buffer size to indicate the maximum number of bytes that the buffer can accomodate. Upon a successful call, BufferSize is the number of bytes that were read successfully from the serial device.
Returns
Will return one of the following return values:
BFCLErrorCodes.BF_OK - Function returned successfully.
BFCLErrorCodes.BFCL_WARN_SIG_CANCEL - Operation was canceled by the user.
Exceptions
System.ApplicationExceptionThrown when there is a problem reading from the serial device.
System.NotSupportedExceptionThrown if the initialied port is not a BF port.

◆ BFSerialRead() [2/2]

string CLComm.CLAllSerial.BFSerialRead ( uint  MaxBytesToRead)

Reads data from the serial device. This method will wait efficiently for data to become available on the port, then return that length of data. No more than MaxBytesToRead will be read at a time, but the length read may be less than that.

Parameters
MaxBytesToReadThe maximum number of bytes to be read from the serial device.
Returns
Returns the data read from the serial device as a string.
Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown when there is a problem reading from the serial device.
System.OperationCanceledExceptionThrown if the function is exiting because of a call to BFSerialCancelRead.
System.NotSupportedExceptionThrown if the initialied port is not a BF port.

◆ BFSerialReadArray()

sbyte [] CLComm.CLAllSerial.BFSerialReadArray ( uint  MaxBytesToRead)

Reads data from the serial device and return it directly.

Parameters
MaxBytesToReadThe maximum number of bytes to be read from the serial device.
Returns
The serial data read.
Exceptions
System.ApplicationExceptionThrown when there is a problem reading from the serial device.
System.InvalidOperationExceptionThrown if no port has been initailized.
System.OperationCanceledExceptionThrown if the function is exiting because of a call to BFSerialCancelRead.
System.NotSupportedExceptionThrown if the initialied port is not a BF port.

◆ BFSerialSettings()

void CLComm.CLAllSerial.BFSerialSettings ( BaudRates  baudRate,
DataBits  dataBits,
Parity  parity,
StopBits  stopBits 
)

Set the BF CLSerial settings.

Parameters
baudRateThe baud rate you want to use. Can be one of the following:
CL_BAUDRATE_9600
CL_BAUDRATE_19200
CL_BAUDRATE_38400
CL_BAUDRATE_57600
CL_BAUDRATE_115200
CL_BAUDRATE_230400
CL_BAUDRATE_460800
CL_BAUDRATE_921600
dataBitsThe number of data bits in each transmitted or received serial character. May be any of the following:
DataBits_5
DataBits_6
DataBits_7
DataBits_8
parityThe parity to be used if any. The parity can be set to one of the following:
ParityEven
ParityOdd
ParityNone
stopBitsSpecifies the number of stop bits transmitted and received in each serial character. The number of stop bits can be set to one of the following:
StopBits_1 - One stop bit.
StopBits_15 - One and a half stop bits.
StopBits_2 - Two stop bits.
Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown when there is a problem one or all of the settings.
System.NotSupportedExceptionThrown if the initialied port is not a BF port.

◆ BFSVersion()

static void CLComm.CLAllSerial.BFSVersion ( ref UInt32  majorVersionRef,
ref UInt32  minorVersionRef 
)
static

Retrieve the version of the loaded BFS library.

Parameters
majorVersionRefReturn reference for the major version.
minorVersionRefReturn reference for the minor version.
Exceptions
System.ApplicationExceptionThrown if an error occurs retrieving the library version.

◆ BFSWConnectorSerialInit()

void CLComm.CLAllSerial.BFSWConnectorSerialInit ( uint  Switch,
uint  Connector 
)

Alternate initializer, initializing from a BitFlow board switch and connector, rather than from the CLSerial port index, which may or may not directly correspond.

Parameters
SwitchThe switch setting of the BitFlow board who's CLSerial device we want to open.
ConnectorThe connector of the switched BitFlow board who's CLSerial device we want to open.
Exceptions
System.InvalidOperationExceptionThrown if a port has already been initailized.
System.ApplicationExceptionThrown when there is a problem initializing the serial device.
See also
SerialInit, BFSerialInit

◆ FlushPort()

void CLComm.CLAllSerial.FlushPort ( )

Discards any bytes that are available in the input buffer.

Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown when there is a problem flushing the serial device.

◆ GetBoardSWConnector()

void CLComm.CLAllSerial.GetBoardSWConnector ( ref uint  Switch,
ref uint  Connector 
)

Return the BitFlow board's Switch and Connector for the currently Initialized port. This is only valid if initialized with

BFSWConnectorSerialInit

Parameters
SwitchSet to the value of the initialized board's Switch.
ConnectorSet to the value of the initialized board's Connector.

BFSWConnectorSerialInit

See also
PortIndex, BoardNumber, BoardSwitch, BoardConnector

◆ GetErrorText()

static string CLComm.CLAllSerial.GetErrorText ( ErrorCodes  ErrorCode)
static

Converts an error code to error text which can be displayed in a dialog box or in the standard I/O window.

Parameters
ErrorCodeThe error code used to look up the appropriate error text.
Returns
Returns the error text assosiated with the error code.
Exceptions
System.ApplicationExceptionThrown when the error code could not be found.

◆ GetNumBytesAvail()

uint CLComm.CLAllSerial.GetNumBytesAvail ( )

Returns the number of bytes that are received, but not yet read out of the the serial device.

Returns
Returns the number of bytes that are received, but not yet read out of the the serial device.
Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown when an error occurs when trying to get the number of bytes available from the serial device.

◆ GetNumPorts()

static uint CLComm.CLAllSerial.GetNumPorts ( )
static

Returns the number of Camera Link serial ports in this machine that are supported by clallserial.dll.

Returns
Returns the number of Camera Link serial ports in this machine.
Exceptions
System.ApplicationExceptionThrown when there is a problem getting the number of CL serial devices.

◆ GetPortInfo()

static void CLComm.CLAllSerial.GetPortInfo ( uint  SerialIndex,
ref string  ManufacturerName,
ref string  PortID,
ref uint  Version 
)
static

This function provides information about the port specified by the serial index.

Parameters
SerialIndexZero-based index of the serial port you are finding the name for. Use GetNumSerialPorts to determine the valid range of serial index. This range will be 0 to number of serial ports - 1.
ManufacturerNameReturns the name of the manufacture for the serial index provided.
PortIDThe identifier for the port.
VersionThe version of the serial driver. Can be one of the following:
CL_DLL_VERSION_NO_VERSION

CL_DLL_VERSION_1_0

CL_DLL_VERSION_1_1

Exceptions
System.ApplicationExceptionThrown when there is a problem getting serial device information.

◆ GetSupportedBaudRates()

BaudRates CLComm.CLAllSerial.GetSupportedBaudRates ( )

Returns the valid baud rates of the interface. The return value is represented as a bitfield with the bitfield values be as follows:
CL_BAUDRATE_9600 - bit 1
CL_BAUDRATE_19200 - bit 2
CL_BAUDRATE_38400 - bit 3
CL_BAUDRATE_57600 - bit 4
CL_BAUDRATE_115200 - bit 5
CL_BAUDRATE_230400 - bit 6
CL_BAUDRATE_460800 - bit 7
CL_BAUDRATE_921600 - bit 8

Returns
Returns the valid baud rates of the interface.
Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown when an error occurs while getting the supported baud rates.

◆ SerialClose()

void CLComm.CLAllSerial.SerialClose ( )

Closes the serial device and cleans up resources associated with it. Does nothing, if the device is not Initialized.

◆ SerialInit()

void CLComm.CLAllSerial.SerialInit ( uint  SerialIndex)

Initializes the device referred to by serialIndex. Only CL boards are considered a serial device.

Parameters
SerialIndexThe serial device number to open. This is the CLSerial index, which may not correspond directly the the BitFlow board number. Use BFSerialInit, to initialize from a BitFlow board number.
Exceptions
System.InvalidOperationExceptionThrown if a port has already been initailized.
System.ApplicationExceptionThrown when there is a problem initializing the serial device.
See also
BFSerialInit, BFSWConnectorSerialInit

◆ SerialRead() [1/2]

ErrorCodes CLComm.CLAllSerial.SerialRead ( byte[]  Buffer,
ref uint  BufferSize,
uint  SerialTimeout 
)

Reads data from the serial device.

Parameters
BufferPoints to a user-allocated buffer. Upon a successful call, contains the data read from the serial device.
BufferSizeAs an input parameter, BufferSize contains the buffer size to indicate the maximum number of bytes that the buffer can accomodate. Upon a successful call, BufferSize is the number of bytes that were read successfully from the serial device.
SerialTimeoutIndicates the timeout value in miliseconds.
Returns
Will return one of the following return values:
ErrorCodes.CL_ERR_NO_ERR - Function returned successfully.
ErrorCodes.CL_ERR_TIMEOUT - Operation not completed within specified timeout period.
Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown when there is a problem reading from the serial device.

◆ SerialRead() [2/2]

string CLComm.CLAllSerial.SerialRead ( uint  NumBytesToRead,
uint  SerialTimeout 
)

Reads data from the serial device.

Parameters
NumBytesToReadThe number of bytes to be read from the serial device.
SerialTimeoutIndicates the timeout value in miliseconds.
Returns
Returns the data read from the serial device as a string.
Exceptions
System.ApplicationExceptionThrown when there is a problem reading from the serial device.
System.InvalidOperationExceptionThrown if no port has been initailized.
System.TimeoutExceptionThrown if the read operation times out.

◆ SerialReadArray()

sbyte [] CLComm.CLAllSerial.SerialReadArray ( uint  NumBytesToRead,
uint  SerialTimeout 
)

Reads data from the serial device and return it directly.

Parameters
NumBytesToReadThe number of bytes desired to read.
SerialTimeoutIndicates the timeout value in miliseconds.
Returns
The serial data read.
Exceptions
System.ApplicationExceptionThrown when there is a problem reading from the serial device.
System.InvalidOperationExceptionThrown if no port has been initailized.
System.TimeoutExceptionThrown if the read operation times out.

◆ SerialReadArrayEx() [1/2]

sbyte [] CLComm.CLAllSerial.SerialReadArrayEx ( uint  NumBytesToRead,
uint  SerialTimeout 
)

Reads data from the serial device and return it directly. Returns data even on timeout.

Parameters
NumBytesToReadThe number of bytes desired to read.
SerialTimeoutIndicates the timeout value in miliseconds.
Returns
The serial data read.
Exceptions
System.ApplicationExceptionThrown when there is a problem reading from the serial device.
System.InvalidOperationExceptionThrown if no port has been initailized.

◆ SerialReadArrayEx() [2/2]

sbyte [] CLComm.CLAllSerial.SerialReadArrayEx ( uint  NumBytesToRead,
uint  SerialTimeout,
out bool  TimeoutExceeded 
)

Reads data from the serial device and return it directly. Returns data even on timeout.

Parameters
NumBytesToReadThe number of bytes desired to read.
SerialTimeoutIndicates the timeout value in miliseconds.
TimeoutExceededOutput parameter indicating whether or not the read exceeded the SerialTimeout
Returns
The serial data read.
Exceptions
System.ApplicationExceptionThrown when there is a problem reading from the serial device.
System.InvalidOperationExceptionThrown if no port has been initailized.

◆ SerialReadEx() [1/3]

ErrorCodes CLComm.CLAllSerial.SerialReadEx ( byte[]  Buffer,
ref uint  BufferSize,
uint  SerialTimeout 
)

Reads data from the serial device. Returns data even on timeout.

Parameters
BufferPoints to a user-allocated buffer. Upon a successful call, contains the data read from the serial device.
BufferSizeAs an input parameter, BufferSize contains the buffer size to indicate the maximum number of bytes that the buffer can accomodate. Upon a successful call, BufferSize is the number of bytes that were read successfully from the serial device.
SerialTimeoutIndicates the timeout value in miliseconds.
Returns
Will return one of the following return values:
ErrorCodes.CL_ERR_NO_ERR - Function returned successfully.
ErrorCodes.CL_ERR_TIMEOUT - Operation not completed within specified timeout period.
Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown when there is a problem reading from the serial device.

◆ SerialReadEx() [2/3]

string CLComm.CLAllSerial.SerialReadEx ( uint  NumBytesToRead,
uint  SerialTimeout 
)

Reads data from the serial device. Returns data even on timeout.

Parameters
NumBytesToReadThe number of bytes to be read from the serial device.
SerialTimeoutIndicates the timeout value in miliseconds.
Returns
Returns the data read from the serial device as a string.
Exceptions
System.ApplicationExceptionThrown when there is a problem reading from the serial device.
System.InvalidOperationExceptionThrown if no port has been initailized.

◆ SerialReadEx() [3/3]

string CLComm.CLAllSerial.SerialReadEx ( uint  NumBytesToRead,
uint  SerialTimeout,
out bool  TimeoutExceeded 
)

Reads data from the serial device. Returns data even on timeout.

Parameters
NumBytesToReadThe number of bytes to be read from the serial device.
SerialTimeoutIndicates the timeout value in miliseconds.
TimeoutExceededOutput parameter indicating whether or not the read exceeded the SerialTimeout
Returns
Returns the data read from the serial device as a string.
Exceptions
System.ApplicationExceptionThrown when there is a problem reading from the serial device.
System.InvalidOperationExceptionThrown if no port has been initailized.

◆ SerialWrite() [1/4]

ErrorCodes CLComm.CLAllSerial.SerialWrite ( byte[]  Buffer,
ref uint  BufferSize,
uint  SerialTimeout 
)

This method writes a data to the serial device.

Parameters
BufferContains data to write to the serial port.
BufferSizeAs an input parameter, BufferSize contains the number of bytes of data in the buffer to write to the serial device. Upon a successful call, BufferSize contains the number of bytes that were written successfully to the serial device.
SerialTimeoutIndicates the timeout value in miliseconds.
Returns
Will return one of the following return values:
ErrorCodes.CL_ERR_NO_ERR - Function returned successfully.
ErrorCodes.CL_ERR_TIMEOUT - Operation not completed within specified timeout period.
Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown when there is a problem writing from the serial device.

◆ SerialWrite() [2/4]

uint CLComm.CLAllSerial.SerialWrite ( byte[]  Buffer,
uint  SerialTimeout 
)

This method writes a buffer of unsigned bytes to the serial device.

Parameters
BufferContains data to write to the serial port.
SerialTimeoutIndicates the timeout value in miliseconds.
Returns
The number of bytes written to the port.
Exceptions
System.ApplicationExceptionThrown when there is a problem writing from the serial device.
System.InvalidOperationExceptionThrown if no port has been initailized.
System.TimeoutExceptionThrown if the write operation times out.

◆ SerialWrite() [3/4]

uint CLComm.CLAllSerial.SerialWrite ( sbyte[]  Buffer,
uint  SerialTimeout 
)

This method writes a buffer of signed bytes to the serial device.

Parameters
BufferContains data to write to the serial port.
SerialTimeoutIndicates the timeout value in miliseconds.
Returns
The number of bytes written to the port.
Exceptions
System.ApplicationExceptionThrown when there is a problem writing from the serial device.
System.InvalidOperationExceptionThrown if no port has been initailized.
System.TimeoutExceptionThrown if the write operation times out.

◆ SerialWrite() [4/4]

uint CLComm.CLAllSerial.SerialWrite ( string  Message,
uint  SerialTimeout 
)

This method writes a string of characters to the serial device.

Parameters
MessageThe string message to send to the serial device.
SerialTimeoutIndicates the timeout value in miliseconds.
Returns
The number of bytes written to the port.
Exceptions
System.ApplicationExceptionThrown when there is a problem writing from the serial device.
System.InvalidOperationExceptionThrown if no port has been initailized.
System.TimeoutExceptionThrown if the write operation times out.

◆ SetBaudRate()

void CLComm.CLAllSerial.SetBaudRate ( BaudRates  BaudRate)

Sets the Baud Rate for the serial port.

Parameters
BaudRateThe baud rate you want to use. Can be one of the following:
CL_BAUDRATE_9600
CL_BAUDRATE_19200
CL_BAUDRATE_38400
CL_BAUDRATE_57600
CL_BAUDRATE_115200
CL_BAUDRATE_230400
CL_BAUDRATE_460800
CL_BAUDRATE_921600
Exceptions
System.InvalidOperationExceptionThrown if no port has been initailized.
System.ApplicationExceptionThrown when an error occurs when setting the baud rate.

Property Documentation

◆ BoardConnector

uint CLComm.CLAllSerial.BoardConnector
get

Retrieve the BitFlow board's Connector for the currently Initialized port. This is only valid if initialized with

BFSWConnectorSerialInit

Returns

BFSWConnectorSerialInit

See also
PortIndex, BoardNumber, GetBoardSWConnector, BoardSwitch

◆ BoardNumber

uint CLComm.CLAllSerial.BoardNumber
get

Return the BitFlow board number of the currently Initialized port. This is only valid if initialized with the

BFSerialInit method.

Returns
The index of the currently Initialized port.
Exceptions
System.ApplicationExceptionThrown if the port is not currently Initialized.

BFSerialInit

See also
PortIndex, GetBoardSWConnector, BoardSwitch, BoardConnector

◆ BoardSwitch

uint CLComm.CLAllSerial.BoardSwitch
get

Retrieve the BitFlow board's Switch for the currently Initialized port. This is only valid if initialized with

BFSWConnectorSerialInit

Returns

BFSWConnectorSerialInit

See also
PortIndex, BoardNumber, GetBoardSWConnector, BoardConnector

◆ Initialized

bool CLComm.CLAllSerial.Initialized
get

Retrieve the initialization status.

Returns
True if the port is currently Initialized, false otherwise.

◆ PortIndex

uint CLComm.CLAllSerial.PortIndex
get

Return the index of the currently Initialized port. This is only valid if initialized with the

SerialInit method.

Returns
The index of the currently Initialized port.
Exceptions
System.ApplicationExceptionThrown if the port is not currently Initialized.

SerialInit

See also
BoardNumber, GetBoardSWConnector, BoardSwitch, BoardConnector

◆ PortIsBF

bool CLComm.CLAllSerial.PortIsBF
get

Return the support status for the BitFlow CLSerial extensions.

Returns
True if the initialized port supports the BitFlow CLSerial extension, false otherwise.

The documentation for this class was generated from the following file: