/**
* Class offers testing of events
* @class
*/
class EventsTest {
/**
* @constructor
* @param {object} logger Logger to be used
*/
constructor(logger) {
this.logger = logger;
}
/**
* Fires a event for testing purposes
* @param {string} eventName name of event to be fired
*/
testEvent(eventName, callback) {
if (eventName === 'event_new_alarm') {
this.event_new_alarm();
return callback(true);
}
}
/**
* Implementation of event-specific methods
*/
/**
* TEST EVENT for testing an incoming alarm
*/
event_new_alarm() {
const Operation = require('./core/core_operation');
let operation = new Operation();
operation.setUUID(); // Calculate new GUID for this operation object as a unique identifier
console.log('EVENT-TEST | Set new guid for test operation to: ' + operation.uuid.value);
operation.operationnumber = 'Einsatznummer';
operation.subject = 'PROBEALARM';
operation.message = 'Probealarm ausgelöst durch Admin in ALARMiator';
operation.object = '-';
operation.operationSourceConnector = 'core';
operation.operationState = 0;
operation.section = '-';
operation.street = 'Nürnberger Straße 20';
operation.community = 'Reichenschwand';
operation.district = 'Oberndorf';
operation.gear = 'FF Reichenschwand\nFL Reichenschwand 60-40-01';
operation.keywordCategory = 'PA';
operation.keywordId = 'T2911';
operation.keywordName = 'Probealarm';
operation.keywordRaw = '#T2911#PA#Probealarm';
operation.location = 'Reichenschwand';
operation.zveis = '24423, 24133, 24427, 24435, 24005F, 24706F, 24401, 24402';
operation.alarmdate = '24.07.2020';
operation.alarmtime = '15:38:39';
operation.gkx = '4451038.87';
operation.gky = '5471198.2';
operation.lat = '49.375792685925724';
operation.lon = '11.324317673609638';
// Send Event to PluginManager
global.plgManager.event_new_alarm(operation);
}
}
module.exports = EventsTest;