Creating the GenetecVSO macro in the Transportation Sensor Management plugin - To simulate TSS data to be used as Genetec™ events, you must first create the GenetecVSO macro. - Transportation Sensor Management 5.10.5.0 - Plugin and extension guides

Security Center Transportation Sensor Management Plugin Guide 5.10.5.0

Product
Transportation Sensor Management
Content type
Guides > Plugin and extension guides
Version
5.10
Release
5.10.5.0
ft:locale
en-US
Last updated
2025-07-14

To simulate TSS data to be used as Genetec™ events, you must first create the GenetecVSO macro.

What you should know

  • Using the GenetecVSO macro, you can send simulated TSS data.
  • Using the GentecVSO-interval macro, you can send TSS data at an interval for a set amount of time.

    To use this macro, add FrequencySecondsPerEvent and Number_of_runs.

Procedure

  1. Open the System task, then click General settings and select the Events page.
  2. From the entity tree, select the TSS zone data input event, and take note of the string in the Value column.
  3. Select the Macros page.
  4. Click Macro () and enter a name for the macro.
  5. Click the Properties tab.
  6. Copy the following macro in the text editor and configure your TSS Zone Data Input.
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Xml;
    
    using Genetec.Sdk.Helpers;
    using Genetec.Sdk;
    using Genetec.Sdk.Entities;
    using Genetec.Sdk.Entities.CustomEvents;
    using Genetec.Sdk.Entities.Utilities;
    using Genetec.Sdk.Enumerations;
    using Genetec.Sdk.Events;
    using Genetec.Sdk.Queries;
    using Genetec.Sdk.Scripting;
    
    public sealed class TSSZoneDataInputMacro : UserMacro
    {
        public int CustomEventId { get; set; }
    
        public Guid TssGuid { get; set; }
    
        public int ZoneId { get; set; }
    
        public int Count { get; set; }
    
        public string Classification { get; set; }
    
        public int SpeedKPH { get; set; }
    
        public int Occupancy { get; set; }
        
        public Guid PluginEntityGUID {get;set;}
    
        [Serializable]
        public class Volume
        {
            public int Count { get; set; }
            public string Classification { get; set; }
        }
    
        [Serializable]
        public class GenetecZoneData
        {
            public Guid TssGuid { get; set; }
            public int ZoneId { get; set; }
            public List<Volume> Counts { get; set; }
            public int Speed { get; set; }
            public int Occupancy { get; set; }
        }
    
        /// <summary>
        /// Entry point of the macro. Provide an implementation of this method.
        /// </summary>
        public override void Execute()
        {
            if (CustomEventId == 0 || TssGuid == Guid.Empty) return;
    
    
            var data = new GenetecZoneData { TssGuid = TssGuid, ZoneId = ZoneId };
            data.Counts = new List<TSSZoneDataInputMacro.Volume>();
            data.Speed = (int)Math.Round(SpeedKPH * 0.277778);
            data.Occupancy = Occupancy;
            data.Counts.Add(new TSSZoneDataInputMacro.Volume { Count = Count, Classification = Classification });
    
            var evt = Sdk.ActionManager.BuildEvent(EventType.CustomEvent, PluginEntityGUID) as CustomEventInstance;
            if (evt == null) return;
            evt.Id = new CustomEventId(CustomEventId);
            evt.Message = SerializationHelper.SerializeToString(data);
    
            Sdk.ActionManager.RaiseEvent(evt);
        }
    
        /// <summary>
        /// Called when the macro needs to clean up. 
        /// </summary>    
        protected override void CleanUp()
        {
            // Release objects created by the Execute method, unhook events, and so on.
        }
    }
    NOTE: The macro can also be imported from a file.
  7. Click the Default context execution tab, and in the Custom event ID field, enter the Value you copied from the TSS zone data input event.
  8. Click Apply.