piotr | dda2227 | 2014-08-04 11:31:54 +0200 | [diff] [blame] | 1 | /* -*- c++ -*- */ |
ptrkrysik | 529895b | 2014-12-02 18:07:38 +0100 | [diff] [blame] | 2 | /* |
| 3 | * @file |
| 4 | * @author Piotr Krysik <ptrkrysik@gmail.com> |
| 5 | * @section LICENSE |
| 6 | * |
| 7 | * Gr-gsm is free software; you can redistribute it and/or modify |
piotr | dda2227 | 2014-08-04 11:31:54 +0200 | [diff] [blame] | 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3, or (at your option) |
| 10 | * any later version. |
ptrkrysik | 529895b | 2014-12-02 18:07:38 +0100 | [diff] [blame] | 11 | * |
| 12 | * Gr-gsm is distributed in the hope that it will be useful, |
piotr | dda2227 | 2014-08-04 11:31:54 +0200 | [diff] [blame] | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
ptrkrysik | 529895b | 2014-12-02 18:07:38 +0100 | [diff] [blame] | 16 | * |
piotr | dda2227 | 2014-08-04 11:31:54 +0200 | [diff] [blame] | 17 | * You should have received a copy of the GNU General Public License |
ptrkrysik | 529895b | 2014-12-02 18:07:38 +0100 | [diff] [blame] | 18 | * along with gr-gsm; see the file COPYING. If not, write to |
piotr | dda2227 | 2014-08-04 11:31:54 +0200 | [diff] [blame] | 19 | * the Free Software Foundation, Inc., 51 Franklin Street, |
| 20 | * Boston, MA 02110-1301, USA. |
| 21 | */ |
| 22 | |
| 23 | #ifndef INCLUDED_GSM_EXTRACT_SYSTEM_INFO_IMPL_H |
| 24 | #define INCLUDED_GSM_EXTRACT_SYSTEM_INFO_IMPL_H |
| 25 | |
ptrkrysik | 3be74a7 | 2014-12-13 10:11:00 +0100 | [diff] [blame] | 26 | #include <grgsm/misc_utils/extract_system_info.h> |
piotr | dda2227 | 2014-08-04 11:31:54 +0200 | [diff] [blame] | 27 | |
| 28 | |
| 29 | namespace gr { |
| 30 | namespace gsm { |
| 31 | |
| 32 | class chan_info { |
| 33 | public: |
| 34 | unsigned int id; |
| 35 | int8_t pwr_db; |
| 36 | unsigned int arfcn; |
| 37 | float freq; |
| 38 | unsigned int lac; |
| 39 | unsigned int cell_id; |
| 40 | unsigned int mnc; |
| 41 | |
| 42 | chan_info() : id(-1), pwr_db(0), arfcn(0), freq(0), lac(0), cell_id(0), mnc(0){} |
| 43 | chan_info(const chan_info & info) : id(info.id), pwr_db(info.pwr_db), arfcn(info.arfcn), freq(info.freq), lac(info.lac), cell_id(info.cell_id), mnc(info.mnc){} |
| 44 | ~chan_info(){} |
| 45 | }; |
| 46 | |
| 47 | |
| 48 | struct compare_id { |
| 49 | inline bool operator()(const chan_info &a, const chan_info &b) const |
| 50 | { |
| 51 | return a.id < b.id; |
| 52 | } |
| 53 | }; |
| 54 | struct compare_pwr { |
| 55 | inline bool operator()(const chan_info &a, const chan_info &b) const |
| 56 | { |
| 57 | return a.pwr_db < b.pwr_db; |
| 58 | } |
| 59 | }; |
| 60 | |
| 61 | |
| 62 | class extract_system_info_impl : public extract_system_info |
| 63 | { |
| 64 | private: |
| 65 | void process_bursts(pmt::pmt_t burst); |
| 66 | void process_sysinfo(pmt::pmt_t msg); |
| 67 | std::set<chan_info, compare_id> d_c0_channels; |
| 68 | bool after_reset; |
| 69 | public: |
| 70 | virtual void show(); |
| 71 | virtual std::vector<int> get_chans(); |
| 72 | virtual std::vector<int> get_pwrs(); |
| 73 | virtual std::vector<int> get_lac(); |
| 74 | virtual std::vector<int> get_cell_id(); |
| 75 | virtual std::vector<int> get_mnc(); |
| 76 | virtual void reset(); |
| 77 | extract_system_info_impl(); |
| 78 | ~extract_system_info_impl(); |
| 79 | }; |
| 80 | } // namespace gsm |
| 81 | } // namespace gr |
| 82 | |
| 83 | #endif /* INCLUDED_GSM_EXTRACT_SYSTEM_INFO_IMPL_H */ |
| 84 | |