SerialMgrOld.h
declares the serial manager API. For more information on the serial manager, see the chapter "Serial Communication" in the Palm OS Programmer's Companion.
SerCtlEnum
, which has the following elements:
SerSettingsPtr
type points to a SerSettingsType structure.
typedef struct SerSettingsType {
    UInt32 baudRate;
    UInt32 flags;
    Int32 ctsTimeout;
    } SerSettingsType;
typedef SerSettingsType* SerSettingsPtr;
Err SerClearErr (UInt16 refNum)
SerClearErr
only after a serial manager function (SerReceive
, SerReceiveCheck
, SerSend
, etc.) returns with the error code serErrLineErr
.
SerClearErr
resets the serial port. So, if SerClearErr
is called unconditionally while a byte is coming into the serial port, that byte is guaranteed to become corrupted.
serErrLineErr
, call SerClearErr
immediately. However, don't make unsolicited calls to SerClearErr
.
serErrLineErr
, consider flushing the receive queue for a fraction of a second by calling SerReceiveFlush
. SerReceiveFlush
calls SerClearErr
for you.
Err SerClose (UInt16 refNum)
  |
0 |
No error. |
  |
serErrNotOpen |
Port wasn't open. |
  |
serErrStillOpen |
Port still held open by another process. |
Err SerControl (UInt16 refNum, UInt16 op, void *valueP, UInt16 *valueLenP)
  |
-> |
Reference number of library. |
  |
-> |
Control operation to perform (SerCtlEnum ). |
  |
<-> |
Pointer to value for operation. |
  |
<-> |
Pointer to size of value. |
  |
0 |
No error. |
  |
|
Invalid parameter (unknown). |
  |
|
Library not open. |
serCtlEmuSetBlockingHook
. See Using the Serial Manager for more information.
SerSettingsType
structure with current serial port attributes.
Err SerGetSettings (UInt16 refNum, SerSettingsPtr settingsP)
  |
-> |
Serial library reference number. |
  |
<-> |
Pointer to SerSettingsType structure to be filled in. |
SerSettingsType
structure for more details.
UInt16 SerGetStatus (UInt16 refNum, Boolean *ctsOnP, Boolean *dsrOnP)
  |
-> |
Serial library reference number. |
  |
-> |
Pointer to location for storing a Boolean value. |
  |
-> |
Pointer to location for storing a Boolean value. |
  |
|
Parity error. |
  |
serLineErrorHWOverrun |
Hardware overrun. |
  |
serLineErrorFraming |
Framing error. |
  |
serLineErrorBreak |
Break signal detected. |
  |
serLineErrorHShake |
Line handshake error. |
  |
serLineErrorSWOverrun |
Software overrun. |
ctsOnP
and dsrOnP
are not meaningful in the present version of the software
Err SerOpen (UInt16 refNum, UInt16 port, UInt32 baud)
  |
-> |
Serial library reference number. |
  |
-> |
Port number. |
  |
-> |
Baud rate. |
  |
0 |
No error. |
  |
serErrAlreadyOpen |
Port was open. Enables port sharing by "friendly" clients (not recommended). |
  |
serErrBadParam |
Invalid parameter. |
  |
memErrNotEnoughSpace |
Insufficient memory. |
size
bytes worth of data or returns with error if a line error or timeout is encountered.
UInt32 SerReceive (UInt16 refNum, void *bufP, UInt32 count, Int32 timeout, Err* errP)
  |
|
Serial library reference number. |
  |
<-> |
Buffer for receiving data. |
  |
-> |
Number of bytes to receive. |
  |
-> |
Interbyte timeout in ticks, 0 for none, -1 forever. |
  |
<-> |
For returning error code. |
NOTE:  The old versions ofSerSend
andSerReceive
are still available asSerSend10
andSerReceive10
(not V10).
Err SerReceive10 (UInt16 refNum, void *bufP, UInt32 bytes, Int32 timeout)
  |
-> |
The serial library reference number. |
  |
-> |
Pointer to the buffer for receiving data. |
  |
-> |
Number of bytes desired. |
  |
-> |
Interbyte time out in system ticks (-1 = forever). |
  |
0 |
No error. Requested number of bytes was received. |
  |
serErrTimeOut |
Interbyte time out exceeded while waiting for the next byte to arrive. |
  |
serErrLineErr |
Line error occurred (see SerClearErr and SerGetStatus). |
SerReceive
.
Err SerReceiveCheck (UInt16 refNum, UInt32 *numBytesP)
  |
-> |
Serial library reference number. |
  |
<-> |
Pointer to location for returning the byte count. |
  |
0 |
No error. |
  |
serErrLineErr |
Line error pending (see SerClearErr and SerGetStatus). |
void SerReceiveFlush (UInt16 refNum, Int32 timeout)
  |
-> |
Serial library reference number. |
  |
-> |
Interbyte time out in system ticks (-1 = forever). |
SerReceiveFlush
blocks until a timeout occurs while waiting for the next byte to arrive.
bytes
bytes of data to accumulate in the receive queue.
Err SerReceiveWait (UInt16 refNum, UInt32 bytes, Int32 timeout)
  |
-> |
Serial library reference number. |
  |
-> |
Number of bytes desired. |
  |
-> |
Interbyte timeout in system ticks (-1 = forever). |
  |
0 |
No error. |
  |
serErrTimeOut |
Interbyte timeout exceeded while waiting for next byte to arrive. |
  |
|
Line error occurred (see SerClearErr and SerGetStatus ). |
UInt32 SerSend (UInt16 refNum, void *bufP, UInt32 count, Err *errP
  |
-> |
Serial library reference number. |
  |
-> |
Pointer to data to send. |
  |
-> |
Number of bytes to send. |
  |
<-> |
For returning error code. |
errP
:
  |
0 |
No error. |
  |
|
Handshake timeout. |
NOTE:  The old versions ofSerSend
andSerReceive
are still available asSerSend10
andSerReceive10
(not V10).
Err SerSend10 (UInt16 refNum, void *bufP, UInt32 size)
  |
-> |
Serial library reference number. |
  |
-> |
Pointer to the data to send. |
  |
-> |
Size (in number of bytes) of the data to send. |
  |
0 |
No error. |
  |
|
Handshake timeout (such as waiting for CTS to become asserted). |
S
erSend10 blocks until all data is transferred to the UART or a timeout error (if CTS handshaking is enabled) occurs. Future implementations may queue up the request and return immediately, performing transmission in the background. If your software needs to detect when all data has been transmitted, see SerSendWait.
SerSend
.
Err SerSendFlush (UInt16 refNum)
SerSend
,
SerSendWait
Err SerSendWait (UInt16 refNum, Int32 timeout)
  |
-> |
Serial library reference number. |
  |
-> |
Reserved for future enhancements. Set to (-1) for compatibility. |
  |
0 |
No error. |
  |
serErrTimeOut |
Handshake timeout (such as waiting for CTS to become asserted). |
SerSend
bufSize
= 0.
Err SerSetReceiveBuffer (UInt16 refNum, void *bufP, UInt16 bufSize)
  |
-> |
Serial library reference number. |
  |
-> |
Pointer to buffer to be used as the new receive queue. |
  |
-> |
Size of buffer, or 0 to restore the default receive queue. |
SerSetReceiveBuffer
passing 0 (zero) for the buffer size. The serial manager does not free the custom receive queue.
Err SerSetSettings (UInt16 refNum, SerSettingsPtr settingsP)
  |
-> |
Serial library reference number. |
  |
<-> |
Pointer to the filled in SerSettingsType structure. |
  |
0 |
No error. |
  |
serErrNotOpen |
The port wasn't open. |
  |
serErrBadParam |
Invalid parameter. |
SerSettingsType
structure for more details.
OR
together:
serSettingsFlagBitsPerChar7 | serSettingsFlagParityOnM | serSettingsFlagParityEvenM | serSettingsFlagStopBits1
serSettingsFlagRTSAutoM
| serSettingsFlagCTSAutoM
.
SerGetSettings
  |   |