diff options
author | Arthur Taylor <codders@octomonkey.org.uk> | 2016-09-05 15:43:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-05 15:43:23 +0200 |
commit | 0167dce98692f707b74395977c478c2ca44fa0c7 (patch) | |
tree | 53db4ad3d930e586be4ec946b0bbbfdda5350732 /src/datatype/event.rs | |
parent | d37818fa5ac01e2bf05c9b6c71362b41691a01f1 (diff) | |
parent | db7575f02de4064a7afaa10c3ae33349fadbf605 (diff) | |
download | rvi_sota_client-0167dce98692f707b74395977c478c2ca44fa0c7.tar.gz |
Merge pull request #8 from advancedtelematic/stable
Merge latest advancedtelematic/stable
Diffstat (limited to 'src/datatype/event.rs')
-rw-r--r-- | src/datatype/event.rs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/datatype/event.rs b/src/datatype/event.rs new file mode 100644 index 0000000..e3f84ca --- /dev/null +++ b/src/datatype/event.rs @@ -0,0 +1,56 @@ +use std::fmt::{Display, Formatter, Result as FmtResult}; + +use datatype::{DownloadComplete, Package, UpdateAvailable, UpdateReport, + UpdateRequestId}; + + +/// System-wide events that are broadcast to all interested parties. +#[derive(RustcEncodable, RustcDecodable, Debug, Clone, PartialEq, Eq)] +pub enum Event { + /// General error event with a printable representation for debugging. + Error(String), + + /// Authentication was successful. + Authenticated, + /// An operation failed because we are not currently authenticated. + NotAuthenticated, + + /// There are new updates available. + NewUpdatesReceived(Vec<UpdateRequestId>), + /// A notification from RVI of a new update. + NewUpdateAvailable(UpdateAvailable), + /// There are no new updates available. + NoNewUpdates, + + /// The following packages are installed on the device. + FoundInstalledPackages(Vec<Package>), + /// An update on the system information was received. + FoundSystemInfo(String), + /// A list of installed packages was sent to the Core server. + InstalledPackagesSent, + /// An update report was sent to the Core server. + UpdateReportSent, + + /// Downloading an update. + DownloadingUpdate(UpdateRequestId), + /// An update was downloaded. + DownloadComplete(DownloadComplete), + /// Downloading an update failed. + DownloadFailed(UpdateRequestId, String), + + /// Installing an update. + InstallingUpdate(UpdateRequestId), + /// An update was installed. + InstallComplete(UpdateReport), + /// The installation of an update failed. + InstallFailed(UpdateReport), + + /// A broadcast event requesting an update on externally installed software. + InstalledSoftwareNeeded, +} + +impl Display for Event { + fn fmt(&self, f: &mut Formatter) -> FmtResult { + write!(f, "{:?}", self) + } +} |