CLProtocol  3.5.1
Public Member Functions | List of all members
CCLPort Class Reference

Wraps a CameraLink protocol DLL and implements the IPort and the ISerial interfaceThe class dynamically loads a protocol driver DLL and binds it to a given port. It implements the IPort and the ISerial interface. More...

Inherits CPortImpl, and ISerial.

Public Member Functions

CLINT32 GetEvent (void *buffer, CLUINT32 *bufferSize)
 We can get event data. More...
 
IPort interface
virtual GENAPI_NAMESPACE::EAccessMode GetAccessMode () const
 Get the access mode of the node.
 
virtual void Read (void *pBuffer, int64_t Address, int64_t Length)
 Reads a chunk of bytes from the port.
 
virtual void Write (const void *pBuffer, int64_t Address, int64_t Length)
 Writes a chunk of bytes to the port.
 
virtual GENAPI_NAMESPACE::EInterfaceType GetPrinicipalInterfaceType () const
 We are an IPort interface.
 
ISerial interface
virtual CLINT32 CLPROTOCOL clSerialRead (CLINT8 *buffer, CLUINT32 *bufferSize, CLUINT32 serialTimeOut)
 calls clSerialRead as defined by the camera link standard More...
 
virtual CLINT32 CLPROTOCOL clSerialWrite (CLINT8 *buffer, CLUINT32 *bufferSize, CLUINT32 serialTimeOut)
 calls clSerialWrite as defined by the camera link standard More...
 
virtual CLINT32 CLPROTOCOL clGetSupportedBaudRates (CLUINT32 *baudRates)
 returns the valid baud rates of the current interface. More...
 

Device discovery and binding

static void GetPortIDs (GENAPI_NAMESPACE::StringList_t &PortIDs)
 Retrieves a list of PortIDs which can be used to create a corresponding port object. More...
 
static ISerialAdapter * GetPort (const GENICAM_NAMESPACE::gcstring &PortID)
 Gets a SerialAdapter port. More...
 
static void GetDeviceIDTemplates (GENICAM_NAMESPACE::gcstring_vector &DeviceIDTemplates)
 Retrieves a list of DeviceID templates. More...
 
static GENICAM_NAMESPACE::gcstring ProbeDevice (const GENICAM_NAMESPACE::gcstring &PortID, const GENICAM_NAMESPACE::gcstring &strDeviceIDTemplate, const CLUINT32 SerialTimeout=500)
 Connects a camera and retrieves all information required for the DeviceID. More...
 
static void StopProbing (CLUINT32 toStop)
 Stop all running ProbeDevice.
 
static GENICAM_NAMESPACE::gcstring RegisterSerial (const GENICAM_NAMESPACE::gcstring &PortName, ISerialAdapter *pSerialAdapter)
 Register a custom serial port. More...
 
static void UnRegisterSerials ()
 Unregister all resource related to serial port.
 
static void Terminate ()
 Cleans up static variables.
 
static void UnRegisterSerial (const GENICAM_NAMESPACE::gcstring &PortID)
 Unregister serial serial port. More...
 
void Connect (const GENICAM_NAMESPACE::gcstring &PortID, const GENICAM_NAMESPACE::gcstring &strDeviceID)
 Creates a port object for a given PortID and DeviceID. More...
 
bool Connect (const GENICAM_NAMESPACE::gcstring &PortID)
 Creates a port object for a given PortID taking the DeviceID from a internal cache. More...
 
void GetXMLIDs (GENICAM_NAMESPACE::gcstring_vector &XMLIDs)
 Retrieves a list of XMLID strings. More...
 
GENICAM_NAMESPACE::gcstring GetXML (GENICAM_NAMESPACE::gcstring XMLID, const bool UseMaxBaudrate=true)
 Retrieves an GenApi XML description either from the DLL or the file system. More...
 
void DeleteXMLDownload (GENICAM_NAMESPACE::gcstring XMLID)
 Delete the device xml file from the download folder if the file was downloaded for the camera. More...
 
GENICAM_NAMESPACE::gcstring GetXML (const bool UseMaxBaudrate=true)
 Retrieves the best matching GenApi XML description either from the DLL or the file system. More...
 
GENICAM_NAMESPACE::gcstring MakeURLfromXMLID (GENICAM_NAMESPACE::gcstring &XMLID)
 Creates a file URL for a given XML ID. More...
 

Creation and parameterizing

static void SetDefaultLogLevel (const CLP_LOG_LEVEL_VALUE logLever)
 Set log level that is assigned to the device protocol when the dll is loaded.
 
static void StorePortIDDeviceIDPairs (GENICAM_NAMESPACE::gcstring_vector &PortIDs, GENICAM_NAMESPACE::gcstring_vector &DeviceIDs)
 Stores a PortID/DeviceID pair.
 
static void RetrievePortIDDeviceIDPairs (GENICAM_NAMESPACE::gcstring_vector &PortIDs, GENICAM_NAMESPACE::gcstring_vector &DeviceIDs)
 Retrieves a PortID/DeviceID pair.
 
 CCLPort ()
 Public constructor.
 
virtual ~CCLPort ()
 Public destructor.
 
void SetSerialTimeOut (const CLUINT32 Timeout)
 Sets the timeout for operations on the serial port. More...
 
CLUINT32 GetSerialTimeOut () const
 Gets the timeout for operations on the serial port.
 
GENICAM_NAMESPACE::gcstring GetDeviceID () const
 Returns the Device ID the object has been created with.
 
void SetProtocolLogLevel (const CLP_LOG_LEVEL_VALUE logLever)
 Set device protocol log lever.
 
void SetDeviceBauderate (const CLUINT32 baudrate)
 Set device bauderate using one of the CL_BAUDRATE_XXXX value.
 
CLUINT32 GetDeviceBauderate ()
 Returns the current device bauderate, using one of the CL_BAUDRATE_XXXX value.
 
CLUINT32 SupportedBaudrates ()
 Sed supported bauderates of the combined device and host interface.
 

Detailed Description

The class can enumerate

Member Function Documentation

◆ GetPortIDs()

static void GetPortIDs ( GENAPI_NAMESPACE::StringList_t &  PortIDs)
static
Parameters
[out]PortIDsA list of PortIDs which each has the form 'ManufacturerName::PortName'

◆ GetPort()

static ISerialAdapter* GetPort ( const GENICAM_NAMESPACE::gcstring &  PortID)
static
Parameters
[in]PortIDPortID of the serial port
Returns
ISerialAdapter interface belonging to the PortID; NULL if PortID is not valid

◆ GetDeviceIDTemplates()

static void GetDeviceIDTemplates ( GENICAM_NAMESPACE::gcstring_vector &  DeviceIDTemplates)
static

Retrieves all DLLs found in the subdirectories of , loads the dlls, asks them for their supported DeviceIDTemplates, and returns a list of the combined DeviceIDTemplate strings of all dlls.

Parameters
[out]DeviceIDTemplatesA list of DeviceID templates

◆ ProbeDevice()

static GENICAM_NAMESPACE::gcstring ProbeDevice ( const GENICAM_NAMESPACE::gcstring &  PortID,
const GENICAM_NAMESPACE::gcstring &  strDeviceIDTemplate,
const CLUINT32  SerialTimeout = 500 
)
static

Connects the camera with 9600 Baud (= CL standard baud rate after power up) and identifies the camera attached to the port given by PortID. The DeviceIDTemplate helps with the identification whose result is returned as DeviceID.

Parameters
[in]PortIDIdentifies the port the camera to be probed is connected to
[in]strDeviceIDTemplateThe DeviceID templates helping the protocol driver dll to identify the camera
[in]SerialTimeoutThe timeout in milliseconds when probing the port (see SetSerialTimeOut).
Returns
A DeviceID containing a unique description of the camera found. If the DeviceID is an empty string no device was found.

◆ RegisterSerial()

static GENICAM_NAMESPACE::gcstring RegisterSerial ( const GENICAM_NAMESPACE::gcstring &  PortName,
ISerialAdapter *  pSerialAdapter 
)
static
Parameters
[in]PortNameIdentifies the port to use for connection.
[in]pSerialAdapterAn interface that allow CCLPort to access the serial port.
Returns
PortID a portId of the form "Local#<PortName>"

◆ UnRegisterSerial()

static void UnRegisterSerial ( const GENICAM_NAMESPACE::gcstring &  PortID)
static
Parameters
[in]PortIDIdentifies the port that need to be disconnected

◆ Connect() [1/2]

void Connect ( const GENICAM_NAMESPACE::gcstring &  PortID,
const GENICAM_NAMESPACE::gcstring &  strDeviceID 
)
Parameters
[in]PortIDIdentifies the port to use for connection.
[in]strDeviceIDIdentifies the device to connect. Can be optionally a DeviceID template.

◆ Connect() [2/2]

bool Connect ( const GENICAM_NAMESPACE::gcstring &  PortID)
Parameters
[in]PortIDIdentifies the port to use for connection.
Returns
false, if the cache doesn't contain a DeviceID for the PortID; true, if the cache contains a corresponding DeviceID and if a matching device is connected Throws an exception if there is a cache entry but no matching device is connected

◆ GetXMLIDs()

void GetXMLIDs ( GENICAM_NAMESPACE::gcstring_vector &  XMLIDs)

Retrieves a list of XML IDs from the file system and the CLProtocol.dll which in turn may ask the camera, e.g. by reading a Manifest register

The list contains only XML ID which would match the DeviceID and whose schema version can be interpreted by the current GenICam version.

The XML ID are order best matching first.

Parameters
[out]XMLIDsA list of XML IDs templates

◆ GetXML() [1/2]

GENICAM_NAMESPACE::gcstring GetXML ( GENICAM_NAMESPACE::gcstring  XMLID,
const bool  UseMaxBaudrate = true 
)
Parameters
[in]XMLIDThe XML ID identifying the XML file whose data is to be received
[in]UseMaxBaudrateif true the baud rate is set to maximum while downloading the XML file and reset afterwards
Returns
GenApi compliant camera XML description code ready to instantiate a node map.

◆ DeleteXMLDownload()

void DeleteXMLDownload ( GENICAM_NAMESPACE::gcstring  XMLID)

This can be use to remove a corrupted file. File can easily be corrupted if the download is aborted.

Parameters
[in]XMLIDThe XML ID identifying the XML file whose data is to be received

◆ GetXML() [2/2]

GENICAM_NAMESPACE::gcstring GetXML ( const bool  UseMaxBaudrate = true)
Parameters
[in]UseMaxBaudrateif true the baud rate is set to maximum while downloading the XML file and reset afterwards
Returns
GenApi compliant camera description code ready to instantiate a node map.

◆ MakeURLfromXMLID()

GENICAM_NAMESPACE::gcstring MakeURLfromXMLID ( GENICAM_NAMESPACE::gcstring &  XMLID)

The URL has the following format: "file:///filepath.xml"

Returns
file URL to a XML file as described in the GenTL module

◆ SetSerialTimeOut()

void SetSerialTimeOut ( const CLUINT32  Timeout)
Parameters
[in]TimeoutTimeout in [ms] for operations on the serial port.

◆ GetEvent()

CLINT32 GetEvent ( void *  buffer,
CLUINT32 *  bufferSize 
)
Parameters
bufferPoints to a user-allocated buffer. Upon a successful call, buffer contains the data read from the serial device. Upon failure, this buffer is not affected. if buffersize is too small result is CL_ERR_BUFFER_TOO_SMALL.
bufferSizeinput is the size of the buffer, output is the size of event data in buffer.

◆ clSerialRead()

virtual CLINT32 CLPROTOCOL clSerialRead ( CLINT8 *  buffer,
CLUINT32 *  bufferSize,
CLUINT32  serialTimeOut 
)
virtual
Parameters
bufferPoints to a user-allocated buffer. Upon a successful call, buffer contains the data read from the serial device. Upon failure, this buffer is not affected. Caller should ensure that buffer is at least numBytes in size.
bufferSizeThis is the number of bytes requested by the caller.
serialTimeOutIndicates the timeout in milliseconds.

Implements ISerial.

◆ clSerialWrite()

virtual CLINT32 CLPROTOCOL clSerialWrite ( CLINT8 *  buffer,
CLUINT32 *  bufferSize,
CLUINT32  serialTimeOut 
)
virtual
Parameters
bufferContains data to write to the serial device.
bufferSizeContains the buffer size indicating the number of bytes to be written. Upon a successful call, bufferSize contains the number of bytes written to the serial device.
serialTimeOutIndicates the timeout in milliseconds.

Implements ISerial.

◆ clGetSupportedBaudRates()

virtual CLINT32 CLPROTOCOL clGetSupportedBaudRates ( CLUINT32 *  baudRates)
virtual
Parameters
baudRatesBitfield that describes all supported baud rates of the serial port as described by serialRefPtr. See Table B-2 of the Camera Link documentation for more information on constants.

Implements ISerial.