5G-MAG Reference Tools - MBMS Modem
CasFrameProcessor.h
Go to the documentation of this file.
1 // 5G-MAG Reference Tools
2 // MBMS Modem Process
3 //
4 // Copyright (C) 2021 Klaus Kühnhammer (Österreichische Rundfunksender GmbH & Co KG)
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU Affero General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU Affero General Public License for more details.
15 //
16 // You should have received a copy of the GNU Affero General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 //
19 
20 #pragma once
21 
22 #include <cstdint>
23 #include <string>
24 #include <vector>
25 #include <thread>
26 #include "srsran/srsran.h"
27 #include "srsran/rlc/rlc.h"
28 #include "Phy.h"
29 #include "RestHandler.h"
30 #include <libconfig.h++>
31 
38  public:
47  CasFrameProcessor(const libconfig::Config& cfg, Phy& phy, srsran::rlc& rlc, RestHandler& rest, unsigned rx_channels)
48  : _cfg(cfg)
49  , _phy(phy)
50  , _rest(rest)
51  , _rlc(rlc)
52  , _rx_channels(rx_channels)
53  {}
54 
58  virtual ~CasFrameProcessor();
59 
64  bool init();
65 
72  bool process(uint32_t tti);
73 
79  void set_cell(srsran_cell_t cell);
80 
84  cf_t** rx_buffer() { _mutex.lock(); return _signal_buffer_rx; }
85 
90 
96  void unlock() { _mutex.unlock(); }
97 
102  std::vector<uint8_t> ce_values();
103 
107  std::vector<uint8_t> pdsch_data();
108 
112  float cinr_db() { return _ue_dl.chest_res.snr_db; }
113 
114  private:
115  const libconfig::Config& _cfg;
116  srsran::rlc& _rlc;
119 
120  cf_t* _signal_buffer_rx[SRSRAN_MAX_PORTS] = {};
122 
123  srsran_softbuffer_rx_t _softbuffer;
124  uint8_t* _data[SRSRAN_MAX_CODEWORDS];
125 
126  srsran_ue_dl_t _ue_dl = {};
127  srsran_ue_dl_cfg_t _ue_dl_cfg = {};
128  srsran_dl_sf_cfg_t _sf_cfg = {};
129 
130  srsran_cell_t _cell;
131  std::mutex _mutex;
132  unsigned _rx_channels;
133 };
Frame processor for CAS subframes.
srsran_softbuffer_rx_t _softbuffer
srsran_ue_dl_cfg_t _ue_dl_cfg
std::vector< uint8_t > ce_values()
Get the CE values (time domain) for displaying the spectrum of the received signal.
uint8_t * _data[SRSRAN_MAX_CODEWORDS]
virtual ~CasFrameProcessor()
Default destructor.
uint32_t _signal_buffer_max_samples
srsran_ue_dl_t _ue_dl
cf_t ** rx_buffer()
Get a handle of the signal buffer to store samples for processing in.
bool init()
Initialize signal- and softbuffers, init all underlying components.
srsran_dl_sf_cfg_t _sf_cfg
void set_cell(srsran_cell_t cell)
Set the parameters for the cell (Nof PRB, etc).
std::vector< uint8_t > pdsch_data()
Get the constellation diagram data (I/Q data of the subcarriers after CE)
uint32_t rx_buffer_size()
Size of the signal buffer.
void unlock()
Unlock the processor.
cf_t * _signal_buffer_rx[SRSRAN_MAX_PORTS]
const libconfig::Config & _cfg
float cinr_db()
Get the CINR estimate (in dB)
bool process(uint32_t tti)
Process the sample data in the signal buffer.
CasFrameProcessor(const libconfig::Config &cfg, Phy &phy, srsran::rlc &rlc, RestHandler &rest, unsigned rx_channels)
Default constructor.
The PHY component.
Definition: Phy.h:42
The RESTful API handler.
Definition: RestHandler.h:44
static Config cfg
Global configuration object.
Definition: main.cpp:165