libvisiontransfer  6.2.1
asynctransfer.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_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 
31 class VT_EXPORT AsyncTransfer {
32 public:
49  AsyncTransfer(const char* address, const char* service = "7681",
51  bool server = false, int bufferSize = 1048576, int maxUdpPacketSize = 1472);
52 
62  AsyncTransfer(const DeviceInfo& device, int bufferSize = 1048576, int maxUdpPacketSize = 1472);
63 
64  ~AsyncTransfer();
65 
79  void sendImagePairAsync(const ImagePair& imagePair, bool deleteData = false);
80 
97  bool collectReceivedImagePair(ImagePair& imagePair, double timeout = -1);
98 
106  int getNumDroppedFrames() const;
107 
117  bool tryAccept();
118 
122  bool isConnected() const;
123 
129  void disconnect();
130 
136  std::string getRemoteAddress() const;
137 
138 private:
139  // We follow the pimpl idiom
140  class Pimpl;
141  Pimpl* pimpl;
142 
143  // This class cannot be copied
144  AsyncTransfer(const AsyncTransfer& other);
145  AsyncTransfer& operator=(const AsyncTransfer&);
146 };
147 
148 #endif
The connection-less UDP transport protocol.
Definition: imageprotocol.h:44
ProtocolType
Supported network protocols.
Definition: imageprotocol.h:39
A set of two images, which are usually the left camera image and the disparity map.
Definition: imagepair.h:31
Class for asynchronous transfer of image pairs.
Definition: asynctransfer.h:31
Aggregates information about a discovered device.
Definition: deviceinfo.h:23
Nerian Vision Technologies