mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 10:20:26 +00:00
Add new API call for batteryinfo
Will return battery:"true/false" if one exists
If one exists, it will also return "level":"1-99"
and "status":"offline/charging/backup/unknown"
REST Request:
-------------------------------
PUT /sysadm/systeminfo
{
"action" : "batteryinfo"
}
REST Response:
-------------------------------
{
"args": {
"batteryinfo": {
"battery": "false"
}
}
}
WebSocket Request:
-------------------------------
{
"namespace" : "sysadm",
"name" : "systeminfo",
"id" : "fooid",
"args" : {
"action" : "batteryinfo"
}
}
WebSocket Response:
-------------------------------
{
"args": {
"batteryinfo": {
"battery": "false"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
This commit is contained in:
@@ -257,7 +257,11 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmSystemInfoRequest(const QJso
|
||||
QString act = JsonValueToString(in_args.toObject().value("action"));
|
||||
if(act=="externalmounts"){
|
||||
ok = true;
|
||||
out->insert("externalmounts", sysadm::SysInfo::ExternalDevicePaths());
|
||||
out->insert("externalmounts", sysadm::SysInfo::externalDevicePaths());
|
||||
}
|
||||
if(act=="batteryinfo"){
|
||||
ok = true;
|
||||
out->insert("batteryinfo", sysadm::SysInfo::batteryInfo());
|
||||
}
|
||||
|
||||
} //end of "action" key usage
|
||||
|
||||
Reference in New Issue
Block a user