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; } }
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()); }
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()); }