update Mi 17. Jun 21:01:01 CEST 2020
This commit is contained in:
parent
45a95cee38
commit
8008e86320
@ -31,7 +31,7 @@ module.exports = function (io, sql, app_cfg, remote_api, saver) {
|
||||
// nur speichern wenn app_id nicht eigenen globalen app_id entspricht
|
||||
if (app_id != app_cfg.global.app_id) {
|
||||
saver.save_new_waip(data, remote_ip, app_id);
|
||||
sql.db_log('API', 'Neuer Wachalarm von ' + remote_ip + ': ' + data);
|
||||
sql.db_log('API', 'Neuer Wachalarm von ' + remote_ip + ': ' + JSON.stringify(data));
|
||||
};
|
||||
});
|
||||
|
||||
@ -43,7 +43,7 @@ module.exports = function (io, sql, app_cfg, remote_api, saver) {
|
||||
if (app_id != app_cfg.global.app_id) {
|
||||
saver.save_new_rmld(data, remote_ip, app_id, function (result) {
|
||||
if (!result) {
|
||||
sql.db_log('API', 'Fehler beim speichern der Rückmeldung von ' + remote_ip + ': ' + data);
|
||||
sql.db_log('API', 'Fehler beim speichern der Rückmeldung von ' + remote_ip + ': ' + JSON.stringify(data));
|
||||
};
|
||||
});
|
||||
};
|
||||
@ -88,7 +88,7 @@ module.exports = function (io, sql, app_cfg, remote_api, saver) {
|
||||
if (app_id != app_cfg.global.app_id) {
|
||||
// nicht erwuenschte Daten ggf. enfernen (Datenschutzoption)
|
||||
saver.save_new_waip(data, app_cfg.endpoint.host, app_id);
|
||||
sql.db_log('API', 'Neuer Wachalarm von ' + app_cfg.endpoint.host + ': ' + data);
|
||||
sql.db_log('API', 'Neuer Wachalarm von ' + app_cfg.endpoint.host + ': ' + JSON.stringify(data));
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ module.exports = function (app_cfg, sql, waip, uuidv4, io, remote_api) {
|
||||
steps: app_cfg.global.circumcircle,
|
||||
units: 'kilometers'
|
||||
})
|
||||
waip_data.ortsdaten.wgs84_area = JSON.stringify(new_buffer);
|
||||
waip_data.ortsdaten.wgs84_area = new_buffer;
|
||||
};
|
||||
// pruefen, ob vielleicht schon ein Einsatz mit einer UUID gespeichert ist
|
||||
sql.db_einsatz_get_uuid_by_enr(waip_data.einsatzdaten.nummer, function (waip_uuid) {
|
||||
@ -92,12 +92,13 @@ module.exports = function (app_cfg, sql, waip, uuidv4, io, remote_api) {
|
||||
|
||||
// Funktion um zu pruefen, ob Nachricht im JSON-Format ist
|
||||
function isValidJSON(text) {
|
||||
try {
|
||||
JSON.parse(text);
|
||||
if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
//the json is ok
|
||||
return true;
|
||||
} catch (error) {
|
||||
} else {
|
||||
//the json is not ok
|
||||
return false;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function validate_waip(data, callback) {
|
||||
|
||||
@ -10,7 +10,6 @@ module.exports = function (db, app_cfg) {
|
||||
|
||||
function db_einsatz_speichern(content, callback) {
|
||||
// Einsatzdaten verarbeiten
|
||||
console.log(content.ortsdaten.wgs84_area);
|
||||
db.run(`INSERT OR REPLACE INTO waip_einsaetze (
|
||||
id, uuid, einsatznummer, alarmzeit, einsatzart, stichwort, sondersignal, besonderheiten, ort, ortsteil, strasse, objekt, objektnr, objektart, wachenfolge, wgs84_x, wgs84_y, wgs84_area)
|
||||
VALUES (
|
||||
@ -31,7 +30,7 @@ module.exports = function (db, app_cfg) {
|
||||
\'` + content.ortsdaten.wachfolge + `\',
|
||||
\'` + content.ortsdaten.wgs84_x + `\',
|
||||
\'` + content.ortsdaten.wgs84_y + `\',
|
||||
\'` + content.ortsdaten.wgs84_area + `\')`,
|
||||
\'` + JSON.stringify(content.ortsdaten.wgs84_area) + `\')`,
|
||||
function (err) {
|
||||
if (err == null) {
|
||||
// letzte Einsatz-ID ermitteln
|
||||
|
||||
@ -20,7 +20,7 @@ module.exports = function (app_cfg, sql, saver) {
|
||||
function send_message(message) {
|
||||
udp_server.send(message, 0, message.length, app_cfg.global.udpport, 'localhost', function (err, bytes) {
|
||||
if (err) throw err;
|
||||
sql.db_log('UDP-Testalarm an Localhost (Port ' + app_cfg.global.udpport + ') gesendet.');
|
||||
sql.db_log('WAIP', 'UDP-Testalarm an localhost:' + app_cfg.global.udpport + ') gesendet.');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user