Hi.
How to properly use range_enc_arfcns() and range_enc_range*() from arfcn_range_decode.h? There're not many comments around the code. From function signature it seems like range_enc_arfcns() will put results into w parameter but in system_information.c after that there's also call to one of range_enc_range*().
I've tried to feed output to wireshark but it decode some unexpected stuff. So, if I have a sequence of ints which I'd like to run through range512 for example - ho do I get the output?
On 15 Apr 2016, at 12:16, Max msuraev@sysmocom.de wrote:
Hi.
How to properly use range_enc_arfcns() and range_enc_range*() from arfcn_range_decode.h? There're not many comments around the code. From function signature it seems like range_enc_arfcns() will put results into w parameter but in system_information.c after that there's also call to one of range_enc_range*().
I've tried to feed output to wireshark but it decode some unexpected stuff. So, if I have a sequence of ints which I'd like to run through range512 for example - ho do I get the output?
1st Determine which range to use 2nd filter out ARFCNs, e.g. if ARFCN 0 is included in the set or not 3rd encode according to the range
does this already help?
range = range_enc_determine_range(arfcns, arfcns_used, &f0); if (range == ARFCN_RANGE_INVALID) return -2;
/* * Manipulate the ARFCN list according to the rules in J4 depending * on the selected range. */ arfcns_used = range_enc_filter_arfcns(arfcns, arfcns_used, f0, &f0_included);
memset(w, 0, sizeof(w)); rc = range_enc_arfcns(range, arfcns, arfcns_used, w, 0); if (rc != 0)
...
switch (range) { case ARFCN_RANGE_128: return range_enc_range128(chan_list, f0, w); break; case ARFCN_RANGE_256:
Thanks for reply. Comments are inline.
On 04/15/2016 07:36 PM, Holger Freyther wrote:
On 15 Apr 2016, at 12:16, Max msuraev@sysmocom.de wrote:
Hi.
How to properly use range_enc_arfcns() and range_enc_range*() from arfcn_range_decode.h? There're not many comments around the code. From function signature it seems like range_enc_arfcns() will put results into w parameter but in system_information.c after that there's also call to one of range_enc_range*().
I've tried to feed output to wireshark but it decode some unexpected stuff. So, if I have a sequence of ints which I'd like to run through range512 for example - ho do I get the output?
1st Determine which range to use
If I know range in advance than this step can be skipped - are there some side effects to range_enc_determine_range() function? What's the meaning of f0?
2nd filter out ARFCNs, e.g. if ARFCN 0 is included in the set or not
So, range_enc_filter_arfcns() changes both arfcns and f0_included ?
3rd encode according to the range
So how do I supply input and where do I get output? The input is previously processed arfcns parameter to range_enc_arfcn() and the output is taken from which parameter of range_enc_range()?
does this already help?
Not entirely but we're getting there.
range = range_enc_determine_range(arfcns, arfcns_used, &f0); if (range == ARFCN_RANGE_INVALID) return -2; /* * Manipulate the ARFCN list according to the rules in J4 depending * on the selected range. */ arfcns_used = range_enc_filter_arfcns(arfcns, arfcns_used, f0, &f0_included); memset(w, 0, sizeof(w)); rc = range_enc_arfcns(range, arfcns, arfcns_used, w, 0); if (rc != 0)...
switch (range) { case ARFCN_RANGE_128: return range_enc_range128(chan_list, f0, w); break; case ARFCN_RANGE_256:
On 18 Apr 2016, at 11:07, Max msuraev@sysmocom.de wrote:
If I know range in advance than this step can be skipped - are there some side effects to range_enc_determine_range() function? What's the meaning of f0?
2nd filter out ARFCNs, e.g. if ARFCN 0 is included in the set or not
GSM 04.08:
F0, frequency 0 indicator
0 ARFCN 0 is not a member of the set 1 ARFCN 0 is a member of the set
At first I thought F0 is like f[0] (the first/lowest frequency in the set) but it is not. For range 1024 it is the question if ARFCN == 0 is part of it or not.
So, range_enc_filter_arfcns() changes both arfcns and f0_included ?
3rd encode according to the range
So how do I supply input and where do I get output? The input is previously processed arfcns parameter to range_enc_arfcn() and the output is taken from which parameter of range_enc_range()?
Have you considered looking at the testcases Jacob were adding? The nice thing of a testcase is, it is very few code, one can single step through it, etc. The nice thing about Jacob's code here is that it tests decode(encode(list)) == list. So you should be able to easily find where something is encoded to and from where the decoder is loading the data. E.g. code like the one below:
if (!silent) printf("chan_list = %s\n", osmo_hexdump(chan_list, sizeof(chan_list)));
rc = gsm48_decode_freq_list(dec_freq, chan_list, sizeof(chan_list), 0xfe, 1);
On top of that using git log on the src/libbsc/arfcn_range_encode.c gives a good explanation of the history:
* I added range512 because the customer needed it * Jacob fixed it * Jacob generalized it * Jacob added the other ranges too
cheers
holger