Exemplo n.º 1
0
        /// <summary>
        /// Sends the telecontrol command.
        /// </summary>
        public void SendCommand(TeleCommand command, WriteFlags writeFlags, out CommandResult commandResult)
        {
            if (command.CnlNum > 0)
            {
                // validate and send command
                coreLogic.SendCommand(command, writeFlags, out commandResult);
            }
            else
            {
                // process acknowledgment command that can only be sent by module
                if (command.CmdCode == ServerCmdCode.AckEvent)
                {
                    coreLogic.AckEvent(new EventAck
                    {
                        EventID   = BitConverter.DoubleToInt64Bits(command.CmdVal),
                        Timestamp = command.CreationTime,
                        UserID    = command.UserID
                    }, false, false);
                }

                // set command ID and creation time
                if (command.CommandID <= 0)
                {
                    DateTime utcNow = DateTime.UtcNow;
                    command.CommandID    = ScadaUtils.GenerateUniqueID(utcNow);
                    command.CreationTime = utcNow;
                }

                // pass command directly to clients
                listener.EnqueueCommand(command);
                commandResult = new CommandResult(true);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sends the telecontrol command.
 /// </summary>
 public void SendCommand(TeleCommand command, out CommandResult commandResult)
 {
     if (command.OutCnlNum > 0)
     {
         // validate and send command
         coreLogic.SendCommand(command, out commandResult);
     }
     else
     {
         // pass command directly to clients
         listener.EnqueueCommand(command);
         commandResult = new CommandResult(true);
     }
 }