[layer23] cell_log's scanning depth now depends on movement speed
[osmocom-bb.git] / src / host / layer23 / src / misc / app_cell_log.c
1 /* "Application" code of the layer2/3 stack */
2
3 /* (C) 2010 by Andreas Eversberg <jolly@eversberg.eu>
4  *
5  * All Rights Reserved
6  *
7  * This program 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 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program 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 along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  */
22
23 #include <signal.h>
24 #include <stdlib.h>
25 #include <time.h>
26
27 #include <osmocom/bb/common/osmocom_data.h>
28 #include <osmocom/bb/common/l1ctl.h>
29 #include <osmocom/bb/common/l23_app.h>
30 #include <osmocom/bb/common/logging.h>
31 #include <osmocom/bb/misc/cell_log.h>
32
33 extern struct log_target *stderr_target;
34
35 int _scan_work(struct osmocom_ms *ms)
36 {
37         return 0;
38 }
39
40 int _scan_exit(struct osmocom_ms *ms)
41 {
42         /* in case there is a lockup during exit */
43         signal(SIGINT, SIG_DFL);
44         signal(SIGHUP, SIG_DFL);
45         signal(SIGTERM, SIG_DFL);
46         signal(SIGPIPE, SIG_DFL);
47
48         scan_exit();
49
50         return 0;
51 }
52
53 int l23_app_init(struct osmocom_ms *ms)
54 {
55         int rc;
56
57         srand(time(NULL));
58
59 //      log_parse_category_mask(stderr_target, "DL1C:DRSL:DRR:DGPS:DSUM");
60         log_parse_category_mask(stderr_target, "DSUM");
61         log_set_log_level(stderr_target, LOGL_INFO);
62
63         l23_app_work = _scan_work;
64         l23_app_exit = _scan_exit;
65
66         rc = scan_init(ms);
67         if (rc)
68                 return rc;
69
70         l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL);
71         printf("Mobile initialized, please start phone now!\n");
72         return 0;
73 }
74
75