A C++ client library for LibreHardwareService
This library is used to retrieve data from LibreHardwareService.
./cmake/build.ps1
#include <lhwservice/HardwareService.h>
...
int main() {
lhws::HardwareService hwService;
for (auto &a: hwService.getSmartAttributes("Harddisk Name", "Storage")) {
std::cout << a.getName() << ": " << a.getValue() << std::endl;
}
try {
lhws::Sensor a = hardwareService.getSensorByName("Sensor Name", "Temperature", "Hardware Name");
std::cout << a.getName() << ": " << a.getValue() << std::endl;
} catch (const SensorNotFoundException &e) {
std::cerr << e.what() << endl;
}
try {
lhws::Sensor a = hardwareService.getSensorById("/intelcpu/0/temperature/2");
std::cout << a.getName() << ": " << a.getValue() << std::endl;
} catch (const SensorNotFoundException &e) {
std::cerr << e.what() << endl;
}
}
For sensor types and names, run ShowSensors.exe from LibreHardwareService, or see LibreHardwareMonitor documentation / code.
This software is licensed under the terms of Mozilla Public License Version 2.0.