/// <summary> /// The set selected com port. /// </summary> /// <param name="selectedComPort"> /// The selected com port. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> private bool SetSelectedComPort(CommunicationSetting selectedComPort) { bool isPassed = true; if (selectedComPort != null) { if (selectedComPort.IsValidlyConfigured) { // valide konfiguriert => starte das setzen des parameters if (!SpecificFlows.SetCommunicationUnit.Run(selectedComPort.SettingValue)) { isPassed = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "[" + selectedComPort.SettingName + "] was not set correctly."); } isPassed &= true; Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "[" + selectedComPort.SettingName + "] was set to [" + selectedComPort.SettingValue + "]."); } else { // invalide konfiguriert => test schlägt fehl isPassed = false; } } else { isPassed &= true; } return(isPassed); }
// Update is called once per frame //void Update() //{ // if (Input.GetKeyDown(KeyCode.P)) // { // Screen.fullScreen = !Screen.fullScreen; // } //} /// <summary> /// 获取系统设置 /// </summary> public static void GetSystemSetting() { string path = Application.dataPath + ConfigPath; if (!File.Exists(path)) { CreateSystemSettingXml(); } else { systemSetting = SerializeHelper.DeserializeFromFile <SystemSetting>(path); } Log.Error("SystemSettingHelper.GetSystemSetting" + systemSetting.IsShowLeftTopo); resolutionSetting = systemSetting.ResolutionSetting; cinemachineSetting = systemSetting.CinemachineSetting; communicationSetting = systemSetting.CommunicationSetting; versionSetting = systemSetting.VersionSetting; refreshSetting = systemSetting.RefreshSetting; assetLoadSetting = systemSetting.AssetLoadSetting; honeyWellSetting = systemSetting.HoneyWellSetting; deviceSetting = systemSetting.DeviceSetting; historyPathSetting = systemSetting.HistoryPathSetting; alarmSetting = systemSetting.AlarmSetting; ///如果版本号不一致,自动更新 if (versionSetting.VersionNumber != SystemSettingHelper.instance.versionNum) { versionSetting.VersionNumber = SystemSettingHelper.instance.versionNum; SaveSystemSetting(); } locationSetting = systemSetting.LocationSetting; debugSetting = systemSetting.DebugSetting; }
public bool Run(Communication communication) { CommunicationSetting ipAddress = communication.GetSpecificSetting("IP Address"); CommunicationSetting foundDevice = communication.GetSpecificSetting("Found devices"); CommunicationSetting port = communication.GetSpecificSetting("Port"); CommunicationSetting timeout = communication.GetSpecificSetting("Timeout"); bool isPassed = true; /* Execution: * 1) Check if module is ready * 2) Click the refresh button to make sure all comm units are recognized (can eventually be skipped) * 3) Set parameters */ if (WaitUntilModuleIsReady.Run(Common.DefaultValues.GeneralTimeout)) { isPassed &= this.SetIpAddress(ipAddress); isPassed &= this.SetFoundDevice(foundDevice); isPassed &= this.SetPort(port); isPassed &= this.SetTimeout(timeout); } else { isPassed = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "DTM was not ready after " + Common.DefaultValues.GeneralTimeout + " seconds"); } return(isPassed); }
public CollectorController(PRSContext context, CollectorService hostedService) { this.context = context; this.communicationSetting = new CommunicationSetting(); this.systemAPIPort = communicationSetting.communicationPort.systemAPIPort; this.userRepository = new Repository <Models.Models.User>(this.context); this.collectorService = hostedService; }
public CalculateController() { this.communicationSettings = new CommunicationSetting(); this.systemAPIPort = communicationSettings.communicationPort.systemAPIPort; this.userAPIPort = communicationSettings.communicationPort.userAPIPort; this.collectorAPIPort = communicationSettings.communicationPort.collectorAPIPort; this.calculateAPIPort = communicationSettings.communicationPort.calculateAPIPort; }
public UserController(PRSContext context) { this.context = context; this.userRepository = new Repository <Models.Models.User>(this.context); this.contactRepository = new Repository <Contact>(this.context); this.communicationSetting = new CommunicationSetting(); this.mainApiPort = communicationSetting.communicationPort.mainAPIPort; this.utilities = new Utilities(); }
public MainController() { this.communicationSettings = new CommunicationSetting(); this.systemAPIPort = communicationSettings.communicationPort.systemAPIPort; this.userAPIPort = communicationSettings.communicationPort.userAPIPort; this.collectorAPIPort = communicationSettings.communicationPort.collectorAPIPort; this.calculateAPIPort = communicationSettings.communicationPort.calculateAPIPort; Debug.WriteLine($"systemAPIPort: {systemAPIPort} | userAPIPort: {userAPIPort} | collectorAPIPort: {collectorAPIPort} | calculateAPIPort: {calculateAPIPort}"); }
public SystemSetting() { ResolutionSetting = new ResolutionSetting(); CinemachineSetting = new CinemachineSetting(); CommunicationSetting = new CommunicationSetting(); VersionSetting = new VersionSetting(); RefreshSetting = new RefreshSetting(); AssetLoadSetting = new AssetLoadSetting(); HoneyWellSetting = new HoneyWellSetting(); DeviceSetting = new DeviceSetting(); HistoryPathSetting = new HistoryPathSetting(); LocationSetting = new LocationSetting(); DebugSetting = new DebugSetting(); AlarmSetting = new AlarmSetting(); }
/// <summary> /// Performs the configuration of the CDI Communication FXA291 Communication DTM /// </summary> /// <param name="communication"> /// The communication. /// </param> /// <returns> /// <br>True: if configuration was successful</br> /// <br>False: if configuration was unsuccessful or errors occurred</br> /// </returns> public bool Run(Communication communication) { CommunicationSetting selectedComPort = communication.GetSpecificSetting("Selected COM port:"); CommunicationSetting baudRate = communication.GetSpecificSetting("Baud rate:"); bool isPassed = true; /* Execution: * 1) Check if module is ready * 2) Click the refresh button to make sure all comm units are recognized (can eventually be skipped) * 3) Set the comm unit (combobox list item will get selected after a string compare) * 4) Set the baud rate, if flag is set in preconditions */ if (Functions.ApplicationArea.Validation.WaitUntilModuleIsReady.Run(30000)) { if (SpecificFlows.ClickRefreshButton.Run()) { isPassed &= this.SetSelectedComPort(selectedComPort); isPassed &= this.SetBaudRate(baudRate); } else { isPassed = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Could not click button [Refresh]"); } } else { isPassed = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "DTM was not ready after 30 seconds"); } Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Configuration is done."); return(isPassed); }
/// <summary> /// Performs the configuration of the HART Communication DTM /// </summary> /// <param name="communication"> /// The communication. /// </param> /// <returns> /// <br>True: if configuration was successful</br> /// <br>False: if configuration was unsuccessful or errors occurred</br> /// </returns> public bool Run(Communication communication) { /* Class initialization */ SpecificFlows.ClickButtonApply clickApply = new SpecificFlows.ClickButtonApply(); SpecificFlows.SetSerialInterface setModem = new SpecificFlows.SetSerialInterface(); SpecificFlows.SetStartAddress setStartAddress = new SpecificFlows.SetStartAddress(); SpecificFlows.SetEndAddress setEndAddress = new SpecificFlows.SetEndAddress(); SpecificFlows.SetCommunicationInterface setCommInterface = new SpecificFlows.SetCommunicationInterface(); Functions.ApplicationArea.Validation.WaitUntilModuleIsReady waitForReady = new Functions.ApplicationArea.Validation.WaitUntilModuleIsReady(); CommunicationSetting communicationInterface = communication.GetSpecificSetting("Communication interface"); CommunicationSetting serialInterface = communication.GetSpecificSetting("Serial Interface"); // CommunicationSetting master = communication.GetSpecificSetting("Master"); // CommunicationSetting preamble = communication.GetSpecificSetting("Preamble"); // CommunicationSetting retries = communication.GetSpecificSetting("Number of communication retries"); CommunicationSetting startAddress = communication.GetSpecificSetting("Start address"); CommunicationSetting endAddress = communication.GetSpecificSetting("End address"); bool isPassed = true; if (waitForReady.Run(30000)) { if (communicationInterface != null) { if (!setCommInterface.Run(communicationInterface.SettingValue)) { isPassed = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), communicationInterface.SettingName + " was not set correctly."); } } if (serialInterface != null) { if (!setModem.Run(serialInterface.SettingValue)) { isPassed = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), serialInterface.SettingName + " was not set correctly."); } } //if (master != null) //{ // if (!setMaster.Run(master.SettingValue)) // { // isPassed = false;; // Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), master.SettingName + " was not set correctly."); // } //} //if (preamble != null) //{ // if (!setPreamble.Run(preamble.SettingValue)) // { // isPassed = false; // Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), preamble.SettingName + " was not set correctly."); // } //} //if (retries != null) //{ // if (!setRetries.Run(retries.SettingValue)) // { // isPassed = false; // Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), retries.SettingName + " was not set correctly."); // } //} if (startAddress != null) { if (!setStartAddress.Run(startAddress.SettingValue)) { isPassed = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), startAddress.SettingName + " was not set correctly."); } } if (endAddress != null) { if (!setEndAddress.Run(endAddress.SettingValue)) { isPassed = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), endAddress.SettingName + " was not set correctly."); } } if (clickApply.Run()) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Configuration done"); } } else { isPassed = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "DTM was not ready after 30 seconds"); } return(isPassed); }
public CollectorService(ILogger <CollectorService> serviceLogger) { this.serviceLogger = serviceLogger; this.communicationSetting = new CommunicationSetting(); }