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 ATCOMMAND_H
00025
#define ATCOMMAND_H
00026
00027
#include <qstring.h>
00028
#include <qstringlist.h>
00029
#include <qptrlist.h>
00030
00031
class ATParameter {
00032
public:
00033 ATParameter();
00034 ATParameter(
const QString &value,
const QString &name=
"",
00035
bool userInput=
false);
00036
00037
void setName(
const QString &name) { mName = name; }
00038
QString name()
const {
return mName; }
00039
void setValue(
const QString &value) { mValue = value; }
00040
QString value()
const {
return mValue; }
00041
void setUserInput(
bool userInput) { mUserInput = userInput; }
00042
bool userInput()
const {
return mUserInput; }
00043
00044
private:
00045
QString mName;
00046
QString mValue;
00047
bool mUserInput;
00048 };
00049
00053
00054 class ATCommand {
00055
public:
00056
ATCommand();
00057
ATCommand(
const QString &cmdString);
00058
ATCommand(
const QString &cmdName,
const QString &cmdString,
00059
bool hexOutput=
false);
00060
virtual ~
ATCommand();
00061
00062
void setCmdName(
const QString &);
00063
QString cmdName();
00064
00065
void setCmdString(
const QString &);
00066
QString cmdString();
00067
00068
QString cmd();
00069
00070
QString id();
00071
00072
void setHexOutput(
bool);
00073
bool hexOutput();
00074
00075
QString processOutput(
const QString &);
00076
QString processOutput();
00077
00078
void setResultString(
const QString &);
00079
QString resultString();
00080
QString resultField(
int index);
00081
QPtrList<QStringList> *resultFields();
00082
00083
void addParameter(ATParameter *);
00084
void clearParameters();
00085
QPtrList<ATParameter> parameters();
00086
00087
void setParameter(
int index,
const QString &value);
00088
void setParameter(
int index,
int value);
00089
00090
void setAutoDelete(
bool autoDelete) { mAutoDelete = autoDelete; }
00091
bool autoDelete() {
return mAutoDelete; }
00092
00093
private:
00094
void construct();
00095
void setResultFields(
QString fieldsString);
00096
void extractParameters();
00097
00098
QString mCmdName;
00099
QString mCmdString;
00100
QString mId;
00101
bool mHexOutput;
00102
00103
QString mResultString;
00104
QPtrList<QStringList> mResultFieldsList;
00105
00106
QPtrList<ATParameter> mParameters;
00107
00108
bool mAutoDelete;
00109 };
00110
00111
#endif