libvisiontransfer  6.4.0
asynctransfer.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_ASYNCTRANSFER_H
16 #define VISIONTRANSFER_ASYNCTRANSFER_H
17 
18 #include "visiontransfer/common.h"
19 #include "visiontransfer/imagetransfer.h"
20 #include "visiontransfer/imagepair.h"
21 #include "visiontransfer/imageprotocol.h"
22 #include "visiontransfer/deviceinfo.h"
23 
24 namespace visiontransfer {
25 
33 class VT_EXPORT AsyncTransfer {
34 public:
51  AsyncTransfer(const char* address, const char* service = "7681",
53  bool server = false, int bufferSize = 1048576, int maxUdpPacketSize = 1472);
54 
64  AsyncTransfer(const DeviceInfo& device, int bufferSize = 1048576, int maxUdpPacketSize = 1472);
65 
66  ~AsyncTransfer();
67 
81  void sendImagePairAsync(const ImagePair& imagePair, bool deleteData = false);
82 
99  bool collectReceivedImagePair(ImagePair& imagePair, double timeout = -1);
100 
108  int getNumDroppedFrames() const;
109 
119  bool tryAccept();
120 
124  bool isConnected() const;
125 
131  void disconnect();
132 
138  std::string getRemoteAddress() const;
139 
140 private:
141  // We follow the pimpl idiom
142  class Pimpl;
143  Pimpl* pimpl;
144 
145  // This class cannot be copied
146  AsyncTransfer(const AsyncTransfer& other);
147  AsyncTransfer& operator=(const AsyncTransfer&);
148 };
149 
150 } // namespace
151 
152 #endif
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
Class for asynchronous transfer of image pairs.
Definition: asynctransfer.h:33
A set of two images, which are usually the left camera image and the disparity map.
Definition: imagepair.h:33
Nerian Vision Technologies