utils: add function gsm_fn_as_gsmtime_str()

Convert a given frame number into a printable string that displays
the sub components of the frame number.

Change-Id: I8015d2ded3940b01b35df7b72fc35c70c25e9926
This commit is contained in:
Philipp Maier 2017-06-26 10:50:28 +02:00 committed by Harald Welte
parent 1389e86d11
commit b808da44ab
3 changed files with 15 additions and 0 deletions

View File

@ -165,6 +165,9 @@ uint16_t gsm_freq102arfcn(uint16_t freq10, int uplink);
/* Convert from frame number to GSM time */
void gsm_fn2gsmtime(struct gsm_time *time, uint32_t fn);
/* Parse GSM Frame Number into printable string */
char *gsm_fn_as_gsmtime_str(uint32_t fn);
/* Convert from GSM time to frame number */
uint32_t gsm_gsmtime2fn(struct gsm_time *time);

View File

@ -750,6 +750,17 @@ void gsm_fn2gsmtime(struct gsm_time *time, uint32_t fn)
time->tc = (time->fn / 51) % 8;
}
/*! Parse GSM Frame Number into printable string
* \param[in] fn GSM Frame Number
* \returns pointer to printable string */
char *gsm_fn_as_gsmtime_str(uint32_t fn)
{
struct gsm_time time;
gsm_fn2gsmtime(&time, fn);
return osmo_dump_gsmtime(&time);
}
/*! Encode decoded \ref gsm_time to Frame Number
* \param[in] time GSM Time in decoded structure
* \returns GSM Frame Number */

View File

@ -272,6 +272,7 @@ gsm_freq102arfcn;
gsm_band_name;
gsm_band_parse;
gsm_fn2gsmtime;
gsm_fn_as_gsmtime_str;
gsm_get_octet_len;
gsm_gsmtime2fn;
osmo_dump_gsmtime;