public void GetValueAsStringTest() { String partialID = "MIB_05"; String expected = "1"; String received = VigoHandling.GetValueAsString(physID, partialID); Assert.AreEqual(expected, received); }
public void SetValueTest() { String partialID = "Probe_01.Temperature.Setup[0]"; object settingValue = "True"; bool success = VigoHandling.SetValue(physID + partialID, settingValue); if (!success) { Assert.Fail("Could not set {0} as value into the VIGO physID {1}", settingValue, (physID + partialID)); } Assert.AreEqual(VigoHandling.GetValueAsString(physID + partialID), settingValue); VigoHandling.SetValue(physID + partialID, "False"); }
private void AxMibocx2_SelChange(object sender, EventArgs e) { String physID = axMibocx2.PhysId.ToString(); textBoxPhysicalID.Text = physID; try { if (!connectionError) { textBoxValue.Text = VigoHandling.GetValueAsString(physID); } } catch { connectionError = true; MessageBox.Show("You must run the Vigo Server to retrieve the values!"); textBoxValue.Text = CONN_ERROR_TEXT; } }
public static void SetAlarmSetpoint(int probeNumber, String setpoint, String alarmType) { CompleteAction("SetAlarmSetpoint " + alarmType + ": " + setpoint, () => { //High alarm Setpoint PacificDisplayHandling.AlarmHandler.ClickMenuItem(2); Thread.Sleep(300); PacificDisplayHandling.KeypadHandler.ClickKeypad(PacificDisplayHandling.KeypadHandler.KeypadKeys.Clr); PacificDisplayHandling.KeypadHandler.ClickKeypad(setpoint); Thread.Sleep(300); PacificDisplayHandling.ClickTaskbarItem(3); Thread.Sleep(600); }, () => { //Is the value set correctly? String vigoSetPoint = VigoHandling.GetValueAsString("Commander6:Master_Box_1.Pacific.Pacific_127.Probe_0" + probeNumber + ".Temperature.Measurement.Temperature.Setpoints." + alarmType + " alarm.Setpoint"); //Console.WriteLine("High alarm Setpoint: ", highAlarm.Replace(",", ".").Equals(vigoSetPoint.Replace(",", "."))); return(parseDoubleCustom(setpoint).Equals(parseDoubleCustom(vigoSetPoint))); }, () => { //Fail-safe int index = alarmType.Equals("High") ? 1 : 2; PacificDisplayHandling.AlarmHandler.SetTab(index); Thread.Sleep(200); }, 1, 2000); }
public static void SetAlarmEnabled(int probeNumber, bool enabled, int tabNumber) //1st tab = 3, 2nd = 4, 3rd = 5 and 4th = 6 { CompleteAction("SetAlarmEnabled #" + tabNumber + ": " + enabled, () => { Console.WriteLine("Running AlarmEnabled Action"); PacificDisplayHandling.AlarmHandler.ClickMenuItem(1); Thread.Sleep(500); }, () => { //Is the value set correctly? String vigoString = "Commander6:Master_Box_1.Pacific.Pacific_127.Probe_0" + probeNumber + ".Temperature.Measurement.Temperature.Setpoints.Enable alarms[" + (tabNumber + 2) + "]"; Console.WriteLine("Retrieving value from: {0}", vigoString); String alarmEnabled = VigoHandling.GetValueAsString(vigoString); Console.WriteLine("Found Vigo Value: {0}", alarmEnabled); bool result = alarmEnabled.Equals(enabled.ToString()); Console.WriteLine("Running AlarmEnabled Confirmation: {0}", result); return(result); }, () => { //Fail-safe Console.WriteLine("Running AlarmEnabled Fail-Safe"); PacificDisplayHandling.AlarmHandler.SetTab(tabNumber); Thread.Sleep(200); }); }