kurtis.heimerl | 8aea56e | 2011-11-26 03:18:30 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Written by Thomas Tsou <ttsou@vt.edu> |
| 3 | * Based on code by Harvind S Samra <hssamra@kestrelsp.com> |
| 4 | * |
| 5 | * Copyright 2011 Free Software Foundation, Inc. |
| 6 | * |
Pau Espin Pedrol | 21d03d3 | 2019-07-22 12:05:52 +0200 | [diff] [blame] | 7 | * SPDX-License-Identifier: AGPL-3.0+ |
| 8 | * |
kurtis.heimerl | 8aea56e | 2011-11-26 03:18:30 +0000 | [diff] [blame] | 9 | * This program is free software: you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU Affero General Public License as published by |
| 11 | * the Free Software Foundation, either version 3 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU Affero General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Affero General Public License |
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | * See the COPYING file in the main directory for details. |
| 22 | */ |
| 23 | |
| 24 | #ifndef RADIOVECTOR_H |
| 25 | #define RADIOVECTOR_H |
| 26 | |
| 27 | #include "sigProcLib.h" |
| 28 | #include "GSMCommon.h" |
Alexander Chemeris | d734e2d | 2013-06-16 14:30:58 +0400 | [diff] [blame] | 29 | #include "Interthread.h" |
kurtis.heimerl | 8aea56e | 2011-11-26 03:18:30 +0000 | [diff] [blame] | 30 | |
Thomas Tsou | a2fe91a | 2013-11-13 22:48:11 -0500 | [diff] [blame] | 31 | class radioVector { |
kurtis.heimerl | 8aea56e | 2011-11-26 03:18:30 +0000 | [diff] [blame] | 32 | public: |
Thomas Tsou | a2fe91a | 2013-11-13 22:48:11 -0500 | [diff] [blame] | 33 | radioVector(GSM::Time& wTime, size_t size = 0, |
| 34 | size_t start = 0, size_t chans = 1); |
| 35 | |
| 36 | radioVector(GSM::Time& wTime, signalVector *vector); |
| 37 | ~radioVector(); |
| 38 | |
kurtis.heimerl | 0628613 | 2011-11-26 03:18:43 +0000 | [diff] [blame] | 39 | GSM::Time getTime() const; |
kurtis.heimerl | 8aea56e | 2011-11-26 03:18:30 +0000 | [diff] [blame] | 40 | void setTime(const GSM::Time& wTime); |
| 41 | bool operator>(const radioVector& other) const; |
| 42 | |
Thomas Tsou | 1882099 | 2013-11-14 18:04:10 -0500 | [diff] [blame] | 43 | signalVector *getVector(size_t chan = 0) const; |
Thomas Tsou | a2fe91a | 2013-11-13 22:48:11 -0500 | [diff] [blame] | 44 | bool setVector(signalVector *vector, size_t chan = 0); |
| 45 | size_t chans() const { return vectors.size(); } |
kurtis.heimerl | 8aea56e | 2011-11-26 03:18:30 +0000 | [diff] [blame] | 46 | private: |
Thomas Tsou | a2fe91a | 2013-11-13 22:48:11 -0500 | [diff] [blame] | 47 | std::vector<signalVector *> vectors; |
kurtis.heimerl | 8aea56e | 2011-11-26 03:18:30 +0000 | [diff] [blame] | 48 | GSM::Time mTime; |
| 49 | }; |
| 50 | |
Thomas Tsou | fa3a787 | 2013-10-17 21:23:34 -0400 | [diff] [blame] | 51 | class noiseVector : std::vector<float> { |
| 52 | public: |
Thomas Tsou | a0179e3 | 2013-11-14 15:52:04 -0500 | [diff] [blame] | 53 | noiseVector(size_t size = 0); |
Thomas Tsou | fa3a787 | 2013-10-17 21:23:34 -0400 | [diff] [blame] | 54 | bool insert(float val); |
Thomas Tsou | 1882099 | 2013-11-14 18:04:10 -0500 | [diff] [blame] | 55 | float avg() const; |
Thomas Tsou | fa3a787 | 2013-10-17 21:23:34 -0400 | [diff] [blame] | 56 | |
| 57 | private: |
Thomas Tsou | a0179e3 | 2013-11-14 15:52:04 -0500 | [diff] [blame] | 58 | size_t itr; |
Thomas Tsou | fa3a787 | 2013-10-17 21:23:34 -0400 | [diff] [blame] | 59 | }; |
| 60 | |
Thomas Tsou | 204a9f1 | 2013-10-29 18:34:16 -0400 | [diff] [blame] | 61 | class VectorFIFO : public InterthreadQueue<radioVector> { }; |
kurtis.heimerl | 8aea56e | 2011-11-26 03:18:30 +0000 | [diff] [blame] | 62 | |
| 63 | class VectorQueue : public InterthreadPriorityQueue<radioVector> { |
| 64 | public: |
| 65 | GSM::Time nextTime() const; |
| 66 | radioVector* getStaleBurst(const GSM::Time& targTime); |
| 67 | radioVector* getCurrentBurst(const GSM::Time& targTime); |
| 68 | }; |
| 69 | |
| 70 | #endif /* RADIOVECTOR_H */ |