Class ListeningProbe
Listening Probes are triggered by a change in state within the underlying device. For example, when an accelerometer reading is emitted, the
AccelerometerProbe is provided with information about device movement in each direction. ListeningProbes
do not generate data unless such state changes occur (however, in the particular case of the AccelerometerProbe, the
hardware accelerometer chip will continuously be registering movement). Whether or not data streams are discontinued when the app is backgrounded
depends on the operating system (Android or iOS) as well as the setting of KeepDeviceAwake.
Inheritance
System.Object
ListeningProbe
Implements
System.ComponentModel.INotifyPropertyChanged
Assembly: SensusAndroid.dll
Syntax
public abstract class ListeningProbe : Probe, INotifyPropertyChanged, IListeningProbe, IProbe
Constructors
ListeningProbe()
Declaration
protected ListeningProbe()
Properties
CollectionDescription
Declaration
public override string CollectionDescription { get; }
Property Value
Type |
Description |
System.String |
|
Overrides
DataRateSampleSize
Gets the size of the data rate sample. Uses 10 times the MaxDataStoresPerSecond if one is specified, so
that the data rate and sampling parameters will be recalculated every 10 seconds when at maximum throughput. If no
MaxDataStoresPerSecond is specified (no rate limit), then a data rate sample size of 10 will be used.
Declaration
protected override long DataRateSampleSize { get; }
Property Value
Type |
Description |
System.Int64 |
The size of the data rate sample.
|
Overrides
DefaultKeepDeviceAwake
Declaration
protected abstract bool DefaultKeepDeviceAwake { get; }
Property Value
Type |
Description |
System.Boolean |
|
DeviceAsleepWarning
Declaration
protected abstract string DeviceAsleepWarning { get; }
Property Value
Type |
Description |
System.String |
|
DeviceAwakeWarning
Declaration
protected abstract string DeviceAwakeWarning { get; }
Property Value
Type |
Description |
System.String |
|
KeepDeviceAwake
Whether or not to keep the device awake and listening for readings, regardless of whether Sensus is backgrounded and the device
is locked and idle. If enabled, then readings will be delivered to Sensus regardless of these states; however, more power will
be consumed because the processor will not be allowed to sleep. If disabled, then the effect depends on the operating system
and state of the device:
Android: If disabled, then readings will be paused when the device enters the sleeping state (i.e., when it is locked and
inactive). When the device wakes up (i.e., is unlocked or being actively used), then some readings that were cached while
asleep may be delivered in bulk to Sensus. This bulk delivery may not include all readings, and the readings delivered in
bulk will have their Timestamp fields set to the time of bulk delivery rather than the time the reading
originated.
iOS: If disabled, then readings will be paused when the app enters the background state (e.g., by hitting the home button),
regardless of whether the phone is unlocked and actively being used. The only way to resume readings in this case is for the
user to bring the app to the foreground.
In any case above, if readings are paused then power will be conserved. If readings are flowing, then the CPU will be active
and will likely consume significant battery power. Furthermore, even a single ListeningProbe with this setting
enabled will be sufficient to keep readings flowing for all ListeningProbes in all Protocols
within Sensus. It is not possible to enable this setting for just one of many enabled ListeningProbes.
Lastly, there are a few exceptions to the above as regards iOS. Certain ListeningProbes will force the the CPU
to remain awake and all readings to remain flowing on iOS. Currently these are the iOS implementation of
CompassProbe as well as ListeningLocationProbe,
ListeningPointsOfInterestProximityProbe, and ListeningSpeedProbe.
If any one of these is enabled on iOS, then readings will continue to flow for all ListeningProbes regardless
of the value for KeepDeviceAwake.
Declaration
[OnOffUiProperty("Keep Device Awake:", true, 2147483646)]
public bool KeepDeviceAwake { get; set; }
Property Value
Type |
Description |
System.Boolean |
true to keep device awake; otherwise, false .
|
MaxDataStoresPerSecond
The maximum number of readings that may be stored in one second.
Declaration
[EntryDoubleUiProperty("Max Data / Second:", true, 2147483647, false)]
public override Nullable<double> MaxDataStoresPerSecond { get; set; }
Property Value
Type |
Description |
System.Nullable<System.Double> |
Maximum data stores per second.
|
Overrides
MinDataStoreDelay
Declaration
public Nullable<TimeSpan> MinDataStoreDelay { get; }
Property Value
Type |
Description |
System.Nullable<System.TimeSpan> |
|
RawParticipation
Declaration
protected override double RawParticipation { get; }
Property Value
Type |
Description |
System.Double |
|
Overrides
WillHaveSignificantNegativeImpactOnBattery
Gets a value indicating whether this ListeningProbe, in its current
configuration, will have a significant negative impact on battery. This can be the case if, e.g.,
the probe has enabled KeepDeviceAwake, or if the probe depends on hardware/software
that is inherently battery hungry (e.g., ListeningLocationProbe and the iOS
version of the CompassProbe, which depends on the GPS subsystem).
Declaration
protected virtual bool WillHaveSignificantNegativeImpactOnBattery { get; }
Property Value
Type |
Description |
System.Boolean |
true if has significant negative impact on battery; otherwise, false .
|
Methods
ProtectedStartAsync()
Declaration
protected override Task ProtectedStartAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
ProtectedStopAsync()
Declaration
protected override Task ProtectedStopAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
ResetAsync()
Declaration
public override Task ResetAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
StartListeningAsync()
Declaration
protected virtual Task StartListeningAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
StopListeningAsync()
Declaration
protected virtual Task StopListeningAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Implements
System.ComponentModel.INotifyPropertyChanged