File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,26 @@ class com : public gui
100
100
return myCOMHandle != 0 ;
101
101
}
102
102
103
+ int baud ()
104
+ {
105
+ if ( ! isOpen () )
106
+ return 0 ;
107
+ DCB dcbSerialParams = { 0 }; // Initializing DCB structure
108
+ dcbSerialParams.DCBlength = sizeof (dcbSerialParams);
109
+ GetCommState (myCOMHandle, &dcbSerialParams);
110
+ return dcbSerialParams.BaudRate ;
111
+ }
112
+ void baud ( int rate )
113
+ {
114
+ if ( ! isOpen () )
115
+ return ;
116
+ DCB dcbSerialParams = { 0 }; // Initializing DCB structure
117
+ dcbSerialParams.DCBlength = sizeof (dcbSerialParams);
118
+ GetCommState (myCOMHandle, &dcbSerialParams);
119
+ dcbSerialParams.BaudRate = rate;
120
+ SetCommState (myCOMHandle, &dcbSerialParams);
121
+ }
122
+
103
123
/* * blocking read from COM port
104
124
@param[in] needed byte count, -1 to read whatever becomes available
105
125
You can’t perform that action at this time.
0 commit comments