public void ShowRadios() { using (SerialCOM dutport = getDUTPort()) { // Make sure we can talk to hub dutport.WaitForPrompt(); dutport.WriteWait("show radios", "Zwave Stack Version", timeout_sec: 5, clear_data: false); string data = dutport.Data; Match m = Regex.Match(data, @"Z-Wave (\d+\.\d+)", RegexOptions.Singleline); if (m.Success && m.Groups.Count > 1) { string verstr = m.Groups[1].Value; fire_status("Zwave Stack Version: " + verstr); bool needToUpdate = needsUpdate(verstr, _zwave_ver_major, _zwave_ver_minor); if (needToUpdate) { throw new Exception("Unexpected Zwave version: " + verstr); } } else { throw new Exception("Unable to detect Zwave version.\r\nData was: " + data); } } }
public void Diagnostics() { using (SerialCOM dutport = getDUTPort()) { // Make sure we can talk to hub //dutport.WriteWait("", "#", 3, clear_data:false); dutport.WaitForPrompt(); // Diags fire_status("Start diagnostics"); dutport.WriteWait("diagnostics", "Press the reset button...", 3); fire_status("Press the reset button..."); write_SingleDIO(Relays.BUTTON, true); dutport.WaitFor(@"Insert both USB drives and attach increased load to usb0. Press <enter> when ready...", 10); fire_status("USB0 Test"); write_SingleDIO(Relays.USB1, true); Thread.Sleep(500); dutport.WriteLine(); dutport.WaitFor(@"Remove increased load from usb0 and attach load to usb1. Press <enter> when ready...", 5); fire_status("USB1 Test"); write_SingleDIO(Relays.USB1, false); write_SingleDIO(Relays.USB2, true); Thread.Sleep(500); dutport.WriteLine(); fire_status("Buzzer Test"); dutport.WaitFor("Buzzer on?", 3); double val = -1.0; double expval = 3.0; for (int i = 0; i < 5; i++) { val = read_SingelAi(Sensors.BUZZER_AUDIO); fire_status(string.Format("Buzzer Voltage: {0}", val.ToString("f2"))); if (val > expval) { break; } Thread.Sleep(1000); } if (val > 3.0) { dutport.WriteLine("y"); } else { dutport.WriteLine("n"); string emsg = string.Format("Unable to detect buzzer. Volatgae was: {0}. Expected more than {1}", val.ToString("f2"), expval.ToString("f2")); throw new Exception(emsg); } fire_status("LED Tests"); led_test(Sensors.GREEN_LIGHT, LED_Green_Low_Value, LED_Green_High_Value, "green"); led_test(Sensors.RED_LIGHT, LED_Red_Low_Value, LED_Red_High_Value, "red"); led_test(Sensors.YELLOW_LIGHT, LED_Yellow_Low_Value, LED_Yellow_High_Value, "yellow"); // Other tests fire_status("Other Built-in Tests..."); dutport.WaitFor("All Tests Passed", 20); fire_status("All Tests Passed"); } }