QOTAClient Class

Main interface to the OTA functionality. More...

Header: #include <QOTAClient>
qmake: QT += qtotaupdate
Instantiated By: OTAClient

Properties

Public Functions

QOTAClient(QObject *parent = Q_NULLPTR)
~QOTAClient()
QString clientDescription() const
QByteArray clientInfo() const
QString clientRevision() const
QString clientVersion() const
QString errorString() const
bool fetchServerInfo() const
bool initialized() const
bool otaEnabled() const
bool restartRequired() const
bool rollback() const
QString rollbackDescription() const
QByteArray rollbackInfo() const
QString rollbackRevision() const
QString rollbackVersion() const
QString serverDescription() const
QByteArray serverInfo() const
QString serverRevision() const
QString serverVersion() const
bool update() const
bool updateAvailable() const

Signals

void errorOccurred(const QString &error)
void fetchServerInfoFinished(bool success)
void initializationFinished()
void restartRequiredChanged(bool required)
void rollbackFinished(bool success)
void rollbackInfoChanged()
void serverInfoChanged()
void updateAvailableChanged(bool available)
void updateFinished(bool success)

Detailed Description

Main interface to the OTA functionality.

QOTAClient provides an API to execute OTA tasks. Offline operations include querying the booted and rollback system version details and atomically performing the rollbacks. Online operations include fetching a new system version from a remote server and atomically performing system updates.

Using this API is safe and won't leave the system in an inconsistent state, even if the power fails half-way through.

Note: Remote Configuration

A remote needs to be configured for a device to be able to locate a server that is hosting an OTA update. A Tech Preview release does not provide Qt API to configure remotes. To configure a remote, it is necessary to use the ostree command line tool. Examples for remote configurations:

No Security:

ostree remote add --no-gpg-verify qt-os http://${SERVER_ADDRESS}:${PORT}/ostree-repo linux/qt

Using GPG Signing:

ostree remote add --set=gpg-verify=true qt-os http://${SERVER_ADDRESS}:${PORT}/ostree-repo linux/qt

Using TLS Authentication:

ostree remote add \
--tls-client-cert-path /path/client.crt \
--tls-client-key-path /path/client.key \
--tls-ca-path /trusted/server.crt qt-os https://${SERVER_ADDRESS}:${PORT}/ostree-repo linux/qt

${SERVER_ADDRESS} - the server where you have exported the OSTree repository.

${PORT} - port number.

Property Documentation

clientDescription : const QString

This property holds a QString containing the booted system's description.

This is a convenience method.

Access functions:

QString clientDescription() const

Notifier signal:

See also clientInfo().

clientInfo : const QByteArray

This property holds a QByteArray containing the booted system's OTA metadata.

Returns JSON-formatted QByteArray containing OTA metadata for the booted system. Metadata is bundled with each system's version.

Access functions:

QByteArray clientInfo() const

Notifier signal:

clientRevision : const QString

This property holds a QString containing the booted system's revision.

A checksum in the OSTree repository.

Access functions:

QString clientRevision() const

Notifier signal:

clientVersion : const QString

This property holds a QString containing the booted system's version.

This is a convenience method.

Access functions:

QString clientVersion() const

Notifier signal:

See also clientInfo().

error : const QString

This property holds a string containing the last error occurred.

Access functions:

QString errorString() const

Notifier signal:

void errorOccurred(const QString &error)

initialized : const bool

This property holds whether the object has completed the initialization.

When an object of this class is created, it asynchronously (from a non-GUI thread) pre-populates the internal state and sets this property accordingly, and signals initializationFinished().

Initialization is fast if there are no other processes locking access to the OSTree repository on a device. This could happen if there is some other process currently writing to the OSTree repository, for example, a daemon calling fetchServerInfo().

Access functions:

bool initialized() const

Notifier signal:

See also initializationFinished().

otaEnabled : const bool

This property holds whether a device supports OTA updates.

Access functions:

bool otaEnabled() const

restartRequired : const bool

This property holds whether reboot is required.

Holds a bool indicating whether reboot is required. Reboot is required after update() and rollback() to boot into the new default system.

Access functions:

bool restartRequired() const

Notifier signal:

void restartRequiredChanged(bool required)

rollbackDescription : const QString

This property holds a QString containing the rollback system's description.

This is a convenience method.

Access functions:

QString rollbackDescription() const

Notifier signal:

See also rollbackInfo().

rollbackInfo : const QByteArray

This property holds a QByteArray containing the rollback system's OTA metadata.

Returns JSON-formatted QByteArray containing OTA metadata for the roolback system. Metadata is bundled with each system's version.

Access functions:

QByteArray rollbackInfo() const

Notifier signal:

See also rollback().

rollbackRevision : const QString

This property holds a QString containing the rollback system's revision.

A checksum in the OSTree repository.

Access functions:

QString rollbackRevision() const

Notifier signal:

rollbackVersion : const QString

This property holds a QString containing the rollback system's version.

This is a convenience method.

Access functions:

QString rollbackVersion() const

Notifier signal:

See also rollbackInfo().

serverDescription : const QString

This property holds a QString containing the system's description on a server.

This is a convenience method.

Access functions:

QString serverDescription() const

Notifier signal:

See also serverInfo().

serverInfo : const QByteArray

This property holds a QByteArray containing the system's OTA metadata on a server.

Returns JSON-formatted QByteArray containing OTA metadata for the system on a server. Metadata is bundled with each system's version.

Access functions:

QByteArray serverInfo() const

Notifier signal:

See also fetchServerInfo().

serverRevision : const QString

This property holds a QString containing the system's revision on a server.

A checksum in the OSTree repository.

Access functions:

QString serverRevision() const

Notifier signal:

serverVersion : const QString

This property holds a QString containing the system's version on a server.

This is a convenience method.

Access functions:

QString serverVersion() const

Notifier signal:

See also serverInfo().

updateAvailable : const bool

This property holds whether a system update is available.

Holds a bool indicating the availability of a system update. This information is cached - to update the local cache, call fetchServerInfo().

Access functions:

bool updateAvailable() const

Notifier signal:

void updateAvailableChanged(bool available)

Member Function Documentation

QOTAClient::QOTAClient(QObject *parent = Q_NULLPTR)

Default constructs an instance of QOTAClient.

QOTAClient::~QOTAClient()

Destroys the instance of QOTAClient.

[signal] void QOTAClient::errorOccurred(const QString &error)

This signal is emitted when an error occurs. The error argument holds the error message.

Note: Notifier signal for property error.

bool QOTAClient::fetchServerInfo() const

Fetch OTA metadata from a server and update the local cache. This metadata contains information on what system version is available on a server. The cache is persistent as it is stored on the disk.

This method is asynchronous and returns immediately. The return value holds whether the operation was started successfully.

See also fetchServerInfoFinished(), updateAvailable(), and serverInfo().

[signal] void QOTAClient::fetchServerInfoFinished(bool success)

This is a notifier signal for fetchServerInfo(). The success argument indicates whether the operation was successful.

[signal] void QOTAClient::initializationFinished()

This signal is emitted when the object has finished initialization. Only after this signal has arrived, the object is ready for use.

Note: Notifier signal for property initialized. Notifier signal for property clientDescription. Notifier signal for property clientVersion. Notifier signal for property clientRevision. Notifier signal for property clientInfo.

[signal] void QOTAClient::restartRequiredChanged(bool required)

This signal is emitted when the value of restartRequired changes. The required argument holds whether reboot is required.

Note: Notifier signal for property restartRequired.

bool QOTAClient::rollback() const

Rollback to the previous system version.

This method is asynchronous and returns immediately. The return value holds whether the operation was started successfully.

See also rollbackFinished() and restartRequired().

[signal] void QOTAClient::rollbackFinished(bool success)

This is a notifier signal for rollback(). The success argument indicates whether the operation was successful.

[signal] void QOTAClient::rollbackInfoChanged()

This signal is emitted when rollback info changes. Rollback info changes when calling rollback().

Note: Notifier signal for property rollbackVersion. Notifier signal for property rollbackDescription. Notifier signal for property rollbackRevision. Notifier signal for property rollbackInfo.

[signal] void QOTAClient::serverInfoChanged()

Server info can change when calling fetchServerInfo(). If OTA metadata on the server is different from the local cache, the local cache is updated and this signal is emitted.

Note: Notifier signal for property serverVersion. Notifier signal for property serverDescription. Notifier signal for property serverRevision. Notifier signal for property serverInfo.

bool QOTAClient::update() const

Fetch an OTA update from a server and perform the system update.

This method is asynchronous and returns immediately. The return value holds whether the operation was started successfully.

See also updateFinished(), fetchServerInfo(), and restartRequired().

[signal] void QOTAClient::updateAvailableChanged(bool available)

This signal is emitted when the value of updateAvailable changes. The available argument holds whether a system update is available for default system.

Note: Notifier signal for property updateAvailable.

[signal] void QOTAClient::updateFinished(bool success)

This is a notifier signal for update(). The success argument indicates whether the operation was successful.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.