using System; using System.Collections.Generic; using System.Text; //using System.Runtime.InteropServices; namespace FusionCOM { public interface IServer { String GetAnalogueValue(int UID); String GetDigitalOutValue(int UID); String GetDigitalInValue(int UID); } public class Server : IServer { List AIValues = new List(); List DOValues = new List(); List DIValues = new List(); public void SetupRRExtensionClass(List MainAIList, List MainDOList, List MainDIList) { for (int i = 0; i < MainAIList.Count; i++) { AIValues.Add(MainAIList[i].CurrentEvaluatedValue); } for (int i = 0; i < MainDOList.Count; i++) { DOValues.Add(MainDOList[i].OnOrOff); } for (int i = 0; i < MainDIList.Count; i++) { DIValues.Add(MainDIList[i].CurrentStateDI); } } public String GetAnalogueValue(int UID) { if (AIValues.Count > UID) { return AIValues[UID].ToString(); } else { return "ERROR"; } } public bool SetAnalogueValue(int UID, double newValue) { if (AIValues.Count > UID) { AIValues[UID] = newValue; return true; } else { return false; } } public String GetDigitalOutValue(int UID) { if (DOValues.Count > UID) { return DOValues[UID].ToString(); } else { return "ERROR"; } } public bool SetDigitalOutValue(int UID, bool newValue) { if (DOValues.Count > UID) { DOValues[UID] = newValue; return true; } else { return false; } } public String GetDigitalInValue(int UID) { if (DIValues.Count > UID) { return DIValues[UID].ToString(); } else { return "ERROR"; } } public bool SetDigitalInValue(int UID, bool newValue) { if (DIValues.Count > UID) { DIValues[UID] = newValue; return true; } else { return false; } } } }