diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-01-05 21:03:27 +0100 |
---|---|---|
committer | fixeria <vyanitskiy@sysmocom.de> | 2021-01-07 00:38:55 +0000 |
commit | 7a8c9dbad7f15e2e6fe80f1b8a712c90c5ef16e7 (patch) | |
tree | 4791c87d1267498b28aeb2fab34c697ffe7ac784 /src/common/vty.c | |
parent | 22646cb122c06e12c2487184619d89047c9681aa (diff) |
power_control: vty: re-use cfg_bts_ul_power_target()
This reduces code duplication by defining an alias.
Change-Id: I37f51d426fcf008c9d9e933827de70ab7b072a94
Related: SYS#4918
Diffstat (limited to 'src/common/vty.c')
-rw-r--r-- | src/common/vty.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/common/vty.c b/src/common/vty.c index ff7ec124..52478b87 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -632,29 +632,26 @@ DEFUN_ATTR(cfg_bts_ul_power_target, cfg_bts_ul_power_target_cmd, CMD_ATTR_IMMEDIATE) { struct gsm_bts *bts = vty->index; + int rxlev_dbm = atoi(argv[0]); + int hyst = 0; - bts->ul_power_ctrl.target_dbm = atoi(argv[0]); - bts->ul_power_ctrl.hysteresis_db = 0; + if (argc > 1) /* optional argument */ + hyst = atoi(argv[1]); + + bts->ul_power_ctrl.target_dbm = rxlev_dbm; + bts->ul_power_ctrl.hysteresis_db = hyst; return CMD_SUCCESS; } /* FIXME: libosmovty is unable to handle 'foo <-110-0> [bar <1-25>]' */ -DEFUN_ATTR(cfg_bts_ul_power_target_hysteresis, - cfg_bts_ul_power_target_hysteresis_cmd, - UL_POWER_TARGET_CMD " hysteresis <1-25>", - UL_POWER_TARGET_CMD_DESC - "Target Rx Level hysteresis\n" - "Tolerable deviation in dBm\n", - CMD_ATTR_IMMEDIATE) -{ - struct gsm_bts *bts = vty->index; - - bts->ul_power_ctrl.target_dbm = atoi(argv[0]); - bts->ul_power_ctrl.hysteresis_db = atoi(argv[1]); - - return CMD_SUCCESS; -} +DEFUN_CMD_ELEMENT(cfg_bts_ul_power_target, + cfg_bts_ul_power_target_hysteresis_cmd, + UL_POWER_TARGET_CMD " hysteresis <1-25>", + UL_POWER_TARGET_CMD_DESC + "Target Rx Level hysteresis\n" + "Tolerable deviation in dBm\n", + CMD_ATTR_IMMEDIATE, 0); DEFUN_ATTR(cfg_no_bts_ul_power_filter, cfg_bts_no_ul_power_filter_cmd, |