GenApi  3.5.1
EventAdapterU3V.h
1 //-----------------------------------------------------------------------------
2 // (c) 2013 by Groget
3 // Author: Jan Becvar
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_EVENTADAPTERU3V_H
29 #define GENAPI_EVENTADAPTERU3V_H
30 
31 #include <GenApi/EventAdapter.h>
32 
33 namespace GENAPI_NAMESPACE
34 {
35 
36  /* ------------------------------------------- */
37  // Declaration of USB3 Vision / 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 U3V_COMMAND_HEADER
55  {
56  uint32_t Prefix;
57  // CCD
58  uint16_t Flags;
59  uint16_t CommandId;
60  uint16_t Length;
61  uint16_t ReqId;
64  typedef struct PACK_STRUCT U3V_EVENT_DATA
65  {
66  // SCD
67  uint16_t Reserved;
68  uint16_t EventId;
69  uint64_t Timestamp;
70  // Deliberately not mentioning the (optional?) variable sized data
73  typedef struct PACK_STRUCT U3V_EVENT_MESSAGE
74  {
75  U3V_COMMAND_HEADER CommandHeader;
76  U3V_EVENT_DATA EventData;
78 
79  const uint32_t U3V_EVENT_PREFIX = 0x45563355;
80  const uint16_t GENCP_EVENT_CMD_ID = 0x0C00;
81  const size_t GENCP_COMMAND_HEADER_SIZE = sizeof (U3V_COMMAND_HEADER);
82  const size_t GENCP_EVENT_BASIC_SIZE = sizeof (U3V_EVENT_MESSAGE);
83 
84  // restore the previous packing
85 #pragma pack(pop)
86  /* ------------------------------------------- */
87 
88 
90  class GENAPI_DECL CEventAdapterU3V : public CEventAdapter
91  {
92  public:
94  CEventAdapterU3V(INodeMap* pNodeMap = NULL);
95 
97  virtual ~CEventAdapterU3V();
98 
99  virtual void DeliverMessage( const uint8_t msg[], uint32_t numBytes );
100 
102  void DeliverEventMessage(const U3V_EVENT_MESSAGE *pEventMessage);
103 
104  };
105 }
106 
107 #endif // GENAPI_EVENTADAPTERU3V_H
U3V/GenCP EVENT_CMD specific command data.
Definition: EventAdapterU3V.h:64
Declaration of the CEventAdapter class.
U3V/GenCP command header.
Definition: EventAdapterU3V.h:54
GENICAM_INTERFACE INodeMap
Interface to access the node map.
Definition: INode.h:50
Connects a U3V Event to a node map.
Definition: EventAdapterU3V.h:90
Entire event data message (without the variable-sized data field)
Definition: EventAdapterU3V.h:73
Definition: ChunkAdapter.h:37
Delivers Events to ports.
Definition: EventAdapter.h:45