diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-01-31 22:16:00 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-01-31 22:38:48 +0100 |
commit | 4e13a8f9f9d40e5d62c9cee7d76348ef8b558981 (patch) | |
tree | 71a31d8620d449137fda631a4dc6719eea6d82ec /openbsc/src/libcommon | |
parent | b8c204cb929a8455bfa6006a95a958d57274ab08 (diff) |
bsc/nitb: Allow to set the GPRS mode through the ctrl command
Create a control command to read and modify the gprs mode. Use
the get_string_value to indicate if the value was found or not.
This is useful for the ctrl interface where I didn't want to
replicate "none", "gprs" and "egprs". Share code to verify that
a BTS supports the mode.
Related: SYS#591
Diffstat (limited to 'openbsc/src/libcommon')
-rw-r--r-- | openbsc/src/libcommon/gsm_data.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index 7cb1d3814..ef98f7d0b 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -199,9 +199,14 @@ static const struct value_string bts_gprs_mode_names[] = { { 0, NULL } }; -enum bts_gprs_mode bts_gprs_mode_parse(const char *arg) +enum bts_gprs_mode bts_gprs_mode_parse(const char *arg, int *valid) { - return get_string_value(bts_gprs_mode_names, arg); + int rc; + + rc = get_string_value(bts_gprs_mode_names, arg); + if (valid) + *valid = rc != -EINVAL; + return rc; } const char *bts_gprs_mode_name(enum bts_gprs_mode mode) @@ -209,6 +214,20 @@ const char *bts_gprs_mode_name(enum bts_gprs_mode mode) return get_value_string(bts_gprs_mode_names, mode); } +int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode) +{ + if (mode != BTS_GPRS_NONE && + !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) { + return 0; + } + if (mode == BTS_GPRS_EGPRS && + !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) { + return 0; + } + + return 1; +} + struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan) { struct gsm_meas_rep *meas_rep; |