Giter Site home page Giter Site logo

frccblue's Introduction

frccblue

A new Flutter plugin.

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

平台

iOS android

使用

dependencies:
  frccblue:
    git:
      url: https://github.com/frcc00/frccblue

调用

Frccblue.init(didReceiveRead:(MethodCall call){
      print(call.arguments);
      return Uint8List.fromList([11,2,3,4,5,6,7,8,9,10,]);
    }, didReceiveWrite:(MethodCall call){
      print(call.arguments);
    },didSubscribeTo: (MethodCall call){
      print(call.arguments);
//      Frccblue.peripheralUpdateValue()
    },didUnsubscribeFrom: (MethodCall call){
      print(call.arguments);
    },peripheralManagerDidUpdateState: (MethodCall call){
      print(call.arguments);
    });

Frccblue.startPeripheral("00000000-0000-0000-0000-AAAAAAAAAAA1", "00000000-0000-0000-0000-AAAAAAAAAAA2").then((_){});

more

peripheralManagerDidUpdateState

iOS上传状态

switch peripheral.state {
        case .unknown:
            print("未知的")
            state = "unknown"
        case .resetting:
            print("重置中")
            state = "resetting"
        case .unsupported:
            print("不支持")
            state = "unsupported"
        case .unauthorized:
            print("未验证")
            state = "unauthorized"
        case .poweredOff:
            print("未启动")
            state = "poweredOff"
            self.peripheralManager?.stopAdvertising()
        case .poweredOn:
            print("可用")
            state = "poweredOn"

android上传状态

"unknown"
"poweredOff"
"poweredOn"

由于iOS没有设备连上和断开连接的回掉,android有;所以统一要求中心设备订阅Characteristic。 那么didSubscribeTo表示设备连上,didUnsubscribeFrom表示设备断开。android端didUnsubscribeFrom会被触发2次,在设备主动取消订阅的情况下。

frccblue's People

Contributors

frcc00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

frccblue's Issues

Library update needed

Hello!

I need to transfer a file from one BLE device to another. Both will be flutter apps. There's a lot of flutter libraries out there to act as a BLE client, but I couldn't find any library to act as a peripheral device except yours. But it is so outdated that it's not usable anymore.

Is there any chance you could work on updating your library? I'm willing to sponsor this project if needed. Please let me know what you think.

Thanks!

startAdvertising cannot be start for more than one time

startAdvertising cannot be start for more than one time
My application had call startAdvertising and it is works,(both send and receive characteristic). But after that, after i called stopAdvertising and try to startAdvertising again, it doesn't work any more.(means can't send and receive characteristic) What can I do for this? Thanks a lot.

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.