public static LoRaArduinoSerial CreateFromPort(string port) { var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); LoRaArduinoSerial result = null; TestLogger.Log($"** Starting serial port '{port}' **"); var serialPort = new SerialPort(port) { BaudRate = 115200, Parity = Parity.None, StopBits = StopBits.One, DataBits = 8, DtrEnable = true, Handshake = Handshake.None }; result = new LoRaArduinoSerial(serialPort); try { serialPort.Open(); } catch (Exception ex) { TestLogger.Log($"Error opening serial port '{port}': {ex.ToString()}"); throw; } return(result); }
public OTAAJoinTest(IntegrationTestFixture testFixture) { this.testFixture = testFixture; this.loraRegion = LoraRegion.EU; this.lora = LoRaArduinoSerial.CreateFromPort(testFixture.Configuration.LeafDeviceSerialPort); this.testFixture.ClearNetworkServerLogEvents(); }
public async Task InitializeAsync() { if (!string.IsNullOrEmpty(this.Configuration.LeafDeviceSerialPort)) { this.arduinoDevice = LoRaArduinoSerial.CreateFromPort(this.Configuration.LeafDeviceSerialPort); } else { TestLogger.Log("[WARN] Not serial port defined for test"); } if (this.Configuration.CreateDevices) { try { await CreateOrUpdateDevicesAsync(); } catch (Exception ex) { TestLogger.Log($"[ERR] Failed to create devices in IoT Hub. {ex.ToString()}"); } } if (!string.IsNullOrEmpty(Configuration.IoTHubEventHubConnectionString) && this.Configuration.NetworkServerModuleLogAssertLevel != LogValidationAssertLevel.Ignore) { this.IoTHubMessages = new EventHubDataCollector(Configuration.IoTHubEventHubConnectionString, Configuration.IoTHubEventHubConsumerGroup); await this.IoTHubMessages.StartAsync(); } if (Configuration.UdpLog) { this.udpLogListener = new UdpLogListener(Configuration.UdpLogPort); this.udpLogListener.Start(); } }
public void Dispose() { TestLogger.Log($"{nameof(IntegrationTestFixture)} disposed"); if (disposed) { return; } AppDomain.CurrentDomain.UnhandledException -= this.OnUnhandledException; this.arduinoDevice?.Dispose(); this.arduinoDevice = null; this.IoTHubMessages?.Dispose(); this.IoTHubMessages = null; this.registryManager?.Dispose(); this.registryManager = null; this.udpLogListener?.Dispose(); this.udpLogListener = null; GC.SuppressFinalize(this); this.disposed = true; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { this.arduinoDevice?.Dispose(); this.arduinoDevice = null; } }
public static LoRaArduinoSerial CreateFromPort(string port) { var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); LoRaArduinoSerial result = null; if (!isWindows) { Console.WriteLine($"Starting serial port '{port}' on non-Windows"); var serialPort = new SerialDevice(port, BaudRate.B115200); result = new LoRaArduinoSerial(serialPort); Console.WriteLine($"Opening serial port"); try { serialPort.Open(); } catch (Exception ex) { Console.WriteLine($"Error opening serial port '{port}': {ex.ToString()}"); throw; } } else { Console.WriteLine($"Starting serial port '{port}' on Windows"); var serialPortWin = new SerialPort(port) { BaudRate = 115200, Parity = Parity.None, StopBits = StopBits.One, DataBits = 8, DtrEnable = true, Handshake = Handshake.None }; result = new LoRaArduinoSerial(serialPortWin); try { serialPortWin.Open(); } catch (Exception ex) { Console.WriteLine($"Error opening serial port '{port}': {ex.ToString()}"); throw; } } return(result); }
public override async Task InitializeAsync() { await base.InitializeAsync(); if (!string.IsNullOrEmpty(this.Configuration.LeafDeviceSerialPort)) { this.arduinoDevice = LoRaArduinoSerial.CreateFromPort(this.Configuration.LeafDeviceSerialPort); } else { TestLogger.Log("[WARN] Not serial port defined for test"); } }
public override async Task InitializeAsync() { TestLogger.LogDate = true; await base.InitializeAsync(); if (!string.IsNullOrEmpty(this.Configuration.LeafDeviceSerialPort)) { this.arduinoDevice = LoRaArduinoSerial.CreateFromPort(this.Configuration.LeafDeviceSerialPort); } else { TestLogger.Log("[WARN] Not serial port defined for test"); } LoRaAPIHelper.Initialize(this.Configuration.FunctionAppCode, this.Configuration.FunctionAppBaseUrl); }
public void Dispose() { this.lora?.Dispose(); this.lora = null; GC.SuppressFinalize(this); }
public IntegrationTestBaseCi(IntegrationTestFixtureCi testFixture) : base(testFixture) { this.arduinoDevice = testFixture.ArduinoDevice; }
public IntegrationTestBase(IntegrationTestFixture testFixture) { this.testFixture = testFixture; this.arduinoDevice = testFixture.ArduinoDevice; this.TestFixture.ClearLogs(); }
public SensorDecodingTest(IntegrationTestFixture testFixture) { this.testFixture = testFixture; this.lora = LoRaArduinoSerial.CreateFromPort(testFixture.Configuration.LeafDeviceSerialPort); this.testFixture.ClearNetworkServerLogEvents(); }