void TriggerAlarm(SensorValueModel sensorValue)
 {
     if (IsAlarmEnabled && sensorValue.AlarmTriggerEnabled)
     {
         StartAlarmSound();
         AddAlarmTriggerEvent(new EventModel(DateTime.Now, sensorValue.ParameterName));
         SendSirenOnMessageToAlarmUIClients();
     }
 }
        public MainViewModel(CoreDispatcher dispatcher, IIOTServer iotServer, IAudioPlayer audioPlayer)
        {
            this.iotServer   = iotServer;
            this.audioPlayer = audioPlayer;
            this.dispatcher  = dispatcher;

            Events             = new ObservableCollection <EventModel>();
            AlarmTriggerEvents = new ObservableCollection <EventModel>();

            Rssi = new SensorValueModel("rssi");
            Rssi.DisableUIColor            = true;
            DisconnectCount                = new SensorValueModel("disconnect count");
            DisconnectCount.DisableUIColor = true;
            DisconnectCount.Update(0);

            Sector0   = new SensorValueModel("sector0", false, TriggerAlarm);
            Movement0 = new SensorValueModel("movement0", true, TriggerAlarm);

            Parameters = new List <SensorValueModel>
            {
                Rssi,
                Sector0,
                Movement0
            };

            AlarmTriggers = new List <SensorValueModel>
            {
                Sector0,
                Movement0
            };

            StopAlarmCommand           = new UICommand(StopAlarmSound, false);
            AlarmToggleCommand         = new UICommand(AlarmToggleAction, true);
            StatusQueryCommand         = new UICommand(QueryAllClientsStatus, false);
            CloseAllConnectionsCommand = new UICommand(CloseAllConnections, false);
            ToggleSirenCommand         = new UICommand(ToggleSiren, false);
        }