DeviceSensors
Namespace: Wisej.Hybrid
Assembly: Wisej.Hybrid (4.1.0.0)
Provides integrations to interact with device sensors.
- C#
- VB.NET
public class DeviceSensors : DeviceInfoBase
Public Class DeviceSensors
Inherits DeviceInfoBase
Access this class through the Device singleton.
Properties
IsAccelerometerSupported
Boolean: Gets a value indicating whether the accelerometer is supported.
IsBarometerSupported
Boolean: Gets a value indicating whether the barometer is supported.
IsCompassSupported
Boolean: Gets a value indicating whether the compass is supported.
IsGyroscopeSupported
Boolean: Gets a value indicating whether the gyroscope is supported.
IsMagnetometerSupported
Boolean: Gets a value indicating whether the magnetometer is supported.
IsOrientationSupported
Boolean: Gets a value indicating whether the device orientation is supported.
IsShakeSupported
Boolean: Gets a value indicating whether shake detection is supported.
Methods
IsMonitoringAsync(type)
Gets whether the given SensorType is available for monitoring on the hybrid device.
| Parameter | Type | Description |
|---|---|---|
| type | SensorType | The type of sensor. |
Returns: Task<Boolean>. True if the given SensorType is available for monitoring.
IsSupportedAsync(type)
Gets whether the given SensorType is supported on the hybrid device.
| Parameter | Type | Description |
|---|---|---|
| type | SensorType | The type of sensor. |
Returns: Task<Boolean>. True if the given SensorType is supported.
OnWebUpdate(info)
Updates sensor information based on the data provided from a web source.
| Parameter | Type | Description |
|---|---|---|
| info | Object | Dynamic object containing sensor support information. |
This method expects the 'info' parameter to have properties matching the sensor names, and their values should be strings that can be parsed to booleans.
Start(type)
Starts monitoring the given SensorType on the hybrid device.
| Parameter | Type | Description |
|---|---|---|
| type | SensorType | The type of sensor. |
Stop(type)
Stops monitoring the given SensorType on the hybrid device.
| Parameter | Type | Description |
|---|---|---|
| type | SensorType | The type of sensor. |
Events
AccelerometerChanged
EventHandler<AccelerometerChangedEventArgs> Occurs when accelerometer reading changes.
BarometerChanged
EventHandler<BarometerChangedEventArgs> Occurs when barometer reading changes.
CompassChanged
EventHandler<CompassChangedEventArgs> Occurs when compass reading changes.
GyroscopeChanged
EventHandler<GyroscopeChangedEventArgs> Occurs when gyroscope reading changes.
MagnetometerChanged
EventHandler<MagnetometerChangedEventArgs> Occurs when magnetometer reading changes.
OrientationSensorChanged
EventHandler<OrientationSensorChangedEventArgs> Occurs when the orientation sensor reading changes.
ReadingChanged
Deprecated: This event will be removed in future releases in favor of sensor-specific events.
EventHandler<SensorChangedEventArgs> Fires when a sensor's reading changes.
Shake
EventHandler Occurs when the device is shaken.