node-red-contrib-snap4city-milestone
Version:
Node-Red integration to communicate with Milestone XProtect VMS
128 lines (111 loc) • 5.1 kB
HTML
<!--/* NODE-RED-CONTRIB-SNAP4CITY-MILESTONE
Copyright (C) 2023 DISIT Lab http://www.disit.org - University of Florence
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */-->
<script type="text/javascript">
RED.nodes.registerType('x-send-event', {
category: 'S4CMilestone',
color: '#fde910',
icon: 'icons/logocam.png',
inputs: 1,
outputs: 1,
label: this.name || 'Send Event to XProtect',
defaults: {
name: { type: 'text' },
guid: { type: 'text' },
hostname: { type: 'text' },
port: { type: 'text' },
description: { type: 'text' }
}
});
</script>
<script type="text/html" data-template-name="x-send-event">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i>Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-guid"><i class="fa fa-tag"></i>Guid </label>
<input type="text" id="node-input-guid" placeholder="GUID">
</div>
<div class="form-row">
<label for="node-input-hostname"><i class="fa fa-tag"></i>Hostname</label>
<input type="text" id="node-input-hostname" placeholder="Hostname(default:localhost)">
</div>
<div class="form-row">
<label for="node-input-port"><i class="fa fa-tag"></i>Port</label>
<input type="text" id="node-input-port" placeholder="Port(default:9090)">
</div>
<div class="form-row">
<label for="node-input-description"><i class="fa fa-tag"></i>Description</label>
<input type="text" id="node-input-description" placeholder="Description">
</div>
</script>
<script type="text/x-red" data-help-name="x-send-event">
<p>With this node you can send an event to the event server and trigger an Alarm with the possibility to activate a rule associated with it.
</p>
<h3>Inputs</h3>
<p>A JSON with these parameters:</p>
<dl class="message-properties">
<dt>name
<span class="property-type">string</span>
</dt>
<dd>The name of the event which will be send and trigger. The event must exist in the VMS. <b>(mandatory)</b></dd>
<dt>guid
<span class="property-type">string</span>
</dt>
<dd>The Guid associated with a hardware device in the Milestone VMS(e.g. Camera, Microphone). Device must be registered. <b>(mandatory)</b></dd>
<dt>hostname
<span class="property-type">string</span>
</dt>
<dd>The hostname where the Milestone VMS runs on. Only http or https are allowed(default localhost). <b>(mandatory)</b></dd>
<dt>port
<span class="property-type">number</span>
</dt>
<dd>The port that allows send analytics events to the VMS, which must be activated(default 9090). Check the XProtect documentation for more details. <b>(mandatory)</b></dd>
<dt>Description
<span class="property-type">string</span>
</dt>
<dd>A short description of the event which will be send. If it's generated from Snap4City will contain name, GPS position, severity, impact etc.. (optional)</dd>
</dl>
<h3>Outputs</h3>
<p>A JSON object with these parameters:</p>
<dl class="message-properties">
<dt>messagge
<span class="property-type">string</span>
</dt>
<dd>The result of the send operation to VMS, with any error</dd>
</dl>
<h3>Example of JSON output if the opreation is correct:</h3>
<dl class="exampleJson">
<dd>
<pre>
{
message: "OK Event sent correctly"
}
</pre>
</dd>
</dl>
<h3>Example of JSON output if operation goes wrong:</h3>
<dl class="exampleJson">
<dd>
<pre>
{
message: "Connection error: TypeError[ERR_INVALID_URL]:Invalid URL:http://wrongaddress:9090"
}
</pre>
</dd>
</dl>
<h3>Details</h3>
<p>The node can receive the parameters described in the Inputs section, with them generates a XML file readable from the event server, and with server response
generates the output JSON. If the values are not present in the input JSON, these are read by those in the node properties. If they are not present
in either part or are wrong, an error is generated for the necessary parameters or the reason why are not correct.</p>
</script>