EventAdapterCL.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //  (c) 2015 by Baumer
00003 //  Project:  GenApi
00004 //    Author:  Thomas Doering
00005 //             Adapted from EventAdapterU3V.h
00006 //  $Header$
00007 //
00008 //  License: This file is published under the license of the EMVA GenICam  Standard Group.
00009 //  A text file describing the legal terms is included in  your installation as 'GenICam_license.pdf'.
00010 //  If for some reason you are missing  this file please contact the EMVA or visit the website
00011 //  (http://www.genicam.org) for a full copy.
00012 //
00013 //  THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
00014 //  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00015 //  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00016 //  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD  GROUP
00017 //  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  SPECIAL,
00018 //  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT  LIMITED TO,
00019 //  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  DATA, OR PROFITS;
00020 //  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY  THEORY OF LIABILITY,
00021 //  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)
00022 //  ARISING IN ANY WAY OUT OF THE USE  OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00023 //  POSSIBILITY OF SUCH DAMAGE.
00024 //-----------------------------------------------------------------------------
00030 #ifndef GENAPI_EVENTADAPTERCL_H
00031 #define GENAPI_EVENTADAPTERCL_H
00032 
00033 #include <GenApi/EventAdapter.h>
00034 
00035 namespace GENAPI_NAMESPACE
00036 {
00037 
00038     /* ------------------------------------------- */
00039     // Declaration of CL / GenCP Event message structures
00040 
00041     // some useful macros
00042     #if defined( _MSC_VER )
00043         #define PACK_STRUCT
00044     #elif defined (__GNUC__)
00045         // While gcc-4 understands #pragma pack,
00046         // gcc-3 does not
00047         #define PACK_STRUCT __attribute__((packed))
00048     #else
00049     #   error Unknown platform
00050     #endif
00051 
00052     // make sure everything is properly packed
00053 #pragma pack(push, 1)
00054 
00056     typedef struct PACK_STRUCT CL_COMMAND_HEADER
00057     {
00058         // prefix
00059         uint16_t Preamble;
00060         uint16_t CcdCrc16;
00061         uint16_t ScdCrc16;
00062         uint16_t ChannelId;
00063 
00064         // CCD
00065         uint16_t Flags;
00066         uint16_t CommandId;
00067         uint16_t Length;
00068         uint16_t ReqId;
00069     } CL_COMMAND_HEADER;
00070 
00072     typedef struct PACK_STRUCT CL_EVENT_DATA
00073     {
00074         // SCD
00075         uint16_t ReservedOrEventSize;
00076         uint16_t EventId;
00077         uint64_t Timestamp;
00078     } CL_EVENT_DATA;
00079 
00081     typedef struct PACK_STRUCT CL_EVENT_DATA1
00082     {
00083         // SCD
00084         uint16_t ReservedOrEventSize;
00085         uint16_t EventId;
00086         uint64_t Timestamp;
00087         uint8_t  Data[1];
00088     } CL_EVENT_DATA1;
00089 
00091     typedef struct PACK_STRUCT CL_EVENT_MESSAGE
00092     {
00093         CL_COMMAND_HEADER CommandHeader;
00094         union {
00095             CL_EVENT_DATA     EventData;
00096 //          CL_EVENT_DATA1    EventData1;
00097         };
00098     } CL_EVENT_MESSAGE;
00099 
00100     const uint16_t CL_EVENT_PREAMBLE = 0x0100;
00101     const uint16_t CL_EVENT_CMD_ID = 0x0C00;
00102     const size_t CL_COMMAND_HEADER_SIZE = sizeof (CL_COMMAND_HEADER);
00103     const size_t CL_EVENT_BASIC_SIZE = sizeof (CL_EVENT_MESSAGE);
00104 
00105     // restore the previous packing
00106 #pragma pack(pop)
00107     /* ------------------------------------------- */
00108 
00109 
00111     class GENAPI_DECL CEventAdapterCL : public  CEventAdapter
00112     {
00113     public:
00115         CEventAdapterCL(INodeMap* pNodeMap = NULL);
00116 
00118         virtual ~CEventAdapterCL();
00119 
00120         virtual void DeliverMessage( const uint8_t msg[], uint32_t numBytes );
00121 
00123         void DeliverEventData(const CL_EVENT_DATA *pEventData, uint16_t length);
00124 
00125     };
00126 }
00127 
00128 #endif // GENAPI_EVENTADAPTERCL_H


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