Add support for retrieving the current system date/time

#56
This commit is contained in:
2021-09-06 23:00:51 -05:00
parent 6f1ee3c13f
commit 37d40b3386
4 changed files with 70 additions and 0 deletions

View File

@ -297,6 +297,11 @@ class UnitConnection extends EventEmitter {
this.client.write(new messages.SLRemoveClient(clientId, senderId).toBuffer());
}
getSystemTime(senderId) {
debugUnit('[%d] sending get system time query...', senderId || 0);
this.client.write(new messages.SLGetSystemTime(null, senderId).toBuffer());
}
onClientMessage(msg) {
debugUnit('received message of length %d', msg.length);
if (msg.length < 4) {
@ -402,6 +407,10 @@ class UnitConnection extends EventEmitter {
debugUnit(" it's async pool status");
this.emit('poolStatus', new messages.SLPoolStatusMessage(msg));
break;
case messages.SLGetSystemTime.getResponseId():
debugUnit(" it's system time");
this.emit('getSystemTime', new messages.SLGetSystemTime(msg));
break;
case 12501:
debugUnit(" it's a schedule changed notification");
this.emit('scheduleChanged');