Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 1.21 KB

README.md

File metadata and controls

24 lines (20 loc) · 1.21 KB

This project is very WIP, use at your own risk

How does the library work?

For now the library only works on Windows
A Powershell script is ran with sample code from the LibreHardwareMonitor library's README.md, that script then periodically sends sensor data to the Powershell console's output stream, the stream is then parsed into Kotlin objects like Hardware and Sensor and then they can be used into a Kotlin/Java program

Example usage

If you are on windows you have to use the LibreStream Object, then you need to add a streamUpdateListener to it which is toggled each time a sensor data stream from the LibreHardwareMonitor library ends, making it safe to use the given Sensor and Component Objects

fun main(){
    val libreStream = LibreStream(1.0)

    libreStream.addStreamUpdateListener {
        for(component in it){
            println("${component.name} ${component.type}")
            for(sensor in component.sensors){
                println("\t${sensor.type} | ${sensor.name} | ${sensor.value}")
            }
        }
    }

    libreStream.startStream()
}