Class Receiver

Inheritance Relationships

Base Type

Derived Types

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

~Receiver()

Destroy the Receiver object.

void read_mac_addr()

Set the data_mac attribute to the MAC address of the data_host.

This method should be called by the constructor and will determine the MAC address of the local network device that is configured with the data_host IPv4 address.

If the data_host is set to the loopback network address (i.e. 127.0.0.1), this method will configure the MAC address to be 00:00:00:00:00:00.

virtual 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.

virtual 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.

virtual void validate_start_scan(const ska::pst::common::AsciiHeader &config) override

Validate requested start scan configuration.

Parameters

config – AsciiHeader containing Start Scan Configuration

virtual void perform_initialise() override

Initialisation callback.

void start_receiving()

Signal to start data acquisition.

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 configure_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.

virtual void perform_stop_scan() override

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 print_stats()

Print scan statistics by printing values from UDPStats.

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 UDPStats &get_stats()

Get a const reference of the stats for the Receiver.

uint64_t get_scan_id()

Get the scan_id of the Receiver.

If currently not configured for a scan this will return UINT64_MAX value. Callers to this method should ensure that they are in a scanning state.

Returns

uint64_t scan_id

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.

inline virtual const std::string get_data_mac()

Get the configured data_mac.

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 accounting 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, setting 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

std::string data_host = {}

IPv4 network address the Receiver will be acquiring UDP data on.

int data_port = {0}

UDP port number the Receiver will be acquiring data on.

ska::pst::common::mac_address data_mac = {}

MAC address of the network device wit the data_host IPv4 address.

UDPStats stats

List of UDPStats objects, one for each source. These classes record the UDP acquisition statistics for each source.

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 dimensions 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 bandwidth of the input data streams in units of MegaHertz.

double freq = {0}

Centre frequency of the input data streams in units of Megahertz.

unsigned start_channel = {0}

First input channel to be acquired.

unsigned end_channel = {0}

Last input channel to be acquired.

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 acquisition commences.

ska::pst::common::Time utc_start = {}

Start time of the 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}