OBECA Receive Process
CasFrameProcessor.h
1 // OBECA - Open Broadcast Edge Cache Appliance
2 // Receive 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 "Phy.h"
27 #include "RestHandler.h"
28 #include <libconfig.h++>
29 #include "srslte/srslte.h"
30 #include "srslte/upper/rlc.h"
31 #include "srslte/upper/pdcp.h"
32 
39  public:
48  CasFrameProcessor(const libconfig::Config& cfg, Phy& phy, srslte::rlc& rlc, RestHandler& rest)
49  : _cfg(cfg)
50  , _phy(phy)
51  , _rest(rest)
52  , _rlc(rlc) {}
53 
57  virtual ~CasFrameProcessor();
58 
63  bool init();
64 
71  bool process(uint32_t tti);
72 
78  void set_cell(srslte_cell_t cell);
79 
83  cf_t** rx_buffer() { return _signal_buffer_rx; }
84 
88  uint32_t rx_buffer_size() { return _signal_buffer_max_samples; }
89 
94  std::vector<uint8_t> ce_values();
95 
99  std::vector<uint8_t> pdsch_data();
100 
104  float cinr_db() { return _ue_dl.chest_res.snr_db; }
105 
106  private:
107  const libconfig::Config& _cfg;
108  srslte::rlc& _rlc;
109  Phy& _phy;
110  RestHandler& _rest;
111 
112  cf_t* _signal_buffer_rx[SRSLTE_MAX_PORTS] = {};
113  uint32_t _signal_buffer_max_samples = 0;
114 
115  srslte_softbuffer_rx_t _softbuffer;
116  uint8_t* _data[SRSLTE_MAX_CODEWORDS];
117 
118  srslte_ue_dl_t _ue_dl = {};
119  srslte_ue_dl_cfg_t _ue_dl_cfg = {};
120  srslte_dl_sf_cfg_t _sf_cfg = {};
121 
122  srslte_cell_t _cell;
123 };
CasFrameProcessor::init
bool init()
Initialize signal- and softbuffers, init all underlying components.
Definition: CasFrameProcessor.cpp:24
CasFrameProcessor
Frame processor for CAS subframes.
Definition: CasFrameProcessor.h:38
CasFrameProcessor::process
bool process(uint32_t tti)
Process the sample data in the signal buffer.
Definition: CasFrameProcessor.cpp:87
Phy
The PHY component.
Definition: Phy.h:43
CasFrameProcessor::CasFrameProcessor
CasFrameProcessor(const libconfig::Config &cfg, Phy &phy, srslte::rlc &rlc, RestHandler &rest)
Default constructor.
Definition: CasFrameProcessor.h:48
CasFrameProcessor::~CasFrameProcessor
virtual ~CasFrameProcessor()
Default destructor.
Definition: CasFrameProcessor.cpp:71
CasFrameProcessor::pdsch_data
std::vector< uint8_t > pdsch_data()
Get the constellation diagram data (I/Q data of the subcarriers after CE)
Definition: CasFrameProcessor.cpp:168
CasFrameProcessor::cinr_db
float cinr_db()
Get the CINR estimate (in dB)
Definition: CasFrameProcessor.h:104
CasFrameProcessor::set_cell
void set_cell(srslte_cell_t cell)
Set the parameters for the cell (Nof PRB, etc).
Definition: CasFrameProcessor.cpp:81
CasFrameProcessor::rx_buffer_size
uint32_t rx_buffer_size()
Size of the signal buffer.
Definition: CasFrameProcessor.h:88
RestHandler
The RESTful API handler.
Definition: RestHandler.h:47
CasFrameProcessor::rx_buffer
cf_t ** rx_buffer()
Get a handle of the signal buffer to store samples for processing in.
Definition: CasFrameProcessor.h:83
CasFrameProcessor::ce_values
std::vector< uint8_t > ce_values()
Get the CE values (time domain) for displaying the spectrum of the received signal.
Definition: CasFrameProcessor.cpp:158