Metrologic Optimus S Programming Manual page 111

"c" programming guide
Table of Contents

Advertisement

read_com
Purpose
To read one character from the receive buffer of a specified COM port.
Syntax
int read_com (int port, char *c);
int port;
char *c;
Example
char c;
if (read_com (1,c))
Description
This routine reads one byte from the receive buffer and then removes it from
the buffer. However, if the buffer is empty, it will return 0 for no action is
taken.
Return
If successful, it returns 1.
Otherwise, it returns 0 to indicate the buffer is empty.
nwrite_com, write_com
See Also
SetCommType
To set the communication type of a specified COM port.
Purpose
Syntax
int SetCommType (int port, int type);
int port;
int type;
COMM_DIRECT
---
COMM_IR
COMM_IrDA
COMM_RF
Example
SetCommType (1, 2);
Description
This routine needs to be called BEFORE opening a COM port.
Note that the COM port mapping is different for each model of terminal, and a
COM port may not support all the communication types.
Return
If successful, it returns 1.
On error, it returns 0 (i.e. invalid setting).
open_com
See Also
Chapter 3 Terminal Specific Function Library
print ("char %c received from COM 1", *c);
/* the following communication types are available */
/* receive buffer of a specified COM port */
/* pointer to character returned */
/* COM port to be set */
0
Direct RS-232
1
Reserved
2
Serial IR (via IR transceiver)
3
Standard IrDA
4
Bluetooth (SPP/DUN)
/* set COM1 to IR communication */
105

Advertisement

Table of Contents
loading

This manual is also suitable for:

Optimus r

Table of Contents