API Documentation
Loading...
Searching...
No Matches
ConnectionForwarding.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Connection.h>
4#include <NDEVR/Translator.h>
5namespace NDEVR
6{
7 /**--------------------------------------------------------------------------------------------------
8 \brief Logic for taking all rx data from one Connection and sending it through another Connection and
9 vice-versa.
10 **/
12 {
13 public:
18 virtual void update() override;
19 virtual bool open(bool start_forward_thread = true);
20 virtual bool isOpen() const;
21 Connection* a() const { return m_a; }
22 Connection* b() const { return m_b; }
23 void close();
26 void setForwardAToB(bool forward);
27 void setForwardBToA(bool forward);
28 bool forwardAToB() const { return m_forward_a_to_b; }
29 bool forwardBToA() const { return m_forward_b_to_a; }
30 TimeSpan updateInterval() const override;
31 void setUpdateInterval(const TimeSpan& span);
32 private:
33 virtual void _close();
34 protected:
35 TimeSpan m_update_span = TimeSpan(0.05);
36 Connection* m_a = nullptr;
37 Connection* m_b = nullptr;
38 bool m_forward_a_to_b = true;
39 bool m_forward_b_to_a = true;
40 bool m_is_open = false;
41 bool m_request_close = false;
42 };
43}
#define HARDWARE_API
Definition DLLInfo.h:56
Logic for taking all rx data from one Connection and sending it through another Connection and vice-v...
Definition ConnectionForwarding.h:12
bool forwardAToB() const
Definition ConnectionForwarding.h:28
TimeSpan updateInterval() const override
void setBConnectionInfo(const ConnectionInfo &info)
ConnectionForwarding(Connection *a, Connection *b, ProgressInfo *log=nullptr)
void setForwardBToA(bool forward)
Connection * b() const
Definition ConnectionForwarding.h:22
Connection * a() const
Definition ConnectionForwarding.h:21
bool forwardBToA() const
Definition ConnectionForwarding.h:29
ConnectionForwarding(ConnectionInfo a, ConnectionInfo b, ProgressInfo *log=nullptr)
void setForwardAToB(bool forward)
virtual bool open(bool start_forward_thread=true)
void setAConnectionInfo(const ConnectionInfo &info)
ConnectionForwarding(ProgressInfo *log=nullptr)
void setUpdateInterval(const TimeSpan &span)
virtual bool isOpen() const
virtual void update() override
A standard interface for all types of connections that allow transmitting and recieving of data betwe...
Definition Connection.h:198
A root class which describes some physical object, such as a Motor, Sensor, or Connection....
Definition Device.h:52
A light-weight base class for Log that allows processes to update, without the need for additional in...
Definition ProgressInfo.hpp:48
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
Definition ACIColor.h:37
A structure designed to store information about a specific Connection.
Definition Connection.h:97