Sets up the serial port parameters for a communication channel (direct serial connection) or assigns a communication channel to a modem.
SetPortParam( short ChannelID, BSTR PortName, long BaudRate, short DataBits, short StopBits, short Parity, short FlowControl, BOOL UseTAPI, short ModemIndex, VARIANT_BOOL *Result); |
Parameters
ChannelID
A channel ID (0-7) used to identify a communication channel.
PortName
A string containing the serial port name (e.g. "COM1").
BaudRate
The baud rate of the transmission (e.g. 9600).
DataBits
The data bits of the transmission, this parameter can be one the following values:
Value |
Comment |
4 |
4 data bits |
5 |
5 data bits |
6 |
6 data bits |
7 |
7 data bits |
8 |
8 data bits |
StopBits
The stop bits of the transmission, this parameter can be one the following values:
Name |
Comment |
0 |
1 stop bit |
1 |
1.5 stop bits |
2 |
2 stop bits |
Parity
The parity of the transmission, this parameter can be one the following values:
Name |
Comment |
0 |
No parity |
1 |
Odd parity |
2 |
Even parity |
3 |
Mark parity |
4 |
Space parity |
FlowControl
The flow control of transmission, this parameter can be one the following values:
Value |
Comment |
0 |
No flow control |
1 |
Xon/Xoff software control |
2 |
Hardware control |
UseTAPI
Indicates whether a communication channel uses modem related Methods to handle the phone communication or not, if it is FALSE, ignore nModemIndex parameter.
ModemIndex
Used to assign a communication channel to a modem, this parameter is a 0-based index and a valid value must be between 0 and total number of modems - 1.
Result
If the method succeeds, the value of variable pointed to by Result is VARIANT_TRUE, otherwise the value is VARIANT_FALSE.
Remarks
If you use modem-related method (e.g. MakeCall Method and WaitForCall Method) to handle the phone communication, your application doesn't need to care about lpPortName, dwBaudRate, nDataBits, nStopBits, nParity and nFlowControl parameters, Micrsoft TAPI will take care of them automatically.