rogue
Loading...
Searching...
No Matches
TcpClient.h
Go to the documentation of this file.
1
17#ifndef __ROGUE_INTERFACES_MEMORY_TCP_CLIENT_H__
18#define __ROGUE_INTERFACES_MEMORY_TCP_CLIENT_H__
19#include "rogue/Directives.h"
20
21#include <stdint.h>
22
23#include <memory>
24#include <string>
25#include <thread>
26#include <condition_variable>
27
28#include "rogue/Logging.h"
30
31namespace rogue {
32namespace interfaces {
33namespace memory {
34
54 // Inbound Address
55 std::string reqAddr_;
56
57 // Outbound Address
58 std::string respAddr_;
59
60 // Zeromq Context
61 void* zmqCtx_;
62
63 // Zeromq inbound port
64 void* zmqReq_;
65
66 // Zeromq outbound port
67 void* zmqResp_;
68
69 // Thread background
70 void runThread();
71
72 // Log
73 std::shared_ptr<rogue::Logging> bridgeLog_;
74
75 // Thread
76 std::thread* thread_;
77 bool threadEn_;
78
79 // Lock
80 std::mutex bridgeMtx_;
81
82 // Probe state
83 std::mutex probeMtx_;
84 std::condition_variable probeCond_;
85 uint32_t probeSeq_;
86 uint32_t probeId_;
87 bool probeDone_;
88 std::string probeResult_;
89 bool waitReadyOnStart_;
90
91 public:
109 static std::shared_ptr<rogue::interfaces::memory::TcpClient> create(std::string addr, uint16_t port, bool waitReady = false);
110
114 static void setup_python();
115
135 TcpClient(std::string addr, uint16_t port, bool waitReady = false);
136
140 ~TcpClient();
141
147 void close();
148
152 void stop();
153
167 bool waitReady(double timeout, double period);
168
177 void start();
178
184 void doTransaction(std::shared_ptr<rogue::interfaces::memory::Transaction> tran);
185};
186
190typedef std::shared_ptr<rogue::interfaces::memory::TcpClient> TcpClientPtr;
191
192} // namespace memory
193} // namespace interfaces
194}; // namespace rogue
195
196#endif
Memory slave device.
Definition Slave.h:54
Memory TCP bridge client.
Definition TcpClient.h:53
void close()
Closes bridge connections.
static std::shared_ptr< rogue::interfaces::memory::TcpClient > create(std::string addr, uint16_t port, bool waitReady=false)
Creates a TCP memory bridge client.
Definition TcpClient.cpp:49
~TcpClient()
Destroys the TCP client and releases transport resources.
bool waitReady(double timeout, double period)
Wait for the remote TcpServer path to respond to a bridge probe.
void stop()
Stops the bridge interface and worker thread.
void start()
Managed-lifecycle startup hook.
static void setup_python()
Registers this type with Python bindings.
void doTransaction(std::shared_ptr< rogue::interfaces::memory::Transaction > tran)
Processes a transaction received from the upstream master.
std::shared_ptr< rogue::interfaces::memory::TcpClient > TcpClientPtr
Shared pointer alias for TcpClient.
Definition TcpClient.h:190