Commit 1e396e24 authored by Roque's avatar Roque Committed by Kazuhiko Shiozaki

erp5_officejs_drone_simulator: changes to make "test drone flight" work

- drone simulator getContent returns console logs if debug mode
parent 617d14cb
......@@ -3,6 +3,8 @@
unparam: true */
var GAMEPARAMETERS = {};
//for DEBUG/TEST mode
var baseLogFunction = console.log, console_log = "";
/******************************* DRONE MANAGER ********************************/
var DroneManager = /** @class */ (function () {
......@@ -549,6 +551,15 @@ var GameManager = /** @class */ (function () {
FixedWingDroneAPI: FixedWingDroneAPI,
DroneLogAPI: DroneLogAPI
};
if (this._game_parameters_json.debug_test_mode) {
console.log = function () {
baseLogFunction.apply(console, arguments);
var args = Array.prototype.slice.call(arguments);
for (var i = 0;i < args.length;i++) {
console_log += args[i] + "\n";
}
};
}
}
Object.defineProperty(GameManager.prototype, "gameParameter", {
......@@ -563,7 +574,11 @@ var GameManager = /** @class */ (function () {
var gadget = this;
return gadget._init()
.push(function () {
return gadget._flight_log;
return {
'message': gadget._result_message,
'content': gadget._flight_log,
'console_log': console_log
};
});
};
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1009.36979.45339.6075</string> </value>
<value> <string>1010.3592.54606.53538</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1688635184.98</float>
<float>1690478004.4</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -555,9 +555,9 @@
.push(function (result) {
var a, blob, div, key, log, log_content;
i = 0;
for (key in result) {
if (result.hasOwnProperty(key)) {
log_content = result[key].join('\n').replaceAll(",", ";");
for (key in result.content) {
if (result.content.hasOwnProperty(key)) {
log_content = result.content[key].join('\n').replaceAll(",", ";");
blob = new Blob([log_content], {type: 'text/plain'});
a = domsugar('a', {
text: 'Download Simulation LOG ' + i,
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1009.22574.47206.13909</string> </value>
<value> <string>1009.59163.16294.47701</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1687785962.67</float>
<float>1690477710.21</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment