Skip to content

Interface Class#

Provides convenient access to an interface.

Inheritance Hierarchy#

System.Object
  Basler.Pylon.Interface

Syntax#

C#

public class Interface : IInterface

VB

Public Class Interface
    Implements IInterface

The Interface type exposes the following members.

Constructors#

NameDescription
Public methodInterface Creates a specific interface using information given in the interfaceInfo parameter.
 

Properties#

NameDescription
Public propertyInterfaceInfo Provides access to interface information.
Public propertyIsOpen Indicates if interface object has been opened.
Public propertyParameters Returns the parameter collection of the interface for accessing all parameters. Example: interface.Parameters[PLInterface.InterfaceType].GetValue();
 

Methods#

NameDescription
Public methodClose Closes an interface.
Public methodDispose Releases all resources used by the Interface
Public methodEnumerateCameras Retrieves information about cameras connected to the interface.
Public methodOpen Opens an interface.
 

Events#

NameDescription
Public eventInterfaceClosed Occurs after the interface has been closed.
Public eventInterfaceClosing Occurs before the interface is closed.
Public eventInterfaceOpened Occurs after the interface has been opened successfully via Open().
Public eventInterfaceOpening Occurs before the interface is opened via Open().
 

Remarks#

An interface is used to represent a frame grabber board, a network card, etc. Currently, this object type is mainly used for the pylon GenTL Consumer Transport Layer, e.g., for CoaXPress. All other pylon transport layers currently return one default interface. The 'open' status of an interface instance won't change even if an attached camera is used, e.g., opened or closed.

Interface.InterfaceClosed Event#

Occurs after the interface has been closed.

Syntax#

C#

public virtual event EventHandler<EventArgs> InterfaceClosed

VB

Public Overridable Event InterfaceClosed As EventHandler(Of EventArgs)

Value#

Type: System.EventHandler(EventArgs)

Implements#

IInterface.InterfaceClosed

Remarks#

During the execution of this event, the interface is already closed.

If an event handler throws an exception, it will be ignored and the remaining handlers will be called.

This event is fired inside the lock of the interface instance.

Interface.InterfaceClosing Event#

Occurs before the interface is closed.

Syntax#

C#

public virtual event EventHandler<EventArgs> InterfaceClosing

VB

Public Overridable Event InterfaceClosing As EventHandler(Of EventArgs)

Value#

Type: System.EventHandler(EventArgs)

Implements#

IInterface.InterfaceClosing

Remarks#

If the interface is closed properly, the interface is still open during the execution of this event.

If an event handler throws an exception, it will be ignored and the remaining handlers will be called.

This event is fired inside the lock of the interface instance.

Interface.InterfaceOpened Event#

Occurs after the interface has been opened successfully via Open().

Syntax#

C#

public virtual event EventHandler<EventArgs> InterfaceOpened

VB

Public Overridable Event InterfaceOpened As EventHandler(Of EventArgs)

Value#

Type: System.EventHandler(EventArgs)

Implements#

IInterface.InterfaceOpened

Remarks#

During the execution of this event, the interface is already open.

If an event handler called by this event throws an exception, the interface will be closed and the exception will be propagated to the caller of Open(). No other handlers will be called.

This event is fired inside the lock of the interface instance.

Interface.InterfaceOpening Event#

Occurs before the interface is opened via Open().

Syntax#

C#

public virtual event EventHandler<EventArgs> InterfaceOpening

VB

Public Overridable Event InterfaceOpening As EventHandler(Of EventArgs)

Value#

Type: System.EventHandler(EventArgs)

Implements#

IInterface.InterfaceOpening

Remarks#

During the execution of this event, the interface is not yet open.

If an event handler called by this event throws an exception, it will be propagated to the caller of Open(). No other handlers will be called.

This event is fired inside the lock of the interface instance.

Interface.Close Method#

Closes an interface.

Syntax#

C#

public virtual void Close()

VB

Public Overridable Sub Close

Implements#

IInterface.Close()

Remarks#

 

  • If the interface has been already closed, the function returns successfully.
  • The OnClose event is raised. If any event handler throws an exception it will be ignored and the next event handler will be called.
  • The interface is closed.
  • The OnClosed event is raised. If any event handler throws an exception it will be ignored and the next event handler will be called.
  Thread Safety: This method is synchronized with the lock of the interface object.

Error Safety: Does not throw exceptions.

Interface.Dispose Method#

Releases all resources used by the Interface

Syntax#

C#

public void Dispose()

VB

Public Sub Dispose

Interface.EnumerateCameras Method#

Retrieves information about cameras connected to the interface.

Syntax#

C#

public virtual List<ICameraInfo> EnumerateCameras()

VB

Public Overridable Function EnumerateCameras As List(Of ICameraInfo)

Return Value#

Type: List(ICameraInfo)
Returns a list of ICameraInfo objects, one for each camera found. The list is ordered by serial number.

Implements#

IInterface.EnumerateCameras()

Remarks#

The function queries for camera devices connected to the interface and returns a list of ICameraInfo objects describing the cameras. The returned information can be used to create a specific Camera object.

Thread Safety: This method is synchronized with the lock of the interface object.

Error Safety: Can throw exceptions.

Interface.Open Method#

Opens an interface.

Syntax#

C#

public virtual IInterface Open()

VB

Public Overridable Function Open As IInterface

Return Value#

Type: IInterface
Returns a reference to the opened interface.

Implements#

IInterface.Open()

Remarks#

 

  • If the interface is already open, the function returns successfully.
  • The InterfaceOpening event is fired. The notification of event handlers stops in case any eventhandler throws an exception.
  • The the interface is opened.
  • The InterfaceOpened event is fired if the interface object has been opened successfully. The notification of event handlers stops in case any eventhandler throws an exception.
  Opening the interface may fail if the interface has been already opened by another instance.

Thread Safety: This method is synchronized with the lock of the interface object.

Error Safety: Can throw exceptions if the interface cannot be opened successfully or if any of the event handlers throws an exception.

Interface Constructor#

Creates a specific interface using information given in the interfaceInfo parameter.

Syntax#

C#

public Interface(
    IInterfaceInfo interfaceInfo
)

VB

Public Sub New ( 
    interfaceInfo As IInterfaceInfo
)

Parameters#

 

interfaceInfo
Type: Basler.Pylon.IInterfaceInfo
Contains the exact properties of the interface to be created. You can retrieve interface infos by calling Enumerate()

Remarks#

Use this constructor to create a specific interface using information returned by Enumerate(). If no interface is found, an exception is thrown.

Error Safety:Can throw exceptions.

Interface.InterfaceInfo Property#

Provides access to interface information.

Syntax#

C#

public virtual IInterfaceInfo InterfaceInfo { get; }

VB

Public Overridable ReadOnly Property InterfaceInfo As IInterfaceInfo
    Get

Return Value#

Type: IInterfaceInfo
Returns information about the interface.

Implements#

IInterface.InterfaceInfo

Remarks#

Returns the interface information collection containing detailed interface information, e.g. interface ID or interface type. This information can be read at all times regardless of whether the interface is open or closed.

Thread Safety: This method is synchronized with the lock of the interface object.

Error Safety: Does not throw exceptions.

Interface.IsOpen Property#

Indicates if interface object has been opened.

Syntax#

C#

public virtual bool IsOpen { get; }

VB

Public Overridable ReadOnly Property IsOpen As Boolean
    Get

Return Value#

Type: Boolean
Returns true if interface object has been opened.

Implements#

IInterface.IsOpen

Remarks#

The 'open' status of an interface instance won't change even if an attached camera is used, e.g., opened or closed.

The interface object will not automatically close itself if the interface is disconnected, e.g., if the interface is physically removed from the PC.

Thread Safety: This method is synchronized with the lock of the interface object.

Error Safety: Does not throw exceptions.

Interface.Parameters Property#

Returns the parameter collection of the interface for accessing all parameters. Example: interface.Parameters[PLInterface.InterfaceType].GetValue();

Syntax#

C#

public virtual IParameterCollection Parameters { get; }

VB

Public Overridable ReadOnly Property Parameters As IParameterCollection
    Get

Return Value#

Type: IParameterCollection
Returns the parameter collection of the interface.

Implements#

IInterface.Parameters

Remarks#

You can use the parameter collection to configure the interface through parameters. You can access parameters by their name or predefined parameter lists. Currently, this object type is mainly used for the pylon GenTL Consumer Transport Layer, e.g., for CoaXPress. All other pylon transport layers currently return one default interface which will have an empty parameter collection.

There is one predefined parameter list available: PLInterface For more information about the parameters, see the documentation for the parameter list.

Precondition for accessing the parameters:
The interface is opened.

You can access parameters by passing a key from a parameter list to the index operator, e.g. C#

interface.Parameters[PLInterface.InterfaceType].GetValue();

Thread Safety: This method is synchronized with the lock of the interface object.

Error Safety: Does not throw exceptions.