简体   繁体   中英

SWUpdate API with Qt

I'm trying to update my application using SWUpdate tool for my embedded board. I already created my.swu pack, anche with ssh command line, it works fine. I need to launch the update from my Qt application. How can I do?

Maybe I can launch QProcess::execute("swupdate -i /run/media/AppUpdate.swu"), but it still not working.

How can I link with Qt the SWUpdate API installed?

Thanks.

You did not state which Qt version you are using. The more recent ones deprecated the QProcess::execute call as you are using it (program name and arguments in one string).

Try this:

QProcess* proc = new QProcess;
proc->setProgram("swupdate");
proc->setArguments(QStringList({"-i", "path/to/your/update.swu"});
proc->start();
if (!proc->waitForStarted()) 
    qCritical() << "failed to start swupdate: " << proc->errorString();
/*optional: block/wait for swupdate to finish*/
proc->waitForFinished(-1);

I recommend to also implement and connect the readyRead signal and save/log swupdate's output in case something goes wrong during the update.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM