piotr | dda2227 | 2014-08-04 11:31:54 +0200 | [diff] [blame] | 1 | /* -*- c++ -*- */ |
| 2 | /* |
| 3 | * Copyright 2014 <+YOU OR YOUR COMPANY+>. |
| 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_GSM_EXTRACT_SYSTEM_INFO_IMPL_H |
| 22 | #define INCLUDED_GSM_EXTRACT_SYSTEM_INFO_IMPL_H |
| 23 | |
ptrkrysik | 4c82577 | 2014-08-16 11:34:54 +0200 | [diff] [blame] | 24 | #include <gsm/misc_utils/extract_system_info.h> |
piotr | dda2227 | 2014-08-04 11:31:54 +0200 | [diff] [blame] | 25 | |
| 26 | |
| 27 | |
| 28 | namespace gr { |
| 29 | namespace gsm { |
| 30 | |
| 31 | class chan_info { |
| 32 | public: |
| 33 | unsigned int id; |
| 34 | int8_t pwr_db; |
| 35 | unsigned int arfcn; |
| 36 | float freq; |
| 37 | unsigned int lac; |
| 38 | unsigned int cell_id; |
| 39 | unsigned int mnc; |
| 40 | |
| 41 | chan_info() : id(-1), pwr_db(0), arfcn(0), freq(0), lac(0), cell_id(0), mnc(0){} |
| 42 | 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){} |
| 43 | ~chan_info(){} |
| 44 | }; |
| 45 | |
| 46 | |
| 47 | struct compare_id { |
| 48 | inline bool operator()(const chan_info &a, const chan_info &b) const |
| 49 | { |
| 50 | return a.id < b.id; |
| 51 | } |
| 52 | }; |
| 53 | struct compare_pwr { |
| 54 | inline bool operator()(const chan_info &a, const chan_info &b) const |
| 55 | { |
| 56 | return a.pwr_db < b.pwr_db; |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | |
| 61 | class extract_system_info_impl : public extract_system_info |
| 62 | { |
| 63 | private: |
| 64 | void process_bursts(pmt::pmt_t burst); |
| 65 | void process_sysinfo(pmt::pmt_t msg); |
| 66 | std::set<chan_info, compare_id> d_c0_channels; |
| 67 | bool after_reset; |
| 68 | public: |
| 69 | virtual void show(); |
| 70 | virtual std::vector<int> get_chans(); |
| 71 | virtual std::vector<int> get_pwrs(); |
| 72 | virtual std::vector<int> get_lac(); |
| 73 | virtual std::vector<int> get_cell_id(); |
| 74 | virtual std::vector<int> get_mnc(); |
| 75 | virtual void reset(); |
| 76 | extract_system_info_impl(); |
| 77 | ~extract_system_info_impl(); |
| 78 | }; |
| 79 | } // namespace gsm |
| 80 | } // namespace gr |
| 81 | |
| 82 | #endif /* INCLUDED_GSM_EXTRACT_SYSTEM_INFO_IMPL_H */ |
| 83 | |