mirror of
https://github.com/ashaduri/gsmartcontrol.git
synced 2026-09-29 23:25:48 +00:00
Use "example_" prefix instead of "_example" suffix for example sources and binaries.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
/******************************************************************************
|
||||
License: BSD Zero Clause License
|
||||
Copyright:
|
||||
(C) 2008 - 2021 Alexander Shaduri <ashaduri@gmail.com>
|
||||
******************************************************************************/
|
||||
/// \file
|
||||
/// \author Alexander Shaduri
|
||||
/// \ingroup applib_examples
|
||||
/// \weakgroup applib_examples
|
||||
/// @{
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "applib/storage_device.h"
|
||||
#include "applib/storage_detector.h"
|
||||
#include "gsc_settings.h" // in src directory
|
||||
|
||||
|
||||
|
||||
/// Main function of the test
|
||||
int main()
|
||||
{
|
||||
// These settings contain device search paths, smartctl binary, etc...
|
||||
init_default_settings();
|
||||
|
||||
std::vector<StorageDevicePtr> drives;
|
||||
// std::vector<std::string> match_patterns;
|
||||
std::vector<std::string> blacklist_patterns; // additional parameters
|
||||
|
||||
StorageDetector sd;
|
||||
// sd.add_match_patterns(match_patterns);
|
||||
sd.add_blacklist_patterns(blacklist_patterns);
|
||||
|
||||
auto ex_factory = std::make_shared<ExecutorFactory>(false);
|
||||
std::string error_msg = sd.detect_and_fetch_basic_data(drives, ex_factory);
|
||||
if (!error_msg.empty()) {
|
||||
std::cerr << error_msg << "\n";
|
||||
|
||||
} else {
|
||||
for (const auto& drive : drives) {
|
||||
std::cerr << drive->get_device_with_type() <<
|
||||
" (" << StorageDevice::get_type_storable_name(drive->get_detected_type()) << ")\n";
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @}
|
||||
Reference in New Issue
Block a user