2 #ifndef USRP_NET_INCLUDED 3 #define USRP_NET_INCLUDED 9 #include <boost/asio.hpp> 10 using boost::asio::ip::tcp;
11 using boost::asio::ip::address;
13 #define MSG_LENGHT 1e4 //Lenght og the buffer string of the server, should not influent since is in a loop 41 void connect(
int init_tcp_port);
45 bool start(param* current_settings);
48 bool stop(
bool force =
false);
57 boost::thread* TCP_worker;
58 boost::thread* reconnect_thread;
59 boost::thread* virtual_pinger_thread;
60 std::atomic<bool> virtual_pinger_online;
62 boost::asio::io_service *io_service =
nullptr;
63 boost::asio::socket_base::reuse_address *option;
64 tcp::acceptor *acceptor;
68 void virtual_pinger();
71 void format_net_buffer(RX_wrapper input_packet,
char* __restrict__ output_buffer);
74 std::atomic<bool> force_close;
77 void tcp_streamer(param* current_settings);
111 bool chk_new_command();
114 void send_async(std::string* message);
117 bool recv_async(usrp_param &my_parameter,
bool blocking =
true);
128 boost::thread* TCP_async_worker_RX;
129 boost::thread* TCP_async_worker_TX;
134 boost::asio::io_service *io_service =
nullptr;
135 boost::asio::socket_base::reuse_address option;
136 tcp::acceptor *acceptor;
140 void connect(
int init_tcp_port);
147 int check_header(
char* init_header);
151 void format_header(
char* header, std::string* message);
char * format_parameter(usrp_param *parameters, bool response)
std::atomic< bool > NET_IS_STREAMING
void reconnect(int init_tcp_port)
std::atomic< bool > reconnect_async
std::atomic< bool > reconnect_data
boost::lockfree::queue< std::string *> async_queue
preallocator< float2 > * memory
std::atomic< bool > ASYNC_SERVER_CONNECTED
int clear_stream_queue(rx_queue *q, preallocator< float2 > *memory)
servr_action code_2_server_action(int code)
std::atomic< bool > NET_IS_CONNECTED
void update_pointers(rx_queue *init_stream_queue, preallocator< float2 > *init_memory)
usrp_param json_2_parameters(std::string message)
Sync_server(rx_queue *init_stream_queue, preallocator< float2 > *init_memory, bool init_passthrough=false)
bool stop(bool force=false)
void connect(int init_tcp_port)
bool start(param *current_settings)