GNU Radio's GSM Package: extract_system_info_impl.h Source File

GNU Radio's GSM Package

extract_system_info_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3 * @file
4 * @author (C) 2014 by Piotr Krysik <ptrkrysik@gmail.com>
5 * @section LICENSE
6 *
7 * Gr-gsm is free software; you can redistribute it and/or modify
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.
11 *
12 * Gr-gsm is distributed in the hope that it will be useful,
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.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with gr-gsm; see the file COPYING. If not, write to
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
26 #include <grgsm/misc_utils/extract_system_info.h>
27 #include <set>
28 #include <map>
29 #include <vector>
30
31 namespace gr {
32 namespace gsm {
33 class chan_info {
34 public:
35 unsigned int id;
36 int8_t pwr_db;
37 unsigned int arfcn;
38 unsigned int lac;
39 unsigned int cell_id;
40 unsigned int mcc;
41 unsigned int mnc;
42 unsigned int ccch_conf;
43 std::set<int> neighbour_cells;
44 std::set<int> cell_arfcns;
45
46 chan_info() : id(-1), pwr_db(0), arfcn(0), lac(0), cell_id(0), mcc(0), mnc(0), ccch_conf(-1){}
47 chan_info(const chan_info & info) : id(info.id), pwr_db(info.pwr_db), arfcn(info.arfcn), lac(info.lac), cell_id(info.cell_id), mcc(info.mcc), mnc(info.mnc), ccch_conf(info.ccch_conf){}
48 ~chan_info(){}
49 void copy_nonzero_elements(const chan_info & info){
50 id = info.id;
51 pwr_db = info.pwr_db;
52 arfcn = info.arfcn;
53 lac = (info.lac!=0) ? info.lac : lac;
54 cell_id = (info.cell_id!=0) ? info.cell_id : cell_id;
55 mcc = (info.mcc!=0) ? info.mcc : mcc;
56 mnc = (info.mnc!=0) ? info.mnc : mnc;
57 ccch_conf = (info.ccch_conf!=-1) ? info.ccch_conf : ccch_conf;
58 }
59 };
60
61
62 struct compare_id {
63 inline bool operator()(const chan_info &a, const chan_info &b) const
64 {
65 return a.id < b.id;
66 }
67 };
68 struct compare_pwr {
69 inline bool operator()(const chan_info &a, const chan_info &b) const
70 {
71 return a.pwr_db < b.pwr_db;
72 }
73 };
74
75 typedef std::map<unsigned int, chan_info> chan_info_map;
76 class extract_system_info_impl : public extract_system_info
77 {
78 private:
79 void process_bursts(pmt::pmt_t burst);
80 void process_sysinfo(pmt::pmt_t msg);
81 chan_info_map d_c0_channels;
82 bool after_reset;
83 void decode_neighbour_cells(uint8_t * data, unsigned int offset, unsigned int chan_id);
84 // void dissect_channel_list_n_range(guint32 offset, guint len, gint range)
85 public:
86 virtual std::vector<int> get_chans();
87 virtual std::vector<int> get_pwrs();
88 virtual std::vector<int> get_lac();
89 virtual std::vector<int> get_cell_id();
90 virtual std::vector<int> get_mcc();
91 virtual std::vector<int> get_mnc();
92 virtual std::vector<int> get_ccch_conf();
93 virtual std::vector<int> get_cell_arfcns(int chan_id);
94 virtual std::vector<int> get_neighbours(int chan_id);
95 virtual void reset();
96 extract_system_info_impl();
97 ~extract_system_info_impl();
98 };
99 } // namespace gsm
100 } // namespace gr
101
102 #endif /* INCLUDED_GSM_EXTRACT_SYSTEM_INFO_IMPL_H */
103
gr::gsm::compare_pwr::operator()
bool operator()(const chan_info &a, const chan_info &b) const
Definition: extract_system_info_impl.h:69
gr::gsm::chan_info::copy_nonzero_elements
void copy_nonzero_elements(const chan_info &info)
Definition: extract_system_info_impl.h:49
gr::gsm::chan_info::chan_info
chan_info()
Definition: extract_system_info_impl.h:46
gr::gsm::chan_info::chan_info
chan_info(const chan_info &info)
Definition: extract_system_info_impl.h:47
gr::gsm::chan_info::mnc
unsigned int mnc
Definition: extract_system_info_impl.h:41
extract_system_info.h
gr::gsm::chan_info::arfcn
unsigned int arfcn
Definition: extract_system_info_impl.h:37
gr::gsm::chan_info::mcc
unsigned int mcc
Definition: extract_system_info_impl.h:40
gr::gsm::chan_info::lac
unsigned int lac
Definition: extract_system_info_impl.h:38
gr::gsm::compare_pwr
Definition: extract_system_info_impl.h:68
gr::gsm::chan_info::cell_arfcns
std::set< int > cell_arfcns
Definition: extract_system_info_impl.h:44
gr::gsm::chan_info::ccch_conf
unsigned int ccch_conf
Definition: extract_system_info_impl.h:42
gr::gsm::chan_info
Definition: extract_system_info_impl.h:33
gr
Definition: constants.h:29
gr::gsm::extract_system_info
<+description of block+>
Definition: extract_system_info.h:39
gr::gsm::extract_system_info_impl
Definition: extract_system_info_impl.h:76
gr::gsm::compare_id
Definition: extract_system_info_impl.h:62
gr::gsm::compare_id::operator()
bool operator()(const chan_info &a, const chan_info &b) const
Definition: extract_system_info_impl.h:63
gr::gsm::chan_info::cell_id
unsigned int cell_id
Definition: extract_system_info_impl.h:39
gr::gsm::chan_info::pwr_db
int8_t pwr_db
Definition: extract_system_info_impl.h:36
gr::gsm::chan_info::id
unsigned int id
Definition: extract_system_info_impl.h:35
gr::gsm::chan_info::~chan_info
~chan_info()
Definition: extract_system_info_impl.h:48
gr::gsm::chan_info_map
std::map< unsigned int, chan_info > chan_info_map
Definition: extract_system_info_impl.h:75
gr::gsm::chan_info::neighbour_cells
std::set< int > neighbour_cells
Definition: extract_system_info_impl.h:43