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. This command requires that the TX is enabled, and that the TX stream state is STREAM_STOPPED; it will fail if these conditions are not met. If t is less or equal to the current time, start immediately; if n is 0, continue until a tx_stop command is received.

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. This command requires that the RX is enabled, and that the RX stream state is STREAM_STOPPED; it will fail if these conditions are not met. If t is less or equal to the current time, start immediately; if n is 0, continue until a rx_stop command is received.

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 or equal to the current time, start immediately; if n_repeat is 0, continue until a tx_stop command is received. If n is small enough that the entire looped waveform fits in the device’s transmit buffer (whose size can be checked with the get_buffer_info command), the samples need only be sent once; otherwise, they must be resent for each repetition. This command requires that the TX is enabled, and that the TX stream state is STREAM_STOPPED; it will fail if these conditions are not met.

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. If t is less than or equal to the current time, start immediately; if n_repeat is 0, continue until a rx_stop command is received. This command requires that the RX is enabled, and that the RX stream state is STREAM_STOPPED; it will fail if these conditions are not met.

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(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(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, size_t n_requested = 0, const uint8_t subdev = 0, const double timeout_s = 10)#

Send transmit data to the device.

Note that if the start time is in the future, timeout_s must be long enough for that start time and data transmission to occur; otherwise the timeout will elapse and the function will return before transmission is finished.

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

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

  • subdev – the subdevice number

  • timeout_s – timeout in seconds, with a maximum of 3600

Returns:

the number of samples placed in the queue for transmission

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

Send transmit data to the device.

Note that if the start time is in the future, timeout_s must be long enough for that start time and data transmission to occur; otherwise the timeout will elapse and the function will return before transmission is finished.

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

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

  • subdev – the subdevice number

  • timeout_s – timeout in seconds, with a maximum of 3600

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_requested = 0, const uint8_t subdev = 0, const double timeout_s = 10)#

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

Note that if the start time is in the future, timeout_s must be long enough for that start time and data acquisition to occur; otherwise the timeout will elapse and the function will return before reception is finished.

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

  • n_requested – the number of samples to be received (0 means use data.size(); if data.size() < n_requested, the vector will be resized to n_requested)

  • subdev – the subdevice number

  • timeout_s – timeout in seconds, with a maximum of 3600

Returns:

the number of samples received before a receive error, or n_requested if no receive errors occur

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

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

Note that if the start time is in the future, timeout_s must be long enough for that start time and data acquisition to occur; otherwise the timeout will elapse and the function will return before reception is finished.

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

  • n_requested – the number of samples to be received (0 means use data.size(); if data.size() < n_requested, the vector will be resized to n_requested)

  • subdev – the subdevice number

  • timeout_s – timeout in seconds, with a maximum of 3600

Returns:

the number of samples received before a receive error, or n_requested if no receive errors occur