Class RemoteDataStore
A Remote Data Store periodically transfers data from the device's LocalDataStore to a remote storage system (e.g., Amazon's Simple Storage Service). The job of the Remote Data Store is to ensure that data accumulated locally on the device are safely transferred off of the device before their accumulated size grows too large or they are corrupted, deleted, lost, etc.
Inherited Members
Namespace: Sensus.DataStores.Remote
Assembly: SensusAndroid.dll
Syntax
public abstract class RemoteDataStore : DataStore
Constructors
RemoteDataStore()
Declaration
protected RemoteDataStore()
Properties
CanRetrieveWrittenData
Declaration
public abstract bool CanRetrieveWrittenData { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DelayToleranceAfterMS
Tolerance in milliseconds for running the RemoteDataStore after the scheduled time, if doing so will increase the number of batched actions and thereby decrease battery consumption.
Declaration
[EntryIntegerUiProperty("Delay Tolerance After (MS):", true, 61, true)]
public int DelayToleranceAfterMS { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The delay tolerance before. |
DelayToleranceBeforeMS
Tolerance in milliseconds for running the RemoteDataStore before the scheduled time, if doing so will increase the number of batched actions and thereby decrease battery consumption.
Declaration
[EntryIntegerUiProperty("Delay Tolerance Before (MS):", true, 60, true)]
public int DelayToleranceBeforeMS { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The delay tolerance before. |
RequireCharging
Whether to require external power when uploading data.
Declaration
[OnOffUiProperty("Require Charging:", true, 54)]
public bool RequireCharging { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
RequiredBatteryChargeLevelPercent
The battery charge percent required to write data to the RemoteDataStore. This value is
only considered when RequireCharging is false. Since remote data storage relies on wireless
data transmission, significant battery consumption may result. This value provides flexibility when combined with
RequireCharging. For example, when RequireCharging is false and
RequiredBatteryChargeLevelPercent is 95%, Sensus will be allowed to transfer data without an external
power source only when the battery is almost fully charged. This will minimize user irritation.
Declaration
[EntryFloatUiProperty("Required Battery Charge (Percent):", true, 55, false)]
public float RequiredBatteryChargeLevelPercent { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single | The required battery charge level percent. |
RequireWiFi
Whether to require a WiFi connection when uploading data. If this is turned off, substantial data charges might result since data will be transferred over the cellular network if WiFi is not available.
Declaration
[OnOffUiProperty("Require WiFi:", true, 53)]
public bool RequireWiFi { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
StorageDescription
Declaration
public virtual string StorageDescription { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
UserNotificationMessage
Available on iOS only. The message displayed to the user when Sensus is in the background and data are scheduled to be transferred to the RemoteDataStore. This message is delivered via a notification in the hope that the user will open Sensus to transmit the data. Data will not be transferred if the user does not open Sensus.
Declaration
[EntryStringUiProperty("(iOS) User Notification Message:", true, 56, true)]
public string UserNotificationMessage { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The user notification message. |
WriteDelayMS
How many milliseconds to pause between each data write cycle.
Declaration
[EntryIntegerUiProperty("Write Delay (MS):", true, 50, true)]
public int WriteDelayMS { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The write delay in milliseconds. |
WriteOnPowerConnect
Whether to initiate an additional data upload each time the device is plugged in to external power. These additional uploads will respect the other settings (e.g., RequireWiFi).
Declaration
[OnOffUiProperty("Write on Power Connect:", true, 52)]
public bool WriteOnPowerConnect { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
WriteTimeoutMinutes
How many minutes the data store has to complete a write before being cancelled.
Declaration
[EntryIntegerUiProperty("Write Timeout (Mins.):", true, 51, true)]
public int WriteTimeoutMinutes { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The write timeout in minutes. |
Methods
DeletePushNotificationRequestAsync(Guid, CancellationToken)
Deletes the push notification request.
Declaration
public abstract Task DeletePushNotificationRequestAsync(Guid backendKey, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | backendKey | Backend key |
| System.Threading.CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Task |
DeletePushNotificationTokenAsync(CancellationToken)
Deletes the push notification token.
Declaration
public abstract Task DeletePushNotificationTokenAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | The push notification token. |
GetDatumAsync<T>(String, CancellationToken)
Retrieves a single Datum from the RemoteDataStore.
Declaration
public abstract Task<T> GetDatumAsync<T>(string datumKey, CancellationToken cancellationToken)
where T : Datum
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | datumKey | Datum key. |
| System.Threading.CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<T> | The datum. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of Datum to retrieve. |
GetDatumKey(Datum)
Gets the key (identifier) value for a Datum. Used within WriteDatumAsync(Datum, CancellationToken) and GetDatumAsync<T>(String, CancellationToken).
Declaration
public abstract string GetDatumKey(Datum datum)
Parameters
| Type | Name | Description |
|---|---|---|
| Datum | datum | Datum. |
Returns
| Type | Description |
|---|---|
| System.String | The datum key. |
GetPushNotificationUpdatesAsync(CancellationToken)
Gets PushNotificationUpdates for the current device.
Declaration
public abstract Task<List<PushNotificationUpdate>> GetPushNotificationUpdatesAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.List<PushNotificationUpdate>> | The updates |
GetScriptAgentPolicyAsync(CancellationToken)
Gets the script agent policy from the RemoteDataStore. See concrete class implementation for details.
Declaration
public abstract Task<JObject> GetScriptAgentPolicyAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Newtonsoft.Json.Linq.JObject> | The script agent policy. |
GetSensingAgentPolicyAsync(CancellationToken)
Gets the sensing agent policy from the RemoteDataStore. See concrete class implementation for details.
Declaration
public abstract Task<JObject> GetSensingAgentPolicyAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Newtonsoft.Json.Linq.JObject> | The sensing agent policy. |
Reset()
Declaration
public override void Reset()
Overrides
SendPushNotificationRequestAsync(PushNotificationRequest, CancellationToken)
Sends the push notification request.
Declaration
public abstract Task SendPushNotificationRequestAsync(PushNotificationRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| PushNotificationRequest | request | Request. |
| System.Threading.CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | The push notification request. |
SendPushNotificationTokenAsync(String, CancellationToken)
Sends the push notification token.
Declaration
public abstract Task SendPushNotificationTokenAsync(string token, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | token | Token. |
| System.Threading.CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | The push notification token. |
StartAsync()
Declaration
public override Task StartAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
Overrides
StopAsync()
Declaration
public override Task StopAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
Overrides
TestHealthAsync(List<AnalyticsTrackedEvent>)
Declaration
public override Task<HealthTestResult> TestHealthAsync(List<AnalyticsTrackedEvent> events)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<AnalyticsTrackedEvent> | events |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<HealthTestResult> |
Overrides
WriteDataStreamAsync(Stream, String, String, CancellationToken)
Writes a stream of Datum objects.
Declaration
public abstract Task WriteDataStreamAsync(Stream stream, string name, string contentType, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream. |
| System.String | name | Descriptive name for the stream. |
| System.String | contentType | MIME content type for the stream. |
| System.Threading.CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | The stream. |
WriteDatumAsync(Datum, CancellationToken)
Writes a single Datum to the RemoteDataStore.
Declaration
public abstract Task WriteDatumAsync(Datum datum, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Datum | datum | Datum. |
| System.Threading.CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Task. |
WriteLocalDataStoreAsync(CancellationToken)
Declaration
public Task<bool> WriteLocalDataStoreAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Boolean> |