Qtopia Home - Classes - Annotated - Functions - Qt Embedded |
|
This is the verbatim text of the phoneat.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 PHONEAT_H
#define PHONEAT_H
#include <qlist.h>
#include "atchat.h"
#include "phone_p.h"
#include "smsmessage.h"
#include <qtopia/qcopenvelope_qws.h>
class SMSRequestPrivate;
class SerialDevice;
class AtChat;
class AtChatCommand;
class PBAtChatCommand;
class SMSAtInterface;
class SimToolkitPrivate;
class SimToolkitAt;
class MuxDevice;
class DataCallInfoAt
{
public:
DataCallInfoAt( const QString& number, const QStringList& initCmds, const QStringList& moduleArgs, bool persist )
{
this->number = number;
this->initCmds = initCmds;
this->moduleArgs = moduleArgs;
this->posn = 0;
this->persist = persist;
}
public:
QString number;
QStringList initCmds;
QStringList moduleArgs;
uint posn;
bool persist;
};
class PhoneCallAt : public PhoneCallPrivate
{
Q_OBJECT
friend class PhoneLineAt;
public:
PhoneCallAt( PhoneLinePrivate *line );
~PhoneCallAt();
void dial( const QString& number, bool callerid );
void dialData( const QString& number, const QStringList& initCmds, const QStringList& moduleArgs, bool persist );
void hangup( PhoneCall::Scope scope );
void accept();
void hold();
void activate( PhoneCall::Scope scope );
void join( bool detachSubscriber );
void tone( const QString& tones );
void transfer( const QString& number );
void primeDataCall();
void freeDataCallInfo();
bool startProtocolModule( bool onready=FALSE );
private slots:
void vtsRequestDone( const AtChatCommand & );
private:
PhoneLineAt *atline;
uint identifier;
static int vtsType;
DataCallInfoAt *dataInfo;
};
class SMSTaggedMessage
{
public:
QString identifier;
SMSMessage message;
};
class SMSRequestAt : public SMSRequestPrivate
{
Q_OBJECT
public:
SMSRequestAt( PhoneLineAt *line );
~SMSRequestAt();
void transmit(const QString &, const SMSMessage &, SMSRequest::Disposition);
void check();
void firstMessage();
void nextMessage();
void deleteMessage( const QString& id );
void sendDatagram( const SMSDatagram& dgram );
void extractMessages( const QString& store, const AtChatCommand& cmd );
protected slots:
void notification( const QString& msg );
void transmitDone( const AtChatCommand& cmd );
void messageCountDone( const AtChatCommand& cmd );
void cpmsCountDone( const AtChatCommand& cmd );
void store1ListDone( const AtChatCommand& cmd );
void store2ListDone( const AtChatCommand& cmd );
private:
PhoneLineAt *line;
QString incomingStore1;
QString incomingStore2;
int totalStore1;
int totalStore2;
QList<SMSTaggedMessage> pending;
uint pendingPosn;
CBSMessage previousCBM;
uint fragmentCounter;
bool fragmentsOnly;
void doTransmit(const QString &, const SMSMessage &, SMSRequest::Disposition, bool );
void joinMessages();
};
class PhoneBookAtOperation
{
public:
enum Operation { Add, Remove, Update };
PhoneBookAtOperation( Operation oper, uint index, const QString& number, const QString& text, PhoneBookAtOperation *next )
{
this->oper = oper;
this->index = index;
this->number = number;
this->text = text;
this->next = next;
}
~PhoneBookAtOperation();
public:
Operation oper;
uint index;
QString number;
QString text;
PhoneBookAtOperation *next;
};
class PhoneBookAtCache
{
public:
PhoneBookAtCache( const QString& store );
~PhoneBookAtCache();
public:
QString store;
PhoneBookAtCache *next;
QValueList<PhoneBookEntry> entries;
uint first, last, current;
bool fullyLoaded;
bool needEmit;
bool fast;
bool redoQuery;
PhoneBookAtOperation *opers;
};
class PhoneBookAt : public PhoneBookPrivate
{
Q_OBJECT
public:
PhoneBookAt( PhoneLinePrivate *_line );
~PhoneBookAt();
virtual void getEntries( const QString& store );
virtual void add( const QString& number, const QString& text, const QString& store, bool flush );
virtual void remove( uint index, const QString& store, bool flush );
virtual void update( uint index, const QString& number, const QString& text, const QString& store, bool flush );
virtual void flush( const QString& store );
void preload( const QString& store );
void setStore( const QString& store ) { updateStorageName( store ); }
private slots:
void readDone( const AtChatCommand& cmd );
void queryDone( const AtChatCommand& cmd );
void notification( const QString& msg );
void slowTimeout();
private:
PhoneLineAt *atline;
QString prevStorageName;
PhoneBookAtCache *caches;
PBAtChatCommand *pending;
QTimer *slowTimer;
void updateStorageName( const QString& storage );
void sendQuery( PhoneBookAtCache *cache );
PhoneBookAtCache *findCache( const QString& store, bool fast=TRUE );
void flushOperations( PhoneBookAtCache *cache );
void flushAdd( const QString& number, const QString& text, PhoneBookAtCache *cache );
void flushRemove( uint index, PhoneBookAtCache *cache );
void flushUpdate( uint index, const QString& number, const QString& text, PhoneBookAtCache *cache );
};
class PhoneLineAt : public PhoneLinePrivate
{
Q_OBJECT
public:
PhoneLineAt( PhoneLine *line, const QString& name );
~PhoneLineAt();
enum InitPhase
{
NoPhasesLeft = 0,
EnableEcam = (1<<0),
EnableClip = (1<<1),
EnableCcwa = (1<<2),
EnableCops = (1<<3),
SMSInit = (1<<4),
STKInit = (1<<5),
};
PhoneCallPrivate *createCall();
SMSRequestPrivate *createSMSRequest();
PhoneBookPrivate *createPhoneBook();
SimToolkitPrivate *createSimToolkit();
void query( PhoneLine::QueryType type ) const;
void modify( PhoneLine::QueryType type, const QString& value );
uint getIdentifier() const;
bool otherActiveCalls( PhoneCallAt *notThis=0 );
PhoneCall getByIdentifier( uint identifier );
void changeGroup( PhoneCall::State oldState, PhoneCall::State newState );
void activateWaitingOrHeld();
bool hasGroup( PhoneCall::State state );
void phaseStart( InitPhase phase );
void phaseDone( InitPhase phase );
void startData( const QString& number, const QStringList& initCmds, const QStringList& moduleArgs, bool persist );
void stopData();
public:
SerialDevice *device;
SerialDevice *deviceLP;
MuxDevice *mux;
AtChat *atchat;
AtChat *atchatLP;
AtChat *atchatData;
PhoneCall incomingCall;
QTimer *ringTimer;
QTimer *clipTimer;
SMSRequestAt *sms;
PhoneBookAt *pb;
SimToolkitAt *sim;
bool ringBlock;
bool hasECAM;
bool smsAvailable;
bool needDataNotify;
bool firstInitDone;
InitPhase phases;
QString dataNumber;
QStringList dataCommands;
QCopChannel *pppdChannel;
private:
void retryChat( const QString& cmd, InitPhase phase );
void performQuery( PhoneLine::QueryType type, const QString& cmd, uint repeatCount=1 ) const;
void performQueryLP( PhoneLine::QueryType type, const QString& cmd ) const;
void performModify( PhoneLine::QueryType type, const QString& cmd ) const;
void performModifyLP( PhoneLine::QueryType type, const QString& cmd ) const;
void existingCall();
void hangupRemote( PhoneCall call );
void vibrate( bool flag );
PhoneCall findDataCall();
public slots:
void queryDone( const AtChatCommand& cmd );
void modifyDone( const AtChatCommand& cmd );
void acceptDone( const AtChatCommand& cmd );
void statusDone( const AtChatCommand& cmd );
void listCallsDone( const AtChatCommand& cmd );
void messageFormatDone( const AtChatCommand& cmd );
void nmiStatusReceived( const AtChatCommand& cmd );
void broadcastSetDone( const AtChatCommand& cmd );
void ecamRequestDone( const AtChatCommand& cmd );
void cgmiRequestDone( const AtChatCommand &cmd );
void dialRequestDone( const AtChatCommand& cmd );
void initRequestDone( const AtChatCommand& cmd );
void chldRequestDone( const AtChatCommand& cmd );
void pinDone( const AtChatCommand& cmd );
void notification( const QString& msg );
void ringTimeout();
void clipTimeout();
void retryChatDone( const AtChatCommand& cmd );
void retryChatTimeout();
void dataChannelReady();
void protocolModuleExited();
private slots:
void firstTimeInit();
void initAfterReset();
void phoneBookPreload();
void pppdListen( const QCString& msg, const QByteArray& data );
void dataStateChanged( const PhoneCall& call );
};
class PBAtChatCommand : public AtChatCommand
{
Q_OBJECT
public:
PBAtChatCommand( const QString& command, const QString& storage )
: AtChatCommand( command ) { this->storage = storage; }
public:
QString storage;
};
class SMSAtChatCommand : public AtChatCommand
{
Q_OBJECT
public:
SMSAtChatCommand( const QString& command, const QString& pdu, PhoneLineAt *line, const QString &id )
: AtChatCommand( command, pdu )
{ this->line = line; this->id_ = id; this->haveId_ = TRUE; }
SMSAtChatCommand( const QString& command, const QString& pdu, PhoneLineAt *line )
: AtChatCommand( command, pdu )
{ this->line = line; this->haveId_ = FALSE; }
bool shouldAbort() const;
bool haveId() const { return haveId_; }
QString id() const { return id_; }
private:
PhoneLineAt *line;
QString id_;
bool haveId_;
};
class QueryAtChatCommand : public AtChatCommand
{
Q_OBJECT
public:
QueryAtChatCommand( const QString& command, PhoneLine::QueryType type )
: AtChatCommand( command ) { this->type = type; }
public:
PhoneLine::QueryType type;
};
class DialAtChatCommand : public AtChatCommand
{
Q_OBJECT
public:
DialAtChatCommand( const QString& command, PhoneCall call )
: AtChatCommand( command ) { this->call = call; }
public:
PhoneCall call;
};
class RetryAtChatCommand : public AtChatCommand
{
Q_OBJECT
public:
RetryAtChatCommand( const QString& command, uint numTries,
PhoneLineAt::InitPhase phase )
: AtChatCommand( command )
{ this->numTries = numTries; this->phase = phase; }
public:
uint numTries;
PhoneLineAt::InitPhase phase;
};
class RetryAtTimer : public QTimer
{
Q_OBJECT
public:
RetryAtTimer( uint numTries, const QString& cmd,
PhoneLineAt::InitPhase phase )
: QTimer()
{ this->numTries = numTries; this->cmd = cmd; this->phase = phase; }
public:
uint numTries;
QString cmd;
PhoneLineAt::InitPhase phase;
};
#endif // PHONEAT_H
| Copyright © 2001-2004 Trolltech | Trademarks | Qtopia version 2.0.1
|