blob: 75d41b33092b938881484624b61c638cd0e6e4cd [file] [log] [blame]
piotrdda22272014-08-04 11:31:54 +02001/* -*- c++ -*- */
ptrkrysik529895b2014-12-02 18:07:38 +01002/*
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
piotrdda22272014-08-04 11:31:54 +02008 * 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.
ptrkrysik529895b2014-12-02 18:07:38 +010011 *
12 * Gr-gsm is distributed in the hope that it will be useful,
piotrdda22272014-08-04 11:31:54 +020013 * 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.
ptrkrysik529895b2014-12-02 18:07:38 +010016 *
piotrdda22272014-08-04 11:31:54 +020017 * You should have received a copy of the GNU General Public License
ptrkrysik529895b2014-12-02 18:07:38 +010018 * along with gr-gsm; see the file COPYING. If not, write to
piotrdda22272014-08-04 11:31:54 +020019 * 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
ptrkrysik4c825772014-08-16 11:34:54 +020026#include <gsm/misc_utils/extract_system_info.h>
piotrdda22272014-08-04 11:31:54 +020027
28
29
30namespace gr {
31 namespace gsm {
32
33 class chan_info {
34 public:
35 unsigned int id;
36 int8_t pwr_db;
37 unsigned int arfcn;
38 float freq;
39 unsigned int lac;
40 unsigned int cell_id;
41 unsigned int mnc;
42
43 chan_info() : id(-1), pwr_db(0), arfcn(0), freq(0), lac(0), cell_id(0), mnc(0){}
44 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){}
45 ~chan_info(){}
46 };
47
48
49 struct compare_id {
50 inline bool operator()(const chan_info &a, const chan_info &b) const
51 {
52 return a.id < b.id;
53 }
54 };
55 struct compare_pwr {
56 inline bool operator()(const chan_info &a, const chan_info &b) const
57 {
58 return a.pwr_db < b.pwr_db;
59 }
60 };
61
62
63 class extract_system_info_impl : public extract_system_info
64 {
65 private:
66 void process_bursts(pmt::pmt_t burst);
67 void process_sysinfo(pmt::pmt_t msg);
68 std::set<chan_info, compare_id> d_c0_channels;
69 bool after_reset;
70 public:
71 virtual void show();
72 virtual std::vector<int> get_chans();
73 virtual std::vector<int> get_pwrs();
74 virtual std::vector<int> get_lac();
75 virtual std::vector<int> get_cell_id();
76 virtual std::vector<int> get_mnc();
77 virtual void reset();
78 extract_system_info_impl();
79 ~extract_system_info_impl();
80 };
81 } // namespace gsm
82} // namespace gr
83
84#endif /* INCLUDED_GSM_EXTRACT_SYSTEM_INFO_IMPL_H */
85