Transmit and Receive Functions

Setting up transmit and receive

bool vxsdr::tx_start(const vxsdr::time_point &t, const uint64_t n = 0, const uint8_t subdev = 0)

Start transmitting at time t until n samples are sent. If t is less than the current time, start immediately; if n is 0, continue until a stop command is sent.

Parameters
  • t – the start time

  • n – the number of samples to send

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

bool vxsdr::rx_start(const vxsdr::time_point &t, const uint64_t n = 0, const uint8_t subdev = 0)

Start receiving at time t until n samples are received. If t is less than the current time, start immediately; if n is 0, continue until a stop command is sent.

Parameters
  • t – the start time

  • n – the number of samples to receive

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

Setting up repeating transmit and receive

bool vxsdr::tx_loop(const vxsdr::time_point &t, const uint64_t n, const vxsdr::duration &t_delay = vxsdr::duration::zero(), const uint32_t n_repeat = 0, const uint8_t subdev = 0)

Start transmitting at time t until n samples are sent, repeating with a delay after each transmission of t_delay, for n_repeat iterations. If t is less than the current time, start immediately; if n_repeat is 0, continue until a stop command is sent. Note that if you wish to send the samples to be looped only once, n_samples must be small enough that the entire looped waveform fits in the device’s transmit buffer.

Parameters
  • t – the start time

  • n – the number of samples to send

  • t_delay – the delay between repeat transmissions

  • n_repeat – the total number of transmissions

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

bool vxsdr::rx_loop(const vxsdr::time_point &t, const uint64_t n, const vxsdr::duration &t_delay = vxsdr::duration::zero(), const uint32_t n_repeat = 0, const uint8_t subdev = 0)

Start receiving at time t until n samples are received, repeating with a delay after each reception of t_delay, for n_repeat iterations. for n_repeat iterations. If t is less than the current time, start immediately; if n_repeat is 0, continue until a stop command is sent.

Parameters
  • t – the start time

  • n – the number of samples to receive

  • t_delay – the delay between repeat receptions

  • n_repeat – the total number of receptions

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

Interrupting transmit and receive

bool vxsdr::tx_stop_now(const uint8_t subdev = 0)

Stop transmitting immediately.

Parameters

subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

bool vxsdr::rx_stop_now(const uint8_t subdev = 0)

Stop receiving immediately.

Parameters

subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

Sending and receiving samples

size_t vxsdr::put_tx_data(const std::vector<std::complex<int16_t>> &data, const uint8_t subdev = 0, const double timeout_s = 10)

Send transmit data to the device.

Parameters
  • data – the complex<int16_t> vector of data to be sent

  • subdev – the subdevice number

  • timeout_s – timeout in seconds

Returns

the number of samples placed in the queue for transmission

size_t vxsdr::put_tx_data(const std::vector<std::complex<float>> &data, const uint8_t subdev = 0, const double timeout_s = 10)

Send transmit data to the device.

Parameters
  • data – the complex<float> vector of data to be sent

  • subdev – the subdevice number

  • timeout_s – timeout in seconds

Returns

the number of samples placed in the queue for transmission

size_t vxsdr::get_rx_data(std::vector<std::complex<int16_t>> &data, const size_t n_desired = 0, const uint8_t subdev = 0, const double timeout_s = 10)

Receive data from the device and return it in a vector.

Parameters
  • data – the complex<int16_t> vector for the received data

  • n_desired – the number of samples to be received (0 means use data.size(); if data.size() < n_desired, only data.size() will be acquired)

  • subdev – the subdevice number

  • timeout_s – timeout in seconds

Returns

the number of samples received before a sequence error, or n_desired if no sequence errors occur

size_t vxsdr::get_rx_data(std::vector<std::complex<float>> &data, const size_t n_desired = 0, const uint8_t subdev = 0, const double timeout_s = 10)

Receive data from the device and return it in a vector.

Parameters
  • data – the complex<float> vector for the received data

  • n_desired – the number of samples to be received (0 means use data.size(); if data.size() < n_desired, only data.size() will be acquired)

  • subdev – the subdevice number

  • timeout_s – timeout in seconds

Returns

the number of samples received before a sequence error, or n_desired if no sequence errors occur