/* Control Interface for osmo-bts */ /* (C) 2014 by Harald Welte * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ #include #include #include #include #include #include #include #include CTRL_CMD_DEFINE(therm_att, "thermal-attenuation"); static int get_therm_att(struct ctrl_cmd *cmd, void *data) { struct gsm_bts_trx *trx = cmd->node; struct trx_power_params *tpp = &trx->power_params; cmd->reply = talloc_asprintf(cmd, "%d", tpp->thermal_attenuation_mdB); return CTRL_CMD_REPLY; } static int set_therm_att(struct ctrl_cmd *cmd, void *data) { struct gsm_bts_trx *trx = cmd->node; struct trx_power_params *tpp = &trx->power_params; int val = atoi(cmd->value); printf("set_therm_att(trx=%p, tpp=%p)\n", trx, tpp); tpp->thermal_attenuation_mdB = val; power_ramp_start(trx, tpp->p_total_cur_mdBm, 0); return get_therm_att(cmd, data); } static int verify_therm_att(struct ctrl_cmd *cmd, const char *value, void *data) { int val = atoi(value); /* permit between 0 to 40 dB attenuation */ if (val < 0 || val > to_mdB(40)) return 1; return 0; } int bts_ctrl_cmds_install(struct gsm_bts *bts) { int rc = 0; rc |= ctrl_cmd_install(CTRL_NODE_TRX, &cmd_therm_att); return rc; }