Git Product home page Git Product logo

dive_computer's Introduction

dive_computer

A Flutter plugin for communication with dive computers using the library libdivecomputer.

pub.dev release License

Installation

TODO

Usage

This plugin automatically spawns its own isolate for communication with the dive computer.

Please refer to the example app for a minimalistic example usage.


Acknowledgements

Parts of this project are using the library libdivecomputer.

libdivecomputer Copyright (c) 2008 Jef Driesen

The library is licensed under the GNU Lesser General Public License version 2.1.

dive_computer's People

Contributors

sese-schneider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dive_computer's Issues

_send is somehow destroying additional field in Computer

I'm currently working on BLE support. Because of that, I needed to extend Computer with the additional field BluetoothDevice? device. The problem starts when calling download via download, afterward the object computer no longer contains a valid BluetoothDevice object. All other fields are fine.

@override
  Future<List<Dive>> download(
    Computer computer,
    ComputerTransport transport, [
    String? lastFingerprint,
  ]) async {
    await _send((
      DiveComputerMethod.download,
      [computer, transport, lastFingerprint],
    ));
    return (_downloadedDives = Completer()).future;
  }
class Computer {
  Computer(
    this.vendor,
    this.product, {
    this.transports = const [],
  });

  final String vendor, product;
  final List<ComputerTransport> transports;
  BluetoothDevice? device;

  void addBleDevice(BluetoothDevice device) {
    this.device = device;
  }

  @override
  String toString() =>
      '$vendor $product ${device ?? ''} [${transports.map((t) => t.name).join(', ')}]';

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is Computer &&
          runtimeType == other.runtimeType &&
          vendor == other.vendor &&
          product == other.product;

  @override
  int get hashCode {
    // hash codes are not equal across isolates, so we need to generate a
    // consistent hash code for each computer
    return '$vendor $product'.codeUnits.fold(1, (a, b) => a * b);
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.