ComSetParameters
This call accepts the complete set of port parameters from the application, and installs them as the new settings for the port. The parameters are associated with the application so they may be restored when port ownership is reclaimed after being lost.
See the COMIO.H header file for the extended parameter structure. A copy of the structure is included below for reference.
- Syntax: err_t far ComSetParameters(handle_t Handle,
struct COM_SETTINGS far *ComSettingsP)
- Parameters: handle_t Handle - The handle returned via a successful ComOpen.
ComSettingsP - Pointer to the structure containing the new port parameters
- Returns: 0 - if successful
Any other value indicates an error condition.
ENOTYOURS - The specified port has not been acquired by the calling
application.
- Comments: ComOpen() must first be called in order to get a valid handle to the
communications port.
ComSetParameters will clear the flow control on the port if it is asserted
(if an XOFF was received).
The COM_SETTINGS structure information is included below for reference.
typedef struct {
char UnusedDial;
int Baud;
char Parity;
char Stop;
char Data;
char Flow;
char InfraRed;
char UnusedDuplex;
char UnusedEcho;
} com_settings;
/* Values for Dial field in com_settings struct */
#define COM_DIAL_TONE 'T' /* Go into TONE dial mode */
#define COM_DIAL_PULSE 'P' /* Go into PULSE dial mode */
/* Values for Baud field in com_settings struct */
#define COM_BR_110 0x417
#define COM_BR_150 0x300
#define COM_BR_300 0x180
#define COM_BR_600 0x0C0
#define COM_BR_1200 0x060
#define COM_BR_2400 0x030
#define COM_BR_4800 0x018
#define COM_BR_9600 0x00C
#define COM_BR_19200 0x006
#define COM_BR_38400 0x003
#define COM_BR_57600 0x002
/* Values for Parity field in com_settings struct. */
#define COM_PTY_NO 0x00 /* No parity */
#define COM_PTY_ODD 0x08 /* Odd parity */
#define COM_PTY_EVEN 0x18 /* Even parity */
#define COM_PTY_MARK 0x28 /* High parity */
#define COM_PTY_SPACE 0x38 /* Low parity */
/* Values for Stop field in com_settings struct. */
#define COM_STOP_1 0x00 /* One stop bit */
#define COM_STOP_2 0x04 /* Two stop bits*/
/* Values for Data field in com_settings struct. */
#define COM_DATA_7 0x02 /* Seven data bits */
#define COM_DATA_8 0x03 /* Eight data bits */
/* Values for XonXof field in com_settings struct. */
#define COM_XON_OFF 1 /* Disable XOF/XON */
#define COM_XON_ON 2 /* Turn on XOF/XON */
#define COM_XON_ANY 4 /* Turn on XOF/ANY */
#define COM_ENQACK 8 /* HP's ENQ/ACK protocol for old equipt */
/* Note that both XON/XOF and ENQ/ACK may */
/* be specified. These two, COM_ENQACK */
/* and COM_XON_ON, are the only two bits that */
/* may be on simultaneously. If any others */
/* are on simultaneously, then results are not */
/* guaranteed. */
/* Values for InfraRed field in com_settings struct */
#define COM_IR_OFF 1 /* Turn off infra-red/on modem/rs-232 */
#define COM_IR_ON 2 /* Turn on infra-red/off modem/rs-232 */
/* Values for Duplex field in com_settings struct. */
#define COM_DUP_HALF 1
#define COM_DUP_FULL 2
/* Values for Echo field in com_settings struct. */
#define COM_ECHO 1
#define COM_NOECHO 2
/* Values for Compression field in com_settings struct. */
#define COM_CMP_OFF 1 /* Turn compression off */
#define COM_CMP_G31D 2 /* Group 3, 1 dimensional (FAX uses this)*/