serialport.h File Reference


Detailed Description

serial port communications 'c' function library.

Author:
Glenn D. MacGougan (GDM)
Date:
2008-11-26
Since:
2008-11-26
"LICENSE INFORMATION"
Copyright (c) 2008, refer to 'author' doxygen tags
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file serialport.h.

#include "basictypes.h"

Go to the source code of this file.

Data Structures

struct  SERIALPORT_structObject
 The serial port data container. i.e. The serial port 'object'. More...

Enumerations

enum  SERIALPORT_enumBaudRate
 baud rate enumeration More...
enum  SERIALPORT_enumParity
 serial port parity enumeration. refer http://msdn.microsoft.com/en-us/library/aa363214(VS.85).aspx More...
enum  SERIALPORT_enumDataBits
 serial port data bits enumeration. More...
enum  SERIALPORT_enumStopBits
 serial port stop bits enumeration refer http://msdn.microsoft.com/en-us/library/aa363214(VS.85).aspx More...
enum  SERIALPORT_enumFlowControl
 serial port handshake enumeration More...
enum  SERIALPORT_enumBehaviour {
  SERIALPORT_BEHAVIOUR_WAIT_UNTIL_BYTES_DETECTED = 0,
  SERIALPORT_BEHAVIOUR_RETURN_IMMEDIATELY = 1
}
 The serial port behaviour during read operations. More...

Functions

BOOL SERIALPORT_Initialize (SERIALPORT_structObject *serialport)
 Initialize a serial port 'object'. This does not open the serial port. Call this function after the declaration of the struct.
BOOL SERIALPORT_Open (SERIALPORT_structObject *serialport)
 
Returns:
TRUE if successful, FALSE otherwise.

BOOL SERIALPORT_Close (SERIALPORT_structObject *serialport)
 
Returns:
TRUE if successful, FALSE otherwise.

BOOL SERIALPORT_Read (SERIALPORT_structObject *serialport, unsigned char *buffer, const unsigned int bytesAvailableInBuffer, unsigned int *bytesRead)
BOOL SERIALPORT_Write (SERIALPORT_structObject *serialport, const unsigned char *buffer, const unsigned int numberOfBytesToWrite)
 
Returns:
TRUE if successful, FALSE otherwise.

BOOL SERIALPORT_WaitOnRingIndicatorEvent (SERIALPORT_structObject *serialport, unsigned short timeout_ms, BOOL *ring_detected)
 
Returns:
TRUE if successful, FALSE otherwise.


Enumeration Type Documentation

enum SERIALPORT_enumBaudRate

baud rate enumeration

Definition at line 54 of file serialport.h.

enum SERIALPORT_enumBehaviour

The serial port behaviour during read operations.

Enumerator:
SERIALPORT_BEHAVIOUR_WAIT_UNTIL_BYTES_DETECTED  Wait until the timeout has elapsed or until bytes are present.
SERIALPORT_BEHAVIOUR_RETURN_IMMEDIATELY  Do not wait until the timeout has elapsed. Return immediately.

Definition at line 153 of file serialport.h.

enum SERIALPORT_enumDataBits

serial port data bits enumeration.

Definition at line 84 of file serialport.h.

enum SERIALPORT_enumFlowControl

serial port handshake enumeration

Definition at line 107 of file serialport.h.

enum SERIALPORT_enumParity

serial port parity enumeration. refer http://msdn.microsoft.com/en-us/library/aa363214(VS.85).aspx

Definition at line 72 of file serialport.h.

enum SERIALPORT_enumStopBits

serial port stop bits enumeration refer http://msdn.microsoft.com/en-us/library/aa363214(VS.85).aspx

Definition at line 97 of file serialport.h.


Function Documentation

BOOL SERIALPORT_Close ( SERIALPORT_structObject serialport  ) 

Returns:
TRUE if successful, FALSE otherwise.

Definition at line 244 of file serialport.c.

BOOL SERIALPORT_Initialize ( SERIALPORT_structObject serialport  ) 

Initialize a serial port 'object'. This does not open the serial port. Call this function after the declaration of the struct.

Returns:
TRUE if successful, FALSE otherwise.

Definition at line 50 of file serialport.c.

BOOL SERIALPORT_Open ( SERIALPORT_structObject serialport  ) 

Returns:
TRUE if successful, FALSE otherwise.

Definition at line 78 of file serialport.c.

BOOL SERIALPORT_Read ( SERIALPORT_structObject serialport,
unsigned char *  buffer,
const unsigned int  bytesAvailableInBuffer,
unsigned int *  bytesRead 
)

Returns:
TRUE if successful, FALSE otherwise.
Parameters:
serialport  The serial port 'object'.
buffer  A valid buffer in which to place data.
bytesAvailableInBuffer  The maximum number of bytes avaiable in the buffer [bytes].
bytesRead  The number of bytes read and stored in the buffer [bytes].

Definition at line 310 of file serialport.c.

BOOL SERIALPORT_WaitOnRingIndicatorEvent ( SERIALPORT_structObject serialport,
unsigned short  timeout_ms,
BOOL ring_detected 
)

Returns:
TRUE if successful, FALSE otherwise.

Parameters:
serialport  The serial port 'object'.
timeout_ms  Wait for up to this timeout value [ms].
ring_detected  A boolean to indicate if a ring signal was detected.

Definition at line 449 of file serialport.c.

BOOL SERIALPORT_Write ( SERIALPORT_structObject serialport,
const unsigned char *  buffer,
const unsigned int  numberOfBytesToWrite 
)

Returns:
TRUE if successful, FALSE otherwise.

Parameters:
serialport  The serial port 'object'.
buffer  A valid buffer containing the data to write.
numberOfBytesToWrite  The number of bytes to write [bytes].

Definition at line 361 of file serialport.c.

SourceForge.net Logo