https://github.com/epinter/lhwservice
A C++ client library for LibreHardwareService
https://github.com/epinter/lhwservice
Last synced: 12 months ago
JSON representation
A C++ client library for LibreHardwareService
- Host: GitHub
- URL: https://github.com/epinter/lhwservice
- Owner: epinter
- License: mpl-2.0
- Created: 2022-06-12T22:38:56.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-26T02:45:48.000Z (about 2 years ago)
- Last Synced: 2025-02-17T16:40:01.795Z (about 1 year ago)
- Language: C++
- Size: 47.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LibHardwareService
## A C++ client library for [LibreHardwareService](https://github.com/epinter/LibreHardwareService)
[](https://github.com/epinter/lhwservice/releases/latest)
[](https://github.com/epinter/lhwservice/releases/latest)
[](https://github.com/epinter/lhwservice/releases/latest)
[](https://github.com/epinter/lhwservice/blob/main/LICENSE)
This library is used to retrieve data from LibreHardwareService.
## Runtime Requirements
- [LibreHardwareService](https://github.com/epinter/LibreHardwareService)
- [Visual C++ Redistributable 2022](https://docs.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist)
- [CMake](https://cmake.org/)
- [vcpkg](https://vcpkg.io/en/)
- [Visual Studio Community 2022](https://visualstudio.microsoft.com/vs/community/)
## Building
```
./cmake/build.ps1
```
## Usage
```
#include
...
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.
## License
This software is licensed under the terms of [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/).