UNPKG

node-red-contrib-snap4city-milestone

Version:

Node-Red integration to communicate with Milestone XProtect VMS

273 lines (231 loc) 10.2 kB
<!--/* 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-alarm-list', { category: 'S4CMilestone', color: '#fde910', icon: 'icons/logocam.png', inputs: 1, outputs: 1, label: 'Print Alarm List From XProtect', defaults: { hostname: { type: 'text' }, port: { type: 'text' }, maxLines: { type: 'text' }, order: { type: 'text' }, target: { type: 'text' }, } }); </script> <script type="text/html" data-template-name="x-alarm-list"> <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:22331)"> </div> <div class="form-row"> <label for="node-input-maxLines"><i class="fa fa-tag"></i>Max lines</label> <input type="text" id="node-input-maxLines" placeholder="Max lines"> </div> <div class="form-row"> <label for="node-input-order"><i class="fa fa-tag"></i>Order</label> <select id="node-input-order" type="text"> <option value ="Descending">Descending</option> <option value="Ascending">Ascending</option> </select> </div> <div class="form-row"> <label for="node-input-target"><i class="fa fa-tag"></i>Target</label> <select id="node-input-target" type="text"> <option value="LocalId">Id</option> <option value="Timestamp">Timestamp</option> <option value="StateName">StateName</option> <option value="SourceName">SourceName</option> <option value="Type">Type</option> </select> </div> </script> <script type="text/x-red" data-help-name="x-alarm-list"> <p>With this node you can retrieve the list of alarms/events from the event server</p> <h3>Inputs</h3> <p>A JSON with these parameters:</p> <dl class="message-properties"> <dt>hostname <span class="property-type">string</span> </dt> <dd>The hostname where the Event Server of 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 you to connect at the event server(default 22331). Check the XProtect documentation for more details. <b>(mandatory)</b></dd> <dt>maxLines <span class="property-type">number</span> </dt> <dd>Max lines of alarm to display from the event server <b>(mandatory)</b></dd> <dt>order <span class="property-type">string</span> </dt> <dd>The sorting type for the alarms.(Basically descending/ascending displayed in a drop-down menu in node properties). <b>(mandatory)</b></dd> <dt>target <span class="property-type">string</span> </dt> <dd>The target property of the sorting for the alarms.(They're displayed with a drop-down menu in node properties). <b>(mandatory)</b></dd> </dl> <h3>Outputs</h3> <p>A JSON array which contains an alarm for each item, if the node works, with these informations:</p> <dl class="message-properties"> <dt>CameraId <span class="property-type">string</span> </dt> <dd>The Id of the camera corresponding to the alarm/event</dd> <dt>Category <span class="property-type">number</span> </dt> <dd>The category of the alarm/event</dd> <dt>CustomTag <span class="property-type">string</span> </dt> <dd>A tag associated with the alarm/event when it is triggered</dd> <dt>Description <span class="property-type">string</span> </dt> <dd>A short description of the alarm/event</dd> <dt>FilterMatch <span class="property-type">boolean</span> </dt> <dd>True or false, depending on the configuration of the filter</dd> <dt>Id <span class="property-type">string</span> </dt> <dd>The Id associated with the alarm/event in the VMS</dd> <dt>LocalId <span class="property-type">number</span> </dt> <dd>The relative Id associated with the alarm/event in the list</dd> <dt>Location <span class="property-type">string</span> </dt> <dd>Where the alarm/event is located in the VMS</dd> <dt>Message <span class="property-type">string</span> </dt> <dd>The message contained in the alarm/event when it triggered</dd> <dt>Modified <span class="property-type">datetime</span> </dt> <dd>Timestamp when the alarm/event was modified last time</dd> <dt>Name <span class="property-type">string</span> </dt> <dd>Name of the alarm/event in the VMS</dd> <dt>Priority <span class="property-type">number</span> </dt> <dd>The priority level of the alarm/event in the VMS</dd> <dt>Priority Name <span class="property-type">string</span> </dt> <dd>The priority associated at the priority number above</dd> <dt>RuleType <span class="property-type">string</span> </dt> <dd>The type of the rule associated with the alarm/event in the VMS</dd> <dt>SourceId <span class="property-type">string</span> </dt> <dd>The Id of the camera associated with the alarm/event in the VMS</dd> <dt>SourceName <span class="property-type">string</span> </dt> <dd>The name of the camera associated with the alarm/event in the VMS</dd> <dt>State <span class="property-type">number</span> </dt> <dd>The state of the alarm/event in the VMS when it triggered</dd> <dt>StateName <span class="property-type">string</span> </dt> <dd>The name associated at the state number above</dd> <dt>Timestamp <span class="property-type">datetime</span> </dt> <dd>Timestamp when the alarm/event was triggered</dd> <dt>Type <span class="property-type">string</span> </dt> <dd>The type of alarm/event in the VMS</dd> <dt>VendorName <span class="property-type">string</span> </dt> <dd>The vendor of the alarm/event in the VMS</dd> </dl> <p>A JSON object with these parameters, if the node doesn't work:</p> <dl class="message-properties"> <dt>error <span class="property-type">string</span> </dt> <dd>The type of error generated by the operation</dd> <dt>description <span class="property-type">string</span> </dt> <dd>A more accurate description to help resolve the issue</dd> </dl> <h3>Example of JSON output if the operation works:</h3> <dl class="exampleJson"> <dd> <pre> { Camerald: "ef06380b-88b8-4545-a93f-0e76b95b7434", Category: "0", CustomTag: "TagFromXML", Description: "test send event block-IJJ Analytics event description, FilterMatch: "true", Id: "ae5efc61-bb48-45dc-abd9-cbeba3a17660", LocalId: "197", Location: " Event location 1, Message: "MyAnalyticsEvent01", Modified: "2023-06-06716:58:00.59Z", Name: "MyAnalyticsAlarm01", Priority: "1", PriorityName: "High", RuleType: "4547f085-8b68-4639-826f-8722afbOffc5", Sourceld: "ef06380b-88b8-4545-a93f-0e76b95b7434", SourceName: "AXIS Q1951-E Thermal Camera (192.168.1.000) - Telecamera 1", State: "1", StateName: "New", Timestamp: "2023-06- 06716:58:00.557Z", Type: "MyType", VendorName: "My Smart Video" } </pre> </dd> </dl> <h3>Example of JSON output if the operation goes wrong:</h3> <dl class="exampleJson"> <dd> <pre> { error: "500 Internal Server Error", description: "The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://videoos.net/2/CentralServerAlarmCommand:maxCount. The InnerException message was 'There was an error deserializing the object of type System.Int32. The value " cannot be parsed as the type 'Int32'.'. Please see InnerException for more details." } </pre> </dd> </dl> <h3>Details</h3> <p>The node can receive the parameters described in the Inputs section, with them generates a XML file with which a SOAP request is sent to the event server. A server response with the alarm list 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>