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

Function main

OpenHD/ohd_interface/test/test_wifi_commands.cpp:84–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84int main(int argc, char* argv[]) {
85 OHDUtil::terminate_if_not_root();
86
87 // Hard coded for testing
88 // const std::string card_name="wlx244bfeb71c05";
89 // const std::string card_name="wlxac9e17596103";
90 const std::string card_name = "wlx200db0c3a53c";
91
92 auto card_opt = DWifiCards::process_card(card_name);
93 if (!card_opt.has_value()) {
94 openhd::log::get_default()->warn("Cannot find card {}", card_name);
95 return 0;
96 }
97 auto card = card_opt.value();
98 write_wificards_manifest({card});
99
100 // Take over the card
101 wifi::commandhelper::nmcli_set_device_managed_status(card.device_name, false);
102 std::this_thread::sleep_for(std::chrono::seconds(2));
103 wifi::commandhelper::iw_enable_monitor_mode(card.device_name);
104 std::this_thread::sleep_for(std::chrono::seconds(2));
105 // debug - set all channel(s) while a (high) tx power is set
106 if (card.type == WiFiCardType::OPENHD_RTL_88X2AU) {
107 // TODO
108 } else {
109 const auto tx_power_mbm = openhd::milli_watt_to_mBm(2000, 1.0f);
110 wifi::commandhelper::openhd_driver_set_tx_power(card.device_name,
111 tx_power_mbm);
112 }
113 std::this_thread::sleep_for(std::chrono::seconds(1));
114
115 // test_all_supported_frequencies(card,20);
116 // std::this_thread::sleep_for(std::chrono::seconds(2));
117 test_all_supported_frequencies(card, 40);
118 // wifi::commandhelper2::exp_set_wifi_frequency
119 // wifi::commandhelper::iw_set_frequency_and_channel_width(card.device_name,5180,20);
120 // std::this_thread::sleep_for(std::chrono::seconds(2));
121 // wifi::commandhelper::iw_set_frequency_and_channel_width(card.device_name,5200,20);
122
123 // wifi::commandhelper::iw_set_frequency_and_channel_width(card.device_name,5340,20);
124 // wifi::commandhelper2::set_wifi_frequency_and_log_result(card.device_name,5340,20);
125
126 // OHDUtil::keep_alive_until_sigterm();
127
128 // Give it back
129 wifi::commandhelper::nmcli_set_device_managed_status(card.device_name, true);
130}

Callers

nothing calls this directly

Calls 3

write_wificards_manifestFunction · 0.85
milli_watt_to_mBmFunction · 0.85

Tested by

no test coverage detected