Qtopia Home - Classes - Annotated - Functions - Qt Embedded |
|
This is the verbatim text of the atchat.h include file. It is provided only for illustration; the copyright remains with Trolltech.
/**********************************************************************
** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef ATCHAT_H
#define ATCHAT_H
#include <qobject.h>
#include <qstring.h>
class AtChatCommandPrivate;
class AtChatPrivate;
class QIODevice;
class SerialDevice;
class MuxDeviceChannel;
class AtChatCommand : public QObject
{
Q_OBJECT
friend class AtChat;
friend class AtChatPrivate;
public:
enum State
{
Unqueued,
Processing,
Timeout,
Done
};
AtChatCommand(const QString& command);
AtChatCommand(const QString& command, const QString& pdu);
~AtChatCommand();
QString command() const;
QString pdu() const;
QString response() const;
State state() const;
bool ok() const;
void setRepeatCount( uint count );
uint repeatCount() const;
bool next( const QString& prefix ) const;
QString lines( const QString& prefix ) const;
QString line() const;
uint readNumeric() const;
QString readString() const;
QString readNextLine() const;
bool atEnd() const;
virtual bool shouldAbort() const;
signals:
void done( const AtChatCommand& cmd );
private:
AtChatCommandPrivate *d;
void emitDone();
};
class AtChat : public QObject
{
Q_OBJECT
public:
AtChat( SerialDevice *serial, MuxDeviceChannel *mux, QObject *parent=0, bool lowPriority=FALSE );
~AtChat();
void chat( AtChatCommand *command );
void chat( const QString& command );
void chat( const QString& command, const QString& pdu );
void disconnectDevice();
void reconnectDevice( int fd );
void abortDial();
static QString quote( const QString& str );
static QString nextString( const QString& buf, uint& posn );
enum DeviceType { Unknown, Wavecom, Ericsson };
void setDeviceType(DeviceType t);
DeviceType deviceType() const;
signals:
// Asynchronous notification message from the modem device.
void notification( const QString& msg );
private:
void writeLine( const QString& line );
void writePduLine( const QString& line );
bool processLine( const QString& line );
private slots:
void incoming();
void retryTimeout();
void requeueTimeout();
private:
AtChatPrivate *d;
// Prime the output with the first command on the queue.
void prime();
void primeIfNecessary();
// Mark the first command on the queue as done.
void done( AtChatCommand::State state, bool ok );
};
#endif // ATCHAT_H
| Copyright © 2001-2004 Trolltech | Trademarks | Qtopia version 2.0.1
|