movisens_flutter 0.1.1

  • README.md
  • Example
  • Installing
  • Versions
  • 58

movisens_flutter_plugin #

pub package A plugin for connecting and collecting data from a Movisens sensor. This plugin excelusively works for Android.

Install #

Add movisens_flutter as a dependency in pubspec.yaml. For help on adding as a dependency, view the documentation.

Android permissions #

Add the following to your manifest

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Example Usage #

A Movisens object is instantiated by providing a UserData object, which is, in essence a Map structure containing a list of required fields for the Movisens sensor. These include: Weight, height, age, sensor address and sensor name.

Intialization: #

Movisens _movisens;
StreamSubscription<MovisensDataPoint> _subscription;
LogManager logManager = new LogManager();
List<MovisensDataPoint> movisensEvents = [];
String address = 'unknown', name = 'unknown';
int weight, height, age;

Start Listening #

Data from the sensor is streamed continuously, which is done by calling the listen() method on a Movisens object. An exception will be thrown if the listen method is invoked on a platform other than Android.

void startListening() {
    address = '88:6B:0F:82:1D:33';
    name = 'Sensor 02655';
    weight = 100;
    height = 180;
    age = 25;
    
    UserData userData = new UserData(
        weight, height, Gender.male, age, SensorLocation.chest, address, name);
    
    _movisens = new Movisens(userData);
    
    try {
      _subscription = _movisens.movisensStream.listen(onData);
    } on MovisensException catch (exception) {
      print(exception);
    }
}

Additionally, it can be a good idea to have a separate method for handling incoming data, such as the onData method shown below:

void onData(MovisensDataPoint d) {
    setState(() {
      movisensEvents.add(d);
      logManager.writeLog('$d');
    });
}

Stop Listening #

The subscription can be cancelled again, by invoking the cancel method:

void stopListening() {
    _subscription.cancel(); 
}

image

example/README.md

movisens_flutter_example #

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  movisens_flutter: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:movisens_flutter/movisens_flutter.dart';
  
Version Uploaded Documentation Archive
0.1.1 Mar 6, 2019 Go to the documentation of movisens_flutter 0.1.1 Download movisens_flutter 0.1.1 archive
0.0.8 Feb 13, 2019 Go to the documentation of movisens_flutter 0.0.8 Download movisens_flutter 0.0.8 archive
0.0.7 Jan 29, 2019 Go to the documentation of movisens_flutter 0.0.7 Download movisens_flutter 0.0.7 archive
0.0.6 Dec 21, 2018 Go to the documentation of movisens_flutter 0.0.6 Download movisens_flutter 0.0.6 archive
0.0.5 Dec 20, 2018 Go to the documentation of movisens_flutter 0.0.5 Download movisens_flutter 0.0.5 archive
0.0.4 Dec 20, 2018 Go to the documentation of movisens_flutter 0.0.4 Download movisens_flutter 0.0.4 archive
0.0.3 Dec 20, 2018 Go to the documentation of movisens_flutter 0.0.3 Download movisens_flutter 0.0.3 archive
0.0.2 Dec 20, 2018 Go to the documentation of movisens_flutter 0.0.2 Download movisens_flutter 0.0.2 archive
0.0.1 Dec 20, 2018 Go to the documentation of movisens_flutter 0.0.1 Download movisens_flutter 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
24
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Apr 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/movisens_flutter.dart.

Run flutter format to format lib/movisens_flutter.dart.

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
path_provider ^0.5.0 0.5.0+1
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8