B4J Library jSensors_B4J - load, fan and temps

  1. http://central.maven.org/maven2/com/profesorfalken/jSensors/2.1/jSensors-2.1.jar
  2. http://central.maven.org/maven2/com/profesorfalken/jPowerShell/2.0/jPowerShell-2.0.jar
  3. http://central.maven.org/maven2/net/java/dev/jna/jna/4.5.1/jna-4.5.1.jar
  4. http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar
  5. http://central.maven.org/maven2/org/slf4j/slf4j-simple/1.7.25/slf4j-simple-1.7.25.jar
Download and copy the above-listed jars into your B4J Additional Libraries folder. Then download and unzip the attached zip file into the same folder.

After all that, you will (possibly) have the power to view the temperatures, loads and fan speeds of the various components in your computer (like cpu, gpu, motherboard, disk). This is thanks to this GitHub project: https://github.com/profesorfalken/jSensors . As the author of that GitHub project points out, though, this does not work with all hardware. Be sure to try running your programs with Administrator privileges to get best results.

Let us also give thanks to @ykucuk for partially funding the development of this library and for finding the aforementioned GitHub project.
 

Attachments

  • jSensors_B4J.zip
    8.1 KB · Views: 491

Magma

Expert
Licensed User
Longtime User
I know that is an old thread...

but anyone tried it ?

i want to get... temperature of cpu... but returning only the length or and object i can't read...

B4X:
    Dim cpus As List=cputemp.GetCPUs
    Dim firstcpu As Component=cpus.Get(0)
    Log(firstcpu.ComponentName)
    Log(firstcpu.ComponentType)
    Log(firstcpu.Temps.Length)   'getting.... without Length getting: ...[Lbutt.droid.jsensors_b4j.Sensors$NameValue;@5ba8657e...
 

Roycefer

Well-Known Member
Licensed User
Longtime User
B4X:
For Each t As NameValue In firstcpu.Temps
    Log(TAB & t.Name & " " & t.Value)
Next

The firstcpu.Temps is an array of NameValue objects, each of which has a t.Name and t.Value property.
 

Roycefer

Well-Known Member
Licensed User
Longtime User
...Cool...
return ok the values...

why if i want to return specific name / value get error ?
B4X:
dim iv as int
iv=firstcpu.temps("Temp CPU Package").value

Note that firstcpu.temps is an Array of NameValue objects. I'm not sure what
B4X:
iv=firstcpu.temps("Temp CPU Package").value
is supposed to do but it's not correct syntax. You can try something like
B4X:
iv=firstcpu.temps(0).value
.
 
Top