2010-12-06 13:52:47 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2010-12-06 13:52:47 +01:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
2010-12-17 17:14:20 +01:00
|
|
|
** No Commercial Usage
|
2010-12-06 13:52:47 +01:00
|
|
|
**
|
2010-12-17 17:14:20 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
2010-12-06 13:52:47 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
2010-12-17 17:14:20 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2010-12-06 13:52:47 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef CODACLIENTAPPLICATION_H
|
|
|
|
|
#define CODACLIENTAPPLICATION_H
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QCoreApplication>
|
|
|
|
|
#include <QtCore/QStringList>
|
|
|
|
|
#include <QtCore/QSharedPointer>
|
2010-12-07 15:20:09 +01:00
|
|
|
#include <QtCore/QTime>
|
2010-12-06 13:52:47 +01:00
|
|
|
|
2010-12-07 11:05:25 +01:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QFile)
|
|
|
|
|
|
2011-02-10 16:48:41 +01:00
|
|
|
namespace Coda {
|
|
|
|
|
struct CodaCommandResult;
|
|
|
|
|
class CodaDevice;
|
|
|
|
|
class CodaEvent;
|
2010-12-06 13:52:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class CodaClientApplication : public QCoreApplication
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2010-12-09 09:49:23 +01:00
|
|
|
enum Mode { Invalid, Ping, Launch, Put, Stat, Install };
|
2010-12-06 13:52:47 +01:00
|
|
|
|
|
|
|
|
explicit CodaClientApplication(int &argc, char **argv);
|
|
|
|
|
~CodaClientApplication();
|
|
|
|
|
|
|
|
|
|
enum ParseArgsResult { ParseArgsOk, ParseArgsError, ParseInitError, ParseArgsHelp };
|
|
|
|
|
ParseArgsResult parseArguments(QString *errorMessage);
|
|
|
|
|
|
|
|
|
|
bool start();
|
|
|
|
|
|
|
|
|
|
static QString usage();
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void slotError(const QString &);
|
|
|
|
|
void slotTrkLogMessage(const QString &);
|
2011-02-10 16:48:41 +01:00
|
|
|
void slotCodaEvent(const Coda::CodaEvent &);
|
2010-12-09 09:49:23 +01:00
|
|
|
void slotSerialPong(const QString &);
|
2010-12-06 13:52:47 +01:00
|
|
|
|
|
|
|
|
private:
|
2010-12-09 09:49:23 +01:00
|
|
|
void printTimeStamp();
|
2010-12-06 13:52:47 +01:00
|
|
|
bool parseArgument(const QString &a, int argNumber, QString *errorMessage);
|
2011-02-10 16:48:41 +01:00
|
|
|
void handleCreateProcess(const Coda::CodaCommandResult &result);
|
|
|
|
|
void handleFileSystemOpen(const Coda::CodaCommandResult &result);
|
|
|
|
|
void handleFileSystemWrite(const Coda::CodaCommandResult &result);
|
|
|
|
|
void handleFileSystemClose(const Coda::CodaCommandResult &result);
|
|
|
|
|
void handleFileSystemFStat(const Coda::CodaCommandResult &result);
|
|
|
|
|
void handleSymbianInstall(const Coda::CodaCommandResult &result);
|
2010-12-06 13:52:47 +01:00
|
|
|
void doExit(int ex);
|
2010-12-07 11:05:25 +01:00
|
|
|
void putSendNextChunk();
|
|
|
|
|
void closeRemoteFile();
|
2010-12-06 13:52:47 +01:00
|
|
|
|
|
|
|
|
Mode m_mode;
|
|
|
|
|
QString m_address;
|
|
|
|
|
unsigned short m_port;
|
|
|
|
|
QString m_launchBinary;
|
|
|
|
|
QStringList m_launchArgs;
|
|
|
|
|
unsigned m_launchUID;
|
|
|
|
|
bool m_launchDebug;
|
|
|
|
|
QString m_installSisFile;
|
|
|
|
|
QString m_installTargetDrive;
|
2010-12-06 17:07:18 +01:00
|
|
|
bool m_installSilently;
|
|
|
|
|
QString m_putLocalFile;
|
|
|
|
|
QString m_putRemoteFile;
|
|
|
|
|
bool m_putWriteOk;
|
|
|
|
|
bool m_statFstatOk;
|
2010-12-07 11:05:25 +01:00
|
|
|
QScopedPointer<QFile> m_putFile;
|
|
|
|
|
quint64 m_putLastChunkSize;
|
2010-12-06 17:07:18 +01:00
|
|
|
QString m_statRemoteFile;
|
|
|
|
|
QByteArray m_remoteFileHandle;
|
2010-12-07 11:05:25 +01:00
|
|
|
quint64 m_putChunkSize;
|
2010-12-06 13:52:47 +01:00
|
|
|
unsigned m_verbose;
|
2010-12-07 15:20:09 +01:00
|
|
|
QTime m_startTime;
|
2011-02-10 16:48:41 +01:00
|
|
|
QScopedPointer<Coda::CodaDevice> m_trkDevice;
|
2010-12-06 13:52:47 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // CODACLIENTAPPLICATION_H
|