In the absence of any decent new cores for years now, you have to be creative. You may have seen my recent posts on polyfills (ie. giving Xwidget functionality that other variations of the language/other engines already possess. In this case we are looking at adding support for Open Hardware Monitor. This follows on from my previous post :
http://bbs.xwidget.com/viewtopic.php?f=3&t=6228What is Open Hardware Monitor?OHM is an open-source tool for extracting detailed system information and the particular bit of information we are talking about now is the temperature information as supplied from the various sensors that have been implemented on your PC hardware. OHM can provide data on a large amount of recognised hardware, the cpu cores, hard drives, motherboards &c. It all depends whether your hardware has those sensors and whether OHM supports them.
Why use OHM?OHM is a free and functional alternative to coretemp and speedfan. Why would anyone bother to implement support for OHM, when cores exist for coretemp and speedfan already? Well, Speedfan is useless as although it provides temperatures through some exposed shared memory it does not tell you which sensor the temperature is from, utterly pointless. Coretemp is a good alternative but it only provides temperatures for the CPUs, any other temperature sensors are ignored.
In addition, Xwidget's cores are a little flawed, the speedfan core only provides one set of temperature data due to the limitations listed above, Tony's coretemp core names the cores incorrectly, so in general the temperature monitoring available to Xwidget is quite poor.
How to access OHM without a core? So back to the code. The following code uses ActiveX to gain access to Windows WMI, a layer where OHM stores its sensor information. You can probe that information and extract it for a pointer to display on an Xwidget gauge. OHM must be installed and running to extract the sensor information.
Using my hardware as an example, it is an old Dell E5400 laptop, a core2duo with a Seagate hybrid drive. The only sensors it provides are for the two CPU cores and the hard drive. There are no other temperature sensors on the motherboard but many other PCs will have five, six or more sensors. OHM supports all my temperature sensors.
Code:
//=========================================================================
// this function
//=========================================================================
function updateOHM(){
var strComputer = "."; // localhost
var loc = new ActiveXObject("WbemScripting.SWbemLocator");
var svc = loc.ConnectServer(strComputer, "root\\OpenHardwareMonitor");
var a = 0, cpuTemp = new Array;
coll = svc.ExecQuery("SELECT * FROM Sensor WHERE Name LIKE '%CPU Core%' AND SensorType = 'Temperature'");
coll = svc.ExecQuery("SELECT * FROM Sensor WHERE SensorType = 'Temperature'"); // reports data in wbemtest
//coll = svc.ExecQuery("SELECT * FROM Sensor WHERE Identifier = '/nvidiagpu/0/temperature/0'");
var items = new Enumerator(coll);
while (!items.atEnd())
{
a = a + 1;
cpuTemp[a] = items.item().Value;
print(">> "+ items.item().Name + " " +items.item().Value);
items.moveNext();
}
cpuPointer.RotateAngle = (cpuTemp[1] * 3) + 30;
cpuPointerShadow.RotateAngle = cpuPointer.RotateAngle;
}
//=====================
//End function
//=====================
The above code will rotate a pointer such as the one pictured below, all you have to do is to call it via a timer and the pointer will rotate.

The image above has a few additional fields that can be populated by data from OHM and via WMI. The code above does not demonstrate how, you'll have to do some investigation for yourself on how to do that but the example above will act as a guide. You could also wait until I finish creating my own Xwidget with the above code.
Smooth AnimationsOne limitation of doing it this way is that smooth animations are not available to you. Xwidget has a problem in that even though you can assign a smooth animation to a rotator image, it does not activate unless you also bind it to a core. As there are going to be no cores assigned then smooth animation is not available unless you implement it entirely in jscript code.
This shows you how easy it would be to implement open hardware monitor core on Xwidget if Tony would only find the time... In the meantime you can use my code above.
PS - Added the newly created widget containing the code.