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

Function main

OpenHD/main.cpp:187–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187int main(int argc, char *argv[]) {
188 // OpenHD needs to be run as root!
189 OHDUtil::terminate_if_not_root();
190 if (OHDFilesystemUtil::exists("/run/openhd/hold.pid")) {
191 std::exit(0);
192 }
193 const OHDRunOptions options = parse_run_parameters(argc, argv);
194 if (options.hardware_config_file.has_value()) {
195 openhd::set_config_file(options.hardware_config_file.value());
196 }
197 { // Print all the arguments the OHD main executable is started with
198 bool validLicense=false;
199 if (OHDFilesystemUtil::exists("/usr/local/share/openhd/license")) {
200 validLicense=true;
201 }
202 std::cout << "\033[2J\033[1;1H"; //clear terminal
203 std::stringstream ss;
204 ss << openhd::get_ohd_version_as_string() << "\n";
205 ss << "\n";
206 ss << blue;
207 ss << " ####### ######## ######## ## ## ## ## ######## \n";
208 ss << " ## ## ## ## ## ### ## ## ## ## ##\n";
209 ss << " ## ## ## ## ## #### ## ## ## ## ##\n";
210 ss << " ## ## ######## ###### ## ## ## ######### ## ##\n";
211 ss << " ## ## ## ## ## #### ## ## ## ##\n";
212 ss << " ## ## ## ## ## ### ## ## ## ##\n";
213 ss << " ####### ## ######## ## ## ## ## ######## \n";
214 ss << reset;
215 if (!validLicense) {
216 ss << "----------------------- " << blue << "OpenSource" << reset << " -----------------------\n";
217 } else {
218 ss << "----------------------- " << green << "Enterprise" << reset << " -----------------------\n";
219 }
220 ss << "\n";
221
222 if (options.run_as_air) {
223 ss << "----------------------- " << green << "Air Unit" << reset << " -----------------------\n";
224 } else {
225 ss << "----------------------- " << red << "Ground Unit" << reset << " ----------------------\n";
226 }
227
228 if (options.reset_all_settings) {
229 ss << red << "Reset Settings" << reset << "\n";
230 }
231 ss << "\n";
232
233 // ss << "Git info:Branch:" << git_Branch() << " SHA:" << git_CommitSHA1() << " Dirty:" << OHDUtil::yes_or_no(git_AnyUncommittedChanges()) << "\n";
234 std::cout << ss.str() << std::flush;
235 // openhd::debug_config();
236 // OHDInterface::print_internal_fec_optimization_method();
237}
238 // Create the folder structure
239 openhd::generateSettingsDirectoryIfNonExists();
240 const auto platform = OHDPlatform::instance();
241 openhd::LEDManager::instance().set_status_loading();
242 // Generate the keys and delete pw if needed
243 OHDInterface::generate_keys_from_pw_if_exists_and_delete();
244 // Parse the program arguments

Callers

nothing calls this directly

Calls 15

parse_run_parametersFunction · 0.85
write_profile_manifestFunction · 0.85
set_status_loadingMethod · 0.80
is_x20Method · 0.80
is_groundMethod · 0.80
get_link_handleMethod · 0.80
get_generic_settingsMethod · 0.80
set_status_okayMethod · 0.80
should_terminateMethod · 0.80

Tested by

no test coverage detected