Wraps a CameraLink protocol DLL and implements the IPort and the ISerial interface. More...
#include <CLPort.h>
Public Member Functions | |
IPort interface | |
virtual GENAPI_NAMESPACE::EAccessMode | GetAccessMode () const |
Get the access mode of the node. More... | |
virtual void | Read (void *pBuffer, int64_t Address, int64_t Length) |
Reads a chunk of bytes from the port. More... | |
virtual void | Write (const void *pBuffer, int64_t Address, int64_t Length) |
Writes a chunk of bytes to the port. More... | |
virtual GENAPI_NAMESPACE::EInterfaceType | GetPrinicipalInterfaceType () const |
We are an IPort interface. More... | |
CLINT32 | GetEvent (void *buffer, CLUINT32 *bufferSize) |
We can get event data. More... | |
![]() | |
CPortImpl () | |
Constructor. More... | |
virtual EYesNo | GetSwapEndianess () |
Determines if the port adapter must perform an endianess swap. More... | |
void | InvalidateNode () |
virtual void | Replay (IPortWriteList *pPortRecorder, bool Invalidate=true) |
sends the commands to the camera. More... | |
virtual void | SetPortImpl (IPort *pPort) |
Sets pointer the real port implementation; this function may called only once. More... | |
virtual | ~CPortImpl () |
Destructor. 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. More... | |
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. More... | |
static void | Terminate () |
Cleans up static variables. More... | |
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. More... | |
static void | StorePortIDDeviceIDPairs (GENICAM_NAMESPACE::gcstring_vector &PortIDs, GENICAM_NAMESPACE::gcstring_vector &DeviceIDs) |
Stores a PortID/DeviceID pair. More... | |
static void | RetrievePortIDDeviceIDPairs (GENICAM_NAMESPACE::gcstring_vector &PortIDs, GENICAM_NAMESPACE::gcstring_vector &DeviceIDs) |
Retrieves a PortID/DeviceID pair. More... | |
CCLPort () | |
Public constructor. More... | |
virtual | ~CCLPort () |
Public destructor. More... | |
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. More... | |
GENICAM_NAMESPACE::gcstring | GetDeviceID () const |
Returns the Device ID the object has been created with. More... | |
void | SetProtocolLogLevel (const CLP_LOG_LEVEL_VALUE logLever) |
Set device protocol log lever. More... | |
void | SetDeviceBauderate (const CLUINT32 baudrate) |
Set device bauderate using one of the CL_BAUDRATE_XXXX value. More... | |
CLUINT32 | GetDeviceBauderate () |
Returns the current device bauderate, using one of the CL_BAUDRATE_XXXX value. More... | |
CLUINT32 | SupportedBaudrates () |
Sed supported bauderates of the combined device and host interface. More... | |
ISerial interface | |
ISerialAdapter * | m_pSerialAdapter |
A proxy to the serial port used by the CCLPort object. More... | |
lib_handle_t | m_hPortDriverDLL |
handle to the port driver DLL loaded More... | |
CLUINT32 | m_SerialTimeOut |
Timeout in [ms]. More... | |
GENICAM_NAMESPACE::gcstring | m_DeviceID |
the DeviceID of the connected device More... | |
GENICAM_NAMESPACE::gcstring | m_PortID |
the PortID of the connected device More... | |
CLUINT32 | m_Cookie |
Cookie. More... | |
CLP_LOG_LEVEL_VALUE | logLevel |
CLUINT32 * | pBufferSize |
const CLINT8 * | pDeviceIDTemplate |
const CLINT8 CLINT8 * | pDeviceID |
const CLINT8 CLINT8 CLUINT32 * | pBufferSize |
const CLINT8 CLINT8 CLUINT32 CLUINT32 * | pCookie |
const CLINT8 CLINT8 CLUINT32 CLUINT32 const CLUINT32 | TimeOut |
const CLUINT32 | Cookie |
const CLUINT32 CLINT8 * | pXMLIDs |
const CLUINT32 CLINT8 CLUINT32 * | pBufferSize |
const CLUINT32 CLINT8 CLUINT32 const CLUINT32 | TimeOut |
const CLUINT32 const CLINT8 * | pDeviceID |
const CLUINT32 const CLINT8 CLINT8 * | pXMLBuffer |
const CLUINT32 const CLINT8 CLINT8 CLUINT32 * | pBufferSize |
const CLUINT32 const CLINT8 CLINT8 CLUINT32 const CLUINT32 | TimeOut |
const CLUINT32 const CLINT64 | Address |
const CLUINT32 const CLINT64 CLINT8 * | pBuffer |
const CLUINT32 const CLINT64 CLINT8 const CLINT64 | BufferSize |
const CLUINT32 const CLINT64 CLINT8 const CLINT64 const CLUINT32 | TimeOut |
const CLUINT32 const CLINT64 const CLINT8 * | pBuffer |
const CLUINT32 const CLINT64 const CLINT8 const CLINT64 | BufferSize |
const CLUINT32 const CLINT64 const CLINT8 const CLINT64 const CLUINT32 | TimeOut |
const CLUINT32 const BOOL8 | ContinueWaiting |
const CLUINT32 const BOOL8 const CLUINT32 | TimeOut |
CLINT8 * | errorText |
CLINT8 CLUINT32 * | errorTextSize |
CLINT8 CLUINT32 const CLUINT32 | Cookie |
CLUINT32 * | pVersionMinor |
CLP_PARAMS | param |
CLP_PARAMS const CLUINT32 | Cookie |
CLP_PARAMS const CLUINT32 const CLINT8 * | pBuffer |
CLP_PARAMS const CLUINT32 const CLINT8 const CLINT64 | BufferSize |
CLP_PARAMS const CLUINT32 const CLINT8 const CLINT64 const CLUINT32 | TimeOut |
CLINT8 * | pBuffer |
CLINT8 CLUINT32 * | pBufferSize |
bool | m_protocolHasBaudratePrms |
true if you can set baud rate via the CLProtocol's function interface More... | |
bool | m_protocolHasLogLevelPrm |
true if you can set the log level More... | |
bool | m_protocolHasLoggerPrm |
true if you can set the logger More... | |
bool | m_protocolHasStopProbeDevice |
true if you can set stop probing More... | |
static SerialPortMap * | s_pSerialList |
A list of all available proxies in the system. More... | |
static SerialPortMap * | s_pPrivateSerialList |
A list of all available proxies registers manually. More... | |
static bool | s_IsSerialListInitialized |
indicates if s_pSerialList is initialized More... | |
static CLP_LOG_LEVEL_VALUE | m_defaultloglevel |
Default log level. More... | |
static CLUINT32 | m_stopProbing |
probe of device is stopped More... | |
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... | |
static void | InitPortIDs (void) |
Initialize the PortID list. More... | |
static void | CheckLastError () |
helper retrieving error messages More... | |
static void | UpdateCache (const GENICAM_NAMESPACE::gcstring &PortID, const GENICAM_NAMESPACE::gcstring &DeviceID) |
updates the DeviceID cache More... | |
virtual CLINT32 CLPROTOCOL | clSetBaudRate (CLUINT32 baudRate) |
This function sets the baud rate for the serial port of the selected device. More... | |
void | CheckError (CLINT32 ErrorCode) const |
Helper retrieving error messages. More... | |
void | LoadProtocolDriver (const GENICAM_NAMESPACE::gcstring &PortDriverDLLPath) |
loads the protocol driver DLL More... | |
void | UnLoadProtocolDriver () |
unloads the driver DLL More... | |
void | CreatePort (const GENICAM_NAMESPACE::gcstring &PortID, const GENICAM_NAMESPACE::gcstring &PortDriverDLLPath) |
Creates a CLProtocol driver and connects it a a port identified by PortID. More... | |
CLINT32 (__cdecl *m_clpInitLib)(clp_logger_t logger | |
Function pointer to clpInitLib. More... | |
CLINT32 (__cdecl *m_clpCloseLib)(void) | |
Function pointer to clpCloseLib. More... | |
CLINT32 (__cdecl *m_clpGetShortDeviceIDTemplates)(CLINT8 *pDeviceTemplates | |
Function pointer to clpGetShortDeviceIDTemplates. More... | |
CLINT32 (__cdecl *m_clpProbeDevice)(ISerial *pSerial | |
Function pointer to clpProbeDevice. More... | |
CLINT32 (__cdecl *m_clpGetXMLIDs)(ISerial *pSerial | |
Function pointer to clpGetXMLIDs. More... | |
CLINT32 (__cdecl *m_clpGetXMLDescription)(ISerial *pSerial | |
Function pointer to m_clpGetXMLDescription. More... | |
CLINT32 (__cdecl *m_clpReadRegister)(ISerial *pSerial | |
Function pointer to clpReadRegister. More... | |
CLINT32 (__cdecl *m_clpWriteRegister)(ISerial *pSerial | |
Function pointer to clpWriteRegister. More... | |
CLINT32 (__cdecl *m_clpContinueWriteRegister)(ISerial *pSerial | |
Function pointer to clpContinueWriteRegister. More... | |
CLINT32 (__cdecl *m_clpGetErrorText)(const CLINT32 errorCode | |
Function pointer to clpGetErrorText. More... | |
CLINT32 (__cdecl *m_clpDisconnect)(const CLUINT32 Cookie) | |
Function pointer to clpDisconnect. More... | |
CLINT32 (__cdecl *m_clpGetCLProtocolVersion)(CLUINT32 *pVersionMajor | |
Function pointer to clpGetCLProtocolVersion. More... | |
CLINT32 (__cdecl *m_clpGetParam)(ISerial *pSerial | |
Function pointer to clpGetParam. More... | |
CLINT32 (__cdecl *m_clpSetParam)(ISerial *pSerial | |
Function pointer to clpSetParam. More... | |
CLINT32 (__cdecl *m_clpIsParamSupported)(CLP_PARAMS param) | |
Function pointer to clpIsParamSupported. More... | |
CLINT32 (__cdecl *m_clpGetEventData)(const CLUINT32 Cookie | |
Function pointer to clpgetEventData. More... | |
CCLPort (CCLPort &) | |
must not be used More... | |
CCLPort & | operator= (CCLPort &) |
must not be used More... | |
Wraps a CameraLink protocol DLL and implements the IPort and the ISerial interface.
The class dynamically loads a protocol driver DLL and binds it to a given port. It implements the IPort and the ISerial interface.
The class can enumerate
CLProtocol::CCLPort::CCLPort | ( | ) |
Public constructor.
|
virtual |
Public destructor.
|
private |
must not be used
|
private |
Helper retrieving error messages.
|
staticprivate |
helper retrieving error messages
|
virtual |
returns the valid baud rates of the current interface.
baudRates | Bitfield 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.
|
private |
Function pointer to clpCloseLib.
|
private |
Function pointer to clpContinueWriteRegister.
|
private |
Function pointer to clpDisconnect.
|
private |
Function pointer to clpGetCLProtocolVersion.
|
private |
Function pointer to clpGetErrorText.
|
private |
Function pointer to clpgetEventData.
|
private |
Function pointer to clpGetParam.
|
private |
Function pointer to clpGetShortDeviceIDTemplates.
|
private |
Function pointer to m_clpGetXMLDescription.
|
private |
Function pointer to clpGetXMLIDs.
|
private |
Function pointer to clpInitLib.
|
private |
Function pointer to clpIsParamSupported.
|
private |
Function pointer to clpProbeDevice.
|
private |
Function pointer to clpReadRegister.
|
private |
Function pointer to clpSetParam.
|
private |
Function pointer to clpWriteRegister.
|
virtual |
calls clSerialRead as defined by the camera link standard
buffer | Points 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. |
bufferSize | This is the number of bytes requested by the caller. |
serialTimeOut | Indicates the timeout in milliseconds. |
Implements ISerial.
|
virtual |
calls clSerialWrite as defined by the camera link standard
buffer | Contains data to write to the serial device. |
bufferSize | Contains 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. |
serialTimeOut | Indicates the timeout in milliseconds. |
Implements ISerial.
|
privatevirtual |
This function sets the baud rate for the serial port of the selected device.
baudRate | The baud rate you want to use. This parameter expects the values represented by the CL_BAUDRATE constants in table B-2. By default, the baud rate for serial communication is 9600.; |
Implements ISerial.
bool CLProtocol::CCLPort::Connect | ( | const GENICAM_NAMESPACE::gcstring & | PortID | ) |
Creates a port object for a given PortID taking the DeviceID from a internal cache.
[in] | PortID | Identifies the port to use for connection. |
void CLProtocol::CCLPort::Connect | ( | const GENICAM_NAMESPACE::gcstring & | PortID, |
const GENICAM_NAMESPACE::gcstring & | strDeviceID | ||
) |
Creates a port object for a given PortID and DeviceID.
[in] | PortID | Identifies the port to use for connection. |
[in] | strDeviceID | Identifies the device to connect. Can be optionally a DeviceID template. |
|
private |
Creates a CLProtocol driver and connects it a a port identified by PortID.
void CLProtocol::CCLPort::DeleteXMLDownload | ( | GENICAM_NAMESPACE::gcstring | XMLID | ) |
Delete the device xml file from the download folder if the file was downloaded for the camera.
This can be use to remove a corrupted file. File can easily be corrupted if the download is aborted.
[in] | XMLID | The XML ID identifying the XML file whose data is to be received |
|
virtual |
Get the access mode of the node.
Implements GENAPI_NAMESPACE::CPortImpl.
CLUINT32 CLProtocol::CCLPort::GetDeviceBauderate | ( | ) |
Returns the current device bauderate, using one of the CL_BAUDRATE_XXXX value.
GENICAM_NAMESPACE::gcstring CLProtocol::CCLPort::GetDeviceID | ( | ) | const |
Returns the Device ID the object has been created with.
|
static |
Retrieves a list of DeviceID templates.
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.
[out] | DeviceIDTemplates | A list of DeviceID templates |
We can get event data.
buffer | Points 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. |
bufferSize | input is the size of the buffer, output is the size of event data in buffer. |
|
static |
Gets a SerialAdapter port.
[in] | PortID | PortID of the serial port |
|
static |
Retrieves a list of PortIDs which can be used to create a corresponding port object.
[out] | PortIDs | A list of PortIDs which each has the form 'ManufacturerName::PortName' |
|
virtual |
We are an IPort interface.
CLUINT32 CLProtocol::CCLPort::GetSerialTimeOut | ( | ) | const |
Gets the timeout for operations on the serial port.
GENICAM_NAMESPACE::gcstring CLProtocol::CCLPort::GetXML | ( | const bool | UseMaxBaudrate = true | ) |
Retrieves the best matching GenApi XML description either from the DLL or the file system.
[in] | UseMaxBaudrate | if true the baud rate is set to maximum while downloading the XML file and reset afterwards |
GENICAM_NAMESPACE::gcstring CLProtocol::CCLPort::GetXML | ( | GENICAM_NAMESPACE::gcstring | XMLID, |
const bool | UseMaxBaudrate = true |
||
) |
Retrieves an GenApi XML description either from the DLL or the file system.
[in] | XMLID | The XML ID identifying the XML file whose data is to be received |
[in] | UseMaxBaudrate | if true the baud rate is set to maximum while downloading the XML file and reset afterwards |
void CLProtocol::CCLPort::GetXMLIDs | ( | GENICAM_NAMESPACE::gcstring_vector & | XMLIDs | ) |
Retrieves a list of XMLID strings.
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.
[out] | XMLIDs | A list of XML IDs templates |
|
staticprivate |
Initialize the PortID list.
|
private |
loads the protocol driver DLL
GENICAM_NAMESPACE::gcstring CLProtocol::CCLPort::MakeURLfromXMLID | ( | GENICAM_NAMESPACE::gcstring & | XMLID | ) |
Creates a file URL for a given XML ID.
The URL has the following format: "file:///filepath.xml"
|
static |
Connects a camera and retrieves all information required for the DeviceID.
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.
[in] | PortID | Identifies the port the camera to be probed is connected to |
[in] | strDeviceIDTemplate | The DeviceID templates helping the protocol driver dll to identify the camera |
[in] | SerialTimeout | The timeout in milliseconds when probing the port (see SetSerialTimeOut). |
Reads a chunk of bytes from the port.
Implements GENAPI_NAMESPACE::CPortImpl.
|
static |
Register a custom serial port.
[in] | PortName | Identifies the port to use for connection. |
[in] | pSerialAdapter | An interface that allow CCLPort to access the serial port. |
|
static |
Retrieves a PortID/DeviceID pair.
|
static |
Set log level that is assigned to the device protocol when the dll is loaded.
void CLProtocol::CCLPort::SetDeviceBauderate | ( | const CLUINT32 | baudrate | ) |
Set device bauderate using one of the CL_BAUDRATE_XXXX value.
void CLProtocol::CCLPort::SetProtocolLogLevel | ( | const CLP_LOG_LEVEL_VALUE | logLever | ) |
Set device protocol log lever.
void CLProtocol::CCLPort::SetSerialTimeOut | ( | const CLUINT32 | Timeout | ) |
Sets the timeout for operations on the serial port.
[in] | Timeout | Timeout in [ms] for operations on the serial port. |
|
static |
Stop all running ProbeDevice.
|
static |
Stores a PortID/DeviceID pair.
CLUINT32 CLProtocol::CCLPort::SupportedBaudrates | ( | ) |
Sed supported bauderates of the combined device and host interface.
|
static |
Cleans up static variables.
|
private |
unloads the driver DLL
|
static |
Unregister serial serial port.
[in] | PortID | Identifies the port that need to be disconnected |
|
static |
Unregister all resource related to serial port.
|
staticprivate |
updates the DeviceID cache
|
virtual |
Writes a chunk of bytes to the port.
Implements GENAPI_NAMESPACE::CPortImpl.
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
true if you can set baud rate via the CLProtocol's function interface
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
private |