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
tuntilnsamples 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. Iftis less or equal to the current time, start immediately; ifnis 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
tuntilnsamples 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. Iftis less or equal to the current time, start immediately; ifnis 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
tuntilnsamples are sent, repeating with a delay after each transmission oft_delay, forn_repeatiterations. Iftis less than or equal to the current time, start immediately; ifn_repeatis 0, continue until a tx_stop command is received. Ifnis 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
tuntilnsamples are received, repeating with a delay after each reception oft_delay, forn_repeatiterations. Iftis less than or equal to the current time, start immediately; ifn_repeatis 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#
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_smust 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 sentn_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_smust 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 sentn_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_smust 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 datan_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_requestedif 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_smust 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 datan_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_requestedif no receive errors occur