forked from qt-creator/qt-creator
CodaClient now supports uninstallation
This commit is contained in:
@@ -50,6 +50,7 @@ static const char usageC[] =
|
|||||||
"%1 ping connection Note: For serial connections ONLY.\n"
|
"%1 ping connection Note: For serial connections ONLY.\n"
|
||||||
"%1 launch [-d] connection binary uid [--] [arguments]\n"
|
"%1 launch [-d] connection binary uid [--] [arguments]\n"
|
||||||
"%1 install[-s] connection remote-sis-file [targetdrive]\n"
|
"%1 install[-s] connection remote-sis-file [targetdrive]\n"
|
||||||
|
"%1 uninstall connection packageUID\n"
|
||||||
"%1 put [c size] connection local-file remote-file\n"
|
"%1 put [c size] connection local-file remote-file\n"
|
||||||
"%1 stat connection remote-file\n\n"
|
"%1 stat connection remote-file\n\n"
|
||||||
"'connection': address[:port] or serial-port\n\n"
|
"'connection': address[:port] or serial-port\n\n"
|
||||||
@@ -90,6 +91,7 @@ CodaClientApplication::CodaClientApplication(int &argc, char **argv) :
|
|||||||
m_port(defaultPort),
|
m_port(defaultPort),
|
||||||
m_launchUID(0),
|
m_launchUID(0),
|
||||||
m_launchDebug(false),
|
m_launchDebug(false),
|
||||||
|
m_uninstallPackage(0),
|
||||||
m_installTargetDrive(QLatin1String("C:")),
|
m_installTargetDrive(QLatin1String("C:")),
|
||||||
m_installSilently(false),
|
m_installSilently(false),
|
||||||
m_putWriteOk(false),
|
m_putWriteOk(false),
|
||||||
@@ -120,6 +122,8 @@ static inline CodaClientApplication::Mode modeArg(const QString &a)
|
|||||||
return CodaClientApplication::Ping;
|
return CodaClientApplication::Ping;
|
||||||
if (a == QLatin1String("install"))
|
if (a == QLatin1String("install"))
|
||||||
return CodaClientApplication::Install;
|
return CodaClientApplication::Install;
|
||||||
|
if (a == QLatin1String("uninstall"))
|
||||||
|
return CodaClientApplication::Uninstall;
|
||||||
if (a == QLatin1String("put"))
|
if (a == QLatin1String("put"))
|
||||||
return CodaClientApplication::Put;
|
return CodaClientApplication::Put;
|
||||||
if (a == QLatin1String("stat"))
|
if (a == QLatin1String("stat"))
|
||||||
@@ -154,6 +158,13 @@ bool CodaClientApplication::parseArgument(const QString &a, int argNumber, QStri
|
|||||||
case Install:
|
case Install:
|
||||||
m_installSisFile = a;
|
m_installSisFile = a;
|
||||||
break;
|
break;
|
||||||
|
case Uninstall:
|
||||||
|
m_uninstallPackage = a.toUInt(0, 0);
|
||||||
|
if (!m_uninstallPackage) {
|
||||||
|
*errorMessage = QLatin1String("Invalid UID");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Put:
|
case Put:
|
||||||
m_putLocalFile = a;
|
m_putLocalFile = a;
|
||||||
break;
|
break;
|
||||||
@@ -261,6 +272,12 @@ CodaClientApplication::ParseArgsResult CodaClientApplication::parseArguments(QSt
|
|||||||
return ParseInitError;
|
return ParseInitError;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Uninstall:
|
||||||
|
if (!m_uninstallPackage) {
|
||||||
|
*errorMessage = QString::fromLatin1("Not enough parameters for uninstall.");
|
||||||
|
return ParseInitError;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Put: {
|
case Put: {
|
||||||
if (m_address.isEmpty() || m_putLocalFile.isEmpty() || m_putRemoteFile.isEmpty()) {
|
if (m_address.isEmpty() || m_putLocalFile.isEmpty() || m_putRemoteFile.isEmpty()) {
|
||||||
*errorMessage = QString::fromLatin1("Not enough parameters for put.");
|
*errorMessage = QString::fromLatin1("Not enough parameters for put.");
|
||||||
@@ -296,6 +313,10 @@ bool CodaClientApplication::start()
|
|||||||
std::printf("Installing '%s' to '%s'\n",
|
std::printf("Installing '%s' to '%s'\n",
|
||||||
qPrintable(m_installSisFile), qPrintable(m_installTargetDrive));
|
qPrintable(m_installSisFile), qPrintable(m_installTargetDrive));
|
||||||
break;
|
break;
|
||||||
|
case Uninstall:
|
||||||
|
std::printf("Uninstalling 0x%x'\n",
|
||||||
|
m_uninstallPackage);
|
||||||
|
break;
|
||||||
case Put:
|
case Put:
|
||||||
std::printf("Copying '%s' to '%s' in chunks of %lluKB\n",
|
std::printf("Copying '%s' to '%s' in chunks of %lluKB\n",
|
||||||
qPrintable(m_putLocalFile), qPrintable(m_putRemoteFile),
|
qPrintable(m_putLocalFile), qPrintable(m_putRemoteFile),
|
||||||
@@ -482,6 +503,18 @@ void CodaClientApplication::handleSymbianInstall(const Coda::CodaCommandResult &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodaClientApplication::handleUninstall(const Coda::CodaCommandResult &result)
|
||||||
|
{
|
||||||
|
if (result.type == Coda::CodaCommandResult::SuccessReply) {
|
||||||
|
printTimeStamp();
|
||||||
|
std::printf("Uninstallation succeeded\n.");
|
||||||
|
doExit(0);
|
||||||
|
} else {
|
||||||
|
std::fprintf(stderr, "Uninstallation failed: %s\n", qPrintable(result.toString()));
|
||||||
|
doExit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CodaClientApplication::slotCodaEvent (const Coda::CodaEvent &ev)
|
void CodaClientApplication::slotCodaEvent (const Coda::CodaEvent &ev)
|
||||||
{
|
{
|
||||||
printTimeStamp();
|
printTimeStamp();
|
||||||
@@ -504,6 +537,10 @@ void CodaClientApplication::slotCodaEvent (const Coda::CodaEvent &ev)
|
|||||||
m_installSisFile.toAscii());
|
m_installSisFile.toAscii());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Uninstall:
|
||||||
|
m_trkDevice->sendSymbianUninstallCommand(Coda::CodaCallback(this, &CodaClientApplication::handleUninstall),
|
||||||
|
m_uninstallPackage);
|
||||||
|
break;
|
||||||
case Put: {
|
case Put: {
|
||||||
const unsigned flags =
|
const unsigned flags =
|
||||||
Coda::CodaDevice::FileSystem_TCF_O_WRITE
|
Coda::CodaDevice::FileSystem_TCF_O_WRITE
|
||||||
@@ -512,15 +549,15 @@ void CodaClientApplication::slotCodaEvent (const Coda::CodaEvent &ev)
|
|||||||
m_putWriteOk = false;
|
m_putWriteOk = false;
|
||||||
m_trkDevice->sendFileSystemOpenCommand(Coda::CodaCallback(this, &CodaClientApplication::handleFileSystemOpen),
|
m_trkDevice->sendFileSystemOpenCommand(Coda::CodaCallback(this, &CodaClientApplication::handleFileSystemOpen),
|
||||||
m_putRemoteFile.toAscii(), flags);
|
m_putRemoteFile.toAscii(), flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Stat: {
|
case Stat: {
|
||||||
const unsigned flags = Coda::CodaDevice::FileSystem_TCF_O_READ;
|
const unsigned flags = Coda::CodaDevice::FileSystem_TCF_O_READ;
|
||||||
m_statFstatOk = false;
|
m_statFstatOk = false;
|
||||||
m_trkDevice->sendFileSystemOpenCommand(Coda::CodaCallback(this, &CodaClientApplication::handleFileSystemOpen),
|
m_trkDevice->sendFileSystemOpenCommand(Coda::CodaCallback(this, &CodaClientApplication::handleFileSystemOpen),
|
||||||
m_statRemoteFile.toAscii(), flags);
|
m_statRemoteFile.toAscii(), flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Invalid:
|
case Invalid:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ class CodaClientApplication : public QCoreApplication
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum Mode { Invalid, Ping, Launch, Put, Stat, Install };
|
enum Mode { Invalid, Ping, Launch, Put, Stat, Install, Uninstall };
|
||||||
|
|
||||||
explicit CodaClientApplication(int &argc, char **argv);
|
explicit CodaClientApplication(int &argc, char **argv);
|
||||||
~CodaClientApplication();
|
~CodaClientApplication();
|
||||||
@@ -77,6 +77,7 @@ private:
|
|||||||
void handleFileSystemClose(const Coda::CodaCommandResult &result);
|
void handleFileSystemClose(const Coda::CodaCommandResult &result);
|
||||||
void handleFileSystemFStat(const Coda::CodaCommandResult &result);
|
void handleFileSystemFStat(const Coda::CodaCommandResult &result);
|
||||||
void handleSymbianInstall(const Coda::CodaCommandResult &result);
|
void handleSymbianInstall(const Coda::CodaCommandResult &result);
|
||||||
|
void handleUninstall(const Coda::CodaCommandResult &result);
|
||||||
void doExit(int ex);
|
void doExit(int ex);
|
||||||
void putSendNextChunk();
|
void putSendNextChunk();
|
||||||
void closeRemoteFile();
|
void closeRemoteFile();
|
||||||
@@ -88,6 +89,7 @@ private:
|
|||||||
QStringList m_launchArgs;
|
QStringList m_launchArgs;
|
||||||
unsigned m_launchUID;
|
unsigned m_launchUID;
|
||||||
bool m_launchDebug;
|
bool m_launchDebug;
|
||||||
|
unsigned m_uninstallPackage;
|
||||||
QString m_installSisFile;
|
QString m_installSisFile;
|
||||||
QString m_installTargetDrive;
|
QString m_installTargetDrive;
|
||||||
bool m_installSilently;
|
bool m_installSilently;
|
||||||
|
Reference in New Issue
Block a user