GithubHelp home page GithubHelp logo

rakesh0021 / flutterdevicelib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yolandaqingniu/flutterdevicelib

0.0 0.0 0.0 8.12 MB

License: Other

Kotlin 18.99% Ruby 3.10% Objective-C 41.02% Dart 36.89%

flutterdevicelib's Introduction

qnsdk

qnsdk is yolanda Company smart device communication plug-in.

Usage

To use this plugin, add qnsdk as a dependency in your pubspec.yaml file.

Getting Started

Xcode configuration
  • iOS10.0 and above must have Bluetooth instructions in Info.plist, otherwise the system's Bluetooth function cannot be used
  • iOS13.0 and above must be configured with the authorization instructions for Bluetooth in Info.plist, otherwise it will be found to crash.
  • There is a pair in the Info.plist [Privacy - Bluetooth Peripheral Usage Description][privacy - bluetooth always usage description] button.
Android
  • Support Android 4.3 system above
  • Using androidx libraries in your project
  • Android 6.0 above requires authorized location rights

Sample Usage

Initialising

 String configFileContent = await rootBundle.loadString('data/123456789.qn');
 qnApi.initSDK('123456789', configFileContent).then((result) => print('initSDK ${result.errorCode}'));

Set up listening

 qnApi.setBleStateListener(this);
 qnApi.setBleDeviceDiscoveryListener(this);
 qnApi.setBleConnectionChangeListener(this);
 qnApi.setScaleDataListener(this);

Start scanning

 qnApi.startBleDeviceDiscovery();

Connection

 qnApi.connectDevice(device,user);

Receive data

 @override
  void onGetUnsteadyWeight(QNBleDevice device, double weight) {
    unsteadyWeightStream.add(weight);
  }

  @override
  void onGetScaleData(QNBleDevice device, QNScaleData data) {
    scaleDataStream.add(data);
  }

  @override
  void onGetStoredScale(
      QNBleDevice device, List<QNScaleStoreData> storedDataList) {
    for (var item in storedDataList) {
      storedDataStream.add(item);
    }
  }

  @override
  void onScaleStateChange(QNBleDevice device, int scaleState) {
    deviceStateStream.add(scaleState);
  }

flutterdevicelib's People

Contributors

donyau avatar yolandaqingniu avatar

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.