kandy

commandscheduler.h
1/*
2 This file is part of Kandy.
3
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20 As a special exception, permission is given to link this program
21 with any edition of TQt, and distribute the resulting executable,
22 without including the source code for TQt in the source distribution.
23*/
24#ifndef COMMANDSCHEDULER_H
25#define COMMANDSCHEDULER_H
26
27#include <tqobject.h>
28#include <tqptrlist.h>
29
30#include "atcommand.h"
31#include "commandset.h"
32
33class Modem;
34
35class CommandScheduler : public TQObject {
36 TQ_OBJECT
37
38 public:
39 CommandScheduler (Modem *modem,TQObject *parent = 0, const char *name = 0);
40
41 void execute(const TQString &command);
42 void execute(ATCommand *command);
43 void executeId(const TQString &id);
44
45 Modem *modem() { return mModem; }
46 CommandSet *commandSet() { return &mCommandSet; }
47
48 bool loadProfile(const TQString& filename);
49 bool saveProfile(const TQString& filename);
50
51 signals:
52 void result(const TQString &);
53 void commandProcessed(ATCommand *);
54
55 private slots:
56 void processOutput(const char *line);
57
58 private:
59 void sendCommand(const TQString &command);
60 void nextCommand();
61
62 private:
63 Modem *mModem;
64
65 CommandSet mCommandSet;
66
67 ATCommand *mLastCommand;
68
69 TQPtrList<ATCommand> mCommandQueue;
70
71 enum State { WAITING, PROCESSING };
72 State mState;
73
74 TQString mResult;
75};
76
77#endif
This class provides an abstraction of an AT command.
Definition: atcommand.h:54
TQListView item representing a modem command.
Definition: commandset.h:37