Class Receiver
Defined in File Receiver.h
Inheritance Relationships
Base Type
public ska::pst::common::ApplicationManager
Derived Types
public ska::pst::recv::UDPReceiveDB
(Class UDPReceiveDB)public ska::pst::recv::UDPReceiver
(Class UDPReceiver)
Class Documentation
-
class Receiver : public ska::pst::common::ApplicationManager
Abstract base class that provides methods for receiving data streams.
Subclassed by ska::pst::recv::UDPReceiveDB, ska::pst::recv::UDPReceiver
Public Functions
-
Receiver(std::string host, int port)
Construct a new Receiver object that is configured to receive data at the host:port UDP endpoint.
- Parameters
host – IPv4 address on which to receive UDP data streams
port – UDP port on which to receive UDP data streams
-
Receiver(std::string host)
Construct a new Receiver object that is configured to receive data on the specified IPv4 address. Note that the port on which to receive the data streams must then be provided in the beam configuration.
- Parameters
host – IPv4 address on which to receive UDP data streams
-
void validate_configure_beam(const ska::pst::common::AsciiHeader &config, ska::pst::common::ValidationContext *context) override
Validate requested beam configuration.
- Parameters
config – AsciiHeader containing Beam Configuration
context – A validation context where errors should be added.
-
void validate_configure_scan(const ska::pst::common::AsciiHeader &config, ska::pst::common::ValidationContext *context) override
Validate requested scan configuration.
- Parameters
config – AsciiHeader containing Scan Configuration
context – A validation context where errors should be added.
-
void validate_start_scan(const ska::pst::common::AsciiHeader &config) override
Validate requested start scan configuration.
- Parameters
config – AsciiHeader containing Start Scan Configuration
-
void perform_initialise() override
Initialisation callback.
-
void start_receiving()
Signal to start data acqusition.
-
void stop_receiving()
Signal to stop data acquisition.
-
void parse_beam_config()
Parse the configuration provided to the Receiver in the configure_beam method Raises a runtime_error if configuration is invalid.
-
void parse_scan_config()
Parse the header provided to the Receiver in the configurat_scan method Raises a runtime_error if the header is invalid.
-
void monitor_method()
Monitor the data receive performance whilst the control_state is Recording.
-
void perform_stop_scan()
StopScan callback that is called by ska::pst::common::ApplicationManager::main. Contains the instructions required prior to transitioning the state from Scanning to ScanConfigured.
-
void check_config_value_patterns(const std::string &config_name, const ska::pst::common::AsciiHeader &config, const std::map<std::string, std::string> &config_value_patterns, ska::pst::common::ValidationContext *context)
Validates existence of configuration keys. Check found key value patterns. Throws all missing keys and non conforming value patterns.
-
virtual uint64_t get_data_bufsz() = 0
Return the size of the data buffer that is receiving the streams.
- Returns
uint64_t size of the data buffer in bytes
-
inline virtual const std::string get_data_host()
Get the configured data_host.
-
inline virtual const int get_data_port()
Get the configured data_port.
Public Static Functions
-
static inline void reset_accounting_meta(db_accounting_t *acc)
Reset the accounting metadata, configure the curr, next and last byte offsets to their default values and resetting the number bytes in the curr and next buffers.
- Parameters
acc – accounting metadata structure to reset.
-
static inline void rotate_accounting_meta(db_accounting_t *acc)
Rotate the acounting metadata, incrementing the curr, next and last byte offsets by the bufsz. Rotates the bytes_next_buf to bytes_curr_buf and resets bytes_next_buf.
- Parameters
acc – accounting metadata structure to rotate.
-
static inline void rotate_accounting_buffers(db_accounting_t *acc)
Rotate the accounting data pointers, switching the curr and next buffers.
- Parameters
acc – accounting data to rotate
-
static inline void advance_accounting_buffers(db_accounting_t *acc)
Advance the accounting data points, settin the curr buffer to the next buffer and resetting the next buffer to nullptr.
- Parameters
acc –
Protected Functions
-
void set_config_value_patterns(std::map<std::string, std::string> beam_config, std::map<std::string, std::string> scan_config, std::map<std::string, std::string> start_scan_config)
Protected Attributes
-
UDPStats stats
List of UDPStats objects, one for each source. These classes record the UDP acquisition statistics for each source.
-
unsigned nsig = {0}
Number of distinct signals present in the input data streams. This number should always be configured as 1.
-
unsigned nchan = {0}
Number of channels in the input data streams.
-
unsigned nbit = {0}
Number of bits per sample in the input data streams. The number of bits corresponds to each datum. So a complex sample (8b real + 8b imag) would be represented as nbit=8.
-
unsigned npol = {0}
Number of polarisations in the input data streams.
-
unsigned ndim = {0}
Number of dimesions in the input data streams. Real data ndim=1, Complex data: ndim=2.
-
double tsamp = {0}
Sampling interval of the input data streams in units of microseconds.
-
double bw = {0}
Critical bandwdith of the input data streams in units of MegaHertz.
-
double freq = {0}
Centre frequency of the input data streams in uints of Megahertz.
-
unsigned start_channel = {0}
First input channel to be acquired.
-
unsigned end_channel = {0}
Last input channel to be acquired.
-
double bits_per_second = {0}
Number of bits per second in the input data streams.
-
double bytes_per_second = {0}
Number of bytes per second in the inputs data streams.
-
unsigned start_delay = {2}
Delay, in seconds, to apply in the Receiver before data acqusition commences.
-
ska::pst::common::Time utc_start = {}
Start time of the data stream.
-
uint64_t scan_id = {UINT64_MAX}
The SCAN ID for this data stream.
-
db_accounting_t data = {}
pointers and offsets for the data output
-
db_accounting_t weights = {}
pointers and offsets for the weights output
-
int timeout = {0}
time out to use during beam configuration
-
std::map<std::string, std::string> beam_config_value_patterns{{"", ""}}
-
std::map<std::string, std::string> scan_config_value_patterns{{"", ""}}
-
std::map<std::string, std::string> start_scan_config_value_patterns{{"", ""}}
-
std::unique_ptr<std::thread> monitor_thread = {nullptr}
Thread identifier for the monitoring thread.
-
bool keep_receiving = {false}
-
Receiver(std::string host, int port)