libvisiontransfer  4.1.5
imageprotocol.h
1 /*******************************************************************************
2  * Copyright (c) 2017 Nerian Vision Technologies
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *******************************************************************************/
14 
15 #ifndef VISIONTRANSFER_IMAGEPROTOCOL_H
16 #define VISIONTRANSFER_IMAGEPROTOCOL_H
17 
18 #include "visiontransfer/common.h"
19 #include "visiontransfer/imagepair.h"
20 
36 class VT_EXPORT ImageProtocol {
37 public:
39  enum ProtocolType {
42 
44  PROTOCOL_UDP
45  };
46 
53  ImageProtocol(ProtocolType protType);
54 
55  ~ImageProtocol();
56 
66  void setTransferImagePair(const ImagePair& imagePair);
67 
97  void setRawTransferData(const ImagePair& metaData, unsigned char* rawData,
98  int firstTileWidth = 0, int secondTileWidth = 0, int validBytes = 0x7FFFFFFF);
99 
109  void setRawValidBytes(int validBytes);
110 
119  const unsigned char* getTransferMessage(int& length);
120 
124  bool transferComplete();
125 
130  void resetTransfer();
131 
146  bool getReceivedImagePair(ImagePair& imagePair);
147 
170  bool getPartiallyReceivedImagePair(ImagePair& imagePair, int& validRows, bool& complete);
171 
175  bool imagesReceived() const;
176 
183  unsigned char* getNextReceiveBuffer(int& maxLength);
184 
198  bool processReceivedMessage(int length);
199 
204  void resetReception();
205 
206 private:
207  // We follow the pimpl idiom
208  class Pimpl;
209  Pimpl* pimpl;
210 
211  // This class cannot be copied
212  ImageProtocol(const ImageProtocol& other);
213  ImageProtocol& operator=(const ImageProtocol&);
214 };
215 
216 #endif
A lightweight protocol for transferring image pairs.
Definition: imageprotocol.h:36
ProtocolType
Supported network protocols.
Definition: imageprotocol.h:39
A set of two images, which are usually the left camera image and the disparity map.
Definition: imagepair.h:30
The connection oriented TCP transport protocol.
Definition: imageprotocol.h:41
Nerian Vision Technologies