BFModule.CLComm.clsCLAllSerial#

class BFModule.CLComm.clsCLAllSerial#

Bases: pybind11_object

Python Wrapper class around the clAllSerial functions.

__init__(self: BFModule.CLComm.clsCLAllSerial) None#

Methods

GetNumBytesAvailable(self)

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

SerialClose(self)

Closes the serial device and cleans up resources associated with it.

SerialInit(*args, **kwargs)

Overloaded function.

SerialRead(self, NumBytesToRead, SerialTimeout)

Reads data from the serial device.

SerialSettings(self, dataBits, parity, ...)

Reconfigure the serial port.

SerialWrite(self, message)

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

SetBaudRate(self, baudRate)

Query the board number of the opened CXP register device.

__init__(self)

GetNumBytesAvailable(self: BFModule.CLComm.clsCLAllSerial) int#

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

Return type:

int

Returns:

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

Raises:
  • ValueError – if the board is not a CXP device.

  • RuntimeError – if timed out waiting for acknowledgement.

  • RuntimeError – if error code in acknowledgement from camera.

SerialClose(self: BFModule.CLComm.clsCLAllSerial) None#

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

Return type:

void

SerialInit(*args, **kwargs)#

Overloaded function.

  1. SerialInit(self: BFModule.CLComm.clsCLAllSerial, parity: BFModule.CLComm.Parity = <Parity.None: 0>, stopBits: BFModule.CLComm.StopBits = <StopBits.SB1: 1>, baudRate: BFModule.CLComm.BaudRates = <BaudRates.CLBaudRate9600: 1>, dataBits: int = 8) -> None

    Opens the board select dialog, and initializes the chosen device.

    Parameters:
    • parity (Parity) - Parity. Default - Parity.None. (Optional)

    Parameters:
    • stopBits (StopBits) - Stop Bits. Default = StopBits.SB1. (Optional)

    Parameters:
    • baudRate (BaudRate) - Baudrate to set. Default = BaudRates.CLBaudRate9600. (Optional)

    Parameters:
    • dataBits (DataBits) - Data Bits. Default = 8. (Optional)

    Return Type:

    void

    Raises:
    • ValueError - Not a valid index.

    • ValueError - The serial device specified by serialIndex was not found.

  2. SerialInit(self: BFModule.CLComm.clsCLAllSerial, sNdx: int, parity: BFModule.CLComm.Parity = <Parity.None: 0>, stopBits: BFModule.CLComm.StopBits = <StopBits.SB1: 1>, baudRate: BFModule.CLComm.BaudRates = <BaudRates.CLBaudRate9600: 1>, dataBits: int = 8) -> None

    Opens the board with the given index.

    Parameters:
    • sNdx (int) - Device Index.

    Parameters:
    • parity (Parity) - Parity. Default - Parity.None. (Optional)

    Parameters:
    • stopBits (StopBits) - Stop Bits. Default = StopBits.SB1. (Optional)

    Parameters:
    • baudRate (BaudRate) - Baudrate to set. Default = BaudRates.CLBaudRate9600. (Optional)

    Parameters:
    • dataBits (DataBits) - Data Bits. Default = 8. (Optional)

    Return Type:

    void

SerialRead(self: BFModule.CLComm.clsCLAllSerial, NumBytesToRead: int, SerialTimeout: int) str#

Reads data from the serial device.

Parameters:
  • NumBytesToRead (int) – The number of bytes to be read from the serial device.

  • SerialTimeout (int) – Indicates the timeout value in miliseconds.

Return type:

str

Returns:

Returns the data read from the serial device as a string.

Raises:
  • ValueError – The serial reference is not valid.

  • ValueError – A NULL pointer was passed into the function.

  • RuntimeError – The timeout has elapsed.

  • RuntimeError – Error with the receiver FIFO during initialization.

SerialSettings(self: BFModule.CLComm.clsCLAllSerial, dataBits: int, parity: int, stopBits: int, baudRate: int) None#

Reconfigure the serial port.

Parameters:
  • dataBits – (DataBits) The serial device number to open.

  • parity – (Parity) The serial device number to open.

  • baudRate – (BaudRates) The baud rate you want to use.

Param stopBits:

(StopBits) - The serial device number to open.

Return type:

void

Raises:
  • ValueError – if the board is not a CXP device.

  • RuntimeError – if timed out waiting for acknowledgement.

  • RuntimeError – if error code in acknowledgement from camera.

SerialWrite(self: BFModule.CLComm.clsCLAllSerial, message: str) int#

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

Parameters:

message (str) – The string message to send to the serial device. Can be a byte array for writing DEC/HEX data.

Return type:

int

Returns:

The number of bytes written to the port.

SetBaudRate(self: BFModule.CLComm.clsCLAllSerial, baudRate: BFModule.CLComm.BaudRates) None#

Query the board number of the opened CXP register device.

Parameters:

baudRate – (BaudRates) The baud rate you want to use.

Return type:

void

Raises:
  • ValueError – if the board is not a CXP device.

  • RuntimeError – if timed out waiting for acknowledgement.

  • RuntimeError – if error code in acknowledgement from camera.