EventAdapterGEV.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //  (c) 2006 by Basler Vision Technologies
00003 //  Section:  Vision Components
00004 //  Project:  GenApi
00005 //    Author:  Fritz Dierks
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_EVENTADAPTERGEV_H
00031 #define GENAPI_EVENTADAPTERGEV_H
00032 
00033 #include <GenApi/EventAdapter.h>
00034 
00035 namespace GENAPI_NAMESPACE
00036 {
00037 
00038     /* ------------------------------------------- */
00039     // Declaration of GigE Vision 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 
00055 
00057     typedef struct PACK_STRUCT GVCP_REQUEST_HEADER
00058     {
00059         uint8_t  Magic;
00060         uint8_t  Flags;
00061         uint16_t Command;
00062         uint16_t Length;
00063         uint16_t ReqId;
00064     } GVCP_REQUEST_HEADER;
00065 
00067     typedef struct PACK_STRUCT GVCP_EVENT_ITEM_BASIC
00068     {
00069         uint16_t ReservedOrEventSize;
00070         uint16_t EventId;
00071     } GVCP_EVENT_ITEM_BASIC;
00072 
00074     typedef struct PACK_STRUCT GVCP_EVENT_ITEM
00075     {
00076         uint16_t ReservedOrEventSize;
00077         uint16_t EventId;
00078         uint16_t StreamChannelId;
00079         uint16_t BlockId;
00080         uint32_t TimestampHigh;
00081         uint32_t TimestampLow;
00082     } GVCP_EVENT_ITEM;
00083 
00085     typedef struct PACK_STRUCT GVCP_EVENT_REQUEST
00086     {
00087         GVCP_REQUEST_HEADER Header;
00088         GVCP_EVENT_ITEM Items[ 1 ];
00089     } GVCP_EVENT_REQUEST;
00090 
00092     typedef struct PACK_STRUCT GVCP_EVENTDATA_REQUEST
00093     {
00094         GVCP_REQUEST_HEADER Header;
00095         GVCP_EVENT_ITEM Event;
00096         uint32_t Data[ 1 ];
00097     } GVCP_EVENTDATA_REQUEST;
00098 
00100     typedef struct PACK_STRUCT GVCP_EVENT_ITEM_EXTENDED_ID
00101     {
00102         uint16_t ReservedOrEventSize;
00103         uint16_t EventId;
00104         uint16_t StreamChannelId;
00105         uint16_t BlockId;
00106         uint32_t BlockId64High;
00107         uint32_t BlockId64Low;
00108         uint32_t TimestampHigh;
00109         uint32_t TimestampLow;
00110     } GVCP_EVENT_ITEM_EXTENDED_ID;
00111 
00113     typedef struct PACK_STRUCT GVCP_EVENT_REQUEST_EXTENDED_ID
00114     {
00115         GVCP_REQUEST_HEADER Header;
00116         GVCP_EVENT_ITEM_EXTENDED_ID Items[ 1 ];
00117     } GVCP_EVENT_REQUEST_EXTENDED_ID;
00118 
00120     typedef struct PACK_STRUCT GVCP_EVENTDATA_REQUEST_EXTENDED_ID
00121     {
00122         GVCP_REQUEST_HEADER Header;
00123         GVCP_EVENT_ITEM_EXTENDED_ID Event;
00124         uint32_t Data[ 1 ];
00125     } GVCP_EVENTDATA_REQUEST_EXTENDED_ID;
00126 
00127     const uint8_t COMMAND_MAGIC = 0x42;
00128 
00129     typedef enum GVCP_MESSAGE_TAGS
00130     {
00131         TAG_EVENT_CMD         = 0xc0,
00132         TAG_EVENTDATA_CMD     = 0xc2
00133     } GVCP_MESSAGE_TAGS;
00134     // restore the previous packing
00135 #pragma pack(pop)
00136     /* ------------------------------------------- */
00137 
00138 
00140     class GENAPI_DECL CEventAdapterGEV : public  CEventAdapter
00141     {
00142     public:
00144         CEventAdapterGEV(INodeMap* pNodeMap = NULL);
00145 
00147         virtual ~CEventAdapterGEV();
00148 
00149         virtual void DeliverMessage( const uint8_t msg[], uint32_t numBytes );
00150 
00152         void DeliverEventMessage(const GVCP_EVENT_REQUEST *pEvent);
00153 
00155         void DeliverEventMessage(const GVCP_EVENTDATA_REQUEST *pEventData);
00156 
00158         void DeliverEventMessage(const GVCP_EVENT_REQUEST_EXTENDED_ID *pEvent);
00159 
00161         void DeliverEventMessage(const GVCP_EVENTDATA_REQUEST_EXTENDED_ID *pEventData);
00162 
00163     private:
00164         void DeliverEventItem(const GVCP_EVENT_ITEM_BASIC *pItem, unsigned int length);
00165 
00166         /*
00167         The code for handling event messages and attaching event items to the EventPort
00168         is the same for events with and without extended ID.
00169         Only the datatype differs, so we keep the implementation in these templates
00170         */
00171         template<typename EVT_REQ_TYPE> void DeliverEventMessageImpl(const EVT_REQ_TYPE *pEvent);
00172         template<typename EVT_REQ_TYPE> void DeliverEventDataMessageImpl(const EVT_REQ_TYPE *pEvent);
00173         void AttachItemToPorts(const uint8_t *pItem, uint16_t event_id, unsigned int length);
00174 
00175     };
00176 }
00177 
00178 #endif // GENAPI_EVENTADAPTERGEV_H


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:02