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

Method openhd_driver_set_tx_power

OpenHD/ohd_interface/src/wifi_command_helper.cpp:384–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384bool wifi::commandhelper::openhd_driver_set_tx_power(WiFiCardType type,
385 const std::string &device,
386 uint32_t tx_power_mBm) {
387 char *TXPOWER_OVERRIDE_FILENAME;
388 switch (type) {
389 case (WiFiCardType::OPENHD_RTL_88X2AU):
390 TXPOWER_OVERRIDE_FILENAME =
391 OPENHD_DRIVER_RTL8812AU_TX_POWER_INDEX_OVERRIDE;
392 break;
393 case (WiFiCardType::OPENHD_RTL_88X2BU):
394 TXPOWER_OVERRIDE_FILENAME = OPENHD_DRIVER_RTL88xxBU_TX_POWER_MW_OVERRIDE;
395 break;
396 case (WiFiCardType::OPENHD_RTL_88X2CU):
397 TXPOWER_OVERRIDE_FILENAME = OPENHD_DRIVER_RTL88xxCU_TX_POWER_MW_OVERRIDE;
398 break;
399 case (WiFiCardType::OPENHD_RTL_88X2EU):
400 TXPOWER_OVERRIDE_FILENAME = OPENHD_DRIVER_RTL88xxEU_TX_POWER_MW_OVERRIDE;
401 break;
402 default:
403 openhd::log::get_default()->error(
404 "INVALID DRIVER TYPE; TX POWER WON'T WORK");
405 break;
406 }
407
408 if (!OHDFilesystemUtil::exists(TXPOWER_OVERRIDE_FILENAME)) {
409 openhd::log::get_default()->error(
410 "YOU ARE USING THE WRONG DRIVER; TX POWER WON'T WORK");
411 // hope this works
412 wifi::commandhelper::iw_set_tx_power(device, tx_power_mBm);
413 return true;
414 }
415 OHDFilesystemUtil::write_file(TXPOWER_OVERRIDE_FILENAME,
416 fmt::format("{}", tx_power_mBm));
417 // initiate change
418 wifi::commandhelper::iw_set_tx_power(device, tx_power_mBm);
419 return true;
420}
421
422void wifi::commandhelper::openhd_driver_set_tx_power_index_override(
423 const std::string &device, uint32_t tpi) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected