libvisiontransfer  8.1.0
imagetransfer.h
1 /*******************************************************************************
2  * Copyright (c) 2020 Nerian Vision GmbH
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_IMAGETRANSFER_H
16 #define VISIONTRANSFER_IMAGETRANSFER_H
17 
18 #include <string>
19 #include "visiontransfer/common.h"
20 #include "visiontransfer/imageprotocol.h"
21 #include "visiontransfer/imageset.h"
22 #include "visiontransfer/deviceinfo.h"
23 
24 namespace visiontransfer {
25 
36 class VT_EXPORT ImageTransfer {
37 public:
42 
46 
49 
52 
54  NOT_CONNECTED
55  };
56 
72  ImageTransfer(const char* address, const char* service = "7681",
74  bool server = false, int bufferSize = 1048576, int maxUdpPacketSize = 1472);
75 
85  ImageTransfer(const DeviceInfo& device, int bufferSize = 1048576,
86  int maxUdpPacketSize = 1472);
87 
88  ~ImageTransfer();
89 
96  void setRawTransferData(const ImageSet& metaData, const std::vector<unsigned char*>& rawData,
97  int firstTileWidth = 0, int secondTileWidth = 0, int validBytes = 0x7FFFFFFF);
98 
104  void setRawValidBytes(const std::vector<int>& validBytes);
105 
116  void setTransferImageSet(const ImageSet& imageSet);
117 
138  TransferStatus transferData();
139 
152  bool receiveImageSet(ImageSet& imageSet);
153 
154 #ifndef DOXYGEN_SHOULD_SKIP_THIS
155  DEPRECATED("Use receiveImageSet() instead")
156  inline bool receiveImagePair(ImageSet& imageSet) {
157  return receiveImageSet(imageSet);
158  }
159 #endif
160 
170  bool receivePartialImageSet(ImageSet& imageSet, int& validRows, bool& complete);
171 
172 #ifndef DOXYGEN_SHOULD_SKIP_THIS
173  DEPRECATED("Use receivePartialImageSet() instead")
174  inline bool receivePartialImagePair(ImageSet& imageSet, int& validRows, bool& complete) {
175  return receivePartialImageSet(imageSet, validRows, complete);
176  }
177 #endif
178 
186  int getNumDroppedFrames() const;
187 
197  bool tryAccept();
198 
202  bool isConnected() const;
203 
209  void disconnect();
210 
216  std::string getRemoteAddress() const;
217 
218  std::string statusReport();
219 
220 private:
221  // We follow the pimpl idiom
222  class Pimpl;
223  Pimpl* pimpl;
224 
225  // This class cannot be copied
226  ImageTransfer(const ImageTransfer& other);
227  ImageTransfer& operator=(const ImageTransfer&);
228 };
229 
230 } // namespace
231 
232 #endif
The operation would block and blocking as been disabled.
Definition: imagetransfer.h:51
Class for synchronous transfer of image sets.
Definition: imagetransfer.h:36
The connection-less UDP transport protocol.
Definition: imageprotocol.h:48
ProtocolType
Supported network protocols.
Definition: imageprotocol.h:43
Aggregates information about a discovered device.
Definition: deviceinfo.h:47
There is currently no more data that could be transmitted.
Definition: imagetransfer.h:48
The image set has been transferred completely.
Definition: imagetransfer.h:41
A set of one to three images, but usually two (the left camera image and the disparity map)...
Definition: imageset.h:38
TransferStatus
The result of a partial image transfer.
Definition: imagetransfer.h:39
Nerian Vision Technologies