示例#1
0
 public void Run()
 {
     try
     {
         AgentServiceClient agentClient = new AgentServiceClient();
         IsRunning = true;
         while (IsRunning)
         {
             lock (OpcCommunication.GetLockObject(serverUrl))
             {
                 if (!IsRunning)
                 {
                     break;
                 }
                 if (OpcCommunication.ServerIsConnected(serverUrl))
                 {
                     agentClient.PostResult(DecisionsAgent.SessionUserContext, DecisionsAgent.AGENT_ID, InstructionId, new AgentInstructionsResult());
                 }
             }
             Thread.Sleep(5000);
         }
     }
     catch
     {
         IsRunning = false;
     }
 }
示例#2
0
 public AgentInstructionsResult HandleInstructions(AgentInstructions instruction)
 {
     OpcCommunication.RemoveEventGroup(
         instruction.Data.GetValueByKey <string>("opcServerUrl"),
         instruction.Data.GetValueByKey <string>("eventId")
         );
     return(new AgentInstructionsResult());
 }
 public AgentInstructionsResult HandleInstructions(AgentInstructions instruction)
 {
     OpcCommunication.SetTagValues(
         instruction.Data.GetValueByKey <string>("opcServerUrl"),
         instruction.Data.GetValueByKey <BaseTagValueWrapper>("valuesWrapper")
         );
     return(new AgentInstructionsResult());
 }
示例#4
0
 public AgentInstructionsResult HandleInstructions(AgentInstructions instruction)
 {
     OpcCommunication.StartListening(
         instruction.Data.GetValueByKey <string>("opcServerUrl"),
         instruction.Id,
         instruction.Data.GetValueByKey <OpcEventGroup[]>("eventGroups")
         );
     return(new AgentInstructionsResult());
 }
        public AgentInstructionsResult HandleInstructions(AgentInstructions instruction)
        {
            OpcInitialData result = OpcCommunication.GetInitialData(
                instruction.Data.GetValueByKey <string>("opcServerUrl"),
                instruction.Data.GetValueByKey <bool>("valuesOnly")
                );

            return(new AgentInstructionsResult
            {
                Data = new DataPair[]
                {
                    new DataPair("initialData", result)
                }
            });
        }
 public AgentInstructionsResult HandleInstructions(AgentInstructions instruction)
 {
     OpcCommunication.StopListening(instruction.Data.GetValueByKey <string>("opcServerUrl"));
     return(new AgentInstructionsResult());
 }