GenApi  3.5.1
ChunkAdapterDcam.h
1 //-----------------------------------------------------------------------------
2 // (c) 2004 by Basler Vision Technologies
3 // Author: Fritz Dierks
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_CHUNKADAPTERDCAM_H
29 #define GENAPI_CHUNKADAPTERDCAM_H
30 
31 #include <cstring>
32 #include <Base/GCTypes.h>
33 #include <GenApi/ChunkAdapter.h>
34 #include <GenApi/Compatibility.h>
35 
36 namespace GENAPI_NAMESPACE
37 {
38 
39  void GENAPI_DECL SET_GUID(GUID& name, uint32_t l, uint16_t w1, uint16_t w2, uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5, uint8_t b6, uint8_t b7, uint8_t b8);
40 
41 
42  // make sure everything is properly packed
43 # pragma pack(push, 1)
44 
45  typedef struct DCAM_CHUNK_TRAILER
46  {
47  GUID ChunkID;
48  uint32_t ChunkLength;
49  uint32_t InverseChunkLength;
50  explicit DCAM_CHUNK_TRAILER() : ChunkLength(0), InverseChunkLength(0)
51  {
52  memset(&ChunkID, 0, sizeof(ChunkID));
53  }
54  } DCAM_CHUNK_TRAILER;
55 
56  typedef struct DCAM_CHECKSUM
57  {
58  uint32_t CRCChecksum;
59  } DCAM_CHECKSUM;
60 
61  // restore the previous packing
62 # pragma pack(pop)
63  /* ------------------------------------------- */
64 
66  class GENAPI_DECL CChunkAdapterDcam : public CChunkAdapter
67  {
68 
69  public:
71  CChunkAdapterDcam(INodeMap* pNodeMap = NULL, int64_t MaxChunkCacheSize = -1);
72 
74  virtual ~CChunkAdapterDcam();
75 
77  virtual bool CheckBufferLayout(uint8_t *pBuffer, int64_t BufferLength);
78 
80  virtual void AttachBuffer(uint8_t *pBuffer, int64_t BufferLength, AttachStatistics_t *pAttachStatistics = NULL);
81 
83  bool HasCRC(uint8_t *pBuffer, int64_t BufferLength);
84 
86  bool CheckCRC(uint8_t *pBuffer, int64_t BufferLength);
87 
88  protected:
90  uint32_t CRC16(const unsigned char *pData, uint32_t nbyLength );
91 
93  bool CheckBuffer(const unsigned char* pData, uint32_t nbyLength );
94 
95  };
96 
97 }
98 
99 #endif // GENAPI_CHUNKADAPTERDCAM_H
Definition: ChunkAdapter.h:43
Connects a chunked DCAM buffer to a node map.
Definition: ChunkAdapterDcam.h:66
GENICAM_INTERFACE INodeMap
Interface to access the node map.
Definition: INode.h:50
Declaration of the CChunkAdapter class.
Connects a chunked buffer to a node map.
Definition: ChunkAdapter.h:55
Definition: ChunkAdapter.h:37
Platform-dependent type definitions.