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 <mesa/SourceSelector.h>
25 #include <chrono>
26 #include <ctime>
27 
28 #include <queue>
29 
30 using namespace std;
31 
32 namespace gr {
33  namespace mesa {
35  {
36  protected:
37  boost::mutex d_mutex;
38  boost::mutex d_queuemutex;
39  float d_holdTime;
44 
45  // Data queue management
46  queue<gr_complex> dataQueue;
47  // long maxQueueSize;
48  bool limitQueue;
49 
53 
54  // Max Power for each input
55  float maxPower[4];
56 
58  std::chrono::time_point<std::chrono::steady_clock> lastShifted;
59 
60  int maxPowerIndex();
61  void queueData(pmt::pmt_t msg);
62 
63  int getDataAvailable();
64 
65  void sendNewPortMsg(int port);
66 
67  virtual void handleMsg(pmt::pmt_t msg, int port);
68 
69  public:
70  SourceSelector_impl(float holdTime, int numInputs, int defaultInput, 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,
81  gr_vector_const_void_star &input_items,
82  gr_vector_void_star &output_items);
83  };
84 
85  } // namespace mesa
86 } // namespace gr
87 
88 #endif /* INCLUDED_MESA_SOURCESELECTOR_IMPL_H */
89 
int d_numInputs
Definition: SourceSelector_impl.h:40
boost::mutex d_queuemutex
Definition: SourceSelector_impl.h:38
queue< gr_complex > dataQueue
Definition: SourceSelector_impl.h:46
STL namespace.
<+description of block+>
Definition: SourceSelector.h:36
boost::mutex d_mutex
Definition: SourceSelector_impl.h:37
bool d_startInitialized
Definition: SourceSelector_impl.h:57
int d_inputBlockSize
Definition: SourceSelector_impl.h:42
float d_holdTime
Definition: SourceSelector_impl.h:39
Definition: AutoDopplerCorrect.h:28
bool initialQueueSizeMet
Definition: SourceSelector_impl.h:52
int d_defaultInput
Definition: SourceSelector_impl.h:41
std::chrono::time_point< std::chrono::steady_clock > lastShifted
Definition: SourceSelector_impl.h:58
int d_currentInput
Definition: SourceSelector_impl.h:43
Definition: SourceSelector_impl.h:34
bool limitQueue
Definition: SourceSelector_impl.h:48
long minQueueLength
Definition: SourceSelector_impl.h:50
long initialDataQueueRequirement
Definition: SourceSelector_impl.h:51