30 #ifndef CLPROTOCOL_CLALLADAPTER_H 31 #define CLPROTOCOL_CLALLADAPTER_H 33 #include <Base/GCBase.h> 34 #include <CLProtocol/ClAllSerial.h> 35 #include <CLProtocol/CLException.h> 36 #include <CLProtocol/CLProtocol.h> 37 #include <CLProtocol/ISerialAdapter.h> 48 typedef HMODULE lib_handle_t;
50 typedef void * lib_handle_t;
54 #if defined (_MSC_VER) 57 # if !defined(__x86_64) && !defined(__arm__) && !defined(__aarch64__) && !defined(VXWORKS) 58 # define __cdecl __attribute__((cdecl)) 67 typedef std::map<GENICAM_NAMESPACE::gcstring, ISerialAdapter *> SerialPortMap;
75 static void Destroy( ISerialAdapter * pAdapter );
79 virtual CLINT32 CLPROTOCOL
clSerialRead( CLINT8*,CLUINT32*, CLUINT32);
80 virtual CLINT32 CLPROTOCOL
clSerialWrite(CLINT8 *,CLUINT32 *,CLUINT32);
83 virtual CLINT32 SerialInit(
void);
84 virtual void SerialClose(
void);
85 virtual void CheckError( CLINT32 ErrorCode );
89 static void GetPortIDs(GENICAM_NAMESPACE::gcstring_vector &TheVector);
91 static ISerialAdapter *GetSerialAdapter(GENICAM_NAMESPACE::gcstring PortID);
100 CLINT32 (CLALLSERIALCC *m_clGetErrorText)(
const CLINT8*, CLINT32, CLINT8*, CLUINT32*);
102 CLINT32 (CLALLSERIALCC *m_clGetNumPorts) ( CLUINT32* Ports);
104 CLINT32 (CLALLSERIALCC *m_clGetPortInfo ) ( CLUINT32 serialIndex, CLINT8* manufacturerName, CLUINT32* nameBytes, CLINT8* portID, CLUINT32* IDBytes, CLUINT32* version);
106 CLINT32 (CLALLSERIALCC *m_clGetSupportedBaudRates) ( hSerRef serialRef, CLUINT32* baudRates);
108 void (CLALLSERIALCC *m_clSerialClose) ( hSerRef serialRef);
110 CLINT32 (CLALLSERIALCC *m_clSerialInit) ( CLUINT32 serialIndex, hSerRef* serialRefPtr);
112 CLINT32 (CLALLSERIALCC *m_clSerialRead) ( hSerRef serialRef, CLINT8* buffer, CLUINT32* bufferSize, CLUINT32 serialTimeout);
114 CLINT32 (CLALLSERIALCC *m_clSerialWrite) ( hSerRef serialRef, CLINT8* buffer, CLUINT32* bufferSize, CLUINT32 serialTimeout);
116 CLINT32 (CLALLSERIALCC *m_clSetBaudRate) ( hSerRef serialRef, CLUINT32 baudRate);
119 static void CheckError( CLINT32 ErrorCode, CLUINT32 SerialIndex, CLAllProxy & );
130 #ifdef _DEBUG // Allow changing serial index to test error situations. 133 CLUINT32 m_SerialIndex;
139 static void InternalGetPortMap(SerialPortMap &);
141 static SerialPortMap *g_pSerialPortMap;
144 lib_handle_t m_ClAlldllHandle;
147 CLAllProxy m_clallproxy;
150 CLUINT32 m_PreviousBaudRate;
154 inline void GetPortMap(SerialPortMap &StdMap)
156 GENICAM_NAMESPACE::gcstring_vector PortIDs;
158 for (GENICAM_NAMESPACE::gcstring_vector::iterator it = PortIDs.begin(); it != PortIDs.end(); it++)
164 inline void Destroy(SerialPortMap &portList)
166 for (SerialPortMap::iterator it = portList.begin(); it != portList.end(); it++)
171 #endif //CLPROTOCOL_CLALLADAPTER_H static void GetPortIDs(GENICAM_NAMESPACE::gcstring_vector &TheVector)
used to copy the content of the SerialPort ma to a std::map
Definition: CLAllAdapter.h:64
Wraps the CLAllSerial.dll.
Definition: CLAllAdapter.h:70
CLSERIALEXPORT CLINT32 CLSERIALCC clSetBaudRate(hSerRef serialRef, CLUINT32 baudRate)
This function sets the baud rate for the serial port of the selected device. Use clGetSupportedBaudRa...
static void Destroy(ISerialAdapter *pAdapter)
Destroy the factory and all its objects.
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...
static ISerialAdapter * GetSerialAdapter(GENICAM_NAMESPACE::gcstring PortID)
used to copy the content of the SerialPort ma to a std::map
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.