EventAdapterU3V.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //  (c) 2013 by Groget
00003 //  Project:  GenApi
00004 //    Author:  Jan Becvar
00005 //  $Header$
00006 //
00007 //  License: This file is published under the license of the EMVA GenICam  Standard Group.
00008 //  A text file describing the legal terms is included in  your installation as 'GenICam_license.pdf'.
00009 //  If for some reason you are missing  this file please contact the EMVA or visit the website
00010 //  (http://www.genicam.org) for a full copy.
00011 //
00012 //  THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
00013 //  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00014 //  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00015 //  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD  GROUP
00016 //  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  SPECIAL,
00017 //  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT  LIMITED TO,
00018 //  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  DATA, OR PROFITS;
00019 //  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY  THEORY OF LIABILITY,
00020 //  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)
00021 //  ARISING IN ANY WAY OUT OF THE USE  OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00022 //  POSSIBILITY OF SUCH DAMAGE.
00023 //-----------------------------------------------------------------------------
00029 #ifndef GENAPI_EVENTADAPTERU3V_H
00030 #define GENAPI_EVENTADAPTERU3V_H
00031 
00032 #include <GenApi/EventAdapter.h>
00033 
00034 namespace GENAPI_NAMESPACE
00035 {
00036 
00037     /* ------------------------------------------- */
00038     // Declaration of USB3 Vision / GenCP Event message structures
00039 
00040     // some useful macros
00041     #if defined( _MSC_VER )
00042         #define PACK_STRUCT
00043     #elif defined (__GNUC__)
00044         // While gcc-4 understands #pragma pack,
00045         // gcc-3 does not
00046         #define PACK_STRUCT __attribute__((packed))
00047     #else
00048     #   error Unknown platform
00049     #endif
00050 
00051     // make sure everything is properly packed
00052 #pragma pack(push, 1)
00053 
00055     typedef struct PACK_STRUCT U3V_COMMAND_HEADER
00056     {
00057         uint32_t  Prefix;
00058         // CCD
00059         uint16_t Flags;
00060         uint16_t CommandId;
00061         uint16_t Length;
00062         uint16_t ReqId;
00063     } U3V_COMMAND_HEADER;
00065     typedef struct PACK_STRUCT U3V_EVENT_DATA
00066     {
00067         // SCD
00068         uint16_t Reserved;
00069         uint16_t EventId;
00070         uint64_t Timestamp;
00071         // Deliberately not mentioning the (optional?) variable sized data 
00072     } U3V_EVENT_DATA;
00074     typedef struct PACK_STRUCT U3V_EVENT_MESSAGE
00075     {
00076       U3V_COMMAND_HEADER CommandHeader;
00077       U3V_EVENT_DATA EventData;
00078     } U3V_EVENT_MESSAGE;
00079 
00080     const uint32_t U3V_EVENT_PREFIX = 0x45563355;
00081     const uint16_t GENCP_EVENT_CMD_ID = 0x0C00;
00082     const size_t GENCP_COMMAND_HEADER_SIZE = sizeof (U3V_COMMAND_HEADER);
00083     const size_t GENCP_EVENT_BASIC_SIZE = sizeof (U3V_EVENT_MESSAGE);
00084 
00085     // restore the previous packing
00086 #pragma pack(pop)
00087     /* ------------------------------------------- */
00088 
00089 
00091     class GENAPI_DECL CEventAdapterU3V : public  CEventAdapter
00092     {
00093     public:
00095         CEventAdapterU3V(INodeMap* pNodeMap = NULL);
00096 
00098         virtual ~CEventAdapterU3V();
00099 
00100         virtual void DeliverMessage( const uint8_t msg[], uint32_t numBytes );
00101 
00103         void DeliverEventMessage(const U3V_EVENT_MESSAGE *pEventMessage);
00104 
00105     };
00106 }
00107 
00108 #endif // GENAPI_EVENTADAPTERU3V_H


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 18:42:46