Description-
This function displays the following dialog box and returns the inputted data. All return values except for the Baud variable is returned in the format required for input to SetPortCharacteristics() functions. The Baud variable is the actual numeric baud rate. Values in the variables previous to the calls will be the displayed initial parameters. See examples below for actual usage.
Syntax-
stat = CdrvLInitDialog(COMPort,Baud,Parity,Length,Stopbit,Protocol);
On Entry-
int Subport;
Corresponds to the COM Port: parameter above.
int Baud;
Corresponds to the Baud(Dec): parameter above. Is the numerical value (decimal) of the baud rate.
int Parity;
Corresponds to the Parity: parameter above..
int Length;
Corresponds to the Length: parameter above.
int Stopbit;
Corresponds to the Stopbit: parameter above.
int Protocol;
Corresponds to the Flow Control: parameter above.
On Exit-
int stat;
IDOK Use new values
IDCANCEL Ignore new values
See Also-
Example-
#include "comm.h
int Port; int Subport=0; UINT Baud=38400; int Parity=PAR_NONE; int Length=LENGTH_8; int Stopbit=STOPBIT_1; int Protocol=PROT_NONNON;
if (CdrvLInitDialog(Subport,Baud,Parity,Length,Stopbit,Protocol) == IDCANCEL) { // User cancelled
return; }
//Note that opening the port with OpenComPort() requires
//adding 1 to Subport.
if ((Port=OpenComPort(SubPort+1,4096,4096)) < 0) {
//Do error processing }
//Note that we must convert the numerical baud rate //received from the dialog box to the Baud Index //required by the SetPortCharacteristics call.
if ((Status =SetPortCharacteristics(Port, CdrvIntToBaudIndex(Port,Baud), Parity, Length,Stopbit,Protocol)) != RS232ERR_NONE) { //Do error processing
}