00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef COMMANDSCHEDULER_H
00025 #define COMMANDSCHEDULER_H
00026
00027 #include <tqobject.h>
00028 #include <tqptrlist.h>
00029
00030 #include "atcommand.h"
00031 #include "commandset.h"
00032
00033 class Modem;
00034
00035 class CommandScheduler : public TQObject {
00036 Q_OBJECT
00037
00038 public:
00039 CommandScheduler (Modem *modem,TQObject *parent = 0, const char *name = 0);
00040
00041 void execute(const TQString &command);
00042 void execute(ATCommand *command);
00043 void executeId(const TQString &id);
00044
00045 Modem *modem() { return mModem; }
00046 CommandSet *commandSet() { return &mCommandSet; }
00047
00048 bool loadProfile(const TQString& filename);
00049 bool saveProfile(const TQString& filename);
00050
00051 signals:
00052 void result(const TQString &);
00053 void commandProcessed(ATCommand *);
00054
00055 private slots:
00056 void processOutput(const char *line);
00057
00058 private:
00059 void sendCommand(const TQString &command);
00060 void nextCommand();
00061
00062 private:
00063 Modem *mModem;
00064
00065 CommandSet mCommandSet;
00066
00067 ATCommand *mLastCommand;
00068
00069 TQPtrList<ATCommand> mCommandQueue;
00070
00071 enum State { WAITING, PROCESSING };
00072 State mState;
00073
00074 TQString mResult;
00075 };
00076
00077 #endif