Modem port class. More...
#include <ModemPort.h>
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. |
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.
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.
portName | Points to a null-terminated string containing the serial port name. |
ModemPort::~ModemPort | ( | ) | [virtual] |
Class destructor.
Destroys the modem port object.
ModemAnswerType ModemPort::getAnswer | ( | ) | [inline] |
Get the modem answer as answer type.
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.
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. |
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.
pData | Pointer to the null terminated AT command string. |