GNU Radio's MESA Package
SourceSelector_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2019 ghostop14.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_MESA_SOURCESELECTOR_IMPL_H
22 #define INCLUDED_MESA_SOURCESELECTOR_IMPL_H
23 
24 #include <chrono>
25 #include <ctime>
26 #include <mesa/SourceSelector.h>
27 
28 #include <queue>
29 
30 using namespace std;
31 
32 namespace gr {
33 namespace mesa {
35 protected:
36  boost::mutex d_mutex;
37  boost::mutex d_queuemutex;
38  float d_holdTime;
43 
44  // Data queue management
45  queue<gr_complex> dataQueue;
46  // long maxQueueSize;
47  bool limitQueue;
48 
52 
53  // Max Power for each input
54  float maxPower[4];
55 
57  std::chrono::time_point<std::chrono::steady_clock> lastShifted;
58 
59  int maxPowerIndex();
60  void queueData(pmt::pmt_t msg);
61 
62  int getDataAvailable();
63 
64  void sendNewPortMsg(int port);
65 
66  virtual void handleMsg(pmt::pmt_t msg, int port);
67 
68 public:
69  SourceSelector_impl(float holdTime, int numInputs, int defaultInput,
70  int inputBlockSize);
72  virtual bool stop();
73 
74  void handleMsgIn1(pmt::pmt_t msg);
75  void handleMsgIn2(pmt::pmt_t msg);
76  void handleMsgIn3(pmt::pmt_t msg);
77  void handleMsgIn4(pmt::pmt_t msg);
78 
79  // Where all the action really happens
80  int work(int noutput_items, gr_vector_const_void_star &input_items,
81  gr_vector_void_star &output_items);
82 };
83 
84 } // namespace mesa
85 } // namespace gr
86 
87 #endif /* INCLUDED_MESA_SOURCESELECTOR_IMPL_H */
int d_numInputs
Definition: SourceSelector_impl.h:39
boost::mutex d_queuemutex
Definition: SourceSelector_impl.h:37
queue< gr_complex > dataQueue
Definition: SourceSelector_impl.h:45
STL namespace.
<+description of block+>
Definition: SourceSelector.h:35
boost::mutex d_mutex
Definition: SourceSelector_impl.h:36
bool d_startInitialized
Definition: SourceSelector_impl.h:56
int d_inputBlockSize
Definition: SourceSelector_impl.h:41
float d_holdTime
Definition: SourceSelector_impl.h:38
Definition: AutoDopplerCorrect.h:27
bool initialQueueSizeMet
Definition: SourceSelector_impl.h:51
int d_defaultInput
Definition: SourceSelector_impl.h:40
std::chrono::time_point< std::chrono::steady_clock > lastShifted
Definition: SourceSelector_impl.h:57
int d_currentInput
Definition: SourceSelector_impl.h:42
Definition: SourceSelector_impl.h:34
bool limitQueue
Definition: SourceSelector_impl.h:47
long minQueueLength
Definition: SourceSelector_impl.h:49
long initialDataQueueRequirement
Definition: SourceSelector_impl.h:50