LAPI-298: Update settings in default.toml

This commit is contained in:
Sergiu Toma 2019-09-25 17:31:02 +03:00
parent ea2e0168d3
commit 12619dcd67
4 changed files with 9 additions and 7 deletions

4
.gitignore vendored
View File

@ -1,2 +1,4 @@
node_modules node_modules
.vscode .vscode
logs/*
!logs

View File

@ -14,7 +14,9 @@ accept_untrusted_certs = true
[settings] [settings]
send_voice = true send_voice = true
send_gps = false send_gps = false
gps_report_interval = 1000 # The interval in which the GPS is sent gps_report_interval = 4000 # The interval in which the GPS is sent
gps_lat_start_point = 46.217802
gps_lng_start_point = 24.776126
[assets] [assets]
# ids = [1947] # ids = [1947]

View File

@ -426,12 +426,11 @@ class Asset {
} }
_sendGPS(callback) { _sendGPS(callback) {
console.log('_sendGPS')
let hub = this.hub; let hub = this.hub;
if (hub && hub.connected) { if (hub && hub.connected) {
let lat = 46.217802; let lat = this.configs.settings.gps_lat_start_point;
let lng = 24.776126; let lng = this.configs.settings.gps_lng_start_point;
setInterval(() => { setInterval(() => {
var new_lat = this._randomCoordinates(lat); var new_lat = this._randomCoordinates(lat);
@ -453,7 +452,6 @@ class Asset {
lat = new_lat; lat = new_lat;
lng = new_lng; lng = new_lng;
console.log('_sendGPS | lat:', lat, ' | lng:', lng)
}, this.configs.settings.gps_report_interval); }, this.configs.settings.gps_report_interval);
} }
} }

View File

@ -3,7 +3,7 @@ const moment = require('moment');
module.exports.writeLog = async (value) => { module.exports.writeLog = async (value) => {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
await fs.writeFile('./logs/simulator-log', `[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${value}\n`, {'flag':'a'}, function(err) { await fs.writeFile('./logs/simulator-log', `[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${value}\n`, {'flag':'a'}, (err) => {
if (err) { reject(err); } if (err) { reject(err); }
else { resolve(); } else { resolve(); }
}); });