All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CLPort.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2008 by Basler Vision Technologies
3 // Section: Vision Components
4 // Project: GenApi
5 // Author: Fritz Dierks
6 // $Header$
7 //
8 // License: This file is published under the license of the EMVA GenICam Standard Group.
9 // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
10 // If for some reason you are missing this file please contact the EMVA or visit the website
11 // (http://www.genicam.org) for a full copy.
12 //
13 // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
14 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
17 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 // POSSIBILITY OF SUCH DAMAGE.
24 //-----------------------------------------------------------------------------
29 #ifndef CLPROTOCOL_CLPORT_H
30 #define CLPROTOCOL_CLPORT_H
31 
32 #include <Base/GCBase.h>
33 #include <GenApi/PortImpl.h>
34 #include <CLProtocol/CLException.h>
36 #include <CLProtocol/CLProtocol.h>
37 #include <CLProtocol/ISerial.h>
40 #include <CLProtocol/DeviceID.h>
41 #include <CLProtocol/CVersion.h>
42 #include <CLProtocol/XMLID.h>
43 #include <iostream>
44 #include <fstream>
45 #include <list>
46 #include <algorithm>
47 
48 
49 namespace CLProtocol
50 {
51 
53 # define CLPORT_PERSISTENCE_MAGIC "{3DFD485D-0ADB-4d84-9956-C3766504A2DD}"
54 
55 
56 #ifdef _MSC_VER
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'
59 #endif
60 
74  {
75  public:
76 
79 
83  static void GetPortIDs( GENAPI_NAMESPACE::StringList_t &PortIDs );
84 
89  static ISerialAdapter *GetPort( const GENICAM_NAMESPACE::gcstring &PortID );
90 
99  static void GetDeviceIDTemplates( GENICAM_NAMESPACE::gcstring_vector &DeviceIDTemplates );
100 
112  static GENICAM_NAMESPACE::gcstring ProbeDevice(const GENICAM_NAMESPACE::gcstring &PortID, const GENICAM_NAMESPACE::gcstring &strDeviceIDTemplate, const CLUINT32 SerialTimeout = 500);
113 
115  static void StopProbing(CLUINT32 toStop);
116 
122  static GENICAM_NAMESPACE::gcstring RegisterSerial( const GENICAM_NAMESPACE::gcstring &PortName, ISerialAdapter *pSerialAdapter);
123 
125  static void UnRegisterSerials( );
126 
128  static void Terminate( );
129 
133  static void UnRegisterSerial( const GENICAM_NAMESPACE::gcstring &PortID );
134 
139  void Connect( const GENICAM_NAMESPACE::gcstring &PortID, const GENICAM_NAMESPACE::gcstring &strDeviceID );
140 
147  bool Connect( const GENICAM_NAMESPACE::gcstring &PortID );
148 
161  void GetXMLIDs( GENICAM_NAMESPACE::gcstring_vector &XMLIDs );
162 
168  GENICAM_NAMESPACE::gcstring GetXML( GENICAM_NAMESPACE::gcstring XMLID, const bool UseMaxBaudrate = true );
169 
177  void DeleteXMLDownload( GENICAM_NAMESPACE::gcstring XMLID );
178 
183  GENICAM_NAMESPACE::gcstring GetXML( const bool UseMaxBaudrate = true );
184 
191  GENICAM_NAMESPACE::gcstring MakeURLfromXMLID( GENICAM_NAMESPACE::gcstring &XMLID );
192 
194 
197 
199  CCLPort();
200 
202  virtual ~CCLPort();
203 
205 
208  void SetSerialTimeOut(const CLUINT32 Timeout);
209 
211  CLUINT32 GetSerialTimeOut() const;
212 
214  GENICAM_NAMESPACE::gcstring GetDeviceID() const;
215 
217  void SetProtocolLogLevel( const CLP_LOG_LEVEL_VALUE logLever);
218 
220  void SetDeviceBauderate( const CLUINT32 baudrate);
221 
223  CLUINT32 GetDeviceBauderate( );
224 
226  CLUINT32 SupportedBaudrates();
227 
229  static void SetDefaultLogLevel( const CLP_LOG_LEVEL_VALUE logLever);
230 
232  static void StorePortIDDeviceIDPairs( GENICAM_NAMESPACE::gcstring_vector &PortIDs, GENICAM_NAMESPACE::gcstring_vector &DeviceIDs );
233 
235  static void RetrievePortIDDeviceIDPairs( GENICAM_NAMESPACE::gcstring_vector &PortIDs, GENICAM_NAMESPACE::gcstring_vector &DeviceIDs );
236 
238 
240 
241 
243  virtual GENAPI_NAMESPACE::EAccessMode GetAccessMode() const;
244 
246  virtual void Read(void * pBuffer, int64_t Address, int64_t Length);
247 
249  virtual void Write(const void * pBuffer, int64_t Address, int64_t Length);
250 
252  virtual GENAPI_NAMESPACE::EInterfaceType GetPrinicipalInterfaceType() const;
254 
256  CLINT32 GetEvent(
257  void * buffer,
258  CLUINT32 * bufferSize
262  );
264 
266 
267 
270  CLINT8* buffer,
271  CLUINT32* bufferSize,
275  CLUINT32 serialTimeOut
276  );
277 
280  CLINT8* buffer,
281  CLUINT32* bufferSize,
282  CLUINT32 serialTimeOut
286  );
287 
290  CLUINT32 *baudRates
291  );
295 
296  private:
298  static void InitPortIDs(void);
299 
302  CLUINT32 baudRate
303  );
306 
308  void CheckError( CLINT32 ErrorCode ) const;
309 
311  static void CheckLastError();
312 
314  void LoadProtocolDriver( const GENICAM_NAMESPACE::gcstring &PortDriverDLLPath );
315 
317  void UnLoadProtocolDriver( );
318 
320  void CreatePort( const GENICAM_NAMESPACE::gcstring &PortID, const GENICAM_NAMESPACE::gcstring &PortDriverDLLPath );
321 
323  static void UpdateCache( const GENICAM_NAMESPACE::gcstring &PortID, const GENICAM_NAMESPACE::gcstring &DeviceID );
324 
327 
330 
333 
336 
337 
340 
343 
346 
349 
352 
353  /*------------------------------------------------*/
354  // functions of the CL protocol DLL
355  /*------------------------------------------------*/
358 
360  CLINT32 (__cdecl *m_clpCloseLib)( void );
361 
363  CLINT32 (__cdecl *m_clpGetShortDeviceIDTemplates) (CLINT8* pDeviceTemplates, CLUINT32* pBufferSize );
364 
366  CLINT32 (__cdecl *m_clpProbeDevice) (ISerial *pSerial, const CLINT8* pDeviceIDTemplate, CLINT8* pDeviceID, CLUINT32 *pBufferSize, CLUINT32 *pCookie, const CLUINT32 TimeOut );
367 
369  CLINT32 (__cdecl *m_clpGetXMLIDs) ( ISerial *pSerial, const CLUINT32 Cookie ,CLINT8* pXMLIDs, CLUINT32* pBufferSize, const CLUINT32 TimeOut );
370 
372  CLINT32 (__cdecl *m_clpGetXMLDescription) (ISerial *pSerial, const CLUINT32 Cookie, const CLINT8* pDeviceID, CLINT8* pXMLBuffer, CLUINT32* pBufferSize, const CLUINT32 TimeOut );
373 
375  CLINT32 (__cdecl *m_clpReadRegister) (ISerial *pSerial, const CLUINT32 Cookie, const CLINT64 Address, CLINT8* pBuffer, const CLINT64 BufferSize, const CLUINT32 TimeOut );
376 
378  CLINT32 (__cdecl *m_clpWriteRegister) (ISerial *pSerial, const CLUINT32 Cookie, const CLINT64 Address, const CLINT8* pBuffer, const CLINT64 BufferSize, const CLUINT32 TimeOut );
379 
381  CLINT32 (__cdecl *m_clpContinueWriteRegister) (ISerial *pSerial, const CLUINT32 Cookie, const BOOL8 ContinueWaiting, const CLUINT32 TimeOut );
382 
384  CLINT32 (__cdecl *m_clpGetErrorText) (const CLINT32 errorCode, CLINT8* errorText, CLUINT32* errorTextSize, const CLUINT32 Cookie );
385 
387  CLINT32 (__cdecl *m_clpDisconnect) (const CLUINT32 Cookie );
388 
390  CLINT32 (__cdecl *m_clpGetCLProtocolVersion) (CLUINT32 *pVersionMajor, CLUINT32 *pVersionMinor );
391 
393  CLINT32 (__cdecl *m_clpGetParam) (ISerial *pSerial, CLP_PARAMS param, const CLUINT32 Cookie, const CLINT8* pBuffer, const CLINT64 BufferSize, const CLUINT32 TimeOut);
394 
396  CLINT32 (__cdecl *m_clpSetParam) (ISerial *pSerial, CLP_PARAMS param, const CLUINT32 Cookie, const CLINT8* pBuffer, const CLINT64 BufferSize, const CLUINT32 TimeOut);
397 
399  CLINT32 (__cdecl *m_clpIsParamSupported) (CLP_PARAMS param);
400 
402  CLINT32 (__cdecl *m_clpGetEventData) (const CLUINT32 Cookie, CLINT8* pBuffer, CLUINT32* pBufferSize);
403 
404  // What 1.1 feature are supported by the device protocol?
407 
410 
413 
416 
419 
422  private:
424  CCLPort( CCLPort& );
425 
428  };
429 
430 #ifdef _MSC_VER
431 # pragma warning(pop)
432 #endif
433 
434 }
435 #endif // CLPROTOCOL_CLPORT_H
CLProtocol::CCLPort::TimeOut
const CLUINT32 const CLINT8 CLINT8 CLUINT32 const CLUINT32 TimeOut
Definition: CLPort.h:372
CLProtocol::CCLPort::errorTextSize
CLINT8 CLUINT32 * errorTextSize
Definition: CLPort.h:384
GENAPI_NAMESPACE::EAccessMode
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
access mode of a node
CLProtocol::CCLPort::m_defaultloglevel
static CLP_LOG_LEVEL_VALUE m_defaultloglevel
Default log level.
Definition: CLPort.h:418
CLProtocol
Definition: CLAllAdapter.h:64
CLProtocol.h
Exported C functions for camera link protocol drivers.
CLProtocol::CCLPort::m_pSerialAdapter
ISerialAdapter * m_pSerialAdapter
A proxy to the serial port used by the CCLPort object.
Definition: CLPort.h:326
CLP_PARAMS
CLP_PARAMS
Types of parameters to be accessed by clpGetParam/clpSetParam.
Definition: CLProtocol.h:94
CLProtocol::CCLPort::m_protocolHasBaudratePrms
bool m_protocolHasBaudratePrms
true if you can set baud rate via the CLProtocol's function interface
Definition: CLPort.h:406
GENAPI_NAMESPACE::Connect
virtual bool Connect(IPort *pPort, const GENICAM_NAMESPACE::gcstring &PortName) const =0
Connects a port to a port node with given name.
CVersion.h
C++ class wrapping CLSerialAll and CLProtocolDriver.
CLINT8
char CLINT8
Definition: ClSerialTypes.h:126
CLProtocol::SerialPortMap
std::map< GENICAM_NAMESPACE::gcstring, ISerialAdapter * > SerialPortMap
A map holding the pointers to the serial adapters.
Definition: CLAllAdapter.h:67
ISerial.h
Exported C functions for camera link protocol drivers.
CLUINT32
unsigned int CLUINT32
Definition: ClSerialTypes.h:105
GENICAM_NAMESPACE::gcstring
A string class which is a clone of std::string.
Definition: GCString.h:52
GENAPI_NAMESPACE::CPortImpl
Definition: PortImpl.h:58
CLProtocol::CCLPort::TimeOut
const CLUINT32 CLINT8 CLUINT32 const CLUINT32 TimeOut
Definition: CLPort.h:369
CLProtocol::CCLPort::pBufferSize
CLUINT32 * pBufferSize
Definition: CLPort.h:363
CLProtocol::CCLPort
Wraps a CameraLink protocol DLL and implements the IPort and the ISerial interface.
Definition: CLPort.h:73
CLProtocol::CCLPort::TimeOut
const CLUINT32 const CLINT64 CLINT8 const CLINT64 const CLUINT32 TimeOut
Definition: CLPort.h:375
clSerialWrite
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSerialWrite(hSerRef serialRef, CLINT8 *buffer, CLUINT32 *bufferSize, CLUINT32 serialTimeout)
CLAutoBuffer.h
C++ class wrapping CLSerialAll and CLProtocolDriver.
CLProtocol::CCLPort::TimeOut
const CLINT8 CLINT8 CLUINT32 CLUINT32 const CLUINT32 TimeOut
Definition: CLPort.h:366
CLProtocol::CCLPort::m_PortID
GENICAM_NAMESPACE::gcstring m_PortID
the PortID of the connected device
Definition: CLPort.h:348
GENAPI_NAMESPACE::Write
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)=0
Writes a chunk of bytes to the port.
CLINT64
__int64 CLINT64
Definition: ClSerialTypes.h:116
__cdecl
#define __cdecl
Definition: CLAllAdapter.h:58
CLProtocol::CCLPort::m_DeviceID
GENICAM_NAMESPACE::gcstring m_DeviceID
the DeviceID of the connected device
Definition: CLPort.h:345
GENAPI_NAMESPACE::EInterfaceType
enum GENAPI_NAMESPACE::_EInterfaceType EInterfaceType
typedef for interface type
DeviceID.h
CLProtocol::CCLPort::s_pSerialList
static SerialPortMap * s_pSerialList
A list of all available proxies in the system.
Definition: CLPort.h:329
CLProtocol::CCLPort::m_Cookie
CLUINT32 m_Cookie
Cookie.
Definition: CLPort.h:351
GENAPI_NAMESPACE::Address
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT int64_t Address
Definition: IPort.h:57
CLProtocol::CCLPort::m_hPortDriverDLL
lib_handle_t m_hPortDriverDLL
handle to the port driver DLL loaded
Definition: CLPort.h:339
CLProtocol::CCLPort::TimeOut
const CLUINT32 const CLINT64 const CLINT8 const CLINT64 const CLUINT32 TimeOut
Definition: CLPort.h:378
CLPROTOCOL_DECL
#define CLPROTOCOL_DECL
Definition: CLProtocol.h:64
CLProtocol::CCLPort::s_pPrivateSerialList
static SerialPortMap * s_pPrivateSerialList
A list of all available proxies registers manually.
Definition: CLPort.h:332
clSetBaudRate
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSetBaudRate(hSerRef serialRef, CLUINT32 baudRate)
GENAPI_NAMESPACE::Length
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT int64_t int64_t Length
Definition: IPort.h:57
CLAllAdapter.h
C++ class wrapping CLSerialAll.
CLProtocol::CCLPort::m_protocolHasStopProbeDevice
bool m_protocolHasStopProbeDevice
true if you can set stop probing
Definition: CLPort.h:415
XMLID.h
CLProtocol::CCLPort::pBufferSize
CLINT8 CLUINT32 * pBufferSize
Definition: CLPort.h:402
clGetSupportedBaudRates
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clGetSupportedBaudRates(hSerRef serialRef, CLUINT32 *baudRates)
GCBase.h
Common GenICam base include file.
lib_handle_t
void * lib_handle_t
Definition: CLAllAdapter.h:50
clSerialRead
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSerialRead(hSerRef serialRef, CLINT8 *buffer, CLUINT32 *bufferSize, CLUINT32 serialTimeout)
CLP_LOG_LEVEL_VALUE
CLP_LOG_LEVEL_VALUE
Definition: CLProtocol.h:116
CLProtocol::CCLPort::m_protocolHasLoggerPrm
bool m_protocolHasLoggerPrm
true if you can set the logger
Definition: CLPort.h:412
int64_t
__int64 int64_t
Definition: config-win32.h:21
clp_logger_t
void(CLPROTOCOL * clp_logger_t)(CLINT32 level, const char *stringFormat, va_list argptr)
Definition: CLProtocol.h:84
ISerialAdapter.h
CLINT32
int CLINT32
Definition: ClSerialTypes.h:100
CLProtocol::CCLPort::TimeOut
const CLUINT32 const BOOL8 const CLUINT32 TimeOut
Definition: CLPort.h:381
PortImpl.h
Definition of CPortImpl.
CLException.h
CLProtocol exception type.
CLProtocol::CCLPort::logLevel
CLP_LOG_LEVEL_VALUE logLevel
Definition: CLPort.h:357
CLProtocol::CCLPort::m_protocolHasLogLevelPrm
bool m_protocolHasLogLevelPrm
true if you can set the log level
Definition: CLPort.h:409
CLProtocol::CCLPort::m_stopProbing
static CLUINT32 m_stopProbing
probe of device is stopped
Definition: CLPort.h:421
CLProtocol::CCLPort::s_IsSerialListInitialized
static bool s_IsSerialListInitialized
indicates if s_pSerialList is initialized
Definition: CLPort.h:335
ISerial
Abstract interface used by the CLProtocol driver to use a serial port.
Definition: ISerial.h:42
GENAPI_NAMESPACE::operator=
virtual IBoolean & operator=(bool Value)
Set node value.
Definition: IBoolean.h:64
BOOL8
char BOOL8
Definition: ClSerialTypes.h:131
GENAPI_NAMESPACE::StringList_t
GENICAM_NAMESPACE::gcstring_vector StringList_t
A list of strings.
Definition: Types.h:149
CLProtocol::CCLPort::pVersionMinor
CLUINT32 * pVersionMinor
Definition: CLPort.h:390
CLProtocol::CCLPort::m_SerialTimeOut
CLUINT32 m_SerialTimeOut
Timeout in [ms].
Definition: CLPort.h:342
CLPROTOCOL
#define CLPROTOCOL
Definition: CLProtocol.h:73
CLProtocol::ISerialAdapter
Definition: ISerialAdapter.h:37


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11