libvisiontransfer  6.1.1
imagetransfer.h
1 /*******************************************************************************
2  * Copyright (c) 2018 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 
34 class VT_EXPORT ImageTransfer {
35 public:
40 
44 
47 
50 
52  NOT_CONNECTED
53  };
54 
70  ImageTransfer(const char* address, const char* service = "7681",
72  bool server = false, int bufferSize = 1048576, int maxUdpPacketSize = 1472);
73 
83  ImageTransfer(const DeviceInfo& device, int bufferSize = 1048576,
84  int maxUdpPacketSize = 1472);
85 
86  ~ImageTransfer();
87 
94  void setRawTransferData(const ImagePair& metaData, unsigned char* rawData,
95  int secondTileWidth = 0, int validBytes = 0x7FFFFFFF);
96 
102  void setRawValidBytes(int validBytes);
103 
114  void setTransferImagePair(const ImagePair& imagePair);
115 
137  TransferStatus transferData();
138 
152  bool receiveImagePair(ImagePair& imagePair);
153 
163  bool receivePartialImagePair(ImagePair& imagePair, int& validRows, bool& complete);
164 
172  int getNumDroppedFrames() const;
173 
183  bool tryAccept();
184 
188  bool isConnected() const;
189 
195  void disconnect();
196 
202  std::string getRemoteAddress() const;
203 
204 private:
205  // We follow the pimpl idiom
206  class Pimpl;
207  Pimpl* pimpl;
208 
209  // This class cannot be copied
210  ImageTransfer(const ImageTransfer& other);
211  ImageTransfer& operator=(const ImageTransfer&);
212 };
213 
214 #endif
The connection-less UDP transport protocol.
Definition: imageprotocol.h:44
Class for synchronous transfer of image pairs.
Definition: imagetransfer.h:34
The image pair has been transferred completely.
Definition: imagetransfer.h:39
ProtocolType
Supported network protocols.
Definition: imageprotocol.h:39
TransferStatus
The result of a partial image transfer.
Definition: imagetransfer.h:37
A set of two images, which are usually the left camera image and the disparity map.
Definition: imagepair.h:31
The operation would block and blocking as been disabled.
Definition: imagetransfer.h:49
Aggregates information about a discovered device.
Definition: deviceinfo.h:23
There is currently no more data that could be transmitted.
Definition: imagetransfer.h:46
Nerian Vision Technologies