1
0
Fork 0
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:
Ylian Saint-Hilaire 2020-05-30 17:21:45 -07:00
parent 1a2c85e9f0
commit bf5be3c145
7 changed files with 1406 additions and 1339 deletions

View file

@ -2176,6 +2176,16 @@ function createMeshCore(agent) {
response = "Available commands: \r\n" + fin + ".";
break;
}
case 'setbattery':
// require('MeshAgent').SendCommand({ action: 'battery', state: 'dc', level: 55 });
if ((args['_'].length > 0) && ((args['_'][0] == 'ac') || (args['_'][0] == 'dc'))) {
var b = { action: 'battery', state: args['_'][0] };
if (args['_'].length == 2) { b.level = parseInt(args['_'][1]); }
require('MeshAgent').SendCommand(b);
} else {
require('MeshAgent').SendCommand({ action: 'battery' });
}
break;
case 'fdsnapshot':
require('ChainViewer').getSnapshot().then(function (c) { sendConsoleText(c, this.sessionid); }).parentPromise.sessionid = sessionid;
break;

View file

@ -27,7 +27,6 @@ function amt_heci() {
this._setupPTHI = function _setupPTHI()
{
this._amt = heci.create();
this._amt.descriptorMetadata = "amt-pthi";
this._amt.BiosVersionLen = 65;
this._amt.UnicodeStringLen = 20;
@ -398,25 +397,20 @@ function amt_heci() {
fn.apply(this, opt);
}, callback, optional);
}
this.getProtocolVersion = function getProtocolVersion(callback)
{
this.getProtocolVersion = function getProtocolVersion(callback) {
var optional = [];
for (var i = 1; i < arguments.length; ++i) { opt.push(arguments[i]); }
if (!this._tmpSession) { this._tmpSession = heci.create(); this._tmpSession.parent = this;}
this._tmpSession.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt)
{
heci.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt) {
if (status == 0) {
var result = buffer.readUInt8(0).toString() + '.' + buffer.readUInt8(1).toString() + '.' + buffer.readUInt8(2).toString() + '.' + buffer.readUInt16BE(3).toString();
opt.unshift(result);
fn.apply(self, opt);
}
else
{
else {
opt.unshift(null);
fn.apply(self, opt);
}
}, this, callback, optional);
}
}