libvisiontransfer  4.1.5
imagetransfer.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_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 
30 class VT_EXPORT ImageTransfer {
31 public:
36  UDP,
37 
40 
43  };
44 
49 
52 
56 
59 
61  WOULD_BLOCK
62  };
63 
86  ImageTransfer(OperationMode mode, const char* remoteAddress, const char* remoteService,
87  const char* localAddress, const char* localService, int bufferSize = 1000000);
88 
89  ~ImageTransfer();
90 
97  void setRawTransferData(const ImagePair& metaData, unsigned char* rawData,
98  int secondTileWidth = 0, int validBytes = 0x7FFFFFFF);
99 
105  void setRawValidBytes(int validBytes);
106 
117  void setTransferImagePair(const ImagePair& imagePair);
118 
137  TransferStatus transferData(bool block);
138 
154  bool receiveImagePair(ImagePair& imagePair, bool block = true);
155 
165  bool receivePartialImagePair(ImagePair& imagePair, int& validRows, bool& complete, bool block = false);
166 
176  bool tryAccept();
177 
183  bool isClientConnected() const;
184 
191  void disconnect();
192 
200  std::string getClientAddress() const;
201 
202 private:
203  // We follow the pimpl idiom
204  class Pimpl;
205  Pimpl* pimpl;
206 
207  // This class cannot be copied
208  ImageTransfer(const ImageTransfer& other);
209  ImageTransfer& operator=(const ImageTransfer&);
210 };
211 
212 #endif
The connection has been closed by the remote host.
Definition: imagetransfer.h:48
Using TCP and acting as communication server.
Definition: imagetransfer.h:42
OperationMode
Supported transfer modes.
Definition: imagetransfer.h:33
Using TCP and acting as communication client.
Definition: imagetransfer.h:39
Class for synchronous transfer of image pairs.
Definition: imagetransfer.h:30
The image pair has been transferred completely.
Definition: imagetransfer.h:51
TransferStatus
The result of a partial image transfer.
Definition: imagetransfer.h:46
A set of two images, which are usually the left camera image and the disparity map.
Definition: imagepair.h:30
There is currently no more data that could be transmitted.
Definition: imagetransfer.h:58
Nerian Vision Technologies