libvisiontransfer  6.4.0
imagetransfer.h
1 /*******************************************************************************
2  * Copyright (c) 2019 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/imagepair.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 ImagePair& metaData, unsigned char* rawData,
97  int secondTileWidth = 0, int validBytes = 0x7FFFFFFF);
98 
104  void setRawValidBytes(int validBytes);
105 
116  void setTransferImagePair(const ImagePair& imagePair);
117 
139  TransferStatus transferData();
140 
154  bool receiveImagePair(ImagePair& imagePair);
155 
165  bool receivePartialImagePair(ImagePair& imagePair, int& validRows, bool& complete);
166 
174  int getNumDroppedFrames() const;
175 
185  bool tryAccept();
186 
190  bool isConnected() const;
191 
197  void disconnect();
198 
204  std::string getRemoteAddress() const;
205 
206 private:
207  // We follow the pimpl idiom
208  class Pimpl;
209  Pimpl* pimpl;
210 
211  // This class cannot be copied
212  ImageTransfer(const ImageTransfer& other);
213  ImageTransfer& operator=(const ImageTransfer&);
214 };
215 
216 } // namespace
217 
218 #endif
The operation would block and blocking as been disabled.
Definition: imagetransfer.h:51
Class for synchronous transfer of image pairs.
Definition: imagetransfer.h:36
The connection-less UDP transport protocol.
Definition: imageprotocol.h:46
ProtocolType
Supported network protocols.
Definition: imageprotocol.h:41
Aggregates information about a discovered device.
Definition: deviceinfo.h:25
There is currently no more data that could be transmitted.
Definition: imagetransfer.h:48
The image pair has been transferred completely.
Definition: imagetransfer.h:41
A set of two images, which are usually the left camera image and the disparity map.
Definition: imagepair.h:33
TransferStatus
The result of a partial image transfer.
Definition: imagetransfer.h:39
Nerian Vision Technologies