/// <summary> /// Pops the COM port configuration dialog and returns the selected settings. /// </summary> /// <exception cref="OperationCanceledException">Thrown if the dialog is cancelled.</exception> public unsafe static CommunicationsConfig CommunicationsConfigDialog(string port, WindowHandle parent) { CommunicationsConfig config = GetDefaultCommunicationsConfig(port); Error.ThrowLastErrorIfFalse( Imports.CommConfigDialogW(port, parent, ref config)); return(config); }
/// <summary> /// Get the default config values for the given com port. /// </summary> /// <param name="port">Simple name only (COM1, not \\.\COM1)</param> public unsafe static CommunicationsConfig GetDefaultCommunicationsConfig(string port) { CommunicationsConfig config = new CommunicationsConfig(); uint size = (uint)sizeof(CommunicationsConfig); Error.ThrowLastErrorIfFalse( Imports.GetDefaultCommConfigW(port, ref config, ref size)); return(config); }
public unsafe static CommunicationsConfig GetCommunicationsConfig(SafeFileHandle fileHandle) { CommunicationsConfig config = new CommunicationsConfig(); uint size = (uint)sizeof(CommunicationsConfig); Error.ThrowLastErrorIfFalse( Imports.GetCommConfig(fileHandle, ref config, ref size)); return(config); }
/// <summary> /// Pops the COM port configuration dialog and returns the selected settings. /// </summary> /// <exception cref="OperationCanceledException">Thrown if the dialog is cancelled.</exception> public unsafe static CommunicationsConfig CommunicationsConfigDialog(string port, WindowHandle parent) { CommunicationsConfig config = GetDefaultCommunicationsConfig(port); if (!Imports.CommConfigDialogW(port, parent, ref config)) { throw Error.GetExceptionForLastError(); } return(config); }
/// <summary> /// Get the default config values for the given com port. /// </summary> /// <param name="port">Simple name only (COM1, not \\.\COM1)</param> public unsafe static CommunicationsConfig GetDefaultCommunicationsConfig(string port) { CommunicationsConfig config = new CommunicationsConfig(); uint size = (uint)sizeof(CommunicationsConfig); if (!Imports.GetDefaultCommConfigW(port, ref config, ref size)) { throw Error.GetExceptionForLastError(); } return(config); }
public unsafe static CommunicationsConfig GetCommunicationsConfig(SafeFileHandle fileHandle) { CommunicationsConfig config = new CommunicationsConfig(); uint size = (uint)sizeof(CommunicationsConfig); if (!Imports.GetCommConfig(fileHandle, ref config, ref size)) { throw Error.GetExceptionForLastError(); } return(config); }