mraa 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new50

mraa #

Build Status

An implementation of the Intel MRAA linux library for Dart.

This is a full implementation of MRAA allowing low level access to sensor devices on a range of supported linux based boards and development environments. This permits low level IOT device control and management directly from the Dart VM.

The implementation is an FFI wrapper around the target boards libmraa library, which can be set to the distro standard libmraa or any libmraa you wish to use yourself. Currently Version 2.0.0 of MRAA is supported.

The API itself is a complete implementation(see UNIMPLEMENTED.md for the few functions not implemented) and is structured as per the MRAA C API, e.g to access an analogue IO pin a call like this would be used :-

mraa.aio.read(0);

Other API functions for GPIO, I2C etc are accessed in a similar manner.

The examples directory contains a general usage example and several runnable examples for a generic range of development boards that use the Grove system sensor family comprising light, temperature and PIR sensors and output to a small OLED display.

Note that to access some devices, GPIO is an example here, you may need elevated permissions, this can be achieved by running Dart under sudo, running as root or adding your user to the appropriate device group.

1.0.0 #

Initial release

example/mraa_example.dart

/*
 * Package : mraa
 * Author : S. Hamblett <steve.hamblett@linux.com>
 * Date   : 03/10/2019
 * Copyright :  S.Hamblett
 */

import 'package:mraa/mraa.dart';

int main() {
  final Mraa mraa = Mraa();

  // Set any options such as no JSON loading here
  // mraa.noJsonLoading = true;

  // Initialise the package, you MUST do this after setting any
  // options if you don't the API calls will throw no such method error.
  mraa.initialise();

  // Call the MRAA API functions
  final String mraaVersion = mraa.common.version();
  print('Version is : $mraaVersion');

  return 0;
}

Use this package as a library

1. Depend on it

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


dependencies:
  mraa: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:mraa/mraa.dart with components: io.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
ffi ^0.1.3-dev.3 0.1.3
Dev dependencies
test ^1.9.3