aboutsummaryrefslogtreecommitdiffstats
path: root/OutputUHD.hpp
blob: 4c7ac12aac436ea2a7240e65c8e274d75bb5b66f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
   Copyright (C) 2015
   Matthias P. Braendli, matthias.braendli@mpb.li

    http://opendigitalradio.org
 */
/*
   This file is part of ODR-DPD.

   ODR-DPD is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as
   published by the Free Software Foundation, either version 3 of the
   License, or (at your option) any later version.

   ODR-DPD is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with ODR-DPD.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include <uhd/usrp/multi_usrp.hpp>

typedef std::complex<float> complexf;


class OutputUHD {
    public:
        OutputUHD(double txgain, double rxgain, double samplerate);

        size_t Transmit(const complexf *samples, size_t sizeIn, double transmit_time);
        ssize_t Receive(complexf *samples, size_t sizeIn, double *first_sample_time);

        void SetTxGain(double gain);
        void SetRxGain(double gain);

    private:
        double m_txgain;
        double m_rxgain;
        double m_samplerate;
        uhd::usrp::multi_usrp::sptr m_usrp;
        uhd::tx_metadata_t md;
        uhd::tx_streamer::sptr myTxStream;

        uhd::rx_streamer::sptr myRxStream;
};