GenApi 3.5.1
EventAdapterCL.h
1//-----------------------------------------------------------------------------
2// (c) 2015 by Baumer
3// Author: Thomas Doering
4//
5// License: This file is published under the license of the EMVA GenICam Standard Group.
6// A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
7// If for some reason you are missing this file please contact the EMVA or visit the website
8// (http://www.genicam.org) for a full copy.
9//
10// THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
11// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
12// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
13// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
14// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
15// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
17// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20// POSSIBILITY OF SUCH DAMAGE.
21//
22//-----------------------------------------------------------------------------
28#ifndef GENAPI_EVENTADAPTERCL_H
29#define GENAPI_EVENTADAPTERCL_H
30
31#include <GenApi/EventAdapter.h>
32
33namespace GENAPI_NAMESPACE
34{
35
36 /* ------------------------------------------- */
37 // Declaration of CL / GenCP Event message structures
38
39 // some useful macros
40 #if defined( _MSC_VER )
41 #define PACK_STRUCT
42 #elif defined (__GNUC__)
43 // While gcc-4 understands #pragma pack,
44 // gcc-3 does not
45 #define PACK_STRUCT __attribute__((packed))
46 #else
47 # error Unknown platform
48 #endif
49
50 // make sure everything is properly packed
51#pragma pack(push, 1)
52
54 typedef struct PACK_STRUCT CL_COMMAND_HEADER
55 {
56 // prefix
57 uint16_t Preamble;
58 uint16_t CcdCrc16;
59 uint16_t ScdCrc16;
60 uint16_t ChannelId;
61
62 // CCD
63 uint16_t Flags;
64 uint16_t CommandId;
65 uint16_t Length;
66 uint16_t ReqId;
68
70 typedef struct PACK_STRUCT CL_EVENT_DATA
71 {
72 // SCD
73 uint16_t ReservedOrEventSize;
74 uint16_t EventId;
75 uint64_t Timestamp;
77
79 typedef struct PACK_STRUCT CL_EVENT_DATA1
80 {
81 // SCD
82 uint16_t ReservedOrEventSize;
83 uint16_t EventId;
84 uint64_t Timestamp;
85 uint8_t Data[1];
87
89 typedef struct PACK_STRUCT CL_EVENT_MESSAGE
90 {
91 CL_COMMAND_HEADER CommandHeader;
92 union {
93 CL_EVENT_DATA EventData;
94// CL_EVENT_DATA1 EventData1;
95 };
97
98 const uint16_t CL_EVENT_PREAMBLE = 0x0100;
99 const uint16_t CL_EVENT_CMD_ID = 0x0C00;
100 const size_t CL_COMMAND_HEADER_SIZE = sizeof (CL_COMMAND_HEADER);
101 const size_t CL_EVENT_BASIC_SIZE = sizeof (CL_EVENT_MESSAGE);
102
103 // restore the previous packing
104#pragma pack(pop)
105 /* ------------------------------------------- */
106
107
109 class GENAPI_DECL CEventAdapterCL : public CEventAdapter
110 {
111 public:
113 CEventAdapterCL(INodeMap* pNodeMap = NULL);
114
117
118 virtual void DeliverMessage( const uint8_t msg[], uint32_t numBytes );
119
121 void DeliverEventData(const CL_EVENT_DATA *pEventData, uint16_t length);
122
123 };
124}
125
126#endif // GENAPI_EVENTADAPTERCL_H
Declaration of the CEventAdapter class.
Connects a U3V Event to a node map.
Definition EventAdapterCL.h:110
virtual ~CEventAdapterCL()
Destructor.
CEventAdapterCL(INodeMap *pNodeMap=NULL)
Constructor.
void DeliverEventData(const CL_EVENT_DATA *pEventData, uint16_t length)
Delivers the Event + Data listed in the packet.
Delivers Events to ports.
Definition EventAdapter.h:46
CL/GenCP command header.
Definition EventAdapterCL.h:55
CL/GenCP EVENT_CMD specific command data WITH event specific data.
Definition EventAdapterCL.h:80
CL/GenCP EVENT_CMD specific command data WITHOUT event specific data.
Definition EventAdapterCL.h:71
Entire event data message.
Definition EventAdapterCL.h:90