diff options
author | Harald Welte <laforge@gnumonks.org> | 2008-11-26 18:27:11 +0530 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2008-11-26 18:27:11 +0530 |
commit | eb13897566ab93c56462b327b75bfd8eb317abc9 (patch) | |
tree | 25236eccb32b7908ef3aea9d279872751c6eec5d | |
parent | 560e8fb53fdf3cb51fffe5bf86d8e8ffab0fee82 (diff) |
Add function to get ARFCN from a known frequency
-rwxr-xr-x | gsm-tvoid/src/python/gsm_scan.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gsm-tvoid/src/python/gsm_scan.py b/gsm-tvoid/src/python/gsm_scan.py index fab6ce8..a366960 100755 --- a/gsm-tvoid/src/python/gsm_scan.py +++ b/gsm-tvoid/src/python/gsm_scan.py @@ -127,6 +127,38 @@ def get_freq_from_arfcn(chan,region): return freq * 1e6 +def get_arfcn_from_freq(freq,region): + freq = freq / 1e6 + # GSM 450 + if freq <= 450.6 + 0.2*(293 - 259) + 10: + arfcn = ((freq - (450.6 + 10)) / 0.2) + 259 + # GSM 480 + elif freq <= 479 + 0.2*(340 - 306) + 10: + arfcn = ((freq - (479 + 10)) / 0.2) + 306 + # GSM 850 + elif freq <= 824.2 + 0.2*(251 - 128) + 45: + arfcn = ((freq - (824.2 + 45)) / 0.2) + 128 + #E/R-GSM 900 + elif freq <= 890 + 0.2*(1023 - 1024) + 45: + arfcn = ((freq - (890 + 45)) / -0.2) + 955 + # GSM 900 + elif freq <= 890 + 0.2*124 + 45: + arfcn = (freq - (890 + 45)) / 0.2 + else: + if region is "u": + if freq > 1850.2 + 0.2*(810 - 512) + 80: + arfcn = 0; + else: + arfcn = (freq - (1850.2 + 80) / 0.2) + 512 + elif region is "e": + if freq > 1710.2 + 0.2*(885 - 512) + 95: + arfcn = 0; + else: + arfcn = (freq - (1710.2 + 95) / 0.2) + 512 + else: + arfcn = 0 + + return arfcn #################### class app_flow_graph(stdgui.gui_flow_graph): |