int l23_app_init(struct osmocom_ms *ms) { /* don't do layer3_init() as we don't want an actualy L3 */ g_ms = ms; lapdm_channel_set_l3(&ms->lapdm_channel, &rcv_rsl, ms); l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL); /* FIXME: L1CTL_RES_T_FULL doesn't reset dedicated mode * (if previously set), so we release it here. */ l1ctl_tx_dm_rel_req(ms); return osmo_signal_register_handler(SS_L1CTL, &signal_cb, NULL); }
static void start_sync(void) { int rxlev = -128; int i, dist = 0; char dist_str[32] = ""; arfcn = 0xffff; for (i = 0; i <= 1023; i++) { if ((pm[i].flags & INFO_FLG_PM) && !(pm[i].flags & INFO_FLG_SYNC)) { if (pm[i].rxlev > rxlev) { rxlev = pm[i].rxlev; arfcn = i; } } } /* if GPS becomes valid, like after exitting a tunnel */ if (!pm_gps_valid && g.valid) { pm_gps_valid = 1; geo2space(&pm_gps_x, &pm_gps_y, &pm_gps_z, g.longitude, g.latitude); } if (pm_gps_valid && g.valid) { double x, y, z; geo2space(&x, &y, &z, g.longitude, g.latitude); dist = distinspace(pm_gps_x, pm_gps_y, pm_gps_z, x, y, z); sprintf(dist_str, " dist %d", (int)dist); } if (dist > MAX_DIST || arfcn == 0xffff || rxlev < min_rxlev) { memset(pm, 0, sizeof(pm)); pm_index = 0; sync_count = 0; start_pm(); return; } pm[arfcn].flags |= INFO_FLG_SYNC; LOGP(DSUM, LOGL_INFO, "Sync ARFCN %d (rxlev %d, %d syncs " "left)%s\n", arfcn, pm[arfcn].rxlev, sync_count--, dist_str); memset(&sysinfo, 0, sizeof(sysinfo)); sysinfo.arfcn = arfcn; state = SCAN_STATE_SYNC; l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL); l1ctl_tx_fbsb_req(ms, arfcn, L1CTL_FBSB_F_FB01SB, 100, 0, CCCH_MODE_NONE); }
int l23_app_init(struct osmocom_ms *ms) { int rc; srand(time(NULL)); // log_parse_category_mask(stderr_target, "DL1C:DRSL:DRR:DGPS:DSUM"); log_parse_category_mask(stderr_target, "DSUM"); log_set_log_level(stderr_target, LOGL_INFO); l23_app_work = _scan_work; l23_app_exit = _scan_exit; rc = scan_init(ms); if (rc) return rc; l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL); printf("Mobile initialized, please start phone now!\n"); return 0; }
static void start_pm(void) { uint16_t from, to; state = SCAN_STATE_PM; from = band_range[pm_index][0]; to = band_range[pm_index][1]; if (from == 0 && to == 0) { LOGP(DSUM, LOGL_INFO, "Measurement done\n"); pm_gps_valid = g.enable && g.valid; if (pm_gps_valid) geo2space(&pm_gps_x, &pm_gps_y, &pm_gps_z, g.longitude, g.latitude); log_pm(); start_sync(); return; } LOGP(DSUM, LOGL_INFO, "Measure from %d to %d\n", from, to); l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL); l1ctl_tx_pm_req_range(ms, from, to); }
int l23_app_init(struct osmocom_ms *ms) { register_signal_handler(SS_L1CTL, &signal_cb, NULL); l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL); return layer3_init(ms); }