private void DevTtyDeleted(object sender, System.IO.FileSystemEventArgs e) { if (e.ChangeType.HasFlag(System.IO.WatcherChangeTypes.Deleted)) { DebugOutput("DeviceMonitor.FileSystemNotifcationPort: DevTtyDeleted: " + e.FullPath); DeviceChange.SystemReportsDeviceRemoved(this, e.FullPath, INTV.Core.Model.Device.ConnectionType.Serial); } }
private static void HandleSystemWillSleep(object sender, SystemWillSleepEventArgs e) { DebugOutput("DeviceMonitor.HandleSystemWillSleep CanCancel: " + e.CanCancel + " PreventSystemSleepDuringDeviceCommands: " + Properties.Settings.Default.PreventSystemSleepDuringDeviceCommands); var cancelSleep = false; if (e.CanCancel && Properties.Settings.Default.PreventSystemSleepDuringDeviceCommands) { var portBeingUsed = GetDevices().FirstOrDefault(d => d.IsValid && (d.Port != null) && d.Port.IsOpen && d.Port.IsInUse); cancelSleep = portBeingUsed != null; e.Cancel = cancelSleep; DebugOutput("DeviceMonitor.HandleSystemWillSleep will cancel: " + cancelSleep + " port being used: " + (cancelSleep ? portBeingUsed.Name : "<null>")); } if (!cancelSleep) { foreach (var port in INTV.Shared.Model.Device.SerialPortConnection.AvailablePorts) { DeviceChange.SystemReportsDeviceRemoved(null, port, INTV.Core.Model.Device.ConnectionType.Serial); } } }
private static void ReportPortDeparture(string portName) { DebugOutput("IOService: Departure: port: " + portName); DeviceChange.SystemReportsDeviceRemoved(null, portName, INTV.Core.Model.Device.ConnectionType.Serial); }