AwareSensor class

The foundation class of Aware-Sensor All of AWARE sensor have to succeed AwareSensor class. This class provide functions to control back-end an AWARE Sensor which are written in Kotlin (Android) and Swift (iOS).

For using this method, you need following five steps:

  1. Make a subclass of AwareSensorConfiguration class for making an optimized configuration class for each sensor.
  2. Make and initialize a subclass of AwareSensor class the sub-class of the configuration.
  3. Add a unique method channel for connecting backend methods using -setMethodChannel() method.
  4. If you need to subscribe to event(s) from backend, you can get an instance for subscribing the events using -getBroadcastStream()
  5. To cancel all of the subscribed events, you have to overwrite with cancelAllEventChannels(). In the method, you should call -cancelBroadcastStream() for all subscribed event.
Inheritance
Implementers

Constructors

AwareSensor(AwareSensorConfig? config)
Initializer for AWARE Sensor You can initialize an AwareSensor Instance with an AwareSensorConfiguration instance. If the configuration parameter is null, the initializer uses the default setting.

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 pair
hashCode int
The hash code for this object.
no setterinherited
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.
disable() Future<Null>
Disable this sensor NOTE: You need to set a method channel before using this method.
override
enable() Future<Null>
Enable this sensor NOTE: You need to set a method channel before using this method.
override
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")
isEnabled() Future
Get the status of this sensor (enabled or not) NOTE: You need to set a method channel before using this method.
override
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.
override
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.
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.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited