PedometerSensor class
The Pedometer measures the acceleration applied to the sensor built-in into the device, including the force of gravity.
Your can initialize this class by the following code.
var sensor = PedometerSensor();
If you need to initialize the sensor with configurations, you can use the following code instead of the above code.
var config = PedometerSensorConfig();
config
..debug = true
..frequency = 100;
var sensor = PedometerSensor.init(config);
Each sub class of AwareSensor provides the following method for controlling the sensor:
start()
stop()
enable()
disable()
sync()
setLabel(String label)
Stream<PedometerData>
allow us to monitor the sensor update
events as follows:
sensor.onDataChanged.listen((data) {
print(data)
}
In addition, this package support data visualization function on Cart Widget. You can generate the Cart Widget by following code.
var card = PedometerCard(sensor: sensor);
- Inheritance
-
- Object
- ISensorController
- AwareSensor
- PedometerSensor
Constructors
- PedometerSensor.init(PedometerSensorConfig config)
- Init Pedometer Sensor without a configuration file
Properties
- config ↔ AwareSensorConfig?
-
The config manage configurations of sensor. Each sensor should overwrite
AwareSensorConfig class for optimizing its for each sensor configuration.
For example in the Accelerometer sensor, you need to add sensing frequency
parameter into the configuration class. Finally, you also need to
overwrite the -toMap() method which is required for sending the
configuration to backend as a Map object.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- latestData ↔ PedometerData
-
getter/setter pair
-
onDataChanged
→ Stream<
PedometerData> -
An event channel for monitoring sensor events.
no setter
-
onDataChangedStreamController
↔ StreamController<
PedometerData> -
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancelBroadcastStream(
String eventName) → Future< Null> -
Cancel a broadcast stream (= event channel)
NOTE: You need to set a method channel before using this method.
inherited
-
disable(
) → Future< Null> -
Disable this sensor
NOTE: You need to set a method channel before using this method.
inherited
-
enable(
) → Future< Null> -
Enable this sensor
NOTE: You need to set a method channel before using this method.
inherited
-
getBroadcastStream(
EventChannel eventChannel, String eventName) → Stream -
For subscribing an event channel (stream channel),
(1) your have to prepare the channel instance by each channels.
static const EventChannel _stream = const EventChannel('awareframework_core/event');
(2) after that, you have to set the channel by using the following method with a unique name
.getBroadcastStream(_stream, "UNIQUE_NAME")
inherited
-
isEnabled(
) → Future -
Get the status of this sensor (enabled or not)
NOTE: You need to set a method channel before using this method.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setLabel(
String label) → Future< Null> -
Set a label to stored data
NOTE: You need to set a method channel before using this method.
inherited
-
setMethodChannel(
MethodChannel channel) → void -
Set a method channel for this sensor.
NOTE: This method name should be unique name. In addition, the instance
should initialize as
static const
.inherited -
start(
) → Future< Null> -
Start this sensor
NOTE: You need to set a method channel before using this method.
override
-
stop(
) → Future< Null> -
Stop this sensor
NOTE: You need to set a method channel before using this method.
override
-
sync(
{bool force = false}) → Future< Null> -
Sync the local-database on this phone with a remote-database
You can sync the database forcefully by using
force=true
option. NOTE: You need to set a method channel before using this method.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited