EventAdapterGEV.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2006 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 //-----------------------------------------------------------------------------
30 #ifndef GENAPI_EVENTADAPTERGEV_H
31 #define GENAPI_EVENTADAPTERGEV_H
32 
33 #include <GenApi/EventAdapter.h>
34 
35 namespace GENAPI_NAMESPACE
36 {
37 
38  /* ------------------------------------------- */
39  // Declaration of GigE Vision 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 
55 
57  typedef struct PACK_STRUCT GVCP_REQUEST_HEADER
58  {
59  uint8_t Magic;
60  uint8_t Flags;
61  uint16_t Command;
62  uint16_t Length;
63  uint16_t ReqId;
65 
67  typedef struct PACK_STRUCT GVCP_EVENT_ITEM_BASIC
68  {
70  uint16_t EventId;
72 
74  typedef struct PACK_STRUCT GVCP_EVENT_ITEM
75  {
77  uint16_t EventId;
78  uint16_t StreamChannelId;
79  uint16_t BlockId;
80  uint32_t TimestampHigh;
81  uint32_t TimestampLow;
83 
85  typedef struct PACK_STRUCT GVCP_EVENT_REQUEST
86  {
88  GVCP_EVENT_ITEM Items[ 1 ];
90 
92  typedef struct PACK_STRUCT GVCP_EVENTDATA_REQUEST
93  {
96  uint32_t Data[ 1 ];
98 
100  typedef struct PACK_STRUCT GVCP_EVENT_ITEM_EXTENDED_ID
101  {
103  uint16_t EventId;
104  uint16_t StreamChannelId;
105  uint16_t BlockId;
106  uint32_t BlockId64High;
107  uint32_t BlockId64Low;
108  uint32_t TimestampHigh;
109  uint32_t TimestampLow;
111 
113  typedef struct PACK_STRUCT GVCP_EVENT_REQUEST_EXTENDED_ID
114  {
118 
120  typedef struct PACK_STRUCT GVCP_EVENTDATA_REQUEST_EXTENDED_ID
121  {
124  uint32_t Data[ 1 ];
126 
127  const uint8_t COMMAND_MAGIC = 0x42;
128 
129  typedef enum GVCP_MESSAGE_TAGS
130  {
134  // restore the previous packing
135 #pragma pack(pop)
136  /* ------------------------------------------- */
137 
138 
141  {
142  public:
144  CEventAdapterGEV(INodeMap* pNodeMap = NULL);
145 
147  virtual ~CEventAdapterGEV();
148 
149  virtual void DeliverMessage( const uint8_t msg[], uint32_t numBytes );
150 
152  void DeliverEventMessage(const GVCP_EVENT_REQUEST *pEvent);
153 
155  void DeliverEventMessage(const GVCP_EVENTDATA_REQUEST *pEventData);
156 
158  void DeliverEventMessage(const GVCP_EVENT_REQUEST_EXTENDED_ID *pEvent);
159 
161  void DeliverEventMessage(const GVCP_EVENTDATA_REQUEST_EXTENDED_ID *pEventData);
162 
163  private:
164  void DeliverEventItem(const GVCP_EVENT_ITEM_BASIC *pItem, unsigned int length);
165 
166  /*
167  The code for handling event messages and attaching event items to the EventPort
168  is the same for events with and without extended ID.
169  Only the datatype differs, so we keep the implementation in these templates
170  */
171  template<typename EVT_REQ_TYPE> void DeliverEventMessageImpl(const EVT_REQ_TYPE *pEvent);
172  template<typename EVT_REQ_TYPE> void DeliverEventDataMessageImpl(const EVT_REQ_TYPE *pEvent);
173  void AttachItemToPorts(const uint8_t *pItem, uint16_t event_id, unsigned int length);
174 
175  };
176 }
177 
178 #endif // GENAPI_EVENTADAPTERGEV_H
const uint8_t COMMAND_MAGIC
Layout of a GVCP event request packet (Extended ID flag set)
struct PACK_STRUCT GENAPI_NAMESPACE::GVCP_EVENT_REQUEST GVCP_EVENT_REQUEST
Layout of a GVCP event request packet (Extended ID flag not set)
layout of a GVCP event item (Extended ID flag set)
interface GENAPI_DECL_ABSTRACT INodeMap
Interface to access the node map.
Definition: INodeMap.h:56
#define GENAPI_DECL
Definition: GenApiDll.h:55
Declaration of the CEventAdapter class.
Layout of a GVCP event data request packet (Extended ID flag set)
header of a GVCP request packet
struct PACK_STRUCT GENAPI_NAMESPACE::GVCP_EVENT_REQUEST_EXTENDED_ID GVCP_EVENT_REQUEST_EXTENDED_ID
Layout of a GVCP event request packet (Extended ID flag set)
struct PACK_STRUCT GENAPI_NAMESPACE::GVCP_EVENTDATA_REQUEST GVCP_EVENTDATA_REQUEST
Layout of a GVCP event data request packet (Extended ID flag not set)
struct PACK_STRUCT GENAPI_NAMESPACE::GVCP_EVENTDATA_REQUEST_EXTENDED_ID GVCP_EVENTDATA_REQUEST_EXTENDED_ID
Layout of a GVCP event data request packet (Extended ID flag set)
Layout of a GVCP event data request packet (Extended ID flag not set)
struct PACK_STRUCT GENAPI_NAMESPACE::GVCP_EVENT_ITEM GVCP_EVENT_ITEM
layout of a GVCP event item (Extended ID flag not set)
struct PACK_STRUCT GENAPI_NAMESPACE::GVCP_REQUEST_HEADER GVCP_REQUEST_HEADER
header of a GVCP request packet
layout of a GVCP event item (common to all types)
struct PACK_STRUCT GENAPI_NAMESPACE::GVCP_EVENT_ITEM_EXTENDED_ID GVCP_EVENT_ITEM_EXTENDED_ID
layout of a GVCP event item (Extended ID flag set)
layout of a GVCP event item (Extended ID flag not set)
Connects a GigE Event to a node map.
struct PACK_STRUCT GENAPI_NAMESPACE::GVCP_EVENT_ITEM_BASIC GVCP_EVENT_ITEM_BASIC
layout of a GVCP event item (common to all types)
Layout of a GVCP event request packet (Extended ID flag not set)
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