Initial commit

This commit is contained in:
2025-10-22 22:06:16 +02:00
commit d8ca4e154f
141 changed files with 32231 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/node_modules/
/frontend/views/*/node_modules/

17
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\dist\\Entry.js"
}
]
}

20
README.md Normal file
View File

@@ -0,0 +1,20 @@
# NTSH-Control
A Node.js control system for Nothing to See Here installation.
## Overview
NTSH-Control provides centralized control and monitoring of:
- Camera runner processes via WebSocket communication
- Unity application lifecycle management
- Real-time system status and calibration through a web dashboard
## Configuration
Configuration is stored in `~/MorphixProductions/NTSHControl/config.json`. Default settings include:
- Web server port: `6300`
- Unity WebSocket: `127.0.0.1:3000`
- Camera runner WebSocket: `127.0.0.1:6301`
- Unity startup delay: `5000ms`

215
dist/CameraRunner.js vendored Normal file
View File

@@ -0,0 +1,215 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CameraRunner = void 0;
var socket_io_client_1 = require("socket.io-client");
var Utils_1 = require("./Utils");
var PREFIX = "[CameraRunner]";
var CameraRunner = /** @class */ (function () {
function CameraRunner(Main) {
this.state = 'DISCONNECTED';
this.processStatus = {
state: 'STOPPED',
startTime: -1,
output: { current: [], last: [] },
};
this._Main = Main;
}
CameraRunner.prototype.handle = function (command) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
switch (command) {
case 'restart':
case 'reboot':
var callback = args[0];
if (typeof callback !== 'function')
return;
this.sendCommand(command, callback);
break;
}
};
CameraRunner.prototype.sendCommand = function (command, callback) {
if (this.socket == null || !this.socket.connected)
return callback({
succeed: false,
message: 'Not connected to CameraRunner',
});
this.socket.emit(command, function (response) {
callback(response);
});
};
CameraRunner.prototype.broadcastState = function () {
this._Main.WebServer.socket.emit('cameraRunnerState', this.getState());
};
CameraRunner.prototype.getState = function () {
return {
state: this.state,
message: this.message,
error: this.error,
processStatus: this.processStatus,
};
};
CameraRunner.prototype.setInfo = function (message, error, state) {
if (state === void 0) { state = 'FAILED'; }
this.message = message;
this.error = error;
this.state = state;
this.broadcastState();
if (state == 'FAILED' || state == 'DISCONNECTED')
console.warn(PREFIX, message !== null && message !== void 0 ? message : error);
else
console.log(PREFIX, message !== null && message !== void 0 ? message : error);
};
CameraRunner.prototype.startPollClock = function () {
var _this = this;
var poll = function () { return __awaiter(_this, void 0, void 0, function () {
var data;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, new Promise(function (resolve) {
_this.socket.emit('getStatus', function (response) {
return resolve(response);
});
})];
case 1:
data = _a.sent();
this.processStatus = data;
this.broadcastState();
return [2 /*return*/];
}
});
}); };
this.socket.on('simpleStatus', function (simpleStatus) {
_this.processStatus.state = simpleStatus.state;
_this.processStatus.message = simpleStatus.message;
_this.processStatus.error = simpleStatus.error;
_this.broadcastState();
});
clearInterval(this.pollClock);
this.pollClock = setInterval(function () { return poll(); }, this._Main.Config.cameraRunner.pollInterval);
poll();
};
CameraRunner.prototype.reconnect = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
clearInterval(this.pollClock);
if (this.socket != null) {
this.socket.disconnect();
this.socket.close();
this.socket = null;
}
return [4 /*yield*/, (0, Utils_1.delay)(2000)];
case 1:
_a.sent();
this.message = 'Reconnecting in 10 seconds...';
this.broadcastState();
return [4 /*yield*/, (0, Utils_1.delay)(5000)];
case 2:
_a.sent();
return [4 /*yield*/, this.connect()];
case 3:
_a.sent();
return [2 /*return*/];
}
});
});
};
CameraRunner.prototype.connect = function () {
return __awaiter(this, void 0, void 0, function () {
var ip, port;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.setInfo('Connecting...', null, 'CONNECTING');
return [4 /*yield*/, (0, Utils_1.delay)(1000)];
case 1:
_a.sent();
ip = this._Main.Config.cameraRunner.webSocket.ip;
port = this._Main.Config.cameraRunner.webSocket.port;
if (ip == null || port == null) {
return [2 /*return*/, this.setInfo('Connection problem', 'Camera Runner WebSocket IP or port is not configured.')];
}
this.socket = (0, socket_io_client_1.io)("ws://".concat(ip, ":").concat(port), {
reconnectionAttempts: 0,
reconnectionDelay: 2000,
});
this.socket.on('connect', function () {
_this.setInfo('Connected', null, 'CONNECTED');
_this.startPollClock();
});
this.socket.on('disconnect', function () {
_this.setInfo('Disconnected', 'Camera Runner was disconnected unexpectedly', 'DISCONNECTED');
_this.reconnect();
});
this.socket.on('reconnect', function () {
_this.setInfo('Connected (reconnection)', null, 'CONNECTED');
});
this.socket.on('connect_error', function (err) {
_this.setInfo('Connection problem', "Connection error: ".concat(err));
_this.reconnect();
});
this.socket.on('error', function (err) {
_this.setInfo('Connection problem', "Socket error: ".concat(err));
_this.reconnect();
});
this.socket.on('reconnect_attempt', function () {
_this.setInfo('Reconnecting', null, 'CONNECTING');
});
this.socket.on('reconnect_failed', function () {
_this.setInfo('Connection problem', 'Reconnection failed');
_this.reconnect();
});
this.socket.on('close', function () {
_this.setInfo('Disconnected', null, 'DISCONNECTED');
_this.reconnect();
});
return [2 /*return*/];
}
});
});
};
return CameraRunner;
}());
exports.CameraRunner = CameraRunner;
//# sourceMappingURL=CameraRunner.js.map

1
dist/CameraRunner.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"CameraRunner.js","sourceRoot":"","sources":["../src/CameraRunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA8C;AAE9C,iCAA8C;AAE9C,IAAM,MAAM,GAAG,gBAAgB,CAAC;AAChC;IAgBC,sBAAY,IAAU;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AiB,GAAG,CAAE,CAAC,CAAC;4BAC3D,KAAI,CAAC,SAAS,EAAE,CAAC;wBAClB,CAAC,CAAC,CAAC;wBAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE;4BACnC,KAAI,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;wBAClD,CAAC,CAAC,CAAC;wBAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE;4BAClC,KAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,qBAAqB,CAAC,CAAC;4BAC1D,KAAI,CAAC,SAAS,EAAE,CAAC;wBAClB,CAAC,CAAC,CAAC;wBAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE;4BACvB,KAAI,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;4BACnD,KAAI,CAAC,SAAS,EAAE,CAAC;wBAClB,CAAC,CAAC,CAAC;;;;;KACH;IACF,mBAAC;AAAD,CAAC,AAzLD,IAyLC;AAzLY,oCAAY"}

View File

@@ -0,0 +1,138 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigurationManager = void 0;
var fs_extra_1 = require("fs-extra");
var path_1 = require("path");
var DefaultConfiguration_1 = require("./DefaultConfiguration");
var PREFIX = '[ConfigurationManager]';
var ConfigurationManager = /** @class */ (function () {
function ConfigurationManager(Main) {
this._Main = Main;
}
ConfigurationManager.prototype.load = function () {
return __awaiter(this, void 0, void 0, function () {
var configPath, configExists, config, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
console.log(PREFIX, 'Loading');
return [4 /*yield*/, (0, fs_extra_1.ensureDir)((0, path_1.join)(this._Main.dataPath))];
case 1:
_b.sent();
configPath = (0, path_1.join)(this._Main.dataPath, 'config.json');
return [4 /*yield*/, (0, fs_extra_1.pathExists)(configPath)];
case 2:
configExists = _b.sent();
if (!!configExists) return [3 /*break*/, 4];
return [4 /*yield*/, (0, fs_extra_1.writeFile)(configPath, JSON.stringify(DefaultConfiguration_1.DefaultConfiguration, null, 4))];
case 3:
_b.sent();
this._Main.Config = DefaultConfiguration_1.DefaultConfiguration;
console.log(PREFIX, 'Written default configuration');
return [3 /*break*/, 7];
case 4: return [4 /*yield*/, (0, fs_extra_1.readJSON)(configPath)];
case 5:
config = _b.sent();
_a = this._Main;
return [4 /*yield*/, this.validateConfig(config)];
case 6:
_a.Config = _b.sent();
console.log(PREFIX, 'Loaded configuration');
_b.label = 7;
case 7: return [2 /*return*/];
}
});
});
};
ConfigurationManager.prototype.validateConfig = function (config) {
return __awaiter(this, void 0, void 0, function () {
var normalizedConfig, hasChanges, configPath;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
normalizedConfig = this.normalizeConfig(config, DefaultConfiguration_1.DefaultConfiguration);
hasChanges = JSON.stringify(config) !== JSON.stringify(normalizedConfig);
if (!hasChanges) return [3 /*break*/, 2];
this._Main.Config = normalizedConfig;
configPath = (0, path_1.join)(this._Main.dataPath, 'config.json');
return [4 /*yield*/, (0, fs_extra_1.writeFile)(configPath, JSON.stringify(normalizedConfig, null, 4))];
case 1:
_a.sent();
console.log(PREFIX, 'Configuration updated and saved');
_a.label = 2;
case 2: return [2 /*return*/, normalizedConfig];
}
});
});
};
ConfigurationManager.prototype.normalizeConfig = function (current, template) {
var _this = this;
if (template === null || template === undefined) {
return template;
}
if (typeof template !== 'object' || Array.isArray(template)) {
if (current !== null &&
current !== undefined &&
typeof current === typeof template) {
if (Array.isArray(template) && Array.isArray(current)) {
if (template.length > 0 &&
typeof template[0] === 'object' &&
!Array.isArray(template[0])) {
return current.map(function (item) {
return _this.normalizeConfig(item, template[0]);
});
}
return current;
}
return current;
}
return template;
}
var result = {};
for (var key in template) {
if (template.hasOwnProperty(key)) {
result[key] = this.normalizeConfig(current === null || current === void 0 ? void 0 : current[key], template[key]);
}
}
return result;
};
return ConfigurationManager;
}());
exports.ConfigurationManager = ConfigurationManager;
//# sourceMappingURL=ConfigurationManager.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ConfigurationManager.js","sourceRoot":"","sources":["../../src/Configuration/ConfigurationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAsE;AAEtE,6BAA4B;AAC5B,+DAA8D;AAE9D,IAAM,MAAM,GAAG,wBAAwB,CAAC;AACxC;IAGC,8BAAY,IAAU;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAEK,mCAAI,GAAV;;;;;;wBACC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;wBAE/B,qBAAM,IAAA,oBAAS,EAAC,IAAA,WAAI,EAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAA;;wBAA1C,SAA0C,CAAC;wBAEvC,UAAU,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;wBACvC,qBAAM,IAAA,qBAAU,EAAC,UAAU,CAAC,EAAA;;wBAA3C,YAAY,GAAG,SAA4B;6BAC3C,CAAC,YAAY,EAAb,wBAAa;wBAChB,qBAAM,IAAA,oBAAS,EACd,UAAU,EACV,IAAI,CAAC,SAAS,CAAC,2CAAoB,EAAE,IAAI,EAAE,CAAC,CAAC,CAC7C,EAAA;;wBAHD,SAGC,CAAC;wBACF,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,2CAAoB,CAAC;wBACzC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAC;;4BAEhC,qBAAM,IAAA,mBAAQ,EAAC,UAAU,CAAC,EAAA;;wBAA3C,MAAM,GAAW,SAA0B;wBAE/C,KAAA,IAAI,CAAC,KAAK,CAAA;wBAAU,qBAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,E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;oBACvD,IACC,QAAQ,CAAC,MAAM,GAAG,CAAC;wBACnB,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ;wBAC/B,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC1B,CAAC;wBACF,OAAO,OAAO,CAAC,GAAG,CAAC,UAAC,IAAI;4BACvB,OAAA,KAAI,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;wBAAvC,CAAuC,CACvC,CAAC;oBACH,CAAC;oBACD,OAAO,OAAO,CAAC;gBAChB,CAAC;gBACD,OAAO,OAAO,CAAC;YAChB,CAAC;YACD,OAAO,QAAQ,CAAC;QACjB,CAAC;QAED,IAAM,MAAM,GAAQ,EAAE,CAAC;QAEvB,KAAK,IAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;YAC5B,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,eAAe,CACjC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,CAAC,EACd,QAAQ,CAAC,GAAG,CAAC,CACb,CAAC;YACH,CAAC;QACF,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IACF,2BAAC;AAAD,CAAC,AA5FD,IA4FC;AA5FY,oDAAoB"}

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultConfiguration = void 0;
exports.DefaultConfiguration = {
webServer: {
port: 6300,
},
unity: {
executable: {
path: '',
arguments: [],
startUpDelay: 5000,
},
webSocket: {
ip: '127.0.0.1',
port: 3000,
},
heartbeatInterval: 1000,
calibrationImageInterval: 2000,
},
cameraRunner: {
webSocket: {
ip: '127.0.0.1',
port: 6301,
},
pollInterval: 5000,
},
};
//# sourceMappingURL=DefaultConfiguration.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DefaultConfiguration.js","sourceRoot":"","sources":["../../src/Configuration/DefaultConfiguration.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAW;IAC3C,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;KACV;IACD,KAAK,EAAE;QACN,UAAU,EAAE;YACX,IAAI,EAAE,EAAE;YACR,SAAS,EAAE,EAAE;YACb,YAAY,EAAE,IAAI;SAClB;QAED,SAAS,EAAE;YACV,EAAE,EAAE,WAAW;YACf,IAAI,EAAE,IAAI;SACV;QAED,iBAAiB,EAAE,IAAI;QACvB,wBAAwB,EAAE,IAAI;KAC9B;IACD,YAAY,EAAE;QACb,SAAS,EAAE;YACV,EAAE,EAAE,WAAW;YACf,IAAI,EAAE,IAAI;SACV;QAED,YAAY,EAAE,IAAI;KAClB;CACD,CAAC"}

138
dist/ConfigurationManager.js vendored Normal file
View File

@@ -0,0 +1,138 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigurationManager = void 0;
var fs_extra_1 = require("fs-extra");
var path_1 = require("path");
var DefaultConfiguration_1 = require("./Defaults/DefaultConfiguration");
var PREFIX = '[ConfigurationManager]';
var ConfigurationManager = /** @class */ (function () {
function ConfigurationManager(Main) {
this._Main = Main;
}
ConfigurationManager.prototype.load = function () {
return __awaiter(this, void 0, void 0, function () {
var configPath, configExists, config, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
console.log(PREFIX, 'Loading');
return [4 /*yield*/, (0, fs_extra_1.ensureDir)((0, path_1.join)(this._Main.dataPath))];
case 1:
_b.sent();
configPath = (0, path_1.join)(this._Main.dataPath, 'config.json');
return [4 /*yield*/, (0, fs_extra_1.pathExists)(configPath)];
case 2:
configExists = _b.sent();
if (!!configExists) return [3 /*break*/, 4];
return [4 /*yield*/, (0, fs_extra_1.writeFile)(configPath, JSON.stringify(DefaultConfiguration_1.DefaultConfiguration, null, 4))];
case 3:
_b.sent();
this._Main.Config = DefaultConfiguration_1.DefaultConfiguration;
console.log(PREFIX, 'Written default configuration');
return [3 /*break*/, 7];
case 4: return [4 /*yield*/, (0, fs_extra_1.readJSON)(configPath)];
case 5:
config = _b.sent();
_a = this._Main;
return [4 /*yield*/, this.validateConfig(config)];
case 6:
_a.Config = _b.sent();
console.log(PREFIX, 'Loaded configuration');
_b.label = 7;
case 7: return [2 /*return*/];
}
});
});
};
ConfigurationManager.prototype.validateConfig = function (config) {
return __awaiter(this, void 0, void 0, function () {
var normalizedConfig, hasChanges, configPath;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
normalizedConfig = this.normalizeConfig(config, DefaultConfiguration_1.DefaultConfiguration);
hasChanges = JSON.stringify(config) !== JSON.stringify(normalizedConfig);
if (!hasChanges) return [3 /*break*/, 2];
this._Main.Config = normalizedConfig;
configPath = (0, path_1.join)(this._Main.dataPath, 'config.json');
return [4 /*yield*/, (0, fs_extra_1.writeFile)(configPath, JSON.stringify(normalizedConfig, null, 4))];
case 1:
_a.sent();
console.log(PREFIX, 'Configuration updated and saved');
_a.label = 2;
case 2: return [2 /*return*/, normalizedConfig];
}
});
});
};
ConfigurationManager.prototype.normalizeConfig = function (current, template) {
var _this = this;
if (template === null || template === undefined) {
return template;
}
if (typeof template !== 'object' || Array.isArray(template)) {
if (current !== null &&
current !== undefined &&
typeof current === typeof template) {
if (Array.isArray(template) && Array.isArray(current)) {
if (template.length > 0 &&
typeof template[0] === 'object' &&
!Array.isArray(template[0])) {
return current.map(function (item) {
return _this.normalizeConfig(item, template[0]);
});
}
return current;
}
return current;
}
return template;
}
var result = {};
for (var key in template) {
if (template.hasOwnProperty(key)) {
result[key] = this.normalizeConfig(current === null || current === void 0 ? void 0 : current[key], template[key]);
}
}
return result;
};
return ConfigurationManager;
}());
exports.ConfigurationManager = ConfigurationManager;
//# sourceMappingURL=ConfigurationManager.js.map

1
dist/ConfigurationManager.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ConfigurationManager.js","sourceRoot":"","s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C,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC1B,CAAC;wBACF,OAAO,OAAO,CAAC,GAAG,CAAC,UAAC,IAAI;4BACvB,OAAA,KAAI,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;wBAAvC,CAAuC,CACvC,CAAC;oBACH,CAAC;oBACD,OAAO,OAAO,CAAC;gBAChB,CAAC;gBACD,OAAO,OAAO,CAAC;YAChB,CAAC;YACD,OAAO,QAAQ,CAAC;QACjB,CAAC;QAED,IAAM,MAAM,GAAQ,EAAE,CAAC;QAEvB,KAAK,IAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;YAC5B,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,eAAe,CACjC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,CAAC,EACd,QAAQ,CAAC,GAAG,CAAC,CACb,CAAC;YACH,CAAC;QACF,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IACF,2BAAC;AAAD,CAAC,AA5FD,IA4FC;AA5FY,oDAAoB"}

6
dist/Entry.js vendored Normal file
View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Main_1 = require("./Main");
var _Main = new Main_1.Main();
_Main.start();
//# sourceMappingURL=Entry.js.map

1
dist/Entry.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Entry.js","sourceRoot":"","sources":["../src/Entry.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,IAAM,KAAK,GAAG,IAAI,WAAI,EAAE,CAAC;AACzB,KAAK,CAAC,KAAK,EAAE,CAAC"}

82
dist/Main.js vendored Normal file
View File

@@ -0,0 +1,82 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Main = void 0;
var path_1 = require("path");
var WebServer_1 = require("./WebServer/WebServer");
var os_1 = require("os");
var ConfigurationManager_1 = require("./Configuration/ConfigurationManager");
var CameraRunner_1 = require("./CameraRunner");
var UnityRunner_1 = require("./Unity/UnityRunner");
var UnityWebSocket_1 = require("./Unity/UnityWebSocket");
var Main = /** @class */ (function () {
function Main() {
this.dataPath = (0, path_1.join)((0, os_1.homedir)(), 'MorphixProductions', 'NTSHControl');
this.ConfigurationManager = new ConfigurationManager_1.ConfigurationManager(this);
this.WebServer = new WebServer_1.WebServer(this);
this.CameraRunner = new CameraRunner_1.CameraRunner(this);
this.UnityRunner = new UnityRunner_1.UnityRunner(this);
this.UnityWebSocket = new UnityWebSocket_1.UnityWebSocket(this);
}
Main.prototype.start = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.ConfigurationManager.load()];
case 1:
_b.sent();
return [4 /*yield*/, this.WebServer.listen()];
case 2:
_b.sent();
return [4 /*yield*/, this.CameraRunner.connect()];
case 3:
_b.sent();
setTimeout(function () {
_this.UnityRunner.start();
}, (_a = this.Config.unity.executable.startUpDelay) !== null && _a !== void 0 ? _a : 0);
return [2 /*return*/];
}
});
});
};
return Main;
}());
exports.Main = Main;
//# sourceMappingURL=Main.js.map

1
dist/Main.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Main.js","sourceRoot":"","sources":["../src/Main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA4B;AAC5B,mDAAkD;AAClD,yBAA6B;AAC7B,6EAG8C;AAC9C,+CAA8C;AAC9C,mDAAkD;AAClD,yDAAwD;AAExD;IAAA;QACC,aAAQ,GAAG,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,oBAAoB,EAAE,aAAa,CAAC,CAAC;QAEhE,yBAAoB,GAAG,IAAI,2CAAoB,CAAC,IAAI,CAAC,CAAC;QACtD,cAAS,GAAG,IAAI,qBAAS,CAAC,IAAI,CAAC,CAAC;QAEhC,iBAAY,GAAG,IAAI,2BAAY,CAAC,IAAI,CAAC,CAAC;QACtC,gBAAW,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,CAAC;QACpC,mBAAc,GAAG,IAAI,+BAAc,CAAC,IAAI,CAAC,CAAC;IAc3C,CAAC;IAVM,oBAAK,GAAX;;;;;;4BACC,qBAAM,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,EAAA;;wBAAtC,SAAsC,CAAC;wBACvC,qBAAM,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAA;;wBAA7B,SAA6B,CAAC;wBAE9B,qBAAM,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAA;;wBAAjC,SAAiC,CAAC;wBAElC,UAAU,CAAC;4BACV,KAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;wBAC1B,CAAC,EAAE,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,mCAAI,CAAC,CAAC,CAAC;;;;;KACnD;IACF,WAAC;AAAD,CAAC,AAtBD,IAsBC;AAtBY,oBAAI"}

214
dist/Unity/CameraRunner.js vendored Normal file
View File

@@ -0,0 +1,214 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CameraRunner = void 0;
var socket_io_client_1 = require("socket.io-client");
var Utils_1 = require("../Utils");
var PREFIX = "[CameraRunner]";
var CameraRunner = /** @class */ (function () {
function CameraRunner(Main) {
this.state = 'DISCONNECTED';
this.processStatus = {
state: 'STOPPED',
startTime: -1,
output: { current: [], last: [] },
};
this._Main = Main;
}
CameraRunner.prototype.handle = function (command) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
switch (command) {
case 'restart':
case 'reboot':
var callback = args[0];
if (typeof callback !== 'function')
return;
this.sendCommand(command, callback);
break;
}
};
CameraRunner.prototype.sendCommand = function (command, callback) {
if (this.socket == null || !this.socket.connected)
return callback({
succeed: false,
message: 'Not connected to CameraRunner',
});
this.socket.emit(command, function (response) {
callback(response);
});
};
CameraRunner.prototype.broadcastState = function () {
this._Main.WebServer.socket.emit('cameraRunnerState', this.getState());
};
CameraRunner.prototype.getState = function () {
return {
state: this.state,
message: this.message,
error: this.error,
processStatus: this.processStatus,
};
};
CameraRunner.prototype.setInfo = function (message, error, state) {
if (state === void 0) { state = 'FAILED'; }
this.message = message;
this.error = error;
this.state = state;
this.broadcastState();
if (state == 'FAILED' || state == 'DISCONNECTED')
console.warn(PREFIX, message !== null && message !== void 0 ? message : error);
else
console.log(PREFIX, message !== null && message !== void 0 ? message : error);
};
CameraRunner.prototype.startPollClock = function () {
var _this = this;
var poll = function () { return __awaiter(_this, void 0, void 0, function () {
var data;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, new Promise(function (resolve) {
_this.socket.emit('getStatus', function (response) {
return resolve(response);
});
})];
case 1:
data = _a.sent();
this.processStatus = data;
this.broadcastState();
return [2 /*return*/];
}
});
}); };
this.socket.on('simpleStatus', function (simpleStatus) {
_this.processStatus.state = simpleStatus.state;
_this.processStatus.message = simpleStatus.message;
_this.processStatus.error = simpleStatus.error;
_this.broadcastState();
});
clearInterval(this.pollClock);
this.pollClock = setInterval(function () { return poll(); }, this._Main.Config.cameraRunner.pollInterval);
poll();
};
CameraRunner.prototype.reconnect = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
clearInterval(this.pollClock);
if (this.socket != null) {
this.socket.disconnect();
this.socket.close();
this.socket = null;
}
return [4 /*yield*/, (0, Utils_1.delay)(500)];
case 1:
_a.sent();
this.setInfo("Reconnecting to CameraRunner in 5 seconds...", null, 'CONNECTING');
return [4 /*yield*/, (0, Utils_1.delay)(5000)];
case 2:
_a.sent();
return [4 /*yield*/, this.connect()];
case 3:
_a.sent();
return [2 /*return*/];
}
});
});
};
CameraRunner.prototype.connect = function () {
return __awaiter(this, void 0, void 0, function () {
var ip, port;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.setInfo('Connecting to CameraRunner', null, 'CONNECTING');
return [4 /*yield*/, (0, Utils_1.delay)(1000)];
case 1:
_a.sent();
ip = this._Main.Config.cameraRunner.webSocket.ip;
port = this._Main.Config.cameraRunner.webSocket.port;
if (ip == null || port == null) {
return [2 /*return*/, this.setInfo('Connection problem', 'Camera Runner WebSocket IP or port is not configured.')];
}
this.socket = (0, socket_io_client_1.io)("ws://".concat(ip, ":").concat(port), {
reconnectionAttempts: 0,
reconnectionDelay: 2000,
});
this.socket.on('connect', function () {
_this.setInfo('Connected', null, 'CONNECTED');
_this.startPollClock();
});
this.socket.on('disconnect', function () {
_this.setInfo('Disconnected', null, 'DISCONNECTED');
_this.reconnect();
});
this.socket.on('reconnect', function () {
_this.setInfo('Connected (reconnection)', null, 'CONNECTED');
});
this.socket.on('connect_error', function (err) {
_this.setInfo('Connection problem', "Connection error: ".concat(err));
_this.reconnect();
});
this.socket.on('error', function (err) {
_this.setInfo('Connection problem', "Socket error: ".concat(err));
_this.reconnect();
});
this.socket.on('reconnect_attempt', function () {
_this.setInfo('Reconnecting', null, 'CONNECTING');
});
this.socket.on('reconnect_failed', function () {
_this.setInfo('Connection problem', 'Reconnection failed');
_this.reconnect();
});
this.socket.on('close', function () {
_this.setInfo('Disconnected', null, 'DISCONNECTED');
_this.reconnect();
});
return [2 /*return*/];
}
});
});
};
return CameraRunner;
}());
exports.CameraRunner = CameraRunner;
//# sourceMappingURL=CameraRunner.js.map

1
dist/Unity/CameraRunner.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"CameraRunner.js","sourceRoot":"","sources":["../../src/Unity/CameraRunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA8C;AAE9C,kCAA+C;AAE/C,IAAM,MAAM,G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KAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,wBAAiB,GAAG,CAAE,CAAC,CAAC;4BAC3D,KAAI,CAAC,SAAS,EAAE,CAAC;wBAClB,CAAC,CAAC,CAAC;wBAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE;4BACnC,KAAI,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;wBAClD,CAAC,CAAC,CAAC;wBAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE;4BAClC,KAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,qBAAqB,CAAC,CAAC;4BAC1D,KAAI,CAAC,SAAS,EAAE,CAAC;wBAClB,CAAC,CAAC,CAAC;wBAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE;4BACvB,KAAI,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;4BACnD,KAAI,CAAC,SAAS,EAAE,CAAC;wBAClB,CAAC,CAAC,CAAC;;;;;KACH;IACF,mBAAC;AAAD,CAAC,AAxLD,IAwLC;AAxLY,oCAAY"}

117
dist/Unity/Unity.js vendored Normal file
View File

@@ -0,0 +1,117 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Unity = void 0;
var ws_1 = require("ws");
var Utils_1 = require("../Utils");
var PREFIX = '[Unity]';
var Unity = /** @class */ (function () {
function Unity(Main) {
this.state = 'DISCONNECTED';
this.restartRequested = false;
this._Main = Main;
}
Unity.prototype.broadcastState = function () {
this._Main.WebServer.socket.emit('unityState', this.getState());
};
Unity.prototype.setInfo = function (message, error, state) {
if (state === void 0) { state = 'FAILED'; }
this.message = message;
this.error = error;
this.state = state;
this.broadcastState();
if (state == 'FAILED' || state == 'DISCONNECTED')
console.warn(PREFIX, message !== null && message !== void 0 ? message : error);
else
console.log(PREFIX, message !== null && message !== void 0 ? message : error);
};
Unity.prototype.reconnect = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.restartRequested)
return [2 /*return*/];
this.restartRequested = true;
if (this.socket != null) {
this.socket.close();
this.socket = null;
}
return [4 /*yield*/, (0, Utils_1.delay)(500)];
case 1:
_a.sent();
this.setInfo("Reconnecting to Unity in 5 seconds...", null, 'CONNECTING');
return [4 /*yield*/, (0, Utils_1.delay)(5000)];
case 2:
_a.sent();
return [4 /*yield*/, this.connect()];
case 3:
_a.sent();
return [2 /*return*/];
}
});
});
};
Unity.prototype.connect = function () {
var _this = this;
var ws = new ws_1.WebSocket("ws://".concat(this._Main.Config.unity.webSocket.ip, ":").concat(this._Main.Config.unity.webSocket.port));
ws.on('error', function (error) {
_this.setInfo('Connection error', "Could not connect: ".concat(error.message), 'FAILED');
_this.reconnect();
});
ws.on('open', function () {
_this.setInfo('Connected', null, 'CONNECTED');
});
ws.on('close', function () {
if (_this.restartRequested)
return;
_this.setInfo('Disconnected', 'Unity was disconnected unexpectedly', 'DISCONNECTED');
_this.reconnect();
});
};
Unity.prototype.getState = function () {
return {
state: this.state,
message: this.message,
error: this.error,
};
};
return Unity;
}());
exports.Unity = Unity;
//# sourceMappingURL=Unity.js.map

1
dist/Unity/Unity.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Unity.js","sourceRoot":"","sources":["../../src/Unity/Unity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yBAA+B;AAE/B,kCAA+C;AAE/C,IAAM,MAAM,GAAG,SAAS,CAAC;AACzB;IASC,eAAY,IAAU;QANtB,UAAK,GAAiB,cAAc,CAAC;QAyB7B,qBAAgB,GAAG,KAAK,CAAC;QAlBhC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,8BAAc,GAAd;QACC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,C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cAAS,CACvB,eAAQ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,cAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAE,CACxF,CAAC;QAEF,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,KAAK;YACpB,KAAI,CAAC,OAAO,CACX,kBAAkB,EAClB,6BAAsB,KAAK,CAAC,OAAO,CAAE,EACrC,QAAQ,CACR,CAAC;YACF,KAAI,CAAC,SAAS,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE;YACb,KAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE;YACd,IAAI,KAAI,CAAC,gBAAgB;gBAAE,OAAO;YAClC,KAAI,CAAC,OAAO,CACX,cAAc,EACd,qCAAqC,EACrC,cAAc,CACd,CAAC;YACF,KAAI,CAAC,SAAS,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,wBAAQ,GAAR;QACC,OAAO;YACN,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;SACjB,CAAC;IACH,CAAC;IACF,YAAC;AAAD,CAAC,AAtFD,IAsFC;AAtFY,sBAAK"}

278
dist/Unity/UnityRunner.js vendored Normal file
View File

@@ -0,0 +1,278 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnityRunner = void 0;
var fs_extra_1 = require("fs-extra");
var child_process_1 = require("child_process");
var Utils_1 = require("../Utils");
var PREFIX = '[UnityRunner]';
var LOG_OUTPUT = !process.argv.includes('--no-output-log');
var UnityRunner = /** @class */ (function () {
function UnityRunner(Main) {
this.message = 'Awaiting startup delay...';
this.startTime = null;
this.output = { current: [], last: [] };
this.restartTriggered = false;
this._Main = Main;
}
UnityRunner.prototype.handle = function (command) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
switch (command) {
case 'restart':
var callback = args[0];
if (typeof callback !== 'function')
return;
callback(this.requestRestart());
break;
}
};
UnityRunner.prototype.startStatusClock = function () {
var _this = this;
clearInterval(this.statusClock);
this.statusClock = setInterval(function () {
_this.broadcastState();
}, 3000);
};
UnityRunner.prototype.requestRestart = function () {
if (this.state !== 'RUNNING')
return {
succeed: false,
message: 'Cannot restart when process is not running. It is probably restarting already.',
};
this.restart(true);
return { succeed: true };
};
UnityRunner.prototype.broadcastState = function () {
this._Main.WebServer.socket.emit('unityRunnerState', this.getStatus());
};
UnityRunner.prototype.setInfo = function (message, error, state) {
if (state === void 0) { state = 'PROBLEM'; }
this.message = message;
this.error = error;
this.state = state;
this.broadcastState();
this.output.current.push("[".concat(new Date().toLocaleTimeString('nl-NL'), "] [System] [").concat(state, "] ").concat(message !== null && message !== void 0 ? message : error));
if (state == 'PROBLEM' || state == 'STOPPED')
console.warn(PREFIX, message !== null && message !== void 0 ? message : error);
else
console.log(PREFIX, message !== null && message !== void 0 ? message : error);
};
UnityRunner.prototype.restart = function () {
return __awaiter(this, arguments, void 0, function (instant) {
if (instant === void 0) { instant = false; }
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.restartTriggered)
return [2 /*return*/];
clearInterval(this.statusClock);
this._Main.WebServer.Calibration.hasCalibrationImage = false;
this._Main.UnityWebSocket.disconnect();
this.restartTriggered = true;
this.startTime = -1;
this.broadcastState();
return [4 /*yield*/, (0, Utils_1.delay)(2000)];
case 1:
_a.sent();
if (this.output.current.length > 0) {
this.output.last = __spreadArray([], this.output.current, true);
this.output.current = [];
}
if (instant)
this.setInfo('Process will restart shortly...', null, 'STOPPED');
if (!(this.process != null)) return [3 /*break*/, 3];
this.process.kill('SIGTERM');
return [4 /*yield*/, (0, Utils_1.delay)(3000)];
case 2:
_a.sent();
if (!this.process.killed && this.process.exitCode === null) {
this.process.kill('SIGKILL');
console.log(PREFIX, 'Sent SIGKILL to process.');
}
_a.label = 3;
case 3:
this.startTime = -1;
if (!!instant) return [3 /*break*/, 5];
this.message = 'Reconnecting in 10 seconds...';
this.broadcastState();
return [4 /*yield*/, (0, Utils_1.delay)(10000)];
case 4:
_a.sent();
_a.label = 5;
case 5: return [4 /*yield*/, this.start()];
case 6:
_a.sent();
return [2 /*return*/];
}
});
});
};
UnityRunner.prototype.start = function () {
return __awaiter(this, void 0, void 0, function () {
var path, fileName;
var _this = this;
var _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
if (this.output.current.length > 0) {
this.output.last = __spreadArray([], this.output.current, true);
this.output.current = [];
}
this.startTime = Date.now();
this.restartTriggered = false;
this.broadcastState();
this._Main.WebServer.Calibration.hasCalibrationImage = false;
clearInterval(this.statusClock);
path = this._Main.Config.unity.executable.path;
if (path == null || !(0, fs_extra_1.pathExistsSync)(path)) {
this.setInfo('Executable problem', "Executable path is not set or does not exist: ".concat(path));
return [2 /*return*/];
}
if (!(this._Main.CameraRunner.state !== 'CONNECTED')) return [3 /*break*/, 2];
return [4 /*yield*/, new Promise(function (resolve) {
_this.setInfo('Waiting for CameraRunner to connect...', null, 'STARTING');
var c = setInterval(function () {
if (_this._Main.CameraRunner.state !== 'CONNECTED')
return;
clearInterval(c);
resolve();
}, 1000);
})];
case 1:
_d.sent();
_d.label = 2;
case 2:
if (!(((_a = this._Main.CameraRunner.processStatus) === null || _a === void 0 ? void 0 : _a.state) !== 'RUNNING')) return [3 /*break*/, 4];
return [4 /*yield*/, new Promise(function (resolve) {
_this.setInfo('Waiting for CameraRunner process to start...', null, 'STARTING');
var c = setInterval(function () {
var _a;
if (((_a = _this._Main.CameraRunner.processStatus) === null || _a === void 0 ? void 0 : _a.state) !==
'RUNNING')
return;
clearInterval(c);
resolve();
}, 1000);
})];
case 3:
_d.sent();
_d.label = 4;
case 4:
fileName = path.split(/(\/|\\)/).pop();
this.setInfo("Starting executable: ".concat(fileName), null, 'STARTING');
this.process = (0, child_process_1.spawn)(path, this._Main.Config.unity.executable.arguments, {
stdio: 'pipe',
});
this.process.on('exit', function (code, signal) {
if (_this.restartTriggered)
return;
_this.setInfo('Process exited', "Process exited with code ".concat(code, " and signal ").concat(signal), 'STOPPED');
_this.restart();
});
this.process.on('error', function (err) {
_this.setInfo('Process error', err.message);
_this.restart();
});
(_b = this.process.stdout) === null || _b === void 0 ? void 0 : _b.on('data', function (data) {
var lines = data
.toString()
.trim()
.split('\n')
.filter(function (line) { return line.length > 0; });
lines.forEach(function (line) {
var formattedLine = "[".concat(new Date().toLocaleTimeString('nl-NL'), "] [").concat(fileName, "] ").concat(line);
if (LOG_OUTPUT)
console.log(PREFIX, formattedLine);
_this.output.current.push(formattedLine);
});
});
(_c = this.process.stderr) === null || _c === void 0 ? void 0 : _c.on('data', function (data) {
var lines = data
.toString()
.trim()
.split('\n')
.filter(function (line) { return line.length > 0; });
lines.forEach(function (line) {
var formattedLine = "[".concat(new Date().toLocaleTimeString('nl-NL'), "] [").concat(fileName, "] [ERROR] ").concat(line);
if (LOG_OUTPUT)
console.error(PREFIX, formattedLine);
_this.output.current.push(formattedLine);
});
});
this.startStatusClock();
setTimeout(function () {
var _a, _b;
if (_this.process == null ||
((_a = _this.process) === null || _a === void 0 ? void 0 : _a.killed) ||
((_b = _this.process) === null || _b === void 0 ? void 0 : _b.exitCode) != null ||
_this.restartTriggered)
return;
_this.setInfo('Running', '', 'RUNNING');
_this._Main.UnityWebSocket.connect();
}, 5000);
return [2 /*return*/];
}
});
});
};
UnityRunner.prototype.getStatus = function () {
return {
state: this.state,
message: this.message,
error: this.error,
startTime: this.startTime,
output: this.output,
};
};
return UnityRunner;
}());
exports.UnityRunner = UnityRunner;
//# sourceMappingURL=UnityRunner.js.map

1
dist/Unity/UnityRunner.js.map vendored Normal file

File diff suppressed because one or more lines are too long

244
dist/Unity/UnityWebSocket.js vendored Normal file
View File

@@ -0,0 +1,244 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnityWebSocket = void 0;
var ws_1 = require("ws");
var Utils_1 = require("../Utils");
var PREFIX = '[Unity]';
var UnityWebSocket = /** @class */ (function () {
function UnityWebSocket(Main) {
this.state = 'DISCONNECTED';
this.message = 'Waiting for process...';
this.parameters = {
timelineWatching: false,
timelineStanding: false,
timelineProgress: 0,
zedPath: '',
zedReady: false,
zedFPS: '-',
parameters: [],
};
this.disconnected = false;
this.restartRequested = false;
this._Main = Main;
}
UnityWebSocket.prototype.handle = function (command) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
switch (command) {
case 'parameterValue':
var sliderIndex = args[0];
var percentage = args[1];
if (this.parameters.parameters[sliderIndex] == undefined)
return;
this.parameters.parameters[sliderIndex].outputValue =
percentage;
if (this.socket == null ||
this.socket.readyState !== ws_1.WebSocket.OPEN)
return;
this.socket.send(JSON.stringify({
type: 'set_slider_value',
sliderIndex: sliderIndex,
sliderValue: percentage,
}));
this.broadcastState();
break;
}
};
UnityWebSocket.prototype.broadcastState = function () {
this._Main.WebServer.socket.emit('unityWebSocketState', this.getState());
};
UnityWebSocket.prototype.setInfo = function (message, error, state) {
if (state === void 0) { state = 'FAILED'; }
this.message = message;
this.error = error;
this.state = state;
this.broadcastState();
if (state == 'FAILED' || state == 'DISCONNECTED')
console.warn(PREFIX, message !== null && message !== void 0 ? message : error);
else
console.log(PREFIX, message !== null && message !== void 0 ? message : error);
};
UnityWebSocket.prototype.stopFetchClocks = function () {
clearInterval(this.heartbeatClock);
clearInterval(this.calibrationImageClock);
};
UnityWebSocket.prototype.handleSocketMessage = function (data) {
var message;
try {
message = JSON.parse(data.toString());
}
catch (error) {
return;
}
switch (message.type) {
case 'heartbeat_data':
this.parameters.timelineWatching =
message.heartbeat.dataTimeline.isWatching;
this.parameters.timelineStanding =
message.heartbeat.dataTimeline.isStanding;
this.parameters.timelineProgress =
message.heartbeat.dataTimeline.timelineProgress;
this.parameters.zedPath = "".concat(message.heartbeat.zedCamera.streamInputIP, ":").concat(message.heartbeat.zedCamera.streamInputPort);
this.parameters.zedReady =
message.heartbeat.zedCamera.isZedReady;
this.parameters.zedFPS = message.heartbeat.zedCamera.cameraFPS;
this.parameters.parameters = message.heartbeat.dataSliders;
this.broadcastState();
break;
case 'response_camera_frame':
this._Main.WebServer.Calibration.writeCalibrationImage(message.imageBase64);
break;
}
};
UnityWebSocket.prototype.disconnect = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.restartRequested = true;
this.disconnected = true;
if (this.socket != null) {
this.socket.close();
this.socket = null;
}
this.stopFetchClocks();
this.setInfo('Waiting for process...', null, 'DISCONNECTED');
return [2 /*return*/];
});
});
};
UnityWebSocket.prototype.reconnect = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.restartRequested)
return [2 /*return*/];
if (this.disconnected)
return [2 /*return*/];
this.restartRequested = true;
this.stopFetchClocks();
if (this.socket != null) {
this.socket.close();
this.socket = null;
}
return [4 /*yield*/, (0, Utils_1.delay)(2000)];
case 1:
_a.sent();
if (this.disconnected)
return [2 /*return*/];
this.message = "Reconnecting in 10 seconds...";
this.broadcastState();
return [4 /*yield*/, (0, Utils_1.delay)(10000)];
case 2:
_a.sent();
if (this.disconnected)
return [2 /*return*/];
return [4 /*yield*/, this.connect()];
case 3:
_a.sent();
return [2 /*return*/];
}
});
});
};
UnityWebSocket.prototype.connect = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.restartRequested = false;
this.disconnected = false;
this.stopFetchClocks();
this.setInfo('Connecting...', null, 'CONNECTING');
return [4 /*yield*/, (0, Utils_1.delay)(1000)];
case 1:
_a.sent();
this.socket = new ws_1.WebSocket("ws://".concat(this._Main.Config.unity.webSocket.ip, ":").concat(this._Main.Config.unity.webSocket.port));
this.socket.on('error', function (error) {
if (_this.restartRequested)
return;
_this.setInfo('Connection error', "Could not connect: ".concat(error.message), 'FAILED');
_this.reconnect();
});
this.socket.on('open', function () {
_this.startFetchClocks();
_this.setInfo('Connected', null, 'CONNECTED');
});
this.socket.on('close', function () {
if (_this.restartRequested)
return;
_this.setInfo('Disconnected', 'Unity was disconnected unexpectedly', 'FAILED');
_this.reconnect();
});
this.socket.on('message', function (data) { return _this.handleSocketMessage(data); });
return [2 /*return*/];
}
});
});
};
UnityWebSocket.prototype.startFetchClocks = function () {
var _this = this;
this.socket.send(JSON.stringify({ type: 'set_heartbeat_auto_send', autoSend: false }));
this.heartbeatClock = setInterval(function () {
if (_this.socket == null ||
_this.socket.readyState !== ws_1.WebSocket.OPEN)
return;
_this.socket.send(JSON.stringify({ type: 'request_heartbeat' }));
}, this._Main.Config.unity.heartbeatInterval);
this.calibrationImageClock = setInterval(function () {
if (_this.socket == null ||
_this.socket.readyState !== ws_1.WebSocket.OPEN)
return;
_this.socket.send(JSON.stringify({ type: 'request_camera_frame' }));
}, this._Main.Config.unity.calibrationImageInterval);
};
UnityWebSocket.prototype.getState = function () {
return {
state: this.state,
message: this.message,
error: this.error,
parameters: this.parameters,
};
};
return UnityWebSocket;
}());
exports.UnityWebSocket = UnityWebSocket;
//# sourceMappingURL=UnityWebSocket.js.map

1
dist/Unity/UnityWebSocket.js.map vendored Normal file

File diff suppressed because one or more lines are too long

207
dist/UnityRunner.js vendored Normal file
View File

@@ -0,0 +1,207 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnityRunner = void 0;
var fs_extra_1 = require("fs-extra");
var child_process_1 = require("child_process");
var Utils_1 = require("./Utils");
var PREFIX = '[UnityRunner]';
var LOG_OUTPUT = !process.argv.includes('--no-output-log');
var UnityRunner = /** @class */ (function () {
function UnityRunner(Main) {
this.state = 'STOPPED';
this.startTime = null;
this.output = { current: [], last: [] };
this.restartTriggered = false;
this._Main = Main;
}
UnityRunner.prototype.requestRestart = function () {
if (this.state !== 'RUNNING')
return {
succeed: false,
message: 'Cannot restart when process is not running. It is probably restarting already.',
};
this.restart(true);
return { succeed: true };
};
UnityRunner.prototype.broadcastState = function () {
this._Main.WebServer.socket.emit('unityRunnerState', this.getStatus());
};
UnityRunner.prototype.setInfo = function (message, error, state) {
if (state === void 0) { state = 'PROBLEM'; }
this.message = message;
this.error = error;
this.state = state;
this.broadcastState();
this.output.current.push("[".concat(new Date().toLocaleTimeString('nl-NL'), "] [System] [").concat(state, "] ").concat(message !== null && message !== void 0 ? message : error));
if (state == 'PROBLEM' || state == 'STOPPED')
console.warn(PREFIX, message !== null && message !== void 0 ? message : error);
else
console.log(PREFIX, message !== null && message !== void 0 ? message : error);
};
UnityRunner.prototype.restart = function () {
return __awaiter(this, arguments, void 0, function (instant) {
if (instant === void 0) { instant = false; }
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.restartTriggered)
return [2 /*return*/];
if (this.output.current.length > 0) {
this.output.last = __spreadArray([], this.output.current, true);
this.output.current = [];
}
this.restartTriggered = true;
this.startTime = -1;
this.broadcastState();
if (instant)
this.setInfo('Process will restart shortly...', null, 'STOPPED');
if (!(this.process != null)) return [3 /*break*/, 2];
this.process.kill('SIGTERM');
return [4 /*yield*/, (0, Utils_1.delay)(3000)];
case 1:
_a.sent();
if (!this.process.killed && this.process.exitCode === null) {
this.process.kill('SIGKILL');
console.log(PREFIX, 'Sent SIGKILL to process.');
}
_a.label = 2;
case 2:
this.startTime = -1;
if (!!instant) return [3 /*break*/, 4];
this.setInfo("Restarting process in 5 seconds...", null, 'STOPPED');
return [4 /*yield*/, (0, Utils_1.delay)(5000)];
case 3:
_a.sent();
_a.label = 4;
case 4: return [4 /*yield*/, this.start()];
case 5:
_a.sent();
return [2 /*return*/];
}
});
});
};
UnityRunner.prototype.start = function () {
var _this = this;
var _a, _b;
if (this.output.current.length > 0) {
this.output.last = __spreadArray([], this.output.current, true);
this.output.current = [];
}
this.startTime = Date.now();
this.restartTriggered = false;
this.broadcastState();
var path = this._Main.Config.unity.executable.path;
if (path == null || !(0, fs_extra_1.pathExistsSync)(path)) {
this.setInfo('Executable problem', "Executable path is not set or does not exist: ".concat(path));
return;
}
var fileName = path.split(/(\/|\\)/).pop();
this.setInfo("Starting executable: ".concat(fileName), null, 'STARTING');
this.process = (0, child_process_1.spawn)(path, this._Main.Config.unity.executable.arguments, {
stdio: 'pipe',
});
this.process.on('exit', function (code, signal) {
if (_this.restartTriggered)
return;
_this.setInfo('Process exited', "Process exited with code ".concat(code, " and signal ").concat(signal), 'STOPPED');
_this.restart();
});
this.process.on('error', function (err) {
_this.setInfo('Process error', err.message);
_this.restart();
});
(_a = this.process.stdout) === null || _a === void 0 ? void 0 : _a.on('data', function (data) {
var lines = data
.toString()
.trim()
.split('\n')
.filter(function (line) { return line.length > 0; });
lines.forEach(function (line) {
var formattedLine = "[".concat(new Date().toLocaleTimeString('nl-NL'), "] [").concat(fileName, "] ").concat(line);
if (LOG_OUTPUT)
console.log(PREFIX, formattedLine);
_this.output.current.push(formattedLine);
});
});
(_b = this.process.stderr) === null || _b === void 0 ? void 0 : _b.on('data', function (data) {
var lines = data
.toString()
.trim()
.split('\n')
.filter(function (line) { return line.length > 0; });
lines.forEach(function (line) {
var formattedLine = "[".concat(new Date().toLocaleTimeString('nl-NL'), "] [").concat(fileName, "] [ERROR] ").concat(line);
if (LOG_OUTPUT)
console.error(PREFIX, formattedLine);
_this.output.current.push(formattedLine);
});
});
setTimeout(function () {
var _a, _b;
if (_this.process == null ||
((_a = _this.process) === null || _a === void 0 ? void 0 : _a.killed) ||
((_b = _this.process) === null || _b === void 0 ? void 0 : _b.exitCode) != null ||
_this.restartTriggered)
return;
_this.setInfo('Running', '', 'RUNNING');
}, 5000);
};
UnityRunner.prototype.getStatus = function () {
return {
state: this.state,
message: this.message,
error: this.error,
startTime: this.startTime,
output: this.output,
};
};
return UnityRunner;
}());
exports.UnityRunner = UnityRunner;
//# sourceMappingURL=UnityRunner.js.map

1
dist/UnityRunner.js.map vendored Normal file

File diff suppressed because one or more lines are too long

7
dist/Utils.js vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.delay = delay;
function delay(duration) {
return new Promise(function (resolve) { return setTimeout(resolve, duration); });
}
//# sourceMappingURL=Utils.js.map

1
dist/Utils.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../src/Utils.ts"],"names":[],"mappings":";;AAMA,sBAEC;AAFD,SAAgB,KAAK,CAAC,QAAgB;IACrC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,IAAK,OAAA,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,EAA7B,CAA6B,CAAC,CAAC;AAChE,CAAC"}

31
dist/WebServer.js vendored Normal file
View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebServer = void 0;
var express = require("express");
var socket_io_1 = require("socket.io");
var http_1 = require("http");
var PREFIX = '[WebServer]';
var WebServer = /** @class */ (function () {
function WebServer(Main) {
this._Main = Main;
this.prepare();
}
WebServer.prototype.prepare = function () {
this.app = express();
this.httpServer = (0, http_1.createServer)(this.app);
this.socket = new socket_io_1.Server(this.httpServer);
};
WebServer.prototype.listen = function () {
var _this = this;
return new Promise(function (resolve) {
var port = _this._Main.Config.webServer.port;
_this.httpServer.listen(port, function () {
console.log(PREFIX, "Listening on port http://127.0.0.1:".concat(port));
resolve();
});
});
};
return WebServer;
}());
exports.WebServer = WebServer;
//# sourceMappingURL=WebServer.js.map

1
dist/WebServer.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"WebServer.js","sourceRoot":"","sources":["../src/WebServer.ts"],"names":[],"mappings":";;;AACA,iCAAmC;AACnC,uCAAqD;AACrD,6BAA0D;AAG1D,IAAM,MAAM,GAAG,aAAa,CAAC;AAC7B;IAOC,mBAAY,IAAU;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IAEO,2BAAO,GAAf;QACC,IAAI,CAAC,GAAG,GAAG,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,IAAA,mBAAY,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IAED,0BAAM,GAAN;QAAA,iBAWC;QAVA,OAAO,IAAI,OAAO,CAAO,UAAC,OAAO;YAChC,IAAM,IAAI,GAAG,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;YAC9C,KAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE;gBAC5B,OAAO,CAAC,GAAG,CACV,MAAM,EACN,6CAAsC,IAAI,CAAE,CAC5C,CAAC;gBACF,OAAO,EAAE,CAAC;YACX,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,gBAAC;AAAD,CAAC,AA/BD,IA+BC;AA/BY,8BAAS"}

80
dist/WebServer/CalibrationRouter.js vendored Normal file
View File

@@ -0,0 +1,80 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CalibrationRouter = void 0;
var express_1 = require("express");
var path_1 = require("path");
var fs_extra_1 = require("fs-extra");
var CalibrationRouter = /** @class */ (function () {
function CalibrationRouter(Main) {
this.hasCalibrationImage = false;
this._Main = Main;
this.Router = (0, express_1.Router)();
this.calibrationImagePath = (0, path_1.join)(this._Main.dataPath, 'calibrationImage.png');
this.registerRoutes();
}
CalibrationRouter.prototype.registerRoutes = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
this.Router.get('/calibrationImage', function (req, res) {
if (!_this.hasCalibrationImage)
return res.redirect('/img/noCalibrationImage.png');
res.sendFile(_this.calibrationImagePath);
});
return [2 /*return*/];
});
});
};
CalibrationRouter.prototype.writeCalibrationImage = function (base64) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, (0, fs_extra_1.writeFile)(this.calibrationImagePath, Buffer.from(base64, 'base64'))];
case 1:
_a.sent();
this.hasCalibrationImage = true;
return [2 /*return*/];
}
});
});
};
return CalibrationRouter;
}());
exports.CalibrationRouter = CalibrationRouter;
//# sourceMappingURL=CalibrationRouter.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CalibrationRouter.js","sourceRoot":"","sources":["../../src/WebServer/CalibrationRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAiC;AAEjC,6BAA4B;AAC5B,qCAA4E;AAE5E;IAOC,2BAAY,IAAU;QAFtB,wBAAmB,GAAY,KAAK,CAAC;QAGpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QAEvB,IAAI,CAAC,oBAAoB,GAAG,IAAA,WAAI,EAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ,EACnB,sBAAsB,CACtB,CAAC;QAEF,IAAI,CAAC,cAAc,EAAE,CAAC;IACvB,CAAC;IAEK,0CAAc,GAApB;;;;gBACC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,EAAE,UAAC,GAAG,EAAE,GAAG;oBAC7C,IAAI,CAAC,KAAI,CAAC,mBAAmB;wBAC5B,OAAO,GAAG,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;oBAEpD,GAAG,CAAC,QAAQ,CAAC,KAAI,CAAC,oBAAoB,CAAC,CAAC;gBACzC,CAAC,CAAC,CAAC;;;;KACH;IAEK,iDAAqB,GAA3B,UAA4B,MAAc;;;;4BACzC,qBAAM,IAAA,oBAAS,EACd,IAAI,CAAC,oBAAoB,EACzB,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAC7B,EAAA;;wBAHD,SAGC,CAAC;wBACF,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;;;;;KAChC;IACF,wBAAC;AAAD,CAAC,AAnCD,IAmCC;AAnCY,8CAAiB"}

100
dist/WebServer/DahboardRouter.js vendored Normal file
View File

@@ -0,0 +1,100 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardRouter = void 0;
var express_1 = require("express");
var path_1 = require("path");
var fs_extra_1 = require("fs-extra");
var DashboardRouter = /** @class */ (function () {
function DashboardRouter(Main) {
this._Main = Main;
this.Router = (0, express_1.Router)();
this.path = (0, path_1.join)(__filename, '..', '..', '..', 'frontend', 'views', 'dashboard');
this.registerRoutes();
}
DashboardRouter.prototype.registerRoutes = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
this.Router.get(['/', '/dashboard'], function (req, res) { return __awaiter(_this, void 0, void 0, function () {
var htmlContent;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, (0, fs_extra_1.readFile)((0, path_1.join)(this.path, 'index.html'))];
case 1:
htmlContent = _a.sent();
res.setHeader('Content-Type', 'text/html');
res.send(htmlContent);
return [2 /*return*/];
}
});
}); });
this.Router.get('/style.css', function (req, res) { return __awaiter(_this, void 0, void 0, function () {
var styleContent;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, (0, fs_extra_1.readFile)((0, path_1.join)(this.path, 'style.css'))];
case 1:
styleContent = _a.sent();
res.setHeader('Content-Type', 'text/css');
res.send(styleContent);
return [2 /*return*/];
}
});
}); });
this.Router.get('/script.js', function (req, res) { return __awaiter(_this, void 0, void 0, function () {
var scriptContent;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, (0, fs_extra_1.readFile)((0, path_1.join)(this.path, 'script.js'))];
case 1:
scriptContent = _a.sent();
res.setHeader('Content-Type', 'application/javascript');
res.send(scriptContent);
return [2 /*return*/];
}
});
}); });
return [2 /*return*/];
});
});
};
return DashboardRouter;
}());
exports.DashboardRouter = DashboardRouter;
//# sourceMappingURL=DahboardRouter.js.map

1
dist/WebServer/DahboardRouter.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"DahboardRouter.js","sourceRoot":"","sources":["../../src/WebServer/DahboardRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAiC;AAEjC,6BAA4B;AAC5B,qCAAiE;AAEjE;IAMC,yBAAY,IAAU;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QAEvB,IAAI,CAAC,IAAI,GAAG,IAAA,WAAI,EACf,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,OAAO,EACP,WAAW,CACX,CAAC;QAEF,IAAI,CAAC,cAAc,EAAE,CAAC;IACvB,CAAC;IAEK,wCAAc,GAApB;;;;gBACC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,UAAO,GAAG,EAAE,GAAG;;;;oCAC/B,qBAAM,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,EAAA;;gCAA3D,WAAW,GAAG,SAA6C;gCACjE,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;gCAC3C,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;;;;qBACtB,CAAC,CAAC;gBACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,UAAO,GAAG,EAAE,GAAG;;;;oCACvB,qBAAM,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,EAAA;;gCAA3D,YAAY,GAAG,SAA4C;gCACjE,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;gCAC1C,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;;;;qBACvB,CAAC,CAAC;gBACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,UAAO,GAAG,EAAE,GAAG;;;;oCACtB,qBAAM,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,EAAA;;gCAA5D,aAAa,GAAG,SAA4C;gCAClE,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC;gCACxD,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;;;;qBACxB,CAAC,CAAC;;;;KACH;IACF,sBAAC;AAAD,CAAC,AAxCD,IAwCC;AAxCY,0CAAe"}

100
dist/WebServer/DashboardRouter.js vendored Normal file
View File

@@ -0,0 +1,100 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardRouter = void 0;
var express_1 = require("express");
var path_1 = require("path");
var fs_extra_1 = require("fs-extra");
var DashboardRouter = /** @class */ (function () {
function DashboardRouter(Main) {
this._Main = Main;
this.Router = (0, express_1.Router)();
this.path = (0, path_1.join)(__filename, '..', '..', '..', 'frontend', 'views', 'dashboard');
this.registerRoutes();
}
DashboardRouter.prototype.registerRoutes = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
this.Router.get(['/', '/dashboard', '/calibration', '/cameralogs', '/unitylogs'], function (req, res) { return __awaiter(_this, void 0, void 0, function () {
var htmlContent;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, (0, fs_extra_1.readFile)((0, path_1.join)(this.path, 'index.html'))];
case 1:
htmlContent = _a.sent();
res.setHeader('Content-Type', 'text/html');
res.send(htmlContent);
return [2 /*return*/];
}
});
}); });
this.Router.get('/style.css', function (req, res) { return __awaiter(_this, void 0, void 0, function () {
var styleContent;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, (0, fs_extra_1.readFile)((0, path_1.join)(this.path, 'style.css'))];
case 1:
styleContent = _a.sent();
res.setHeader('Content-Type', 'text/css');
res.send(styleContent);
return [2 /*return*/];
}
});
}); });
this.Router.get('/script.js', function (req, res) { return __awaiter(_this, void 0, void 0, function () {
var scriptContent;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, (0, fs_extra_1.readFile)((0, path_1.join)(this.path, 'script.js'))];
case 1:
scriptContent = _a.sent();
res.setHeader('Content-Type', 'application/javascript');
res.send(scriptContent);
return [2 /*return*/];
}
});
}); });
return [2 /*return*/];
});
});
};
return DashboardRouter;
}());
exports.DashboardRouter = DashboardRouter;
//# sourceMappingURL=DashboardRouter.js.map

1
dist/WebServer/DashboardRouter.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"DashboardRouter.js","sourceRoot":"","sources":["../../src/WebServer/Dashboard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,YAAY,EAAE,UAAO,GAAG,EAAE,GAAG;;;;oCACtB,qBAAM,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,EAAA;;gCAA5D,aAAa,GAAG,SAA4C;gCAClE,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC;gCACxD,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;;;;qBACxB,CAAC,CAAC;;;;KACH;IACF,sBAAC;AAAD,CAAC,AA7CD,IA6CC;AA7CY,0CAAe"}

78
dist/WebServer/WebServer.js vendored Normal file
View File

@@ -0,0 +1,78 @@
"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebServer = void 0;
var express = require("express");
var socket_io_1 = require("socket.io");
var http_1 = require("http");
var DashboardRouter_1 = require("./DashboardRouter");
var path_1 = require("path");
var CalibrationRouter_1 = require("./CalibrationRouter");
var PREFIX = '[WebServer]';
var WebServer = /** @class */ (function () {
function WebServer(Main) {
this._Main = Main;
this.Dashboard = new DashboardRouter_1.DashboardRouter(this._Main);
this.Calibration = new CalibrationRouter_1.CalibrationRouter(this._Main);
this.prepare();
}
WebServer.prototype.prepare = function () {
var _this = this;
this.app = express();
this.httpServer = (0, http_1.createServer)(this.app);
this.socket = new socket_io_1.Server(this.httpServer);
this.app.use(express.static((0, path_1.join)(__filename, '..', '..', '..', 'frontend', 'static')));
this.app.use(this.Dashboard.Router);
this.app.use(this.Calibration.Router);
this.socket.on('connection', function (socket) {
socket.emit('cameraRunnerState', _this._Main.CameraRunner.getState());
socket.emit('unityRunnerState', _this._Main.UnityRunner.getStatus());
socket.emit('unityWebSocketState', _this._Main.UnityWebSocket.getState());
socket.on('cameraRunner', function (command) {
var _a;
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return (_a = _this._Main.CameraRunner).handle.apply(_a, __spreadArray([command], args, false));
});
socket.on('unityRunner', function (command) {
var _a;
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return (_a = _this._Main.UnityRunner).handle.apply(_a, __spreadArray([command], args, false));
});
socket.on('unityWebSocket', function (command) {
var _a;
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return (_a = _this._Main.UnityWebSocket).handle.apply(_a, __spreadArray([command], args, false));
});
});
};
WebServer.prototype.listen = function () {
var _this = this;
return new Promise(function (resolve) {
var port = _this._Main.Config.webServer.port;
_this.httpServer.listen(port, function () {
console.log(PREFIX, "Listening on port http://127.0.0.1:".concat(port));
resolve();
});
});
};
return WebServer;
}());
exports.WebServer = WebServer;
//# sourceMappingURL=WebServer.js.map

1
dist/WebServer/WebServer.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"WebServer.js","sourceRoot":"","sources":["../../src/WebServer/WebServer.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iCAAmC;AACnC,uCAAqD;AACrD,6BAA0D;AAE1D,qDAAoD;AACpD,6BAA4B;AAC5B,yDAAwD;AAExD,IAAM,MAAM,GAAG,aAAa,CAAC;AAC7B;IAUC,mBAAY,IAAU;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,SAAS,GAAG,IAAI,iCAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,qCAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAErD,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IAEO,2BAAO,GAAf;QAAA,iBAmCC;QAlCA,IAAI,C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AAd,UAAc,EAAd,qBAAc,EAAd,IAAc;oBAAd,6BAAc;;gBACxD,OAAA,CAAA,KAAA,KAAI,CAAC,KAAK,CAAC,WAAW,CAAA,CAAC,MAAM,0BAAC,OAAO,GAAK,IAAI;YAA9C,CAA+C,CAC/C,CAAC;YACF,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,OAAe;;gBAAE,cAAc;qBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;oBAAd,6BAAc;;gBAC3D,OAAA,CAAA,KAAA,KAAI,CAAC,KAAK,CAAC,cAAc,CAAA,CAAC,MAAM,0BAAC,OAAO,GAAK,IAAI;YAAjD,CAAkD,CAClD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,0BAAM,GAAN;QAAA,iBAWC;QAVA,OAAO,IAAI,OAAO,CAAO,UAAC,OAAO;YAChC,IAAM,IAAI,GAAG,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;YAC9C,KAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE;gBAC5B,OAAO,CAAC,GAAG,CACV,MAAM,EACN,6CAAsC,IAAI,CAAE,CAC5C,CAAC;gBACF,OAAO,EAAE,CAAC;YACX,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,gBAAC;AAAD,CAAC,AAnED,IAmEC;AAnEY,8BAAS"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,116 @@
# [material-symbols](https://github.com/marella/material-symbols/tree/main/material-symbols)
Latest variable icon fonts and CSS for Material Symbols.
> This package is automatically updated, so it will always have the latest icons from Google.
> For fonts with fewer variations, see [`@material-symbols/font-400`](https://www.npmjs.com/package/@material-symbols/font-400)
>
> For SVGs, see [`@material-symbols/svg-400`](https://www.npmjs.com/package/@material-symbols/svg-400)
- [Installation](#installation)
- [Usage](#usage)
- [Available Icons](#available-icons)
## Installation
Install the [latest version][releases] using:
```sh
npm install material-symbols@latest
```
## Usage
Import in JS (example: `src/index.js` in Create React App, `src/main.js` in Vue CLI):
```js
import 'material-symbols';
```
or import in CSS (example: `src/styles.css` in Angular CLI):
```css
@import 'material-symbols';
```
or import in HTML:
```html
<link href="/path/to/material-symbols/index.css" rel="stylesheet">
```
To display an icon, use one of the following:
```html
<span class="material-symbols-outlined">face</span> <!-- Outlined -->
<span class="material-symbols-rounded">face</span> <!-- Rounded -->
<span class="material-symbols-sharp">face</span> <!-- Sharp -->
```
To customize the variable font axes (fill, weight, grade, and optical size), use:
```css
.material-symbols-outlined {
font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 48;
}
```
### Reducing Build Size
The default `index.css` includes CSS for all fonts. This may cause build tools such as webpack to copy all fonts to the build directory even if you are not using all of them. To reduce the build size, import only the styles you need. For example, if you only need outlined icons, import `outlined.css` instead of the default `index.css`:
```diff
-import 'material-symbols';
+import 'material-symbols/outlined.css';
```
<details>
<summary><strong>Show all</strong></summary><br>
Icons | CSS | Sass
:--- | :--- | :---
Outlined | outlined.css | outlined.scss
Rounded | rounded.css | rounded.scss
Sharp | sharp.css | sharp.scss
</details>
### Using Sass
Import in Sass (example: `src/styles.scss` in Angular CLI):
```scss
@import 'material-symbols';
```
If you are getting errors with webpack or Vue CLI, add this line before importing:
```scss
$material-symbols-font-path: '~material-symbols/';
```
### Using Angular `mat-icon`
To display an icon, use one of the following:
```html
<mat-icon fontSet="material-symbols-outlined">face</mat-icon>
<mat-icon fontSet="material-symbols-rounded">face</mat-icon>
<mat-icon fontSet="material-symbols-sharp">face</mat-icon>
```
## Available Icons
See [demo].
## License
Material Symbols are created by [Google](https://github.com/google/material-design-icons#license).
> We have made these icons available for you to incorporate into your products under the [Apache License Version 2.0][license]. Feel free to remix and re-share these icons and documentation in your products.
We'd love attribution in your app's *about* screen, but it's not required.
[releases]: https://github.com/marella/material-symbols/releases
[license]: https://github.com/marella/material-symbols/blob/main/material-symbols/LICENSE
[demo]: https://marella.github.io/material-symbols/demo/

View File

@@ -0,0 +1,47 @@
$material-symbols-font-path: './' !default;
// @see https://github.com/twbs/bootstrap/blob/main/scss/_functions.scss
@function material-symbols-str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace +
material-symbols-str-replace(
str-slice($string, $index + str-length($search)),
$search,
$replace
);
}
@return $string;
}
@mixin material-symbols-font($font-family) {
$class-name: to-lower-case($font-family);
$class-name: material-symbols-str-replace($class-name, ' ', '-');
$font-file: $material-symbols-font-path + $class-name;
@font-face {
font-family: $font-family;
font-style: normal;
font-weight: 100 700;
font-display: block;
src: url('#{$font-file}.woff2') format('woff2');
}
.#{$class-name} {
font-family: $font-family;
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-smoothing: antialiased; // Support for all WebKit browsers
-moz-osx-font-smoothing: grayscale; // Support for Firefox
text-rendering: optimizeLegibility; // Support for Safari and Chrome
font-feature-settings: 'liga'; // Support for IE
}
}

View File

@@ -0,0 +1,74 @@
@font-face {
font-family: "Material Symbols Outlined";
font-style: normal;
font-weight: 100 700;
font-display: block;
src: url("./material-symbols-outlined.woff2") format("woff2");
}
.material-symbols-outlined {
font-family: "Material Symbols Outlined";
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
font-feature-settings: "liga";
}
@font-face {
font-family: "Material Symbols Rounded";
font-style: normal;
font-weight: 100 700;
font-display: block;
src: url("./material-symbols-rounded.woff2") format("woff2");
}
.material-symbols-rounded {
font-family: "Material Symbols Rounded";
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
font-feature-settings: "liga";
}
@font-face {
font-family: "Material Symbols Sharp";
font-style: normal;
font-weight: 100 700;
font-display: block;
src: url("./material-symbols-sharp.woff2") format("woff2");
}
.material-symbols-sharp {
font-family: "Material Symbols Sharp";
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
font-feature-settings: "liga";
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
@import 'outlined';
@import 'rounded';
@import 'sharp';

View File

@@ -0,0 +1,24 @@
@font-face {
font-family: "Material Symbols Outlined";
font-style: normal;
font-weight: 100 700;
font-display: block;
src: url("./material-symbols-outlined.woff2") format("woff2");
}
.material-symbols-outlined {
font-family: "Material Symbols Outlined";
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
font-feature-settings: "liga";
}

View File

@@ -0,0 +1,3 @@
@import 'core';
@include material-symbols-font('Material Symbols Outlined');

View File

@@ -0,0 +1,41 @@
{
"name": "material-symbols",
"version": "0.17.4",
"description": "Latest variable icon fonts and CSS for Material Symbols.",
"main": "index.css",
"sass": "index.scss",
"types": "index.d.ts",
"files": [
"index.d.ts",
"*.{css,scss,woff2}"
],
"scripts": {
"build": "sass --no-source-map --no-error-css ."
},
"devDependencies": {
"sass": "1.56.1"
},
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/marella/material-symbols.git",
"directory": "material-symbols"
},
"bugs": {
"url": "https://github.com/marella/material-symbols/issues"
},
"homepage": "https://marella.github.io/material-symbols/demo/",
"keywords": [
"material-symbols",
"material-icons",
"material-design-icons",
"material-design",
"material",
"symbols",
"icons",
"font"
],
"publishConfig": {
"access": "public"
}
}

View File

@@ -0,0 +1,24 @@
@font-face {
font-family: "Material Symbols Rounded";
font-style: normal;
font-weight: 100 700;
font-display: block;
src: url("./material-symbols-rounded.woff2") format("woff2");
}
.material-symbols-rounded {
font-family: "Material Symbols Rounded";
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
font-feature-settings: "liga";
}

View File

@@ -0,0 +1,3 @@
@import 'core';
@include material-symbols-font('Material Symbols Rounded');

View File

@@ -0,0 +1,24 @@
@font-face {
font-family: "Material Symbols Sharp";
font-style: normal;
font-weight: 100 700;
font-display: block;
src: url("./material-symbols-sharp.woff2") format("woff2");
}
.material-symbols-sharp {
font-family: "Material Symbols Sharp";
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
font-feature-settings: "liga";
}

View File

@@ -0,0 +1,3 @@
@import 'core';
@include material-symbols-font('Material Symbols Sharp');

113
frontend/views/dashboard/dist/artNet.js vendored Normal file
View File

@@ -0,0 +1,113 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArtNet = void 0;
var morphux_1 = require("morphux");
var ArtNet = /** @class */ (function () {
function ArtNet(Main) {
this.universesContainer = document.querySelector('.ntsh_artnet-universes');
this.stateContainer = document.querySelector('.ntsh_artnet-state');
this._Main = Main;
this.prepareUniverses();
this.setupHandler();
}
ArtNet.prototype.prepareUniverses = function () {
return __awaiter(this, void 0, void 0, function () {
var request, universes;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, fetch('/universes')];
case 1:
request = _a.sent();
return [4 /*yield*/, request.json()];
case 2:
universes = _a.sent();
universes.forEach(function (universe) {
var button = new morphux_1.MorphComponent.Button({
mode: 'normal',
content: String(universe),
target: function () {
_this.universesContainer
.querySelectorAll('.mux_button')
.forEach(function (btn) { return btn.classList.remove('ntsh_active'); });
button.container.classList.add('ntsh_active');
_this.showFrame(universe);
},
});
_this.universesContainer.appendChild(button.container);
});
return [2 /*return*/];
}
});
});
};
ArtNet.prototype.showFrame = function (universe) {
this.frame = (0, morphux_1.ce)('iframe', null, { src: "/universe/".concat(universe) });
this.stateContainer.innerHTML = '';
this.stateContainer.appendChild(this.frame);
this.currentUniverse = universe;
this.setupRefreshClock();
};
ArtNet.prototype.setupRefreshClock = function () {
var _this = this;
clearInterval(this.refreshClock);
this.refreshClock = setInterval(function () {
_this.frame.src = "/universe/".concat(_this.currentUniverse);
}, 1000);
};
ArtNet.prototype.setupHandler = function () {
var _this = this;
this._Main.TabController.registerListener('artnet', function (visible) {
var _a;
if (visible) {
_this.universesContainer
.querySelectorAll('.mux_button')
.forEach(function (btn) { return btn.classList.remove('ntsh_active'); });
}
else {
if (((_a = _this.frame) === null || _a === void 0 ? void 0 : _a.parentElement) != null)
_this.frame.remove();
clearInterval(_this.refreshClock);
}
});
};
return ArtNet;
}());
exports.ArtNet = ArtNet;
//# sourceMappingURL=artNet.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"artNet.js","sourceRoot":"","sources":["../ts/artNet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA6C;AAG7C;IAWC,gBAAY,IAAU;QANtB,uBAAkB,GAAmB,QAAQ,CAAC,aAAa,CAC1D,wBAAwB,CACxB,CAAC;QACF,mBAAc,GACb,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;QAG7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;IACrB,CAAC;IAEa,iCAAgB,GAA9B;;;;;;4BACe,qBAAM,KAAK,CAAC,YAAY,CAAC,EAAA;;wBAAnC,OAAO,GAAG,SAAyB;wBACb,qBAAM,OAAO,CAAC,IAAI,EAAE,EAAA;;wBAA1C,SAAS,GAAa,SAAoB;wBAE9C,SAAS,CAAC,OAAO,CAAC,UAAC,QAAQ;4BAC1B,IAAI,MAAM,GAAG,IAAI,wBAAc,CAAC,MAAM,CAAC;gCACtC,IAAI,EAAE,QAAQ;gCACd,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC;gCACzB,MAAM,EAAE;oCACP,KAAI,CAAC,kBAAkB;yCACrB,gBAAgB,CAAC,aAAa,CAAC;yCAC/B,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,EAAnC,CAAmC,CAAC,CAAC;oCACxD,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;oCAE9C,KAAI,CAAC,SAAS,CAAC,QAAQ,C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KAAK,CAAC,MAAM,EAAE,CAAC;gBAC3D,aAAa,CAAC,KAAI,CAAC,YAAY,CAAC,CAAC;YAClC,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,aAAC;AAAD,CAAC,AAvED,IAuEC;AAvEY,wBAAM"}

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Calibration = void 0;
var Calibration = /** @class */ (function () {
function Calibration(Main) {
this.container = document.querySelector('.ntsh_calibration');
this.image = this.container.querySelector('img');
this.fullscreenButton = this.container.querySelector('.ntsh_calibration-fullscreen');
this._Main = Main;
this.registerListeners();
}
Calibration.prototype.startFetchClock = function () {
var _this = this;
this.image.src = "/calibrationImage?t=".concat(Date.now());
this.fetchClock = setInterval(function () {
_this.image.src = "/calibrationImage?t=".concat(Date.now());
}, 1000);
};
Calibration.prototype.stopFetchClock = function () {
clearInterval(this.fetchClock);
};
Calibration.prototype.registerListeners = function () {
var _this = this;
this._Main.TabController.registerListener('calibration', function (visible) {
if (visible)
_this.startFetchClock();
else
_this.stopFetchClock();
});
this.fullscreenButton.addEventListener('click', function () {
_this.image.requestFullscreen();
});
};
return Calibration;
}());
exports.Calibration = Calibration;
//# sourceMappingURL=calibration.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"calibration.js","sourceRoot":"","sources":["../ts/calibration.ts"],"names":[],"mappings":";;;AAEA;IASC,qBAAY,IAAU;QANtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;QACxE,UAAK,GAAqB,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9D,qBAAgB,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC9D,8BAA8B,CAC9B,CAAC;QAGD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC1B,CAAC;IAGD,qCAAe,GAAf;QAAA,iBAKC;QAJA,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,8BAAuB,IAAI,CAAC,GAAG,EAAE,CAAE,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC;YAC7B,KAAI,CAAC,KAAK,CAAC,GAAG,GAAG,8BAAuB,IAAI,CAAC,GAAG,EAAE,CAAE,CAAC;QACtD,CAAC,EAAE,IAAI,CAAC,CAAC;IACV,CAAC;IAED,oCAAc,GAAd;QACC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;IAEO,uCAAiB,GAAzB;QAAA,iBASC;QARA,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,aAAa,EAAE,UAAC,OAAO;YAChE,IAAI,OAAO;gBAAE,KAAI,CAAC,eAAe,EAAE,CAAC;;gBAC/B,KAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,OAAO,EAAE;YAC/C,KAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,kBAAC;AAAD,CAAC,AArCD,IAqCC;AArCY,kCAAW"}

View File

@@ -0,0 +1,161 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardCameraRunner = void 0;
var morphux_1 = require("morphux");
var utils_1 = require("./utils");
var CELCIUS = 'ºC';
var DashboardCameraRunner = /** @class */ (function () {
function DashboardCameraRunner(Main) {
this.container = document.querySelector('.ntsh_dashboard-camerarunner');
this.connectionStatus = this.container.querySelector('.ntsh_dashboard-camerarunner-connectionstatus');
this.connectionInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-connectioninfo');
this.rebootButton = this.container.querySelector('.ntsh_dashboard-camerarunner-reboot');
this.processStatus = this.container.querySelector('.ntsh_dashboard-camerarunner-processstatus');
this.processInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-processinfo');
this.restartButton = this.container.querySelector('.ntsh_dashboard-camerarunner-restart');
this.uptimeInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-uptime');
this.errorContainer = this.container.querySelector('.ntsh_dashboard-camerarunner-error');
this.errorText = this.container.querySelector('.ntsh_dashboard-camerarunner-errortext');
this._Main = Main;
this.registerListeners();
}
DashboardCameraRunner.prototype.updateState = function (state) {
var _a, _b, _c;
// ----------- Connection -----------
(0, utils_1.setStatusState)(this.connectionStatus, {
CONNECTING: 'yellow',
CONNECTED: 'green',
DISCONNECTED: 'gray',
FAILED: 'red',
}[state.state]);
this.connectionInfo.innerText = (_a = state.message) !== null && _a !== void 0 ? _a : '';
// ----------- Process -----------
if (state.state != 'CONNECTED') {
state.processStatus.state = 'PROBLEM';
state.processStatus.message = 'Not connected to CameraRunner';
state.processStatus.startTime = -1;
this.restartButton.style.display = 'none';
this.rebootButton.style.display = 'none';
}
else {
this.rebootButton.style.display = 'flex';
if (state.processStatus.state == 'RUNNING')
this.restartButton.style.display = 'flex';
else
this.restartButton.style.display = 'none';
}
(0, utils_1.setStatusState)(this.processStatus, {
RUNNING: 'green',
STOPPED: 'gray',
STARTING: 'yellow',
PROBLEM: 'red',
}[state.processStatus.state]);
this.processInfo.innerText = (_b = state.processStatus.message) !== null && _b !== void 0 ? _b : '';
// ----------- Uptime -----------
var uptimeSeconds = state.processStatus.startTime == -1
? -1
: (Date.now() - state.processStatus.startTime) / 1000;
this.uptimeInfo.innerText = (0, utils_1.formatUptime)(uptimeSeconds);
// ----------- Error -----------
if (((_c = state === null || state === void 0 ? void 0 : state.error) !== null && _c !== void 0 ? _c : '').trim().length > 0) {
this.errorText.innerText = state.error;
this.errorContainer.style.display = 'block';
}
else {
this.errorContainer.style.display = 'none';
this.errorText.innerText = '';
}
this._Main.Logs.setCameraLogs(state.processStatus.output.current);
};
DashboardCameraRunner.prototype.registerListeners = function () {
var _this = this;
this._Main.socket.on('cameraRunnerState', function (state) {
_this.updateState(state);
});
this.restartButton.addEventListener('click', function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.executeCommand('restart', 'Are you sure you want to restart the Camera Runner process?');
return [2 /*return*/];
});
}); });
this.rebootButton.addEventListener('click', function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.executeCommand('reboot', 'Are you sure you want to reboot the Camera Runner machine?');
return [2 /*return*/];
});
}); });
};
DashboardCameraRunner.prototype.executeCommand = function (command, message) {
return __awaiter(this, void 0, void 0, function () {
var confirmed;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, morphux_1.MorphFeature.Confirm({
title: 'Are you sure?',
message: message,
})];
case 1:
confirmed = _a.sent();
if (!confirmed)
return [2 /*return*/];
morphux_1.MorphFeature.Loader({
active: true,
message: "Requesting Camera Runner ".concat(command, "..."),
});
this._Main.socket.emit('cameraRunner', command, function (response) {
morphux_1.MorphFeature.Loader({ active: false });
if (!response.succeed)
return morphux_1.MorphFeature.Alert({
title: 'Error',
message: response.message,
});
morphux_1.MorphFeature.Notification({
level: 'success',
message: "Camera Runner is ".concat(command, "ing..."),
});
});
return [2 /*return*/];
}
});
});
};
return DashboardCameraRunner;
}());
exports.DashboardCameraRunner = DashboardCameraRunner;
//# sourceMappingURL=dashboard.camerarunner%20copy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dashboard.camerarunner copy.js","sourceRoot":"","sources":["../ts/dashboard.camerarunner copy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAuC;AAEvC,iCAKiB;AAEjB,IAAM,OAAO,GAAG,IAAI,CAAC;AAErB;IAsCC,+BAAY,IAAU;QAnCtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CACjD,4BAA4B,CAC5B,CAAC;QAEF,qBAAgB,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC9D,6CAA6C,CAC7C,CAAC;QACF,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;wBACH,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CACrB,cAAc,EACd,OAAO,EACP,UAAC,QAAgD;4BAChD,sBAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;4BAEvC,IAAI,CAAC,QAAQ,CAAC,OAAO;gCACpB,OAAO,sBAAY,CAAC,KAAK,CAAC;oCACzB,KAAK,EAAE,OAAO;oCACd,OAAO,EAAE,QAAQ,CAAC,OAAO;iCACzB,CAAC,CAAC;4BAEJ,sBAAY,CAAC,YAAY,CAAC;gCACzB,KAAK,EAAE,SAAS;gCAChB,OAAO,EAAE,2BAAoB,OAAO,WAAQ;6BAC5C,CAAC,CAAC;wBACJ,CAAC,CACD,CAAC;;;;;KACF;IACF,4BAAC;AAAD,CAAC,AA5JD,IA4JC;AA5JY,sDAAqB"}

View File

@@ -0,0 +1,166 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardCameraRunner = void 0;
var morphux_1 = require("morphux");
var utils_1 = require("./utils");
var CELCIUS = 'ºC';
var DashboardCameraRunner = /** @class */ (function () {
function DashboardCameraRunner(Main) {
this.container = document.querySelector('.ntsh_dashboard-camerarunner');
this.connectionStatus = this.container.querySelector('.ntsh_dashboard-camerarunner-connectionstatus');
this.connectionInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-connectioninfo');
this.rebootButton = this.container.querySelector('.ntsh_dashboard-camerarunner-reboot');
this.processStatus = this.container.querySelector('.ntsh_dashboard-camerarunner-processstatus');
this.processInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-processinfo');
this.restartButton = this.container.querySelector('.ntsh_dashboard-camerarunner-restart');
this.uptimeInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-uptime');
this.errorContainer = this.container.querySelector('.ntsh_dashboard-camerarunner-error');
this.errorText = this.container.querySelector('.ntsh_dashboard-camerarunner-errortext');
this._Main = Main;
this.registerListeners();
}
DashboardCameraRunner.prototype.updateState = function (state) {
var _a, _b, _c, _d, _e;
// ----------- Connection -----------
(0, utils_1.setStatusState)(this.connectionStatus, {
CONNECTING: 'yellow',
CONNECTED: 'green',
DISCONNECTED: 'red',
FAILED: 'red',
}[state.state]);
this.connectionInfo.innerText = (_a = state.message) !== null && _a !== void 0 ? _a : '';
// ----------- Process -----------
if (state.state != 'CONNECTED') {
state.processStatus.state = 'STOPPED';
state.processStatus.message = 'Not connected';
state.processStatus.startTime = -1;
this.restartButton.style.display = 'none';
this.rebootButton.style.display = 'none';
}
else {
this.rebootButton.style.display = 'flex';
if (state.processStatus.state == 'RUNNING')
this.restartButton.style.display = 'flex';
else
this.restartButton.style.display = 'none';
}
(0, utils_1.setStatusState)(this.processStatus, {
RUNNING: 'green',
STOPPED: 'gray',
STARTING: 'yellow',
PROBLEM: 'red',
}[state.processStatus.state]);
this.processInfo.innerText = (_b = state.processStatus.message) !== null && _b !== void 0 ? _b : '';
// ----------- Uptime -----------
var uptimeSeconds = state.processStatus.startTime == -1
? -1
: (Date.now() - state.processStatus.startTime) / 1000;
this.uptimeInfo.innerText = (0, utils_1.formatUptime)(uptimeSeconds);
// ----------- Error -----------
var errors = [];
if (((_c = state === null || state === void 0 ? void 0 : state.error) !== null && _c !== void 0 ? _c : '').trim().length > 0)
errors.push(state.error);
if (((_e = (_d = state === null || state === void 0 ? void 0 : state.processStatus) === null || _d === void 0 ? void 0 : _d.error) !== null && _e !== void 0 ? _e : '').trim().length > 0)
errors.push(state.processStatus.error);
if (errors.length > 0) {
this.errorText.innerText = errors.join('\n');
this.errorContainer.style.display = 'block';
}
else {
this.errorContainer.style.display = 'none';
this.errorText.innerText = '';
}
this._Main.Logs.setCameraLogs(state.processStatus.output.current);
};
DashboardCameraRunner.prototype.registerListeners = function () {
var _this = this;
this._Main.socket.on('cameraRunnerState', function (state) {
_this.updateState(state);
});
this.restartButton.addEventListener('click', function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.executeCommand('restart', 'Are you sure you want to restart the Camera Runner process?');
return [2 /*return*/];
});
}); });
this.rebootButton.addEventListener('click', function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.executeCommand('reboot', 'Are you sure you want to reboot the Camera Runner machine?');
return [2 /*return*/];
});
}); });
};
DashboardCameraRunner.prototype.executeCommand = function (command, message) {
return __awaiter(this, void 0, void 0, function () {
var confirmed;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, morphux_1.MorphFeature.Confirm({
title: 'Are you sure?',
message: message,
})];
case 1:
confirmed = _a.sent();
if (!confirmed)
return [2 /*return*/];
morphux_1.MorphFeature.Loader({
active: true,
message: "Requesting Camera Runner ".concat(command, "..."),
});
this._Main.socket.emit('cameraRunner', command, function (response) {
morphux_1.MorphFeature.Loader({ active: false });
if (!response.succeed)
return morphux_1.MorphFeature.Alert({
title: 'Error',
message: response.message,
});
morphux_1.MorphFeature.Notification({
level: 'success',
message: "Camera Runner is ".concat(command, "ing..."),
});
});
return [2 /*return*/];
}
});
});
};
return DashboardCameraRunner;
}());
exports.DashboardCameraRunner = DashboardCameraRunner;
//# sourceMappingURL=dashboard.camerarunner.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dashboard.camerarunner.js","sourceRoot":"","sources":["../ts/dashboard.camerarunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAuC;AAEvC,iCAKiB;AAEjB,IAAM,OAAO,GAAG,IAAI,CAAC;AAErB;IAsCC,+BAAY,IAAU;QAnCtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CACjD,8BAA8B,CAC9B,CAAC;QAEF,qBAAgB,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC9D,+CAA+C,CAC/C,CAAC;QACF,mBAAc,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC5D,6CAA6C,CAC7C,CAAC;QACF,iBAAY,GAAmB,IAA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,qBAAM,sBAAY,CAAC,OAAO,CAAC;4BAC5C,KAAK,EAAE,eAAe;4BACtB,OAAO,SAAA;yBACP,CAAC,EAAA;;wBAHI,SAAS,GAAG,SAGhB;wBACF,IAAI,CAAC,SAAS;4BAAE,sBAAO;wBAEvB,sBAAY,CAAC,MAAM,CAAC;4BACnB,MAAM,EAAE,IAAI;4BACZ,OAAO,EAAE,mCAA4B,OAAO,QAAK;yBACjD,CAAC,CAAC;wBACH,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CACrB,cAAc,EACd,OAAO,EACP,UAAC,QAAgD;4BAChD,sBAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;4BAEvC,IAAI,CAAC,QAAQ,CAAC,OAAO;gCACpB,OAAO,sBAAY,CAAC,KAAK,CAAC;oCACzB,KAAK,EAAE,OAAO;oCACd,OAAO,EAAE,QAAQ,CAAC,OAAO;iCACzB,CAAC,CAAC;4BAEJ,sBAAY,CAAC,YAAY,CAAC;gCACzB,KAAK,EAAE,SAAS;gCAChB,OAAO,EAAE,2BAAoB,OAAO,WAAQ;6BAC5C,CAAC,CAAC;wBACJ,CAAC,CACD,CAAC;;;;;KACF;IACF,4BAAC;AAAD,CAAC,AAhKD,IAgKC;AAhKY,sDAAqB"}

View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardCameraRunner = void 0;
var CELCIUS = 'ºC';
var DashboardCameraRunner = /** @class */ (function () {
function DashboardCameraRunner(Main) {
this.container = document.querySelector('.ntsh_dashboard-camerarunner');
this.connectionStatus = this.container.querySelector('.ntsh_dashboard-camerarunner-connectedstatus');
this.connectionInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-connectedinfo');
this.processStatus = this.container.querySelector('.ntsh_dashboard-camerarunner-processstatus');
this.processInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-processinfo');
this.restartButton = this.container.querySelector('.ntsh_dashboard-camerarunner-restart');
this.uptimeInfo = this.container.querySelector('.ntsh_dashboard-camerarunner-uptimeinfo');
this.errorContainer = this.container.querySelector('.ntsh_dashboard-camerarunner-error');
this.errorText = this.container.querySelector('.ntsh_dashboard-camerarunner-errortext');
this._Main = Main;
this.registerListeners();
}
DashboardCameraRunner.prototype.updateState = function (state) {
var _a;
console.log(state);
// ----------- Error -----------
if (((_a = state === null || state === void 0 ? void 0 : state.error) !== null && _a !== void 0 ? _a : '').trim().length > 0) {
this.errorText.innerText = state.error;
this.errorContainer.style.display = 'block';
}
else {
this.errorContainer.style.display = 'none';
this.errorText.innerText = '';
}
};
DashboardCameraRunner.prototype.registerListeners = function () {
var _this = this;
this._Main.socket.on('ledControllerState', function (state) {
_this.updateState(state);
});
};
return DashboardCameraRunner;
}());
exports.DashboardCameraRunner = DashboardCameraRunner;
//# sourceMappingURL=dashboard.ledcontroller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dashboard.ledcontroller.js","sourceRoot":"","sources":["../ts/dashboard.ledcontroller.ts"],"names":[],"mappings":";;;AAIA,IAAM,OAAO,GAAG,IAAI,CAAC;AAErB;IAmCC,+BAAY,IAAU;QAhCtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CACjD,8BAA8B,CAC9B,CAAC;QAEF,qBAAgB,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC9D,8CAA8C,CAC9C,CAAC;QACF,mBAAc,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC5D,4CAA4C,CAC5C,CAAC;QAEF,kBAAa,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC3D,4CAA4C,CAC5C,CAAC;QACF,gBAAW,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CACzD,0CAA0C,CAC1C,CAAC;QACF,kBAAa,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC3D,sCAAsC,CACtC,CAAC;QAEF,eAAU,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CACxD,yCAAyC,CACzC,CAAC;QAEF,mBAAc,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC5D,oCAAoC,CACpC,CAAC;QACF,cAAS,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CACvD,wCAAwC,CACxC,CAAC;QAGD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC1B,CAAC;IAED,2CAAW,GAAX,UAAY,KAAyB;;QACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,gCAAgC;QAChC,IAAI,CAAC,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC;YACvC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QAC7C,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;YAC3C,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;QAC/B,CAAC;IACF,CAAC;IAED,iDAAiB,GAAjB;QAAA,iBAOC;QANA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CACnB,oBAAoB,EACpB,UAAC,KAAyB;YACzB,KAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,CACD,CAAC;IACH,CAAC;IACF,4BAAC;AAAD,CAAC,AA7DD,IA6DC;AA7DY,sDAAqB"}

View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardMMWave = void 0;
var utils_1 = require("./utils");
var CELCIUS = 'ºC';
var DashboardMMWave = /** @class */ (function () {
function DashboardMMWave(Main) {
this.container = document.querySelector('.ntsh_dashboard-mmwave');
this.standardPortStatus = this.container.querySelector('.ntsh_dashboard-mmwave-standardstatus');
this.standardPortInfo = this.container.querySelector('.ntsh_dashboard-mmwave-standardinfo');
this.enhancedPortStatus = this.container.querySelector('.ntsh_dashboard-mmwave-enhancedstatus');
this.enhancedPortInfo = this.container.querySelector('.ntsh_dashboard-mmwave-enhancedinfo');
this.framesPerSecond = this.container.querySelector('.ntsh_dashboard-mmwave-framespersecond');
this.trackedPersons = this.container.querySelector('.ntsh_dashboard-mmwave-trackedpersons');
this.personsInBounds = this.container.querySelector('.ntsh_dashboard-mmwave-personsinbounds');
this._Main = Main;
this.registerListeners();
}
DashboardMMWave.prototype.updateState = function (state) {
if (state == null)
return;
// ----------- Standard Port -----------
(0, utils_1.setStatusState)(this.standardPortStatus, state.ports.standard.connected == 'connecting'
? 'warning'
: state.ports.standard.connected
? 'ok'
: 'error');
this.standardPortInfo.innerText = state.ports.standard.path;
// ----------- Enhanced Port -----------
(0, utils_1.setStatusState)(this.enhancedPortStatus, state.ports.enhanced.connected == 'connecting'
? 'warning'
: state.ports.enhanced.connected
? 'ok'
: 'error');
this.enhancedPortInfo.innerText = state.ports.enhanced.path;
// ----------- Statistics -----------
this.framesPerSecond.innerText = state.framesPerSecond.toString();
this.trackedPersons.innerText = state.trackedPersons.toString();
this.personsInBounds.innerText = state.personsInBounds.toString();
};
DashboardMMWave.prototype.registerListeners = function () {
var _this = this;
this._Main.socket.on('mmWaveState', function (state) {
_this.updateState(state);
});
};
return DashboardMMWave;
}());
exports.DashboardMMWave = DashboardMMWave;
//# sourceMappingURL=dashboard.mmwave%20copy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dashboard.mmwave copy.js","sourceRoot":"","sources":["../ts/dashboard.mmwave copy.ts"],"names":[],"mappings":";;;AAEA,iCAAyC;AAEzC,IAAM,OAAO,GAAG,IAAI,CAAC;AAErB;IA+BC,yBAAY,IAAU;QA5BtB,cAAS,GAAmB,QAAQ,CAAC,aAA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AAC,CAAC,SAAS;YACX,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS;gBAChC,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,OAAO,CACV,CAAC;QACF,IAAI,CAAC,gBAAgB,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QAE5D,qCAAqC;QACrC,IAAI,CAAC,eAAe,CAAC,SAAS,GAAG,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;QAClE,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAChE,IAAI,CAAC,eAAe,CAAC,SAAS,GAAG,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;IACnE,CAAC;IAED,2CAAiB,GAAjB;QAAA,iBAIC;QAHA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,UAAC,KAAkB;YACtD,KAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,sBAAC;AAAD,CAAC,AAzED,IAyEC;AAzEY,0CAAe"}

View File

@@ -0,0 +1,60 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardMMWave = void 0;
var utils_1 = require("./utils");
var CELCIUS = 'ºC';
var DashboardMMWave = /** @class */ (function () {
function DashboardMMWave(Main) {
this.container = document.querySelector('.ntsh_dashboard-mmwave');
this.standardPortStatus = this.container.querySelector('.ntsh_dashboard-mmwave-standardstatus');
this.standardPortInfo = this.container.querySelector('.ntsh_dashboard-mmwave-standardinfo');
this.enhancedPortStatus = this.container.querySelector('.ntsh_dashboard-mmwave-enhancedstatus');
this.enhancedPortInfo = this.container.querySelector('.ntsh_dashboard-mmwave-enhancedinfo');
this.framesPerSecond = this.container.querySelector('.ntsh_dashboard-mmwave-framespersecond');
this.trackedPersons = this.container.querySelector('.ntsh_dashboard-mmwave-trackedpersons');
this.personsInBounds = this.container.querySelector('.ntsh_dashboard-mmwave-personsinbounds');
this.errorContainer = this.container.querySelector('.ntsh_dashboard-mmwave-error');
this.errorText = this.container.querySelector('.ntsh_dashboard-mmwave-errortext');
this._Main = Main;
this.registerListeners();
}
DashboardMMWave.prototype.updateState = function (state) {
var _a;
if (state == null)
return;
var statusColors = {
CONNECTED: 'green',
DISCONNECTED: 'gray',
CONNECTING: 'yellow',
PROBLEM: 'red',
};
// ----------- Standard Port -----------
(0, utils_1.setStatusState)(this.standardPortStatus, statusColors[state.ports.standard.connected]);
this.standardPortInfo.innerText = state.ports.standard.info;
// ----------- Enhanced Port -----------
(0, utils_1.setStatusState)(this.enhancedPortStatus, statusColors[state.ports.enhanced.connected]);
this.enhancedPortInfo.innerText = state.ports.enhanced.info;
// ----------- Statistics -----------
this.framesPerSecond.innerText = state.framesPerSecond.toString();
this.trackedPersons.innerText = state.trackedPersons.toString();
this.personsInBounds.innerText = state.personsInBounds.toString();
// ----------- Error -----------
if (((_a = state === null || state === void 0 ? void 0 : state.error) !== null && _a !== void 0 ? _a : '').trim().length > 0) {
this.errorText.innerText = state.error;
this.errorContainer.style.display = 'block';
}
else {
this.errorContainer.style.display = 'none';
this.errorText.innerText = '';
}
};
DashboardMMWave.prototype.registerListeners = function () {
var _this = this;
this._Main.socket.on('mmWaveState', function (state) {
_this.updateState(state);
});
};
return DashboardMMWave;
}());
exports.DashboardMMWave = DashboardMMWave;
//# sourceMappingURL=dashboard.mmwave.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dashboard.mmwave.js","sourceRoot":"","sources":["../ts/dashboard.mmwave.ts"],"names":[],"mappings":";;;AAEA,iCAAqD;AAErD,IAAM,OAAO,GAAG,IAAI,CAAC;AAErB;IAsCC,yBAAY,IAAU;QAnCtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CACjD,wBAAwB,CACxB,CAAC;QAEF,uBAAkB,GAAmB,IAAI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this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardProjector = void 0;
var morphux_1 = require("morphux");
var utils_1 = require("./utils");
var CELCIUS = 'ºC';
var DashboardProjector = /** @class */ (function () {
function DashboardProjector(Main) {
this.container = document.querySelector('.ntsh_dashboard-projector');
this.powerStatus = this.container.querySelector('.ntsh_dashboard-projector-powerstatus');
this.powerInfo = this.container.querySelector('.ntsh_dashboard-projector-powerinfo');
this.powerOnButton = this.container.querySelector('.ntsh_dashboard-projector-poweron');
this.powerOffButton = this.container.querySelector('.ntsh_dashboard-projector-poweroff');
this.laserStatus = this.container.querySelector('.ntsh_dashboard-projector-laserstatus');
this.laserInfo = this.container.querySelector('.ntsh_dashboard-projector-laserinfo');
this.shutterOpenButton = this.container.querySelector('.ntsh_dashboard-projector-shutteropen');
this.shutterCloseButton = this.container.querySelector('.ntsh_dashboard-projector-shutterclose');
this.sourceStatus = this.container.querySelector('.ntsh_dashboard-projector-sourcestatus');
this.sourceInfo = this.container.querySelector('.ntsh_dashboard-projector-sourceinfo');
this.sourceHDMIButton = this.container.querySelector('.ntsh_dashboard-projector-sourcehdmi');
this.sourceDVIDButton = this.container.querySelector('.ntsh_dashboard-projector-sourcedvid');
this.sourceDisplayPortButton = this.container.querySelector('.ntsh_dashboard-projector-sourcedisplayport');
this.sourceSDIButton = this.container.querySelector('.ntsh_dashboard-projector-sourcesdi');
this.temperatureIntake = this.container.querySelector('.ntsh_dashboard-projector-temperature-temperatureintake');
this.temmperatureLaser = this.container.querySelector('.ntsh_dashboard-projector-temperature-temperaturelaser');
this.temperatureDMD = this.container.querySelector('.ntsh_dashboard-projector-temperature-temperaturedmd');
this.errorContainer = this.container.querySelector('.ntsh_dashboard-projector-error');
this.errorText = this.container.querySelector('.ntsh_dashboard-projector-errortext');
this._Main = Main;
this.registerListeners();
}
DashboardProjector.prototype.updateState = function (state) {
if (state == null)
return;
// ----------- Power -----------
(0, utils_1.setStatusState)(this.powerStatus, state.Powermd == 'Power On' ? 'ok' : 'error');
this.powerInfo.innerText = state.Powermd;
this.powerOnButton.style.display =
state.Powermd == 'Power On' ? 'none' : 'flex';
this.powerOffButton.style.display =
state.Powermd == 'Power On' ? 'flex' : 'none';
// ----------- Laser -----------
(0, utils_1.setStatusState)(this.laserStatus, state.LaserStatus == 'On' ? 'ok' : 'error');
this.laserInfo.innerText = "".concat(state.LaserStatus, " (").concat(state.Laserhr, " hrs)");
this.shutterOpenButton.style.display =
state.LaserStatus == 'On' ? 'none' : 'flex';
this.shutterCloseButton.style.display =
state.LaserStatus == 'On' ? 'flex' : 'none';
// ----------- Source -----------
(0, utils_1.setStatusState)(this.sourceStatus, state.Sourcemd == 'No Source' ? 'error' : 'ok');
this.sourceInfo.innerText = state.Sourcemd;
this.sourceHDMIButton.style.display =
state.Sourcemd == 'HDMI' ? 'none' : 'flex';
this.sourceDVIDButton.style.display =
state.Sourcemd == 'DVI-D' ? 'none' : 'flex';
this.sourceDisplayPortButton.style.display =
state.Sourcemd == 'DisplayPort' ? 'none' : 'flex';
this.sourceSDIButton.style.display =
state.Sourcemd == '3G-SDI' ? 'none' : 'flex';
// ----------- Temperature -----------
this.temperatureIntake.innerText = "".concat(state.IntakeTempDeg, " ").concat(CELCIUS);
this.temmperatureLaser.innerText = "".concat(state.LaserTempDeg, " ").concat(CELCIUS);
this.temperatureDMD.innerText = "".concat(state.DMDTempDeg, " ").concat(CELCIUS);
};
DashboardProjector.prototype.registerListeners = function () {
var _this = this;
this._Main.socket.on('projectorState', function (state) {
_this.updateState(state);
});
this.powerOnButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'powerOn');
};
this.powerOffButton.onclick = function () {
return __awaiter(_this, void 0, void 0, function () {
var confirmed;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, morphux_1.MorphFeature.Confirm({
message: 'Are you sure you want to power on the projector?',
})];
case 1:
confirmed = _a.sent();
if (!confirmed)
return [2 /*return*/];
this._Main.socket.emit('projectorCommand', 'powerOff');
return [2 /*return*/];
}
});
});
};
this.shutterOpenButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'shutterOpen');
};
this.shutterCloseButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'shutterClose');
};
this.sourceHDMIButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'source', 'HDMI');
};
this.sourceDVIDButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'source', 'DVI-D');
};
this.sourceDisplayPortButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'source', 'DisplayPort');
};
this.sourceSDIButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'source', '3G-SDI');
};
};
return DashboardProjector;
}());
exports.DashboardProjector = DashboardProjector;
//# sourceMappingURL=dashboard.projector%20copy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dashboard.projector copy.js","sourceRoot":"","sources":["../ts/dashboard.projector copy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAuC;AAEvC,iCAAyC;AAEzC,IAAM,OAAO,GAAG,IAAI,CAAC;AAErB;IAqEC,4BAAY,IAAU;QAlEtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CACjD,2BAA2B,CAC3B,CAAC;QAEF,gBAAW,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CACzD,uCAAuC,CACvC,CAAC;QACF,cAAS,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CACvD,qCAAqC,CACrC,CAAC;QACF,kBAAa,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC3D,mCAAmC,CACnC,CAAC;QACF,mBAAc,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC5D,oCAAoC,CACpC,CAAC;QAEF,gBAAW,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CACzD,uCAAuC,CACvC,CAAC;QACF,cAAS,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CACvD,qCAAqC,CACrC,CAAC;QACF,sBAAiB,GAAmB,IAA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C;AAlKY,gDAAkB"}

View File

@@ -0,0 +1,182 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardProjector = void 0;
var morphux_1 = require("morphux");
var utils_1 = require("./utils");
var CELCIUS = 'ºC';
var DashboardProjector = /** @class */ (function () {
function DashboardProjector(Main) {
this.container = document.querySelector('.ntsh_dashboard-projector');
this.powerStatus = this.container.querySelector('.ntsh_dashboard-projector-powerstatus');
this.powerInfo = this.container.querySelector('.ntsh_dashboard-projector-powerinfo');
this.powerOnButton = this.container.querySelector('.ntsh_dashboard-projector-poweron');
this.powerOffButton = this.container.querySelector('.ntsh_dashboard-projector-poweroff');
this.laserStatus = this.container.querySelector('.ntsh_dashboard-projector-laserstatus');
this.laserInfo = this.container.querySelector('.ntsh_dashboard-projector-laserinfo');
this.shutterOpenButton = this.container.querySelector('.ntsh_dashboard-projector-shutteropen');
this.shutterCloseButton = this.container.querySelector('.ntsh_dashboard-projector-shutterclose');
this.sourceStatus = this.container.querySelector('.ntsh_dashboard-projector-sourcestatus');
this.sourceInfo = this.container.querySelector('.ntsh_dashboard-projector-sourceinfo');
this.sourceHDMIButton = this.container.querySelector('.ntsh_dashboard-projector-sourcehdmi');
this.sourceDVIDButton = this.container.querySelector('.ntsh_dashboard-projector-sourcedvid');
this.sourceDisplayPortButton = this.container.querySelector('.ntsh_dashboard-projector-sourcedisplayport');
this.sourceSDIButton = this.container.querySelector('.ntsh_dashboard-projector-sourcesdi');
this.temperatureIntake = this.container.querySelector('.ntsh_dashboard-projector-temperature-temperatureintake');
this.temmperatureLaser = this.container.querySelector('.ntsh_dashboard-projector-temperature-temperaturelaser');
this.temperatureDMD = this.container.querySelector('.ntsh_dashboard-projector-temperature-temperaturedmd');
this.errorContainer = this.container.querySelector('.ntsh_dashboard-projector-error');
this.errorText = this.container.querySelector('.ntsh_dashboard-projector-errortext');
this._Main = Main;
this.registerListeners();
}
DashboardProjector.prototype.updateState = function (state) {
if (state == null)
return;
// ----------- Power -----------
(0, utils_1.setStatusState)(this.powerStatus, {
Disabled: 'red',
'Not Connected': 'red',
'Power On': 'green',
'Power Off': 'gray',
'Powering Up': 'yellow',
'Powering Down': 'yellow',
}[state.Powermd]);
this.powerInfo.innerText = state.Powermd;
this.powerOnButton.style.display =
state.Powermd == 'Power Off' ? 'flex' : 'none';
this.powerOffButton.style.display =
state.Powermd == 'Power On' ? 'flex' : 'none';
// ----------- Laser -----------
(0, utils_1.setStatusState)(this.laserStatus, state.LaserStatus == 'On' ? 'green' : 'gray');
this.laserInfo.innerText = "".concat(state.LaserStatus, " (").concat(state.Laserhr, " hrs)");
this.shutterOpenButton.style.display =
state.LaserStatus == 'On' || state.Powermd != 'Power On'
? 'none'
: 'flex';
this.shutterCloseButton.style.display =
state.LaserStatus == 'Off' || state.Powermd != 'Power On'
? 'none'
: 'flex';
// ----------- Source -----------
(0, utils_1.setStatusState)(this.sourceStatus, state.Sourcemd == 'No Source' ||
state.Sourcemd == '?' ||
state.Powermd != 'Power On'
? 'gray'
: 'green');
this.sourceInfo.innerText =
state.Powermd == 'Power On' ? state.Sourcemd : '';
this.sourceHDMIButton.style.display =
state.Sourcemd == 'HDMI' || state.Powermd != 'Power On'
? 'none'
: 'flex';
this.sourceDVIDButton.style.display =
state.Sourcemd == 'DVI-D' || state.Powermd != 'Power On'
? 'none'
: 'flex';
this.sourceDisplayPortButton.style.display =
state.Sourcemd == 'DisplayPort' || state.Powermd != 'Power On'
? 'none'
: 'flex';
this.sourceSDIButton.style.display =
state.Sourcemd == '3G-SDI' || state.Powermd != 'Power On'
? 'none'
: 'flex';
// ----------- Temperature -----------
this.temperatureIntake.innerText = "".concat(state.IntakeTempDeg, " ").concat(CELCIUS);
this.temmperatureLaser.innerText = "".concat(state.LaserTempDeg, " ").concat(CELCIUS);
this.temperatureDMD.innerText = "".concat(state.DMDTempDeg, " ").concat(CELCIUS);
// ----------- Error -----------
if (state.Err != '(No Error)') {
this.errorText.innerText = state.Err;
this.errorContainer.style.display = 'block';
}
else {
this.errorContainer.style.display = 'none';
this.errorText.innerText = '';
}
};
DashboardProjector.prototype.registerListeners = function () {
var _this = this;
this._Main.socket.on('projectorState', function (state) {
_this.updateState(state);
});
this.powerOnButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'powerOn');
};
this.powerOffButton.onclick = function () {
return __awaiter(_this, void 0, void 0, function () {
var confirmed;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, morphux_1.MorphFeature.Confirm({
message: 'Are you sure you want to power on the projector?',
})];
case 1:
confirmed = _a.sent();
if (!confirmed)
return [2 /*return*/];
this._Main.socket.emit('projectorCommand', 'powerOff');
return [2 /*return*/];
}
});
});
};
this.shutterOpenButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'shutterOpen');
};
this.shutterCloseButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'shutterClose');
};
this.sourceHDMIButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'source', 'HDMI');
};
this.sourceDVIDButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'source', 'DVI-D');
};
this.sourceDisplayPortButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'source', 'DisplayPort');
};
this.sourceSDIButton.onclick = function () {
_this._Main.socket.emit('projectorCommand', 'source', '3G-SDI');
};
};
return DashboardProjector;
}());
exports.DashboardProjector = DashboardProjector;
//# sourceMappingURL=dashboard.projector.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardShowControl = void 0;
var utils_1 = require("./utils");
var CELCIUS = 'ºC';
var DashboardShowControl = /** @class */ (function () {
function DashboardShowControl(Main) {
this.container = document.querySelector('.ntsh_dashboard-showcontrol');
this.runningStatus = this.container.querySelector('.ntsh_dashboard-showcontrol-runningstatus');
this.runningInfo = this.container.querySelector('.ntsh_dashboard-showcontrol-runninginfo');
this.errorContainer = this.container.querySelector('.ntsh_dashboard-showcontrol-error');
this.errorText = this.container.querySelector('.ntsh_dashboard-showcontrol-errortext');
this.startButton = this.container.querySelector('.ntsh_dashboard-showcontrol-start');
this.stopButton = this.container.querySelector('.ntsh_dashboard-showcontrol-stop');
this._Main = Main;
this.registerListeners();
}
DashboardShowControl.prototype.updateState = function (state) {
var _a;
// ----------- Running -----------
var runningStatus = {
STOPPED: 'gray',
STARTING: 'yellow',
RUNNING: 'green',
STOPPING: 'yellow',
RETRYING: 'red',
HALTED: 'red',
}[state.status];
(0, utils_1.setStatusState)(this.runningStatus, runningStatus);
this.runningInfo.innerText = {
STOPPED: 'Idle',
STARTING: state.info,
RUNNING: 'Running',
STOPPING: 'Stopping...',
RETRYING: 'Problem detected! Retrying...',
HALTED: 'Halted due to problems!',
}[state.status];
// ----------- Buttons -----------
this.startButton.style.display =
state.status == 'STOPPED' ||
state.status == 'HALTED' ||
state.status == 'RETRYING'
? 'flex'
: 'none';
this.stopButton.style.display =
state.status == 'RUNNING' || state.status == 'RETRYING'
? 'flex'
: 'none';
// ----------- Error -----------
if (((_a = state === null || state === void 0 ? void 0 : state.error) !== null && _a !== void 0 ? _a : '').trim().length > 0) {
this.errorText.innerText = state.error;
this.errorContainer.style.display = 'block';
}
else {
this.errorContainer.style.display = 'none';
this.errorText.innerText = '';
}
};
DashboardShowControl.prototype.registerListeners = function () {
var _this = this;
this._Main.socket.on('showControlState', function (state) {
_this.updateState(state);
});
this.startButton.onclick = function () {
fetch('/api/v1/start');
};
this.stopButton.onclick = function () {
fetch('/api/v1/stop');
};
};
return DashboardShowControl;
}());
exports.DashboardShowControl = DashboardShowControl;
//# sourceMappingURL=dashboard.showcontrol.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dashboard.showcontrol.js","sourceRoot":"","sources":["../ts/dashboard.showcontrol.ts"],"names":[],"mappings":";;;AAEA,iCAAyC;AAEzC,IAAM,OAAO,GAAG,IAAI,CAAC;AAErB;IA4BC,8BAAY,IAAU;QAzBtB,c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D,CAAC,AAxFD,IAwFC;AAxFY,oDAAoB"}

View File

@@ -0,0 +1,176 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Testing = void 0;
var morphux_1 = require("morphux");
var Testing = /** @class */ (function () {
function Testing(Main) {
this.container = document.querySelector('.ntsh_testing');
this.weatherResetButton = this.container.querySelector('.ntsh_testing-weather-reset');
this.weather0Button = this.container.querySelector('.ntsh_testing-weather-0');
this.weather5Button = this.container.querySelector('.ntsh_testing-weather-5');
this.weather10Button = this.container.querySelector('.ntsh_testing-weather-10');
this.weather20Button = this.container.querySelector('.ntsh_testing-weather-20');
this.weather50Button = this.container.querySelector('.ntsh_testing-weather-50');
this.resetAllTracksButton = this.container.querySelector('.ntsh_testing-tracks-reset');
this.cloudAnimationsSimoultaneousContainer = this.container.querySelector('.ntsh_testing-cloud-animations-simoultaneous');
this.cloudAnimationsStandaloneContainer = this.container.querySelector('.ntsh_testing-cloud-animations-standalone');
this._Main = Main;
this.registerListeners();
}
Testing.prototype.registerListeners = function () {
var _this = this;
this.weatherResetButton.onclick = function () { return _this.setWeather('reset'); };
this.weather0Button.onclick = function () { return _this.setWeather(0); };
this.weather5Button.onclick = function () { return _this.setWeather(5); };
this.weather10Button.onclick = function () { return _this.setWeather(10); };
this.weather20Button.onclick = function () { return _this.setWeather(20); };
this.weather50Button.onclick = function () { return _this.setWeather(50); };
[
'Rain',
'Blink',
'Breath',
'Fill',
'Rainbow',
'Wave',
'Pulse',
'Ambient',
'Flow',
'Thunder',
'Swipe Left',
'Swipe Right',
'Swipe Down',
'Swipe Up',
'Sphere Pulse',
].forEach(function (effect) {
var simoultaneous = (0, morphux_1.ce)('div', ['mux_button', 'mux_normal', 'mux_text'], null, effect);
var standalone = simoultaneous.cloneNode(true);
_this.cloudAnimationsSimoultaneousContainer.appendChild(simoultaneous);
_this.cloudAnimationsStandaloneContainer.appendChild(standalone);
simoultaneous.onclick = function () {
return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.fetch("/dev/animation/cloud/simoultaneous/".concat(effect
.replace(/ /g, '')
.toLowerCase()))];
case 1:
_a.sent();
morphux_1.MorphFeature.Notification({
level: 'success',
message: "Cloud animation set to ".concat(effect, " (simoultaneous)!"),
});
return [2 /*return*/];
}
});
});
};
standalone.onclick = function () {
return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.fetch("/dev/animation/cloud/standalone/".concat(effect
.replace(/ /g, '')
.toLowerCase()))];
case 1:
_a.sent();
morphux_1.MorphFeature.Notification({
level: 'success',
message: "Cloud animation set to ".concat(effect, " (standalone)!"),
});
return [2 /*return*/];
}
});
});
};
});
this.resetAllTracksButton.onclick = function () {
return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.fetch('/dev/resetTracks')];
case 1:
_a.sent();
morphux_1.MorphFeature.Notification({
level: 'success',
message: "All tracks have been reset!",
});
return [2 /*return*/];
}
});
});
};
};
Testing.prototype.setWeather = function (rainAmount) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.fetch("/dev/weather/".concat(rainAmount))];
case 1:
_a.sent();
morphux_1.MorphFeature.Notification({
level: 'success',
message: rainAmount == 'reset'
? 'Returned to actual weather!'
: "Weather set to ".concat(rainAmount, "!"),
});
return [2 /*return*/];
}
});
});
};
Testing.prototype.fetch = function (address) {
return __awaiter(this, void 0, void 0, function () {
var request;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
morphux_1.MorphFeature.Loader({ active: true });
return [4 /*yield*/, fetch(address)];
case 1:
request = _a.sent();
morphux_1.MorphFeature.Loader({ active: false });
return [2 /*return*/];
}
});
});
};
return Testing;
}());
exports.Testing = Testing;
//# sourceMappingURL=dashboard.testing.js.map

View File

@@ -0,0 +1 @@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C,sBAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;;;;;KACvC;IACF,cAAC;AAAD,CAAC,AAnID,IAmIC;AAnIY,0BAAO"}

View File

@@ -0,0 +1,243 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardUnity = void 0;
var morphux_1 = require("morphux");
var utils_1 = require("./utils");
var DashboardUnity = /** @class */ (function () {
function DashboardUnity(Main) {
this.container = document.querySelector('.ntsh_dashboard-unity');
this.processStatus = document.querySelector('.ntsh_dashboard-unity-processstatus');
this.processInfo = document.querySelector('.ntsh_dashboard-unity-processinfo');
this.restartButton = document.querySelector('.ntsh_dashboard-unity-restart');
this.uptimeInfo = document.querySelector('.ntsh_dashboard-unity-uptime');
this.webSocketStatus = document.querySelector('.ntsh_dashboard-unity-websocketstatus');
this.webSocketInfo = document.querySelector('.ntsh_dashboard-unity-websocketinfo');
this.zedStreamStatus = document.querySelector('.ntsh_dashboard-unity-zedstreamstatus');
this.zedStreamInfo = document.querySelector('.ntsh_dashboard-unity-zedstreaminfo');
this.zedStreamFps = document.querySelector('.ntsh_dashboard-unity-zedstreamfps');
this.zedStreamPath = document.querySelector('.ntsh_dashboard-unity-zedstreampath');
this.timelineWatching = document.querySelector('.ntsh_dashboard-unity-timeline-watching');
this.timelineStanding = document.querySelector('.ntsh_dashboard-unity-timeline-standing');
this.timelineProgress = document.querySelector('.ntsh_dashboard-unity-timeline-progress');
this.parametersTable = document.querySelector('.ntsh_dashboard-unity-parameters');
this.errorContainer = document.querySelector('.ntsh_dashboard-unity-error');
this.errorText = document.querySelector('.ntsh_dashboard-unity-errortext');
this._Main = Main;
this.registerListeners();
}
DashboardUnity.prototype.updateRunnerState = function (state) {
var _a, _b;
// ----------- Process -----------
if (state.state != 'RUNNING') {
state.startTime = -1;
this.restartButton.style.display = 'none';
}
else {
this.restartButton.style.display = 'flex';
}
(0, utils_1.setStatusState)(this.processStatus, {
RUNNING: 'green',
STOPPED: 'red',
STARTING: 'yellow',
PROBLEM: 'red',
}[state.state]);
this.processInfo.innerText = (_a = state.message) !== null && _a !== void 0 ? _a : '';
// ----------- Uptime -----------
var uptimeSeconds = state.startTime == -1 ? -1 : (Date.now() - state.startTime) / 1000;
this.uptimeInfo.innerText = (0, utils_1.formatUptime)(uptimeSeconds);
// ----------- Error -----------
if (((_b = state === null || state === void 0 ? void 0 : state.error) !== null && _b !== void 0 ? _b : '').trim().length > 0)
this.runnerError = state.error;
else
this.runnerError = null;
this.updateError();
this._Main.Logs.setUnityLogs(state.output.current);
};
DashboardUnity.prototype.updateWebSocketState = function (state) {
var _a, _b;
// ----------- WebSocket -----------
(0, utils_1.setStatusState)(this.webSocketStatus, {
CONNECTING: 'yellow',
CONNECTED: 'green',
DISCONNECTED: 'gray',
FAILED: 'red',
}[state.state]);
this.webSocketInfo.innerText = (_a = state.message) !== null && _a !== void 0 ? _a : '';
// ----------- ZED Stream -----------
(0, utils_1.setStatusState)(this.zedStreamStatus, state.parameters.zedReady ? 'green' : 'red');
this.zedStreamInfo.innerText = state.parameters.zedReady
? "Connected to ".concat(state.parameters.zedPath)
: 'Not ready';
this.zedStreamFps.innerText =
state.parameters.zedFPS == '-' ? '' : state.parameters.zedFPS;
// ----------- Timeline -----------
this.timelineWatching.innerText = state.parameters.timelineWatching
? 'Yes'
: 'No';
this.timelineStanding.innerText = state.parameters.timelineStanding
? 'Yes'
: 'No';
(0, utils_1.setProgressState)(this.timelineProgress, state.parameters.timelineProgress);
// ----------- Parameters -----------
this.renderParameterSliders(state.parameters.parameters);
// ----------- Error -----------
if (((_b = state === null || state === void 0 ? void 0 : state.error) !== null && _b !== void 0 ? _b : '').trim().length > 0)
this.webSocketError = state.error;
else
this.webSocketError = null;
this.updateError();
};
DashboardUnity.prototype.renderParameterSliders = function (parameters) {
var _this = this;
if (parameters.length === 0)
return;
var existingSliders = this.parametersTable.querySelectorAll('.ntsh_dashboard-unity-parameter-row');
if (existingSliders.length !== parameters.length) {
this.parametersTable.innerHTML = '';
parameters.forEach(function (param) {
var row = (0, morphux_1.ce)('tr', 'ntsh_dashboard-unity-parameter-row');
var nameCell = (0, morphux_1.ce)('td');
nameCell.appendChild((0, morphux_1.ce)('div', 'mux_text', null, param.sliderName));
row.appendChild(nameCell);
var progressCell = (0, morphux_1.ce)('td', 'no-service');
progressCell.appendChild((0, utils_1.createProgress)(param.outputValue));
row.appendChild(progressCell);
var sliderCell = (0, morphux_1.ce)('td', 'only-service');
var sliderProgress = (0, utils_1.createProgress)(param.outputValue);
var sliderValue = sliderProgress.querySelector('.ntsh_progress-value');
sliderValue.classList.add('mux_resizer');
sliderCell.appendChild(sliderProgress);
var resizer = new morphux_1.MorphComponent.Resizer({
existingContainer: sliderValue,
direction: 'right',
relative: true,
min: 0,
max: function () { return sliderProgress.clientWidth; },
});
var lastPercentage = -1;
resizer.on('resized', function (size) {
var percentage = Math.round((size / sliderProgress.clientWidth) * 100) /
100;
if (percentage === lastPercentage)
return;
lastPercentage = percentage;
_this._Main.socket.emit('unityWebSocket', 'parameterValue', param.sliderIndex, percentage);
(0, utils_1.setProgressState)(sliderProgress, percentage);
});
row.appendChild(sliderCell);
_this.parametersTable.appendChild(row);
});
}
else {
existingSliders.forEach(function (row, index) {
var value = parameters[index].outputValue;
var progressElement = row.querySelector('.no-service .ntsh_progress');
(0, utils_1.setProgressState)(progressElement, value);
var sliderElement = row.querySelector('.only-service .ntsh_progress');
if (sliderElement.querySelector('.mux_resizer-moving') == null)
(0, utils_1.setProgressState)(sliderElement, value);
});
}
};
DashboardUnity.prototype.updateError = function () {
var errors = [];
if (this.runnerError != null)
errors.push(this.runnerError);
if (this.webSocketError != null)
errors.push(this.webSocketError);
if (errors.length > 0) {
this.errorText.innerText = errors.join('\n');
this.errorContainer.style.display = 'block';
}
else {
this.errorContainer.style.display = 'none';
this.errorText.innerText = '';
}
};
DashboardUnity.prototype.registerListeners = function () {
var _this = this;
this._Main.socket.on('unityRunnerState', function (state) {
return _this.updateRunnerState(state);
});
this._Main.socket.on('unityWebSocketState', function (state) { return _this.updateWebSocketState(state); });
this.restartButton.addEventListener('click', function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.executeCommand('restart', 'Are you sure you want to restart the Unity Runner process?');
return [2 /*return*/];
});
}); });
};
DashboardUnity.prototype.executeCommand = function (command, message) {
return __awaiter(this, void 0, void 0, function () {
var confirmed;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, morphux_1.MorphFeature.Confirm({
title: 'Are you sure?',
message: message,
})];
case 1:
confirmed = _a.sent();
if (!confirmed)
return [2 /*return*/];
morphux_1.MorphFeature.Loader({
active: true,
message: "Requesting Unity Runner ".concat(command, "..."),
});
this._Main.socket.emit('unityRunner', command, function (response) {
morphux_1.MorphFeature.Loader({ active: false });
if (!response.succeed)
return morphux_1.MorphFeature.Alert({
title: 'Error',
message: response.message,
});
morphux_1.MorphFeature.Notification({
level: 'success',
message: "Unity Runner is ".concat(command, "ing..."),
});
});
return [2 /*return*/];
}
});
});
};
return DashboardUnity;
}());
exports.DashboardUnity = DashboardUnity;
//# sourceMappingURL=dashboard.unity.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,143 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardUnityRunner = void 0;
var morphux_1 = require("morphux");
var utils_1 = require("./utils");
var CELCIUS = 'ºC';
var DashboardUnityRunner = /** @class */ (function () {
function DashboardUnityRunner(Main) {
this.container = document.querySelector('.ntsh_dashboard-unity');
this.processStatus = this.container.querySelector('.ntsh_dashboard-unity-processstatus');
this.processInfo = this.container.querySelector('.ntsh_dashboard-unity-processinfo');
this.restartButton = this.container.querySelector('.ntsh_dashboard-unity-restart');
this.uptimeInfo = this.container.querySelector('.ntsh_dashboard-unity-uptime');
this.errorContainer = this.container.querySelector('.ntsh_dashboard-unity-error');
this.errorText = this.container.querySelector('.ntsh_dashboard-unity-errortext');
this._Main = Main;
this.registerListeners();
}
DashboardUnityRunner.prototype.updateState = function (state) {
var _a, _b;
// ----------- Process -----------
if (state.state != 'RUNNING') {
state.startTime = -1;
this.restartButton.style.display = 'none';
}
else {
this.restartButton.style.display = 'flex';
}
(0, utils_1.setStatusState)(this.processStatus, {
RUNNING: 'green',
STOPPED: 'red',
STARTING: 'yellow',
PROBLEM: 'red',
}[state.state]);
this.processInfo.innerText = (_a = state.message) !== null && _a !== void 0 ? _a : '';
// ----------- Uptime -----------
var uptimeSeconds = state.startTime == -1 ? -1 : (Date.now() - state.startTime) / 1000;
this.uptimeInfo.innerText = (0, utils_1.formatUptime)(uptimeSeconds);
// ----------- Error -----------
var errors = [];
if (((_b = state === null || state === void 0 ? void 0 : state.error) !== null && _b !== void 0 ? _b : '').trim().length > 0)
errors.push(state.error);
if (errors.length > 0) {
this.errorText.innerText = errors.join('\n');
this.errorContainer.style.display = 'block';
}
else {
this.errorContainer.style.display = 'none';
this.errorText.innerText = '';
}
this._Main.Logs.setUnityLogs(state.output.current);
};
DashboardUnityRunner.prototype.registerListeners = function () {
var _this = this;
this._Main.socket.on('unityRunnerState', function (state) {
_this.updateState(state);
});
this._Main.socket.on('unityWebSocketState', function (state) {
console.log('Unity WebSocket State:', state);
});
this.restartButton.addEventListener('click', function () {
return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.executeCommand('restart', 'Are you sure you want to restart the Unity Runner process?');
return [2 /*return*/];
});
});
});
};
DashboardUnityRunner.prototype.executeCommand = function (command, message) {
return __awaiter(this, void 0, void 0, function () {
var confirmed;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, morphux_1.MorphFeature.Confirm({
title: 'Are you sure?',
message: message,
})];
case 1:
confirmed = _a.sent();
if (!confirmed)
return [2 /*return*/];
morphux_1.MorphFeature.Loader({
active: true,
message: "Requesting Unity Runner ".concat(command, "..."),
});
this._Main.socket.emit('unityRunner', command, function (response) {
morphux_1.MorphFeature.Loader({ active: false });
if (!response.succeed)
return morphux_1.MorphFeature.Alert({
title: 'Error',
message: response.message,
});
morphux_1.MorphFeature.Notification({
level: 'success',
message: "Unity Runner is ".concat(command, "ing..."),
});
});
return [2 /*return*/];
}
});
});
};
return DashboardUnityRunner;
}());
exports.DashboardUnityRunner = DashboardUnityRunner;
//# sourceMappingURL=dashboard.unityrunner.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dashboard.unityrunner.js","sourceRoot":"","sources":["../ts/dashboard.unityrunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAuC;AAEvC,iCAKiB;AAEjB,IAAM,OAAO,GAAG,IAAI,CAAC;AAErB;IA4BC,8BAAY,IAAU;QAzBtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CACjD,2BAA2B,CAC3B,CAAC;QAEF,kBAAa,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC3D,yCAAyC,CACzC,CAAC;QACF,gBAAW,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CACzD,uCAAuC,CACvC,CAAC;QACF,kBAAa,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC3D,mCAAmC,CACnC,CAAC;QAEF,eAAU,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CACxD,kCAAkC,CAClC,CAAC;QAEF,mBAAc,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CAC5D,iCAAiC,CACjC,CAAC;QACF,cAAS,GAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,CACvD,qCAAqC,CACrC,CAAC;QAGD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC1B,CAAC;IAED,0CAAW,GAAX,UAAY,KAAwB;;QACnC,kCAAkC;QAClC,IAAI,KAAK,CAAC,KAAK,IAAI,SAAS,EAAE,CAAC;YAC9B,KAAK,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E,KAAK,EAAE,CAAC,CAAC;4BAEvC,IAAI,CAAC,QAAQ,CAAC,OAAO;gCACpB,OAAO,sBAAY,CAAC,KAAK,CAAC;oCACzB,KAAK,EAAE,OAAO;oCACd,OAAO,EAAE,QAAQ,CAAC,OAAO;iCACzB,CAAC,CAAC;4BAEJ,sBAAY,CAAC,YAAY,CAAC;gCACzB,KAAK,EAAE,SAAS;gCAChB,OAAO,EAAE,0BAAmB,OAAO,WAAQ;6BAC3C,CAAC,CAAC;wBACJ,CAAC,CACD,CAAC;;;;;KACF;IACF,2BAAC;AAAD,CAAC,AA3HD,IA2HC;AA3HY,oDAAoB"}

View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Leds = void 0;
var morphux_1 = require("morphux");
var Leds = /** @class */ (function () {
function Leds(Main) {
this.container = document.querySelector(".ntsh_tab[tabid=\"leds\"]");
this._Main = Main;
this.registerTabListener();
}
Leds.prototype.createPreviewFrame = function () {
var container = (0, morphux_1.ce)('div', 'ntsh_leds');
var urlParams = new URLSearchParams(window.location.search);
var transform = urlParams.has('transform')
? "?transform=".concat(urlParams.get('transform'))
: '';
var frame = (0, morphux_1.ce)('iframe', 'ntsh_leds-frame', {
src: "http://".concat(window.location.hostname, ":84").concat(transform),
});
container.appendChild(frame);
this.container.appendChild(container);
};
Leds.prototype.removePreviewFrame = function () {
this.container.innerHTML = '';
};
Leds.prototype.registerTabListener = function () {
var _this = this;
this._Main.TabController.registerListener('leds', function (visible) {
if (visible)
_this.createPreviewFrame();
else
_this.removePreviewFrame();
});
};
return Leds;
}());
exports.Leds = Leds;
//# sourceMappingURL=leds%20copy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"leds copy.js","sourceRoot":"","sources":["../ts/leds copy.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAG7B;IAOC,cAAY,IAAU;QAJtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CACjD,2BAAyB,CACzB,CAAC;QAGD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC5B,CAAC;IAED,iCAAkB,GAAlB;QACC,IAAI,SAAS,GAAG,IAAA,YAAE,EAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAEvC,IAAI,SAAS,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE5D,IAAI,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;YACzC,CAAC,CAAC,qBAAc,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAE;YAC5C,CAAC,CAAC,EAAE,CAAC;QAEN,IAAI,KAAK,GAAG,IAAA,YAAE,EAAC,QAAQ,EAAE,iBAAiB,EAAE;YAC3C,GAAG,EAAE,iBAAU,MAAM,CAAC,QAAQ,CAAC,QAAQ,gBAAM,SAAS,CAAE;SACxD,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,iCAAkB,GAAlB;QACC,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;IAC/B,CAAC;IAEO,kCAAmB,GAA3B;QAAA,iBAKC;QAJA,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,MAAM,EAAE,UAAC,OAAO;YACzD,IAAI,OAAO;gBAAE,KAAI,CAAC,kBAAkB,EAAE,CAAC;;gBAClC,KAAI,CAAC,kBAAkB,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,WAAC;AAAD,CAAC,AAxCD,IAwCC;AAxCY,oBAAI"}

38
frontend/views/dashboard/dist/leds.js vendored Normal file
View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Leds = void 0;
var morphux_1 = require("morphux");
var Leds = /** @class */ (function () {
function Leds(Main) {
this.container = document.querySelector(".ntsh_tab[tabid=\"leds\"]");
this._Main = Main;
this.registerTabListener();
}
Leds.prototype.createPreviewFrame = function () {
var container = (0, morphux_1.ce)('div', 'ntsh_leds');
var urlParams = new URLSearchParams(window.location.search);
var transform = urlParams.has('transform')
? "?transform=".concat(urlParams.get('transform'))
: '';
var frame = (0, morphux_1.ce)('iframe', 'ntsh_leds-frame', {
src: "http://".concat(window.location.hostname, ":84").concat(transform),
});
container.appendChild(frame);
this.container.appendChild(container);
};
Leds.prototype.removePreviewFrame = function () {
this.container.innerHTML = '';
};
Leds.prototype.registerTabListener = function () {
var _this = this;
this._Main.TabController.registerListener('leds', function (visible) {
if (visible)
_this.createPreviewFrame();
else
_this.removePreviewFrame();
});
};
return Leds;
}());
exports.Leds = Leds;
//# sourceMappingURL=leds.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"leds.js","sourceRoot":"","sources":["../ts/leds.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAG7B;IAOC,cAAY,IAAU;QAJtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CACjD,2BAAyB,CACzB,CAAC;QAGD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC5B,CAAC;IAED,iCAAkB,GAAlB;QACC,IAAI,SAAS,GAAG,IAAA,YAAE,EAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAEvC,IAAI,SAAS,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE5D,IAAI,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;YACzC,CAAC,CAAC,qBAAc,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAE;YAC5C,CAAC,CAAC,EAAE,CAAC;QAEN,IAAI,KAAK,GAAG,IAAA,YAAE,EAAC,QAAQ,EAAE,iBAAiB,EAAE;YAC3C,GAAG,EAAE,iBAAU,MAAM,CAAC,QAAQ,CAAC,QAAQ,gBAAM,SAAS,CAAE;SACxD,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,iCAAkB,GAAlB;QACC,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;IAC/B,CAAC;IAEO,kCAAmB,GAA3B;QAAA,iBAKC;QAJA,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,MAAM,EAAE,UAAC,OAAO;YACzD,IAAI,OAAO;gBAAE,KAAI,CAAC,kBAAkB,EAAE,CAAC;;gBAClC,KAAI,CAAC,kBAAkB,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,WAAC;AAAD,CAAC,AAxCD,IAwCC;AAxCY,oBAAI"}

19
frontend/views/dashboard/dist/logs.js vendored Normal file
View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logs = void 0;
var Logs = /** @class */ (function () {
function Logs() {
this.cameraLogsContainer = document.querySelector('.ntsh_tab[tabid="cameralogs"] .ntsh_logs');
this.unityLogsContainer = document.querySelector('.ntsh_tab[tabid="unitylogs"] .ntsh_logs');
}
Logs.prototype.setCameraLogs = function (logs) {
this.applyLogs(this.cameraLogsContainer, logs);
};
Logs.prototype.setUnityLogs = function (logs) {
this.applyLogs(this.unityLogsContainer, logs);
};
Logs.prototype.applyLogs = function (container, logs) { };
return Logs;
}());
exports.Logs = Logs;
//# sourceMappingURL=logs.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../ts/logs.ts"],"names":[],"mappings":";;;AAAA;IAAA;QACC,wBAAmB,GAAmB,QAAQ,CAAC,aAAa,CAC3D,sCAAsC,CACtC,CAAC;QACF,uBAAkB,GAAmB,QAAQ,CAAC,aAAa,CAC1D,qCAAqC,CACrC,CAAC;IAWH,CAAC;IATA,4BAAa,GAAb,UAAc,IAAc;QAC3B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,2BAAY,GAAZ,UAAa,IAAc;QAC1B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IAEO,wBAAS,GAAjB,UAAkB,SAAyB,EAAE,IAAc,IAAG,CAAC;IAChE,WAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBY,oBAAI"}

View File

@@ -0,0 +1,116 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogsHandler = void 0;
var morphux_1 = require("morphux");
var ansi_up_1 = require("ansi_up");
var LogsHandler = /** @class */ (function () {
function LogsHandler(Main) {
this.ansiUp = new ansi_up_1.AnsiUp();
this.cameraLogsContainer = document.querySelector('.ntsh_tab[tabid="cameralogs"] .ntsh_logs');
this.unityLogsContainer = document.querySelector('.ntsh_tab[tabid="unitylogs"] .ntsh_logs');
this.firstTime = new Set();
this._Main = Main;
this.registerListeners();
}
LogsHandler.prototype.setCameraLogs = function (logs) {
this.applyLogs(this.cameraLogsContainer, logs);
};
LogsHandler.prototype.setUnityLogs = function (logs) {
this.applyLogs(this.unityLogsContainer, logs);
};
LogsHandler.prototype.applyLogs = function (container, logs) {
return __awaiter(this, void 0, void 0, function () {
var logCount, isAtBottom;
var _this = this;
return __generator(this, function (_a) {
logCount = container.querySelectorAll('.ntsh_log.ntsh_log-normal').length;
if (logCount === logs.length)
return [2 /*return*/];
if (logCount > logs.length)
logCount = 0;
isAtBottom = !this.firstTime.has(container) ||
container.scrollTop + container.clientHeight >=
container.scrollHeight;
container.innerHTML = '';
logs.forEach(function (log, i) {
var element = (0, morphux_1.ce)('div', ['ntsh_log', 'ntsh_log-normal'], null, null, _this.ansiUp.ansi_to_html(log));
if (_this.firstTime.has(container) && i > logCount - 1) {
element.style.display = 'none';
var spawnDelay = (i - logCount) * 10;
setTimeout(function () {
element.style.display = 'block';
if (isAtBottom)
container.scrollTop = container.scrollHeight;
}, spawnDelay);
}
container.appendChild(element);
if (isAtBottom)
container.scrollTop = container.scrollHeight;
});
if (!this.firstTime.has(container)) {
container.scrollTop = container.scrollHeight;
this.firstTime.add(container);
}
return [2 /*return*/];
});
});
};
LogsHandler.prototype.registerListeners = function () {
var _this = this;
this._Main.TabController.registerListener('cameralogs', function (visible) {
if (!visible)
return;
setTimeout(function () {
_this.cameraLogsContainer.scrollTop =
_this.cameraLogsContainer.scrollHeight;
}, 10);
});
this._Main.TabController.registerListener('unitylogs', function (visible) {
if (!visible)
return;
setTimeout(function () {
_this.unityLogsContainer.scrollTop =
_this.unityLogsContainer.scrollHeight;
}, 10);
});
};
return LogsHandler;
}());
exports.LogsHandler = LogsHandler;
//# sourceMappingURL=logsHandler.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"logsHandler.js","sourceRoot":"","sources":["../ts/logsHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA6B;AAG7B,mCAAiC;AAEjC;IAYC,qBAAY,IAAU;QATtB,WAAM,GAAG,IAAI,gBAAM,EAAE,CAAC;QAEtB,wBAAmB,GAAmB,QAAQ,CAAC,aAAa,CAC3D,0CAA0C,CAC1C,CAAC;QACF,uBAAkB,GAAmB,QAAQ,CAAC,aAAa,CAC1D,yCAAyC,CACzC,CAAC;QAgBM,cAAS,GAAwB,IAAI,GAAG,EAAE,CAAC;QAblD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC1B,CAAC;IAED,mCAAa,GAAb,UAAc,IAAc;QAC3B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,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wBAC/C,CAAC,EAAE,UAAU,CAAC,CAAC;oBAChB,CAAC;oBAED,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;oBAC/B,IAAI,UAAU;wBAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,YAAY,CAAC;gBAC9D,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;oBACpC,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,YAAY,CAAC;oBAC7C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBAC/B,CAAC;;;;KACD;IAEO,uCAAiB,GAAzB;QAAA,iBAkBC;QAjBA,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,YAAY,EAAE,UAAC,OAAO;YAC/D,IAAI,CAAC,OAAO;gBAAE,OAAO;YAErB,UAAU,CAAC;gBACV,KAAI,CAAC,mBAAmB,CAAC,SAAS;oBACjC,KAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC;YACxC,CAAC,EAAE,EAAE,CAAC,CAAC;QACR,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,WAAW,EAAE,UAAC,OAAO;YAC9D,IAAI,CAAC,OAAO;gBAAE,OAAO;YAErB,UAAU,CAAC;gBACV,KAAI,CAAC,kBAAkB,CAAC,SAAS;oBAChC,KAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC;YACvC,CAAC,EAAE,EAAE,CAAC,CAAC;QACR,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,kBAAC;AAAD,CAAC,AA1FD,IA0FC;AA1FY,kCAAW"}

36
frontend/views/dashboard/dist/main.js vendored Normal file
View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Main = void 0;
var socket_io_client_1 = require("socket.io-client");
var menuBar_1 = require("./menuBar");
var tabController_1 = require("./tabController");
var morphux_1 = require("morphux");
var dashboard_camerarunner_1 = require("./dashboard.camerarunner");
var logsHandler_1 = require("./logsHandler");
var calibration_1 = require("./calibration");
var dashboard_unity_1 = require("./dashboard.unity");
var socket = (0, socket_io_client_1.io)('/');
var Main = /** @class */ (function () {
function Main() {
this.socket = socket;
this.MenuBar = new menuBar_1.MenuBar(this);
this.TabController = new tabController_1.TabController(this);
this.Logs = new logsHandler_1.LogsHandler(this);
this.Calibration = new calibration_1.Calibration(this);
this.DashboardCameraRunner = new dashboard_camerarunner_1.DashboardCameraRunner(this);
this.DashboardUnityRunner = new dashboard_unity_1.DashboardUnity(this);
if (window.location.search.includes('debug')) {
window.SN = this;
console.log('Debug mode enabled');
}
}
return Main;
}());
exports.Main = Main;
morphux_1.MorphFeature.Loader({ active: true, message: 'Connecting to server...' });
socket.on('connect', function () {
console.log('Connected to server');
morphux_1.MorphFeature.Loader({ active: false });
});
var _Main = new Main();
//# sourceMappingURL=main.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["../ts/main.ts"],"names":[],"mappings":";;;AAAA,qDAAsC;AACtC,qCAAoC;AACpC,iDAAgD;AAChD,mCAAuC;AACvC,mEAAiE;AACjE,6CAA4C;AAC5C,6CAA4C;AAC5C,qDAAmD;AAEnD,IAAM,MAAM,GAAG,IAAA,qBAAE,EAAC,GAAG,CAAC,CAAC;AACvB;IAYC;QAXA,WAAM,GAAG,MAAM,CAAC;QAEhB,YAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,CAAC;QAC5B,kBAAa,GAAG,IAAI,6BAAa,CAAC,IAAI,CAAC,CAAC;QAExC,SAAI,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,CAAC;QAC7B,gBAAW,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,CAAC;QAEpC,0BAAqB,GAAG,IAAI,8CAAqB,CAAC,IAAI,CAAC,CAAC;QACxD,yBAAoB,GAAG,IAAI,gCAAc,CAAC,IAAI,CAAC,CAAC;QAG/C,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7C,MAAc,CAAC,EAAE,GAAG,IAAI,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QACnC,CAAC;IACF,CAAC;IACF,WAAC;AAAD,CAAC,AAlBD,IAkBC;AAlBY,oBAAI;AAoBjB,sBAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC,CAAC;AAC1E,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE;IACpB,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACnC,sBAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC,CAAC;AAEH,IAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC"}

171
frontend/views/dashboard/dist/menubar.js vendored Normal file
View File

@@ -0,0 +1,171 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MenuBar = void 0;
var morphux_1 = require("morphux");
var Component_MenuBar_1 = require("morphux/dist/Components/MenuBar/Component.MenuBar");
var MenuBar = /** @class */ (function () {
function MenuBar(main) {
var _this = this;
this.container = document.querySelector('.ntsh_menubar');
this._Main = main;
this.build();
setTimeout(function () {
if ((localStorage === null || localStorage === void 0 ? void 0 : localStorage.getItem('serviceMode')) === 'true')
_this.toggleServiceMode(true, true);
}, 10);
}
MenuBar.prototype.build = function () {
var _this = this;
this.menubar = new Component_MenuBar_1.ComponentMenuBar({
left: [
{
type: 'image',
url: '/img/morphix_logo_white.png',
},
{
type: 'normal',
text: 'Dashboard',
materialIcon: 'dashboard',
uniqueIdentifier: 'dashboard',
selected: true,
click: function () { return _this._Main.TabController.showTab('dashboard'); },
},
{
type: 'normal',
text: 'Calibration',
uniqueIdentifier: 'calibration',
materialIcon: 'crop_free',
click: function () {
return _this._Main.TabController.showTab('calibration');
},
},
{
type: 'normal',
text: 'Unity Logs',
uniqueIdentifier: 'unitylogs',
materialIcon: 'deployed_code',
click: function () { return _this._Main.TabController.showTab('unitylogs'); },
},
{
type: 'normal',
text: 'Camera Logs',
uniqueIdentifier: 'cameralogs',
materialIcon: 'photo_camera',
click: function () { return _this._Main.TabController.showTab('cameralogs'); },
},
],
right: [
{
type: 'normal',
text: document.body.classList.contains('ntsh_service')
? 'Exit Service'
: 'Service Mode',
uniqueIdentifier: 'serviceMode',
materialIcon: document.body.classList.contains('ntsh_service')
? 'logout'
: 'engineering',
click: function () { return __awaiter(_this, void 0, void 0, function () {
var mobileMenu;
return __generator(this, function (_a) {
mobileMenu = document.querySelector('.mux_mobilemenu');
mobileMenu === null || mobileMenu === void 0 ? void 0 : mobileMenu.click();
this.toggleServiceMode();
return [2 /*return*/];
});
}); },
},
],
});
this.container.innerHTML = '';
this.container.appendChild(this.menubar.container);
};
MenuBar.prototype.toggleServiceMode = function (mode, skipPin) {
return __awaiter(this, void 0, void 0, function () {
var newMode, servicePin;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
newMode = mode !== null && mode !== void 0 ? mode : !document.body.classList.contains('ntsh_service');
if (!newMode) return [3 /*break*/, 3];
if (!(skipPin !== true)) return [3 /*break*/, 2];
return [4 /*yield*/, morphux_1.MorphFeature.Prompt({
title: 'Service Mode',
message: 'Enter the service PIN:',
type: 'number',
canBeEmpty: false,
placeholder: '****',
})];
case 1:
servicePin = _a.sent();
if (servicePin !== '4252') {
morphux_1.MorphFeature.Alert({
title: 'Error',
message: 'Incorrect PIN provided.',
});
return [2 /*return*/, false];
}
_a.label = 2;
case 2:
document.body.classList.add('ntsh_service');
localStorage.setItem('serviceMode', 'true');
morphux_1.MorphFeature.Notification({
level: 'success',
message: 'Service mode activated.',
});
return [3 /*break*/, 4];
case 3:
document.body.classList.remove('ntsh_service');
this._Main.TabController.showTab('dashboard');
localStorage.setItem('serviceMode', 'false');
morphux_1.MorphFeature.Notification({
level: 'success',
message: 'Service mode deactivated.',
});
_a.label = 4;
case 4:
this.build();
return [2 /*return*/, true];
}
});
});
};
return MenuBar;
}());
exports.MenuBar = MenuBar;
//# sourceMappingURL=menuBar.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"menuBar.js","sourceRoot":"","sources":["../ts/menuBar.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAuD;AAEvD,uFAAqF;AAErF;IAOC,iBAAY,IAAU;QAAtB,iBASC;QAbD,cAAS,GAAmB,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAKnE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,UAAU,CAAC;YACV,IAAI,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,CAAC,aAAa,CAAC,MAAK,MAAM;gBAClD,KAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACrC,CAAC,EAAE,EAAE,CAAC,CAAC;IACR,CAAC;IAED,uBAAK,GAAL;QAAA,iBAoEC;QAnEA,IAAI,CAAC,OAAO,GAAG,IAAI,oCAAgB,CAAC;YACnC,IAAI,EAAE;gBACL;oBACC,IAAI,EAAE,OAAO;oBACb,GAAG,EAAE,6BAA6B;iBAClC;gBACD;oBACC,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,WAAW;oBACjB,YAAY,EAAE,WAAW;oBACzB,gBAAgB,EAAE,WAAW;oBAC7B,QAAQ,EAAE,IAAI;oBAEd,KAAK,EAAE,cAAM,OAAA,KAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,EAA7C,CAA6C;iBAC1D;gBACD;oBACC,IAAI,EAAE,QA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a,EAAE,OAAO,CAAC,CAAC;wBAE7C,sBAAY,CAAC,YAAY,CAAC;4BACzB,KAAK,EAAE,SAAS;4BAChB,OAAO,EAAE,2BAA2B;yBACpC,CAAC,CAAC;;;wBAGJ,IAAI,CAAC,KAAK,EAAE,CAAC;wBACb,sBAAO,IAAI,EAAC;;;;KACZ;IACF,cAAC;AAAD,CAAC,AAzID,IAyIC;AAzIY,0BAAO"}

166
frontend/views/dashboard/dist/mmWave.js vendored Normal file
View File

@@ -0,0 +1,166 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mmWave = void 0;
var morphux_1 = require("morphux");
var MAPPING_CORNER_COLOR = '#f00';
var MAPPING_LINE_COLOR = '#9c0000ff';
var mmWave = /** @class */ (function () {
function mmWave(Main) {
this.container = document.querySelector('.ntsh_mmwave-container');
this.nodes = this.container.querySelector('.ntsh_mmwave-nodes');
this.lines = this.container.querySelector('.ntsh_mmwave-lines');
this.linesContext = this.lines.getContext('2d');
this._Main = Main;
this.registerListeners();
}
mmWave.prototype.registerListeners = function () {
var _this = this;
console.log('Registering mmWave listeners');
this._Main.socket.on('mmwaveROI', function (roi) {
_this.roi = roi;
_this.updateROI();
});
this._Main.socket.on('mmwaveMapping', function (mapping) {
_this.mapping = mapping;
_this.setMappingCorners();
});
// this._Main.socket.on('mmwaveTracks', (tracks: Track[]) => {
// this.updateTracks(tracks);
// });
this._Main.socket.on('mmwavePoints', function (mappedPoints) {
_this.updateTracks(mappedPoints);
});
this.container.onclick = function (e) {
var rect = _this.container.getBoundingClientRect();
var scaleX = _this.container.clientWidth / rect.width;
var scaleY = _this.container.clientHeight / rect.height;
var x = (e.clientX - rect.left) * scaleX;
var y = (e.clientY - rect.top) * scaleY;
var xPercentage = (x / _this.container.clientWidth) * 100;
var yPercentage = (y / _this.container.clientHeight) * 100;
var roiPos = _this.toROI(xPercentage, yPercentage);
console.log(roiPos);
};
window.addEventListener('resize', function () { return _this.scale(); });
};
mmWave.prototype.updateTracks = function (mappedPoints) {
var _this = this;
if (this.roi == null)
return;
mappedPoints.forEach(function (_a) {
var track = _a.track, mapped = _a.mapped;
var trackPoint = _this.nodes.querySelector(".ntsh_mmwave-track[trackid=\"".concat(track.trackId, "\"]"));
var trackLabel = trackPoint === null || trackPoint === void 0 ? void 0 : trackPoint.querySelector('.ntsh_mmwave-label');
if (trackPoint == null) {
trackPoint = (0, morphux_1.ce)('div', 'ntsh_mmwave-track', {
trackid: track.trackId,
});
trackPoint.appendChild((0, morphux_1.ce)('div', 'ntsh_mmwave-track-cross'));
trackPoint.appendChild((0, morphux_1.ce)('div', 'ntsh_mmwave-track-cross'));
trackLabel = (0, morphux_1.ce)('div', 'ntsh_mmwave-label');
trackPoint.appendChild(trackLabel);
_this.nodes.appendChild(trackPoint);
trackPoint.animate({
opacity: [0, 1],
}, { duration: 200 });
}
var _b = _this.toPercentage(track.x, track.y), xPercentage = _b.xPercentage, yPercentage = _b.yPercentage;
trackPoint.style.left = "".concat(xPercentage, "%");
trackPoint.style.top = "".concat(yPercentage, "%");
if (mapped == null)
return trackPoint.classList.add('ntsh_mmwave-track-outside');
trackPoint.classList.remove('ntsh_mmwave-track-outside');
trackLabel.innerHTML = '';
trackLabel.appendChild((0, morphux_1.ce)('span', 'ntsh_mmwave-label-id', null, track.trackId.toString()));
trackLabel.appendChild((0, morphux_1.ce)('span', null, null, "".concat(Math.round(mapped.x), "%, ").concat(Math.round(mapped.y), "%")));
});
var trackIds = mappedPoints.map(function (t) { return t.track.trackId; });
this.nodes
.querySelectorAll('.ntsh_mmwave-track')
.forEach(function (trackPoint) {
var trackId = parseInt(trackPoint.getAttribute('trackid'));
if (trackIds.includes(trackId))
return;
trackPoint.animate({
opacity: 0,
}, { duration: 200 }).onfinish = function () {
trackPoint.remove();
};
});
};
mmWave.prototype.updateROI = function () {
if (this.roi == null)
return;
var xDif = Math.abs(this.roi.x[1] - this.roi.x[0]);
var yDif = Math.abs(this.roi.y[1] - this.roi.y[0]);
var height = (1920 / xDif) * yDif;
this.container.style.minWidth = "1920px";
this.container.style.minHeight = "".concat(height, "px");
this.lines.height = height;
this.lines.width = 1920;
this.scale();
};
mmWave.prototype.setMappingCorners = function () {
if (this.mapping == null)
return;
this.nodes
.querySelectorAll('.ntsh_mmwave-corner')
.forEach(function (el) { return el.remove(); });
var tl = this.addCorner(this.mapping.topLeft.x, this.mapping.topLeft.y, 'tl');
var tr = this.addCorner(this.mapping.topRight.x, this.mapping.topRight.y, 'tr');
var bl = this.addCorner(this.mapping.bottomLeft.x, this.mapping.bottomLeft.y, 'bl');
var br = this.addCorner(this.mapping.bottomRight.x, this.mapping.bottomRight.y, 'br');
this.linesContext.clearRect(0, 0, this.lines.width, this.lines.height);
this.linesContext.strokeStyle = MAPPING_LINE_COLOR;
this.linesContext.lineWidth = 2;
this.linesContext.beginPath();
this.linesContext.moveTo((tl.xPercentage / 100) * this.lines.width, (tl.yPercentage / 100) * this.lines.height);
this.linesContext.lineTo((tr.xPercentage / 100) * this.lines.width, (tr.yPercentage / 100) * this.lines.height);
this.linesContext.lineTo((br.xPercentage / 100) * this.lines.width, (br.yPercentage / 100) * this.lines.height);
this.linesContext.lineTo((bl.xPercentage / 100) * this.lines.width, (bl.yPercentage / 100) * this.lines.height);
this.linesContext.closePath();
this.linesContext.stroke();
};
mmWave.prototype.addCorner = function (x, y, corner) {
var cornerPoint = (0, morphux_1.ce)('div', [
'ntsh_mmwave-corner',
"ntsh_mmwave-corner-".concat(corner),
]);
cornerPoint.style.setProperty('--sn-mmwave-corner-color', MAPPING_CORNER_COLOR);
cornerPoint.appendChild((0, morphux_1.ce)('div', 'ntsh_mmwave-corner-cross'));
cornerPoint.appendChild((0, morphux_1.ce)('div', 'ntsh_mmwave-corner-cross'));
var position = this.toPercentage(x, y);
cornerPoint.style.left = "".concat(position.xPercentage, "%");
cornerPoint.style.top = "".concat(position.yPercentage, "%");
cornerPoint.appendChild((0, morphux_1.ce)('div', 'ntsh_mmwave-label', null, "".concat(x, ", ").concat(y)));
this.nodes.appendChild(cornerPoint);
return position;
};
mmWave.prototype.toPercentage = function (x, y) {
var xPercentage = ((x - this.roi.x[0]) / (this.roi.x[1] - this.roi.x[0])) * 100;
var yPercentage = ((y - this.roi.y[0]) / (this.roi.y[1] - this.roi.y[0])) * 100;
return { xPercentage: xPercentage, yPercentage: yPercentage };
};
mmWave.prototype.toROI = function (xPercentage, yPercentage) {
var x = this.roi.x[0] +
(xPercentage / 100) * (this.roi.x[1] - this.roi.x[0]);
var y = this.roi.y[0] +
(yPercentage / 100) * (this.roi.y[1] - this.roi.y[0]);
return { x: x, y: y };
};
mmWave.prototype.scale = function () {
var elementWidth = this.container.clientWidth;
var elementHeight = this.container.clientHeight;
var parentWidth = this.container.parentElement.clientWidth;
var parentHeight = this.container.parentElement.clientHeight;
var ratioWidth = parentWidth / elementWidth;
var ratioHeight = parentHeight / elementHeight;
var ratio = elementHeight * ratioWidth > parentHeight
? ratioHeight
: ratioWidth;
this.container.style.transform = "scale(".concat(ratio, ")");
};
return mmWave;
}());
exports.mmWave = mmWave;
//# sourceMappingURL=mmWave.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Preview = void 0;
var morphux_1 = require("morphux");
var Preview = /** @class */ (function () {
function Preview(Main) {
this.container = document.querySelector(".ntsh_tab[tabid=\"preview\"]");
this._Main = Main;
this.registerTabListener();
}
Preview.prototype.createPreviewFrame = function () {
var container = (0, morphux_1.ce)('div', 'ntsh_preview');
var urlParams = new URLSearchParams(window.location.search);
var transform = urlParams.has('transform')
? "?transform=".concat(urlParams.get('transform'))
: '';
var frame = (0, morphux_1.ce)('iframe', 'ntsh_preview-frame', {
src: "http://".concat(window.location.hostname, ":84").concat(transform),
});
container.appendChild(frame);
this.container.appendChild(container);
};
Preview.prototype.removePreviewFrame = function () {
this.container.innerHTML = '';
};
Preview.prototype.registerTabListener = function () {
var _this = this;
this._Main.TabController.registerListener('preview', function (visible) {
if (visible)
_this.createPreviewFrame();
else
_this.removePreviewFrame();
});
};
return Preview;
}());
exports.Preview = Preview;
//# sourceMappingURL=preview.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../ts/preview.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAG7B;IAOC,iBAAY,IAAU;QAJtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CACjD,8BAA4B,CAC5B,CAAC;QAGD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC5B,CAAC;IAED,oCAAkB,GAAlB;QACC,IAAI,SAAS,GAAG,IAAA,YAAE,EAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QAE1C,IAAI,SAAS,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE5D,IAAI,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;YACzC,CAAC,CAAC,qBAAc,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAE;YAC5C,CAAC,CAAC,EAAE,CAAC;QAEN,IAAI,KAAK,GAAG,IAAA,YAAE,EAAC,QAAQ,EAAE,oBAAoB,EAAE;YAC9C,GAAG,EAAE,iBAAU,MAAM,CAAC,QAAQ,CAAC,QAAQ,gBAAM,SAAS,CAAE;SACxD,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,oCAAkB,GAAlB;QACC,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;IAC/B,CAAC;IAEO,qCAAmB,GAA3B;QAAA,iBAKC;QAJA,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAC,OAAO;YAC5D,IAAI,OAAO;gBAAE,KAAI,CAAC,kBAAkB,EAAE,CAAC;;gBAClC,KAAI,CAAC,kBAAkB,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,cAAC;AAAD,CAAC,AAxCD,IAwCC;AAxCY,0BAAO"}

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Projection = void 0;
var morphux_1 = require("morphux");
var Projection = /** @class */ (function () {
function Projection(Main) {
this.container = document.querySelector(".ntsh_tab[tabid=\"projection\"]");
this._Main = Main;
this.registerTabListener();
}
Projection.prototype.createPreviewFrame = function () {
var container = (0, morphux_1.ce)('div', 'ntsh_projection');
var frame = (0, morphux_1.ce)('iframe', 'ntsh_projection-frame', {
src: "".concat(window.location.origin, "/visualization").concat(window.location.search),
});
container.appendChild(frame);
this.container.appendChild(container);
};
Projection.prototype.removePreviewFrame = function () {
this.container.innerHTML = '';
};
Projection.prototype.registerTabListener = function () {
var _this = this;
this._Main.TabController.registerListener('projection', function (visible) {
if (visible)
_this.createPreviewFrame();
else
_this.removePreviewFrame();
});
};
return Projection;
}());
exports.Projection = Projection;
//# sourceMappingURL=projection.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../ts/projection.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAG7B;IAOC,oBAAY,IAAU;QAJtB,cAAS,GAAmB,QAAQ,CAAC,aAAa,CACjD,iCAA+B,CAC/B,CAAC;QAGD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC5B,CAAC;IAED,uCAAkB,GAAlB;QACC,IAAI,SAAS,GAAG,IAAA,YAAE,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QAE7C,IAAI,KAAK,GAAG,IAAA,YAAE,EAAC,QAAQ,EAAE,uBAAuB,EAAE;YACjD,GAAG,EAAE,UAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,2BAAiB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAE;SACvE,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,uCAAkB,GAAlB;QACC,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;IAC/B,CAAC;IAEO,wCAAmB,GAA3B;QAAA,iBAKC;QAJA,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,YAAY,EAAE,UAAC,OAAO;YAC/D,IAAI,OAAO;gBAAE,KAAI,CAAC,kBAAkB,EAAE,CAAC;;gBAClC,KAAI,CAAC,kBAAkB,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,iBAAC;AAAD,CAAC,AAlCD,IAkCC;AAlCY,gCAAU"}

View File

@@ -0,0 +1,120 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TabController = void 0;
var morphux_1 = require("morphux");
var TabController = /** @class */ (function () {
function TabController(main) {
this.container = document.querySelector('.ntsh_tabs');
this.tabListeners = new Map();
this._Main = main;
this.registerNavigationListener();
}
TabController.prototype.registerListener = function (tabId, callback) {
if (this.tabListeners.has(tabId))
throw new Error("Listener for tab id ".concat(tabId, " has already been registered!"));
this.tabListeners.set(tabId, callback);
callback(this.currentTabId == tabId);
};
TabController.prototype.showTab = function (tabId) {
return __awaiter(this, void 0, void 0, function () {
var confirmed, succeed, tabName;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.currentTabId == tabId)
return [2 /*return*/];
if (!(tabId !== 'dashboard' &&
!document.body.classList.contains('ntsh_service'))) return [3 /*break*/, 3];
return [4 /*yield*/, morphux_1.MorphFeature.Confirm({
title: 'Service Mode Required',
message: "You need to be in service mode to access tab ".concat(tabId, ", switch to Service Mode now?"),
})];
case 1:
confirmed = _a.sent();
if (!confirmed)
return [2 /*return*/, this.showTab('dashboard')];
return [4 /*yield*/, this._Main.MenuBar.toggleServiceMode(true)];
case 2:
succeed = _a.sent();
if (!succeed)
return [2 /*return*/, this.showTab('dashboard')];
_a.label = 3;
case 3:
this._Main.MenuBar.menubar.setSelected(tabId);
if (this.tabListeners.has(this.currentTabId))
this.tabListeners.get(this.currentTabId)(false);
if (this.tabListeners.has(tabId))
this.tabListeners.get(tabId)(true);
this.currentTabId = tabId;
this.container
.querySelectorAll('.ntsh_tab')
.forEach(function (tab) { return tab.classList.remove('ntsh_tab-visible'); });
this.container
.querySelector(".ntsh_tab[tabid=\"".concat(tabId, "\"]"))
.classList.add('ntsh_tab-visible');
window.history.pushState({ tab: tabId }, '', "/".concat(tabId).concat(window.location.search));
tabName = {
dashboard: 'Dashboard',
calibration: 'Calibration',
cameralogs: 'Camera Logs',
unitylogs: 'Unity Logs',
}[tabId];
document.title = "NTSH Control - ".concat(tabName);
return [2 /*return*/];
}
});
});
};
TabController.prototype.registerNavigationListener = function () {
var _this = this;
window.addEventListener('popstate', function (event) {
var state = event.state;
if (state && state.tab)
_this.showTab(state.tab);
});
var startTab = window.location.pathname
.replace('/', '')
.split('/')
.shift();
this.showTab(startTab.length > 0 ? startTab : 'dashboard');
};
return TabController;
}());
exports.TabController = TabController;
//# sourceMappingURL=tabController.js.map

Some files were not shown because too many files have changed in this diff Show More