mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added device battery indication
This commit is contained in:
parent
1a2c85e9f0
commit
bf5be3c145
7 changed files with 1406 additions and 1339 deletions
|
@ -1351,6 +1351,15 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||
obj.updateSessions();
|
||||
break;
|
||||
}
|
||||
case 'battery': {
|
||||
// Device battery and power state
|
||||
if (obj.sessions == null) { obj.sessions = {}; }
|
||||
if (obj.sessions.battery == null) { obj.sessions.battery = {}; }
|
||||
if ((command.state == 'ac') || (command.state == 'dc')) { obj.sessions.battery.state = command.state; } else { delete obj.sessions.battery.state; }
|
||||
if ((typeof command.level == 'number') && (command.level >= 0) && (command.level <= 100)) { obj.sessions.battery.level = command.level; } else { delete obj.sessions.battery.level; }
|
||||
obj.updateSessions();
|
||||
break;
|
||||
}
|
||||
case 'plugin': {
|
||||
if ((parent.parent.pluginHandler == null) || (typeof command.plugin != 'string')) break;
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue