EventAdapterCL.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2015 by Baumer
3 // Project: GenApi
4 // Author: Thomas Doering
5 // Adapted from EventAdapterU3V.h
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 //-----------------------------------------------------------------------------
30 #ifndef GENAPI_EVENTADAPTERCL_H
31 #define GENAPI_EVENTADAPTERCL_H
32 
33 #include <GenApi/EventAdapter.h>
34 
35 namespace GENAPI_NAMESPACE
36 {
37 
38  /* ------------------------------------------- */
39  // Declaration of CL / GenCP Event message structures
40 
41  // some useful macros
42  #if defined( _MSC_VER )
43  #define PACK_STRUCT
44  #elif defined (__GNUC__)
45  // While gcc-4 understands #pragma pack,
46  // gcc-3 does not
47  #define PACK_STRUCT __attribute__((packed))
48  #else
49  # error Unknown platform
50  #endif
51 
52  // make sure everything is properly packed
53 #pragma pack(push, 1)
54 
56  typedef struct PACK_STRUCT CL_COMMAND_HEADER
57  {
58  // prefix
59  uint16_t Preamble;
60  uint16_t CcdCrc16;
61  uint16_t ScdCrc16;
62  uint16_t ChannelId;
63 
64  // CCD
65  uint16_t Flags;
66  uint16_t CommandId;
67  uint16_t Length;
68  uint16_t ReqId;
70 
72  typedef struct PACK_STRUCT CL_EVENT_DATA
73  {
74  // SCD
76  uint16_t EventId;
77  uint64_t Timestamp;
78  } CL_EVENT_DATA;
79 
81  typedef struct PACK_STRUCT CL_EVENT_DATA1
82  {
83  // SCD
85  uint16_t EventId;
86  uint64_t Timestamp;
87  uint8_t Data[1];
89 
91  typedef struct PACK_STRUCT CL_EVENT_MESSAGE
92  {
94  union {
96 // CL_EVENT_DATA1 EventData1;
97  };
99 
100  const uint16_t CL_EVENT_PREAMBLE = 0x0100;
101  const uint16_t CL_EVENT_CMD_ID = 0x0C00;
102  const size_t CL_COMMAND_HEADER_SIZE = sizeof (CL_COMMAND_HEADER);
103  const size_t CL_EVENT_BASIC_SIZE = sizeof (CL_EVENT_MESSAGE);
104 
105  // restore the previous packing
106 #pragma pack(pop)
107  /* ------------------------------------------- */
108 
109 
112  {
113  public:
115  CEventAdapterCL(INodeMap* pNodeMap = NULL);
116 
118  virtual ~CEventAdapterCL();
119 
120  virtual void DeliverMessage( const uint8_t msg[], uint32_t numBytes );
121 
123  void DeliverEventData(const CL_EVENT_DATA *pEventData, uint16_t length);
124 
125  };
126 }
127 
128 #endif // GENAPI_EVENTADAPTERCL_H
CL/GenCP command header.
CL/GenCP EVENT_CMD specific command data WITHOUT event specific data.
const uint16_t CL_EVENT_PREAMBLE
interface GENAPI_DECL_ABSTRACT INodeMap
Interface to access the node map.
Definition: INodeMap.h:56
struct PACK_STRUCT GENAPI_NAMESPACE::CL_COMMAND_HEADER CL_COMMAND_HEADER
CL/GenCP command header.
#define GENAPI_DECL
Definition: GenApiDll.h:55
Declaration of the CEventAdapter class.
CL/GenCP EVENT_CMD specific command data WITH event specific data.
const size_t CL_EVENT_BASIC_SIZE
const size_t CL_COMMAND_HEADER_SIZE
Entire event data message.
const uint16_t CL_EVENT_CMD_ID
struct PACK_STRUCT GENAPI_NAMESPACE::CL_EVENT_MESSAGE CL_EVENT_MESSAGE
Entire event data message.
struct PACK_STRUCT GENAPI_NAMESPACE::CL_EVENT_DATA CL_EVENT_DATA
CL/GenCP EVENT_CMD specific command data WITHOUT event specific data.
struct PACK_STRUCT GENAPI_NAMESPACE::CL_EVENT_DATA1 CL_EVENT_DATA1
CL/GenCP EVENT_CMD specific command data WITH event specific data.
Connects a U3V Event to a node map.
Part of the generic device API.
Definition: Autovector.h:48
Delivers Events to ports.
Definition: EventAdapter.h:47


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 19:10:54