movisens_flutter 0.1.3

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" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

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# movisens_plugin

##0.1.3

  • Changed Movisens core Android library for foreground service notification on Android>8.1

0.1.2 #

  • MovisensDataPoint removed and replaced with a Map.

0.1.1 #

  • Initial release.

example/README.md

movisens_flutter_example #

Demonstrates how to use the movisens_flutter plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  movisens_flutter: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub 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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
36
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/movisens_flutter.dart. (-0.50 points)

Analysis of lib/movisens_flutter.dart reported 1 hint:

line 4 col 8: Unused import: 'dart:convert'.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (path_provider).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
path_provider ^0.5.0 0.5.0+1 1.1.2
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
Dev dependencies
flutter_test

Admin