ModemPort Class Reference

Modem port class. More...

#include <ModemPort.h>

Inheritance diagram for ModemPort:
SerialPort SerialPortInterface

List of all members.

Public Member Functions

 ModemPort ()
 Default class constructor.
 ModemPort (const char *portName)
 Class constructor.
virtual ~ModemPort ()
 Class destructor.
size_t read (char *pData, size_t maxSize, int timeOut=DEFAULT_AT_TIMEOUT)
 Read modem response.
void waitNoCarrier (void)
 Wait for no-carrier condition.
ssize_t write (const char *pData)
 Write AT command to the modem.
ModemAnswerType getAnswer ()
 Get the modem answer as answer type.

Detailed Description

Modem port class.

Modem port class implements parsing of modem AT commands and responses. The class is intended to simplify communication to a GSM/GPRS modem with generic AT command interface.


Constructor & Destructor Documentation

ModemPort::ModemPort (  ) 

Default class constructor.

Initializes the modem port object.

ModemPort::ModemPort ( const char *  portName  ) 

Class constructor.

Initializes the modem port object and opens the specified serial port.

Parameters:
portName Points to a null-terminated string containing the serial port name.
ModemPort::~ModemPort (  )  [virtual]

Class destructor.

Destroys the modem port object.


Member Function Documentation

ModemAnswerType ModemPort::getAnswer (  )  [inline]

Get the modem answer as answer type.

Returns:
Returns the answer type retrieved from modem
size_t ModemPort::read ( char *  pData,
size_t  maxSize,
int  timeOut = DEFAULT_AT_TIMEOUT 
)

Read modem response.

Reads the modem reply to a previously sent AT command. The function blocks until the modem response is received or the timeout expires.

Parameters:
pData Pointer to a buffer that receives the command reply.
maxSize Specifies maximum length of the modem reply.
timeOut Specifies the modem response timeout, in milliseconds.
Returns:
Returns number of characters received from the modem.
void ModemPort::waitNoCarrier ( void   ) 

Wait for no-carrier condition.

Wait until the modem sends NO CARRIER.

ssize_t ModemPort::write ( const char *  pData  ) 

Write AT command to the modem.

Sends the specified AT command to the modem.

Parameters:
pData Pointer to the null terminated AT command string.
Returns:
Returns number of characters written to modem port. On error, returns -1.

The documentation for this class was generated from the following files:
Generated on Wed Oct 20 11:13:44 2010 for libspatha by  doxygen 1.6.3