@@ -53,7 +53,7 @@ type Port interface {
53
53
// NoTimeout should be used as a parameter to SetReadTimeout to disable timeout.
54
54
var NoTimeout time.Duration = - 1
55
55
56
- // ModemStatusBits contains all the modem status bits for a serial port (CTS, DSR, etc...).
56
+ // ModemStatusBits contains all the modem input status bits for a serial port (CTS, DSR, etc...).
57
57
// It can be retrieved with the Port.GetModemStatusBits() method.
58
58
type ModemStatusBits struct {
59
59
CTS bool // ClearToSend status
@@ -62,6 +62,16 @@ type ModemStatusBits struct {
62
62
DCD bool // DataCarrierDetect status
63
63
}
64
64
65
+ // ModemOutputBits contains all the modem output bits for a serial port.
66
+ // This is used in the Mode.InitialStatusBits struct to specify the initial status of the bits.
67
+ // Note: Linux and MacOSX (and basically all unix-based systems) can not set the status bits
68
+ // before opening the port, even if the initial state of the bit is set to false they will go
69
+ // anyway to true for a few milliseconds, resulting in a small pulse.
70
+ type ModemOutputBits struct {
71
+ RTS bool // ReadyToSend status
72
+ DTR bool // DataTerminalReady status
73
+ }
74
+
65
75
// Open opens the serial port using the specified modes
66
76
func Open (portName string , mode * Mode ) (Port , error ) {
67
77
return nativeOpen (portName , mode )
@@ -74,10 +84,11 @@ func GetPortsList() ([]string, error) {
74
84
75
85
// Mode describes a serial port configuration.
76
86
type Mode struct {
77
- BaudRate int // The serial port bitrate (aka Baudrate)
78
- DataBits int // Size of the character (must be 5, 6, 7 or 8)
79
- Parity Parity // Parity (see Parity type for more info)
80
- StopBits StopBits // Stop bits (see StopBits type for more info)
87
+ BaudRate int // The serial port bitrate (aka Baudrate)
88
+ DataBits int // Size of the character (must be 5, 6, 7 or 8)
89
+ Parity Parity // Parity (see Parity type for more info)
90
+ StopBits StopBits // Stop bits (see StopBits type for more info)
91
+ InitialStatusBits * ModemOutputBits // Initial output modem bits status (if nil defaults to DTR=true and RTS=true)
81
92
}
82
93
83
94
// Parity describes a serial port parity setting
0 commit comments