29 #ifndef CLPROTOCOL_CLPORT_H 30 #define CLPROTOCOL_CLPORT_H 32 #include <Base/GCBase.h> 33 #include <GenApi/PortImpl.h> 34 #include <CLProtocol/CLException.h> 35 #include <CLProtocol/CLAutoBuffer.h> 36 #include <CLProtocol/CLProtocol.h> 37 #include <CLProtocol/ISerial.h> 38 #include <CLProtocol/ISerialAdapter.h> 39 #include <CLProtocol/CLAllAdapter.h> 40 #include <CLProtocol/DeviceID.h> 41 #include <CLProtocol/CVersion.h> 42 #include <CLProtocol/XMLID.h> 53 # define CLPORT_PERSISTENCE_MAGIC "{3DFD485D-0ADB-4d84-9956-C3766504A2DD}" 57 # pragma warning (push ) 58 # pragma warning( disable:4275) // warning C4275: non dll-interface class 'GenApi::CPortImpl' used as base for dll-interface class 'CLProtocol::CCLPort' 73 class CLPROTOCOL_DECL
CCLPort :
public GENAPI_NAMESPACE::CPortImpl,
public ISerial 83 static void GetPortIDs( GENAPI_NAMESPACE::StringList_t &PortIDs );
89 static ISerialAdapter *GetPort(
const GENICAM_NAMESPACE::gcstring &PortID );
99 static void GetDeviceIDTemplates( GENICAM_NAMESPACE::gcstring_vector &DeviceIDTemplates );
112 static GENICAM_NAMESPACE::gcstring ProbeDevice(
const GENICAM_NAMESPACE::gcstring &PortID,
const GENICAM_NAMESPACE::gcstring &strDeviceIDTemplate,
const CLUINT32 SerialTimeout = 500);
115 static void StopProbing(CLUINT32 toStop);
122 static GENICAM_NAMESPACE::gcstring RegisterSerial(
const GENICAM_NAMESPACE::gcstring &PortName, ISerialAdapter *pSerialAdapter);
125 static void UnRegisterSerials( );
128 static void Terminate( );
133 static void UnRegisterSerial(
const GENICAM_NAMESPACE::gcstring &PortID );
139 void Connect(
const GENICAM_NAMESPACE::gcstring &PortID,
const GENICAM_NAMESPACE::gcstring &strDeviceID );
147 bool Connect(
const GENICAM_NAMESPACE::gcstring &PortID );
161 void GetXMLIDs( GENICAM_NAMESPACE::gcstring_vector &XMLIDs );
168 GENICAM_NAMESPACE::gcstring GetXML( GENICAM_NAMESPACE::gcstring XMLID,
const bool UseMaxBaudrate =
true );
177 void DeleteXMLDownload( GENICAM_NAMESPACE::gcstring XMLID );
183 GENICAM_NAMESPACE::gcstring GetXML(
const bool UseMaxBaudrate =
true );
191 GENICAM_NAMESPACE::gcstring MakeURLfromXMLID( GENICAM_NAMESPACE::gcstring &XMLID );
208 void SetSerialTimeOut(
const CLUINT32 Timeout);
211 CLUINT32 GetSerialTimeOut()
const;
214 GENICAM_NAMESPACE::gcstring GetDeviceID()
const;
217 void SetProtocolLogLevel(
const CLP_LOG_LEVEL_VALUE logLever);
220 void SetDeviceBauderate(
const CLUINT32 baudrate);
223 CLUINT32 GetDeviceBauderate( );
226 CLUINT32 SupportedBaudrates();
229 static void SetDefaultLogLevel(
const CLP_LOG_LEVEL_VALUE logLever);
232 static void StorePortIDDeviceIDPairs( GENICAM_NAMESPACE::gcstring_vector &PortIDs, GENICAM_NAMESPACE::gcstring_vector &DeviceIDs );
235 static void RetrievePortIDDeviceIDPairs( GENICAM_NAMESPACE::gcstring_vector &PortIDs, GENICAM_NAMESPACE::gcstring_vector &DeviceIDs );
243 virtual GENAPI_NAMESPACE::EAccessMode GetAccessMode()
const;
246 virtual void Read(
void * pBuffer, int64_t Address, int64_t Length);
249 virtual void Write(
const void * pBuffer, int64_t Address, int64_t Length);
252 virtual GENAPI_NAMESPACE::EInterfaceType GetPrinicipalInterfaceType()
const;
258 CLUINT32 * bufferSize
271 CLUINT32* bufferSize,
275 CLUINT32 serialTimeOut
281 CLUINT32* bufferSize,
282 CLUINT32 serialTimeOut
298 static void InitPortIDs(
void);
308 void CheckError( CLINT32 ErrorCode )
const;
311 static void CheckLastError();
314 void LoadProtocolDriver(
const GENICAM_NAMESPACE::gcstring &PortDriverDLLPath );
317 void UnLoadProtocolDriver( );
320 void CreatePort(
const GENICAM_NAMESPACE::gcstring &PortID,
const GENICAM_NAMESPACE::gcstring &PortDriverDLLPath );
323 static void UpdateCache(
const GENICAM_NAMESPACE::gcstring &PortID,
const GENICAM_NAMESPACE::gcstring &DeviceID );
326 ISerialAdapter *m_pSerialAdapter;
329 static SerialPortMap *s_pSerialList;
332 static SerialPortMap *s_pPrivateSerialList;
335 static bool s_IsSerialListInitialized;
339 lib_handle_t m_hPortDriverDLL;
342 CLUINT32 m_SerialTimeOut;
345 GENICAM_NAMESPACE::gcstring m_DeviceID;
348 GENICAM_NAMESPACE::gcstring m_PortID;
357 CLINT32 (__cdecl *m_clpInitLib)( clp_logger_t logger, CLP_LOG_LEVEL_VALUE logLevel);
360 CLINT32 (__cdecl *m_clpCloseLib)( void );
363 CLINT32 (__cdecl *m_clpGetShortDeviceIDTemplates) (CLINT8* pDeviceTemplates, CLUINT32* pBufferSize );
366 CLINT32 (__cdecl *m_clpProbeDevice) (
ISerial *pSerial,
const CLINT8* pDeviceIDTemplate, CLINT8* pDeviceID, CLUINT32 *pBufferSize, CLUINT32 *pCookie,
const CLUINT32 TimeOut );
369 CLINT32 (__cdecl *m_clpGetXMLIDs) (
ISerial *pSerial,
const CLUINT32 Cookie ,CLINT8* pXMLIDs, CLUINT32* pBufferSize,
const CLUINT32 TimeOut );
372 CLINT32 (__cdecl *m_clpGetXMLDescription) (
ISerial *pSerial,
const CLUINT32 Cookie,
const CLINT8* pDeviceID, CLINT8* pXMLBuffer, CLUINT32* pBufferSize,
const CLUINT32 TimeOut );
375 CLINT32 (__cdecl *m_clpReadRegister) (
ISerial *pSerial,
const CLUINT32 Cookie,
const CLINT64 Address, CLINT8* pBuffer,
const CLINT64 BufferSize,
const CLUINT32 TimeOut );
378 CLINT32 (__cdecl *m_clpWriteRegister) (
ISerial *pSerial,
const CLUINT32 Cookie,
const CLINT64 Address,
const CLINT8* pBuffer,
const CLINT64 BufferSize,
const CLUINT32 TimeOut );
381 CLINT32 (__cdecl *m_clpContinueWriteRegister) (
ISerial *pSerial,
const CLUINT32 Cookie,
const BOOL8 ContinueWaiting,
const CLUINT32 TimeOut );
384 CLINT32 (__cdecl *m_clpGetErrorText) (
const CLINT32 errorCode, CLINT8* errorText, CLUINT32* errorTextSize,
const CLUINT32 Cookie );
387 CLINT32 (__cdecl *m_clpDisconnect) (
const CLUINT32 Cookie );
390 CLINT32 (__cdecl *m_clpGetCLProtocolVersion) (CLUINT32 *pVersionMajor, CLUINT32 *pVersionMinor );
393 CLINT32 (__cdecl *m_clpGetParam) (
ISerial *pSerial, CLP_PARAMS param,
const CLUINT32 Cookie,
const CLINT8* pBuffer,
const CLINT64 BufferSize,
const CLUINT32 TimeOut);
396 CLINT32 (__cdecl *m_clpSetParam) (
ISerial *pSerial, CLP_PARAMS param,
const CLUINT32 Cookie,
const CLINT8* pBuffer,
const CLINT64 BufferSize,
const CLUINT32 TimeOut);
399 CLINT32 (__cdecl *m_clpIsParamSupported) (CLP_PARAMS param);
402 CLINT32 (__cdecl *m_clpGetEventData) (
const CLUINT32 Cookie, CLINT8* pBuffer, CLUINT32* pBufferSize);
406 bool m_protocolHasBaudratePrms;
409 bool m_protocolHasLogLevelPrm;
412 bool m_protocolHasLoggerPrm;
415 bool m_protocolHasStopProbeDevice;
418 static CLP_LOG_LEVEL_VALUE m_defaultloglevel;
421 static CLUINT32 m_stopProbing;
431 # pragma warning(pop) 435 #endif // CLPROTOCOL_CLPORT_H Definition: CLAllAdapter.h:64
CLSERIALEXPORT CLINT32 CLSERIALCC clSetBaudRate(hSerRef serialRef, CLUINT32 baudRate)
This function sets the baud rate for the serial port of the selected device. Use clGetSupportedBaudRa...
Abstract interface used by the CLProtocol driver to use a serial port.
Definition: ISerial.h:42
Wraps a CameraLink protocol DLL and implements the IPort and the ISerial interfaceThe class dynamical...
Definition: CLPort.h:73
CLSERIALEXPORT CLINT32 CLSERIALCC clSerialRead(hSerRef serialRef, CLINT8 *buffer, CLUINT32 *bufferSize, CLUINT32 serialTimeOut)
This function reads numBytes from the serial device referred to by serialRef. clSerialRead will retur...
CLSERIALEXPORT CLINT32 CLSERIALCC clSerialWrite(hSerRef serialRef, CLINT8 *buffer, CLUINT32 *bufferSize, CLUINT32 serialTimeOut)
This function writes the data in the buffer to the serial device referenced by serialRef.
CLSERIALEXPORT CLINT32 CLSERIALCC clGetSupportedBaudRates(hSerRef serialRef, CLUINT32 *baudRates)
This function returns the valid baud rates of the current interface.