1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
// Copyright (c) 2015-2016 Josh Blum
// SPDX-License-Identifier: BSL-1.0
#pragma once
#include "SoapyRPCSocket.hpp"
#include "ThreadPrioHelper.hpp"
#include <csignal> //sig_atomic_t
#include <string>
#include <thread>
class SoapyStreamEndpoint;
namespace SoapySDR
{
class Device;
class Stream;
}
/*!
* Server-side stream data for client handler.
* This class manages a recv/send endpoint,
* and a thread to handle that endpoint.
*/
class ServerStreamData
{
public:
ServerStreamData(void);
~ServerStreamData(void);
SoapySDR::Device *device;
SoapySDR::Stream *stream;
std::string format;
size_t chanMask;
double priority;
//this ID identifies the stream to the remote host
int streamId;
//datagram socket for stream endpoint
SoapyRPCSocket *streamSock;
//datagram socket for status endpoint
SoapyRPCSocket *statusSock;
//remote side of the stream endpoint
SoapyStreamEndpoint *endpoint;
//hooks to start/stop work
void startSendThread(void);
void startRecvThread(void);
void startStatThread(void);
void stopThreads(void);
//worker implementations
void recvEndpointWork(void);
void sendEndpointWork(void);
void statEndpointWork(void);
private:
//worker thread for this stream
std::thread *streamThread;
std::thread *statusThread;
//signal done to the thread
sig_atomic_t done;
};
|