free5GRAN  V1.0
rf.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Telecom Paris
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15  */
16 
17 #ifndef FREE5GRAN_RF_H
18 #define FREE5GRAN_RF_H
19 
20 
21 
22 #include <string>
23 #include <uhd.h>
24 #include <uhd/usrp/multi_usrp.hpp>
25 #include <complex>
26 
27 using namespace std;
28 
29 class rf {
30  /*
31  * rf class implements the exchanges between NRPhy and USRP based on UHD lib (https://files.ettus.com/manual/index.html).
32  */
33 
34 private:
35  double sample_rate;
37  double gain;
38  double bandwidth;
39  string device_args;
40  string subdev;
41  string antenna_mode;
42  string ref;
43  uhd::usrp::multi_usrp::sptr usrp;
44 
45 public:
46  rf(
47  double sample_rate,
48  double center_frequency,
49  double gain,
50  double bandwidth,
51  const string &subdev,
52  const string &antenna_mode,
53  const string &ref,
54  const string &device_args);
55 
56  /*
57  * Get samples from RF device
58  * buff is the output buffer
59  * time_first_sample is the time of the first received sample
60  */
61  void get_samples(vector<complex<float>> *buff, double &time_first_sample);
62 
63  double getSampleRate() const;
64 
65  void setSampleRate(double rate);
66 
67  double getCenterFrequency();
68 
69  void setCenterFrequency(double freq);
70 
71  void setGain(double gain);
72 
73  double getGain();
74 
75 
76 };
77 
78 
79 #endif
string ref
Definition: rf.h:42
string device_args
Definition: rf.h:39
string subdev
Definition: rf.h:40
double gain
Definition: rf.h:37
uhd::usrp::multi_usrp::sptr usrp
Definition: rf.h:43
double bandwidth
Definition: rf.h:38
double center_frequency
Definition: rf.h:36
double sample_rate
Definition: rf.h:35
string antenna_mode
Definition: rf.h:41
Definition: rf.h:29