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
+1 -1
View File
@@ -20,7 +20,7 @@ namespace OpenHardwareMonitor.GUI {
private ISensor sensor;
private PersistentSettings settings;
private UnitManager unitManager;
private string format;
public string format;
private bool plot = false;
private Color? penColor = null;