UpdateManager
Description
The UpdateManager object provides functions and properties for querying and installing system updates.
- › Inherits:
Overview
Properties
Methods
Signals
Enumerations
Properties
autoDownload
This property holds whether to automatically download available updates.
- › Type:
Boolean
- › Default:
false- › Signal:
autoDownloadChanged()
- › Attributes:
Writable
autoInstall
This property holds whether to automatically install downloaded updates.
- › Type:
Boolean
- › Default:
false- › Signal:
autoInstallChanged()
- › Attributes:
Writable
autoReboot
This property holds whether to automatically reboot the system after installing updates.
- › Type:
Boolean
- › Default:
false- › Signal:
autoRebootChanged()
- › Attributes:
Writable
checkInterval
This property holds the interval in milliseconds in which to check the configured repositories for updates. The minimum value is 5000.
- › Type:
SignedInteger
- › Default:
0- › Signal:
checkIntervalChanged()
- › Attributes:
Writable
downloadStorage
This property holds a storage location for storing downloaded update files.
- › Type:
- › Signal:
downloadStorageChanged()
- › Attributes:
Readonly
error
This property holds the most recently occurred error or UpdateManager.NoError if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() signal to detect multiple occurrences of the same error.
- › Type:
- › Signal:
errorChanged()
- › Attributes:
Readonly
errorData
This property holds additional information on errors occurred while checking, downloading or installing updates.
- › Type:
String
- › Signal:
errorDataChanged()
- › Attributes:
Readonly
errorString
This property holds the current human readable error string corresponding to the current value in the error property. It may include additional information such as failure reasons or locations.
- › Type:
String
- › Signal:
errorStringChanged()
- › Attributes:
Readonly
installStepMessage
This property holds a message providing information about the current step of an update installation.
This property was introduced in InCore 2.5.
- › Type:
String
- › Signal:
installStepMessageChanged()
- › Attributes:
Readonly
pendingUpdates
This property holds the list of available updates pending for installation. This list usually is populated by the download() method but also can be written manually for installing a custom update bundle via the install() method.
- › Type:
StringList
- › Signal:
pendingUpdatesChanged()
- › Attributes:
Writable
progress
This property holds the percentage progress of the update installation operation.
- › Type:
SignedInteger
- › Signal:
progressChanged()
- › Attributes:
Readonly
repositories
This property holds a list of repositories where to retrieve update bundles from.
- › Type:
- › Signal:
repositoriesChanged()
- › Attributes:
Readonly
targets
This property holds a list of targets which to install updates for.
- › Type:
- › Signal:
targetsChanged()
- › Attributes:
Readonly
updatesAvailable
This property holds whether any updates are available in the configured repositories.
- › Type:
Boolean
- › Signal:
updatesAvailableChanged()
- › Attributes:
Readonly
updatesReady
This property holds whether any updates have been downloaded and are ready to install.
- › Type:
Boolean
- › Signal:
updatesReadyChanged()
- › Attributes:
Readonly
Methods
check()
This method checks the configured repositories for updates by fetching corresponding update file lists. Returns true if at least one repository could be checked successfully. If autoDownload is set to true downloads will be started afterwards automatically. Otherwise call download() manually.
- › Returns:
Boolean
download()
This method initiates the download of available updates to the storage specified by downloadStorage. Returns true if the downloads could be started successfully. Once all downloads are finished the updatesReady property changes to true and pendingUpdates is updated accordingly. If autoInstall is set to true all downloaded updates will be installed afterwards automatically. Otherwise call install() manually.
- › Returns:
Boolean
install()
This method initiates the installation of the downloaded updates. Returns true if at least one update is available for installation. Once all updates have been installed the updatesInstalled() signal is emitted. If autoReboot is set to true the system is rebooted afterwards automatically.
- › Returns:
Boolean
Signals
errorOccurred()
This signal is emitted whenever an error has occurred, regardless of whether the error property has changed or not. In contrast to the change notification signal of the error property this signal is also emitted several times if a certain error occurs several times in succession.
repositoriesDataChanged(SignedInteger index)
This signal is emitted whenever the List.dataChanged() signal is emitted, i.e. the item at index in the repositories list itself emitted the dataChanged() signal.
targetsDataChanged(SignedInteger index)
This signal is emitted whenever the List.dataChanged() signal is emitted, i.e. the item at index in the targets list itself emitted the dataChanged() signal.
updatesInstalled()
This signal is emitted when one or multiple updates have been installed succesfully. This can be used to trigger further actions when autoReboot is set to false and the device keeps running after the update.
Enumerations
Error
This enumeration describes all errors which can occur in UpdateManager objects. The most recently occurred error is stored in the error property.
Name |
Value |
Description |
|---|---|---|
|
|
No error occurred or was detected. |
|
|
No repositories specified. |
|
|
Update file is invalid or incompatible. |
|
|
An error occurred while installing an update. |
|
|
None or invalid download storage set. |
|
|
Insufficient space available on the download storage. |
|
|
Updates have not been checked or no updates are available for the configured targets. |
|
|
No updates have been downloaded for installation. |
|
|
Failed to download one or multiple updates. |
Example
import InCore.Foundation 2.5
import InCore.Http 2.5
Application {
id: app
name: "update-manager-example"
version: "0.1.0"
UpdateManager {
id: updateManager
autoInstall: true
onCompleted: check()
repositories: [
LocalRepository { storage: LocalStorage { } },
UsbDriveRepository { storage.onAvailableChanged: updateManager.check() },
HttpRepository { url: "http://download.inhub.de/siineos/updates/" }
]
UpdateTarget {
bundlePrefix: "siineos"
currentVersion: system.osVersion
}
UpdateTarget {
bundlePrefix: "example-app"
currentVersion: app.version
}
}
}