Last active
December 26, 2015 12:39
-
-
Save desrtfx/7152785 to your computer and use it in GitHub Desktop.
Temperature monitor Currently, this is a test project.
I put the data.json file in the "D:\downloads" folder. The Hardware and Children classes were created with an online JSON parser.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.desrtfx.tempmonitor; | |
import java.util.List; | |
import com.google.gson.annotations.SerializedName; | |
public class Children{ | |
@SerializedName("Children") | |
private List<Children> children; | |
@SerializedName("ImageUrl") | |
private String imageURL; | |
@SerializedName("Max") | |
private String max; | |
@SerializedName("Min") | |
private String min; | |
@SerializedName("Text") | |
private String text; | |
@SerializedName("Value") | |
private String value; | |
private Number id; | |
public List<Children> getChildren(){ | |
return this.children; | |
} | |
public void setChildren(List<Children> children){ | |
this.children = children; | |
} | |
public String getImageURL(){ | |
return this.imageURL; | |
} | |
public void setImageURL(String imageURL){ | |
this.imageURL = imageURL; | |
} | |
public String getMax(){ | |
return this.max; | |
} | |
public void setMax(String max){ | |
this.max = max; | |
} | |
public String getMin(){ | |
return this.min; | |
} | |
public void setMin(String min){ | |
this.min = min; | |
} | |
public String getText(){ | |
return this.text; | |
} | |
public void setText(String text){ | |
this.text = text; | |
} | |
public String getValue(){ | |
return this.value; | |
} | |
public void setValue(String value){ | |
this.value = value; | |
} | |
public Number getId(){ | |
return this.id; | |
} | |
public void setId(Number id){ | |
this.id = id; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": 0, | |
"Text": "Sensor", | |
"Children": [ | |
{ | |
"id": 1, | |
"Text": "ACER_DESRTFX", | |
"Children": [ | |
{ | |
"id": 2, | |
"Text": "VA70_HW", | |
"Children": [ | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/mainboard.png" | |
}, | |
{ | |
"id": 3, | |
"Text": "Intel Core i7-4702MQ", | |
"Children": [ | |
{ | |
"id": 4, | |
"Text": "Clocks", | |
"Children": [ | |
{ | |
"id": 5, | |
"Text": "Bus Speed", | |
"Children": [ | |
], | |
"Min": "100 MHz", | |
"Value": "100 MHz", | |
"Max": "100 MHz", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 6, | |
"Text": "CPU Core #1", | |
"Children": [ | |
], | |
"Min": "798 MHz", | |
"Value": "798 MHz", | |
"Max": "2893 MHz", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 7, | |
"Text": "CPU Core #2", | |
"Children": [ | |
], | |
"Min": "798 MHz", | |
"Value": "798 MHz", | |
"Max": "3093 MHz", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 8, | |
"Text": "CPU Core #3", | |
"Children": [ | |
], | |
"Min": "798 MHz", | |
"Value": "798 MHz", | |
"Max": "2893 MHz", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 9, | |
"Text": "CPU Core #4", | |
"Children": [ | |
], | |
"Min": "798 MHz", | |
"Value": "798 MHz", | |
"Max": "2893 MHz", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/clock.png" | |
}, | |
{ | |
"id": 10, | |
"Text": "Temperatures", | |
"Children": [ | |
{ | |
"id": 11, | |
"Text": "CPU Core #1", | |
"Children": [ | |
], | |
"Min": "37,0 °C", | |
"Value": "39,0 °C", | |
"Max": "45,0 °C", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 12, | |
"Text": "CPU Core #2", | |
"Children": [ | |
], | |
"Min": "40,0 °C", | |
"Value": "41,0 °C", | |
"Max": "47,0 °C", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 13, | |
"Text": "CPU Core #3", | |
"Children": [ | |
], | |
"Min": "37,0 °C", | |
"Value": "38,0 °C", | |
"Max": "44,0 °C", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 14, | |
"Text": "CPU Core #4", | |
"Children": [ | |
], | |
"Min": "35,0 °C", | |
"Value": "36,0 °C", | |
"Max": "44,0 °C", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 15, | |
"Text": "CPU Package", | |
"Children": [ | |
], | |
"Min": "40,0 °C", | |
"Value": "41,0 °C", | |
"Max": "46,0 °C", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/temperature.png" | |
}, | |
{ | |
"id": 16, | |
"Text": "Load", | |
"Children": [ | |
{ | |
"id": 17, | |
"Text": "CPU Total", | |
"Children": [ | |
], | |
"Min": "1,8 %", | |
"Value": "2,9 %", | |
"Max": "17,0 %", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 18, | |
"Text": "CPU Core #1", | |
"Children": [ | |
], | |
"Min": "1,6 %", | |
"Value": "3,9 %", | |
"Max": "31,3 %", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 19, | |
"Text": "CPU Core #2", | |
"Children": [ | |
], | |
"Min": "0,0 %", | |
"Value": "5,4 %", | |
"Max": "18,8 %", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 20, | |
"Text": "CPU Core #3", | |
"Children": [ | |
], | |
"Min": "0,0 %", | |
"Value": "0,0 %", | |
"Max": "14,8 %", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 21, | |
"Text": "CPU Core #4", | |
"Children": [ | |
], | |
"Min": "0,8 %", | |
"Value": "2,3 %", | |
"Max": "17,2 %", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/load.png" | |
}, | |
{ | |
"id": 22, | |
"Text": "Powers", | |
"Children": [ | |
{ | |
"id": 23, | |
"Text": "CPU Package", | |
"Children": [ | |
], | |
"Min": "4,8 W", | |
"Value": "5,9 W", | |
"Max": "14,6 W", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 24, | |
"Text": "CPU Cores", | |
"Children": [ | |
], | |
"Min": "0,4 W", | |
"Value": "0,7 W", | |
"Max": "6,8 W", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 25, | |
"Text": "CPU Graphics", | |
"Children": [ | |
], | |
"Min": "0,0 W", | |
"Value": "0,0 W", | |
"Max": "0,1 W", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 26, | |
"Text": "CPU DRAM", | |
"Children": [ | |
], | |
"Min": "1,4 W", | |
"Value": "1,5 W", | |
"Max": "2,0 W", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/power.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/cpu.png" | |
}, | |
{ | |
"id": 27, | |
"Text": "Generic Memory", | |
"Children": [ | |
{ | |
"id": 28, | |
"Text": "Load", | |
"Children": [ | |
{ | |
"id": 29, | |
"Text": "Memory", | |
"Children": [ | |
], | |
"Min": "24,4 %", | |
"Value": "24,9 %", | |
"Max": "25,0 %", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/load.png" | |
}, | |
{ | |
"id": 30, | |
"Text": "Data", | |
"Children": [ | |
{ | |
"id": 31, | |
"Text": "Used Memory", | |
"Children": [ | |
], | |
"Min": "3,8 GB", | |
"Value": "3,9 GB", | |
"Max": "3,9 GB", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 32, | |
"Text": "Available Memory", | |
"Children": [ | |
], | |
"Min": "11,8 GB", | |
"Value": "11,8 GB", | |
"Max": "11,8 GB", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/power.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/ram.png" | |
}, | |
{ | |
"id": 33, | |
"Text": "NVIDIA GeForce GTX 760M", | |
"Children": [ | |
{ | |
"id": 34, | |
"Text": "Clocks", | |
"Children": [ | |
{ | |
"id": 35, | |
"Text": "GPU Core", | |
"Children": [ | |
], | |
"Min": "0 MHz", | |
"Value": "627 MHz", | |
"Max": "627 MHz", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 36, | |
"Text": "GPU Memory", | |
"Children": [ | |
], | |
"Min": "2005 MHz", | |
"Value": "2005 MHz", | |
"Max": "2005 MHz", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 37, | |
"Text": "GPU Shader", | |
"Children": [ | |
], | |
"Min": "0 MHz", | |
"Value": "1254 MHz", | |
"Max": "1254 MHz", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/clock.png" | |
}, | |
{ | |
"id": 38, | |
"Text": "Temperatures", | |
"Children": [ | |
{ | |
"id": 39, | |
"Text": "GPU Core", | |
"Children": [ | |
], | |
"Min": "0,0 °C", | |
"Value": "0,0 °C", | |
"Max": "33,0 °C", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/temperature.png" | |
}, | |
{ | |
"id": 40, | |
"Text": "Load", | |
"Children": [ | |
{ | |
"id": 41, | |
"Text": "GPU Core", | |
"Children": [ | |
], | |
"Min": "0,0 %", | |
"Value": "0,0 %", | |
"Max": "0,0 %", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 42, | |
"Text": "GPU Memory Controller", | |
"Children": [ | |
], | |
"Min": "0,0 %", | |
"Value": "0,0 %", | |
"Max": "0,0 %", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 43, | |
"Text": "GPU Video Engine", | |
"Children": [ | |
], | |
"Min": "0,0 %", | |
"Value": "0,0 %", | |
"Max": "0,0 %", | |
"ImageURL": "images/transparent.png" | |
}, | |
{ | |
"id": 44, | |
"Text": "GPU Memory", | |
"Children": [ | |
], | |
"Min": "2,9 %", | |
"Value": "2,9 %", | |
"Max": "2,9 %", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/load.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/nvidia.png" | |
}, | |
{ | |
"id": 45, | |
"Text": "TOSHIBA MQ01ABD100", | |
"Children": [ | |
{ | |
"id": 46, | |
"Text": "Temperatures", | |
"Children": [ | |
{ | |
"id": 47, | |
"Text": "Temperature", | |
"Children": [ | |
], | |
"Min": "27,0 °C", | |
"Value": "27,0 °C", | |
"Max": "27,0 °C", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/temperature.png" | |
}, | |
{ | |
"id": 48, | |
"Text": "Load", | |
"Children": [ | |
{ | |
"id": 49, | |
"Text": "Used Space", | |
"Children": [ | |
], | |
"Min": "34,3 %", | |
"Value": "34,3 %", | |
"Max": "34,3 %", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/load.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/hdd.png" | |
}, | |
{ | |
"id": 50, | |
"Text": "TOSHIBA THNSNH128GMCT", | |
"Children": [ | |
{ | |
"id": 51, | |
"Text": "Temperatures", | |
"Children": [ | |
{ | |
"id": 52, | |
"Text": "Temperature", | |
"Children": [ | |
], | |
"Min": "31,0 °C", | |
"Value": "31,0 °C", | |
"Max": "31,0 °C", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/temperature.png" | |
}, | |
{ | |
"id": 53, | |
"Text": "Load", | |
"Children": [ | |
{ | |
"id": 54, | |
"Text": "Used Space", | |
"Children": [ | |
], | |
"Min": "40,4 %", | |
"Value": "40,4 %", | |
"Max": "40,4 %", | |
"ImageURL": "images/transparent.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/load.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/hdd.png" | |
} | |
], | |
"Min": "", | |
"Value": "", | |
"Max": "", | |
"ImageURL": "images_icon/computer.png" | |
} | |
], | |
"Min": "Min", | |
"Value": "Value", | |
"Max": "Max", | |
"ImageURL": "" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.desrtfx.tempmonitor; | |
import java.util.List; | |
public class Hardware{ | |
@SerializedName("Children") | |
private List<Children> children; | |
@SerializedName("ImageUrl") | |
private String imageURL; | |
@SerializedName("Max") | |
private String max; | |
@SerializedName("Min") | |
private String min; | |
@SerializedName("Text") | |
private String text; | |
@SerializedName("Value") | |
private String value; | |
private Number id; | |
public List<Children> getChildren(){ | |
return this.children; | |
} | |
public void setChildren(List<Children> children){ | |
this.children = children; | |
} | |
public String getImageURL(){ | |
return this.imageURL; | |
} | |
public void setImageURL(String imageURL){ | |
this.imageURL = imageURL; | |
} | |
public String getMax(){ | |
return this.max; | |
} | |
public void setMax(String max){ | |
this.max = max; | |
} | |
public String getMin(){ | |
return this.min; | |
} | |
public void setMin(String min){ | |
this.min = min; | |
} | |
public String getText(){ | |
return this.text; | |
} | |
public void setText(String text){ | |
this.text = text; | |
} | |
public String getValue(){ | |
return this.value; | |
} | |
public void setValue(String value){ | |
this.value = value; | |
} | |
public Number getId(){ | |
return this.id; | |
} | |
public void setId(Number id){ | |
this.id = id; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.desrtfx.tempmonitor; | |
import java.util.Scanner; | |
import java.io.FileReader; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import com.google.gson.*; | |
public class TempMonitor { | |
public static void main(String[] args) throws IOException { | |
StringBuilder json = new StringBuilder(); | |
Scanner s = null; | |
try { | |
s = new Scanner(new BufferedReader(new FileReader("D:\\Downloads\\data.json"))); | |
while (s.hasNextLine()) { | |
json.append(s.nextLine()); | |
} | |
} finally { | |
s.close(); | |
} | |
System.out.println(json.toString()); | |
Gson gson = new Gson(); | |
Children theHardware = gson.fromJson(json.toString(), Children.class); | |
System.out.println(theHardware.getText()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment