Adding a REST like web api and introducing Json.NET

Adds the ability to handle simple REST like api calls to the Webserver.

If a POST request is received by the webserver it calls HttpServer::HandlePostRequest

"Get" Action Example:
http://localhost:8085/Sensor?action=Get&id=/ltc/example/0

This will return a JSON response containing either the value of the Sensor
or an error message.

Example response:
If it succeeded:
	{ "result" : "ok", "value" : "42" }
If it failed:
	{ "result" : "fail" , "message" : "Some error message" }

"Set" Action Example:
http://localhost:8085/Sensor?action=Set&id=/ltc/example/0&value=42.0

This will try to set the Control value of the specified Sensor.

Example response:
If it succeeded:
        { "result" : "ok" }
If it failed:
        { "result" : "fail" , "message" : "Some error message" }

The TestScripts folder contains 3 python scripts that demonstrate the
usage of the WebServer and the WMI provider.
This commit is contained in:
Marcus Tillmanns
2017-09-18 23:49:48 +02:00
parent a0db71e585
commit fc0cd04b53
7 changed files with 416 additions and 70 deletions
+17
View File
@@ -0,0 +1,17 @@
################################################################
# Install:
# * python.exe -m pip install pypiwin32
# * python.exe -m pip install wmi
#
# Usage:
# * !! Make sure openhardwaremonitor is running !!
# * python basicwmi.py
################################################################
import wmi
hwmon = wmi.WMI(namespace="root\OpenHardwareMonitor")
sensors = hwmon.Sensor(SensorType="Control")
for s in sensors:
print s