Skip to main content

Class UpdateService

The default Meadow implementation of IUpdateService

Assembly: Meadow.dll
View Source
public class UpdateService : IUpdateService, ICommandService

Implements:
Meadow.Update.IUpdateService, Meadow.Cloud.ICommandService

Properties

State

Gets the current state of the service

View Source
public UpdateState State { get; }

Fields

NetworkRetryTimeoutSeconds

Retry period the service will use to attempt network reconnection

View Source
public const int NetworkRetryTimeoutSeconds = 15

MaxDownloadRetries

Specifies the maximum number of download attempts before giving up.

View Source
public const int MaxDownloadRetries = 10

RetryDelayMilliseconds

Period the service will wait between download attempts in case of failure.

View Source
public const int RetryDelayMilliseconds = 1000

TokenExpirationPeriod

Auth token expiration period in minutes. TODO: Replace this hard-coded value with one retrieved from the Meadow Cloud.

View Source
public const int TokenExpirationPeriod = 60

Methods

Shutdown()

Stops the service

View Source
public void Shutdown()

Start()

Starts the service if it is not already running

View Source
public void Start()

ClearUpdates()

Clears all locally stored update package information

View Source
public void ClearUpdates()

RetrieveUpdate(UpdateInfo)

Retrieves an update package from the defined update server with the provided parameters

View Source
public void RetrieveUpdate(UpdateInfo updateInfo)
Parameters
TypeNameDescription
Meadow.Update.UpdateInfoupdateInfoThe UpdateInfo describing the update to retrieve

ApplyUpdate(UpdateInfo)

Applies an already-retrieved update package with the provided parameters

View Source
public void ApplyUpdate(UpdateInfo updateInfo)
Parameters
TypeNameDescription
Meadow.Update.UpdateInfoupdateInfoThe UpdateInfo describing the update to apply

Events

OnStateChanged

Event raised when an the state of the Update service changes

View Source
public event EventHandler<UpdateState> OnStateChanged
Event Type

System.EventHandler<Meadow.Update.UpdateState>

OnUpdateAvailable

Event raised when an update is available on the defined Update server

View Source
public event UpdateEventHandler OnUpdateAvailable
Event Type

Meadow.Update.UpdateEventHandler

OnUpdateRetrieved

Event raised after an update package has been retrieved from the defined Update server

View Source
public event UpdateEventHandler OnUpdateRetrieved
Event Type

Meadow.Update.UpdateEventHandler

OnUpdateSuccess

Event raised after an update package has been successfully applied

View Source
public event UpdateEventHandler OnUpdateSuccess
Event Type

Meadow.Update.UpdateEventHandler

OnUpdateFailure

Event raised if a failure occurs in an attempt to apply an update package

View Source
public event UpdateEventHandler OnUpdateFailure
Event Type

Meadow.Update.UpdateEventHandler

Implements