The text of a manual · part 17 of 19
PDT 3200 Run-Time Library Reference Manual: Chapter 3 Serial Communications, pages 145 to 152
Pages 145 to 152 of 168, from PDT 3200 Run-Time Library Reference Manual
The original document is the PDF (949 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Symbol PDT-3200
Page 145
Chapter 3: Serial Communications
SIO_Close sio.h Syntax void SIO_Close (PORT *port);
Description Closes the communications port, releases the software ÒlockÓ on the port, restores previous port characteristics, resets interrupts if needed, and frees any memory structures that were allocated. This procedure must be called prior to program termination if SIO_AutoClose() is set to FALSE.
Parameters port
Pointer to port structure of port to close.
Returns None.
Sample See SIO_Open().
3-9
Page 146
PDT 3200 Run-Time Library Reference Manual
SIO_FileTransfer sio.h Syntax int SIO_FileTransfer (PORT *port, char szFileName[], FLAGS flags, PWORD extradata);
Description Provides for automatic uploading and downloading of Þles. The protocol speciÞed in the port data structure performs the transfer and affects how the parameters are interpreted.
Parameters Pointer to port structure containing conÞguration to use for Þle transfer. See PORT Data Structure for the port structure deÞnition. szFileName Path and Þle name of Þle to transfer. flags Bit ßag deÞned by the following constants: SIO_FLG_TRANSMIT indicates that szFileName is transmitted out the communications port. SIO_FLG_RECEIVE indicates that szFileName is received through the communications port. SIO_FLG_APPEND indicates that data is received and appended to szFileName. This is available only with the Symbol ACK/NAK protocol. Note: ASCII dump ignores this parameter and always behaves as if SIO_FLG_TRANSMIT was set.
port extradata
3-10
A pointer to a value or structure that can be used as a protocol-speciÞc parameter. Symbol ACK/NAK uses this to designate a transfer timeout value. ASCII dump uses this to designate a packet delay value. Xmodem does not use this parameter.
Page 147
Chapter 3: Serial Communications
Returns SIO_ERR_NONE SIO_ERR_INVALIDFTP SIO_ERR_TIMEOUT SIO_ERR_KEYSTROKE SIO_ERR_FILEOPEN SIO_ERR_FILECREATE SIO_ERR_FILEAPPEND SIO_ERR_FILEWRITE SIO_ERR_LINELENGTH SIO_ERR_MALLOC SIO_ERR_PACKETNBR SIO_ERR_UNKNOWN
File transferred successfully. Protocol speciÞed is not valid. Transfer timed out. Transfer aborted by user keystroke. File could not be opened. File could not be created. File could not be opened for append. An error occurred while trying to write to the Þle. Line in Þle is too long. Memory could not be allocated for data buffer. The packet received was out of order. Unknown error.
Sample See SIO_Open().
3-11
Page 148
PDT 3200 Run-Time Library Reference Manual
SIO_FlushComm sio.h Syntax void SIO_FlushComm (PORT *port, FLAG flag);
Description Flushes the serial read and write interrupt buffers. Also clears all incoming serial data. Data waiting to be sent in the UARTÕs transmitter buffer is not cleared.
Parameters port flags
Returns None.
Sample None.
3-12
Pointer to port structure containing the buffers to clear. Bit ßag deÞned by the following constants: SIO_FLUSHREAD indicates that the read buffer should be cleared. SIO_FLUSHWRITE indicates that the write buffer should be cleared. SIO_FLUSHALL indicates that both buffers should be cleared.
Page 149
Chapter 3: Serial Communications
SIO_GetComm sio.h Syntax void SIO_GetComm (PORT *port);
Description Retrieve communications port parameters, such as the value of the parity, stop bits, data bits, break bit, RTS, DTR, GPO1, GPO2, CTS, RI, DCD, DSR, and the baud rate. The values are stored in the port data structure. To use this function, call it with the proper port structure as a parameter, and read the desired data from the port structure directly.
Parameters None.
Returns port
Pointer to port structure containing conÞgurations returned. See PORT Data Structure for the port structure deÞnition.
Sample None.
3-13
Page 150
PDT 3200 Run-Time Library Reference Manual
SIO_GetCommError sio.h Syntax WORD SIO_GetCommError (PORT *port);
Description Returns the contents of PORT_commstatus and clears any errors that might have been pending. Although the PORT_commstatus variable could be checked manually, the error status wouldn't be cleared, and the action of checking for errors wouldn't be as obvious from a programmer's point of view.
Parameters port
Pointer to port structure containing commstatus to retrieve. See PORT Data Structure for the port structure deÞnition.
Returns New characters came into the communications port before existing characters were read. Old characters were discarded. When interrupts are enabled, this means the read buffer is full. SIO_ERR_PARITY A parity error occurred on the communications port. SIO_ERR_FRAMING A framing error (start/stop bit) occurred. SIO_ERR_BREAK_DETECT A break signal was detected on the communications port. SIO_ERR_WRITEBUFFERFULL The write buffer is full. With interrupts off, this means the last character sent to the UART hasnÕt been dispatched. With interrupts on, it indicates the write buffer is full. SIO_ERR_READBUFFERFULL The read buffer is full. With interrupts off, this error should never occur. With interrupts on, it indicates the read buffer is full. SIO_ERR_OVERRUN
Sample None.
3-14
Page 151
Chapter 3: Serial Communications
SIO_Keyflush sio.h Syntax void SIO_Keyflush (void);
Description Clears the type-ahead keyboard buffer.
Parameters None.
Returns None.
Sample None.
3-15
Page 152
PDT 3200 Run-Time Library Reference Manual
SIO_Keyhit sio.h Syntax BYTE SIO_Keyhit (void);
Description Checks whether a keystroke is available from the keyboard buffer.
Parameters None.
Returns FALSE TRUE
Sample None.
3-16
No character available. At least one character is available.