MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / iw_set_tx_power

Method iw_set_tx_power

OpenHD/ohd_interface/src/wifi_command_helper.cpp:127–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127bool wifi::commandhelper::iw_set_tx_power(const std::string &device,
128 uint32_t tx_power_mBm) {
129 if (device == "ath0") { // Qualcomm-specific logic
130 get_logger()->warn("set_tx_power {} {} dBm", device, tx_power_mBm);
131 std::vector<std::string> args{"acfg_set_tx_power", "wifi0", "0",
132 std::to_string(tx_power_mBm)};
133 get_logger()->warn("Running command: acfg_tool with arguments: [{}]",
134 fmt::join(args, ", "));
135 const auto ret = OHDUtil::run_command("acfg_tool", args);
136 if (ret != 0) {
137 get_logger()->warn(
138 "Qualcomm-specific set_tx_power failed for device {} with return "
139 "code {}",
140 device, ret);
141 return false;
142 }
143 return true;
144 }
145
146 // Generic logic for other devices
147 get_logger()->debug("Setting tx_power for device: {} to {} mBm", device,
148 tx_power_mBm);
149
150 std::vector<std::string> args{
151 "dev", device, "set", "txpower", "fixed", std::to_string(tx_power_mBm)};
152 get_logger()->debug("Running command: iw with arguments: [{}]",
153 fmt::join(args, ", "));
154
155 const auto ret = OHDUtil::run_command("iw", args);
156 if (ret != 0) {
157 get_logger()->debug(
158 "Failed to set tx_power for device: {}. Power: {} mBm, Return Code: "
159 "{}. Command Args: [{}]",
160 device, tx_power_mBm, ret, fmt::join(args, ", "));
161 return false;
162 }
163
164 get_logger()->debug("Successfully set tx_power for device: {} to {} mBm",
165 device, tx_power_mBm);
166 return true;
167}
168
169// HE MCS0-11 NSS 1 20 MHz
170static const std::vector<uint32_t> he20_11ax_rate_ol{

Callers

nothing calls this directly

Calls 3

to_stringFunction · 0.85
debugMethod · 0.80
get_loggerFunction · 0.70

Tested by

no test coverage detected