Giter Site home page Giter Site logo

quick.flutter's People

Contributors

azimuthdeveloper avatar creaous avatar fotidim avatar mglolenstine avatar rohitsangwan01 avatar sunbreak avatar yahya-uddin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

quick.flutter's Issues

Getting Error: Unresolved reference: S, FLAG_MUTABLE

My project needs to use an external USB microphone and the internal one at the same time on an Android device, so I tried adding this library to my existing project but when it failed to build. So I created a new flutter project, leaving all codes intact (except setting the sdk versions as below) and added this package as the first thing and I'm getting the very same error:

e: /Users/myname/.pub-cache/hosted/pub.dartlang.org/quick_usb-0.4.0/android/src/main/kotlin/com/example/quick_usb/QuickUsbPlugin.kt: (20, 52): Unresolved reference: S
e: /Users/myname/.pub-cache/hosted/pub.dartlang.org/quick_usb-0.4.0/android/src/main/kotlin/com/example/quick_usb/QuickUsbPlugin.kt: (21, 19): Unresolved reference: FLAG_MUTABLE

I have already set the sdk versions to:

compileSdkVersion 33
minSdkVersion 23
targetSdkVersion 33

flutter clean and pub get, invalidate caches and restarting Android Studio did not help.

My Flutter SDK version is 3.3.2

Please help.

[Android BLE]: BLE device not disconnecting

If I connect to a device and then try to reconnect, it doesn't connect.
If I connect, disconnect and wait for about a minute, it does connect again.

I found other reports (admittedly, not using this library) with the same issue (https://stackoverflow.com/questions/37653487/android-ble-device-is-not-disconnecting-sometime, https://stackoverflow.com/questions/35986549/totally-disconnect-a-bluetooth-low-energy-device/63187218#63187218).
In both cases, the onConnectionStateChange: Disconnected is called right after the QuickBlue.disconnect is called.

[quick_blue] Option to filter for service UUIDs

it would be nice to filter for service UUID while scanning for devices.
Currently, you must connect to a device in order to start scanning for services.

On iOS and MacOS there is an option to filter for services using

centralManager.scanForPeripherals(withServices: [serviceUUID])

I would love getting this feature out for as much platforms as possible

why QuickUsb.openDevice always return false????

I used quick_usb 0.3.1 version,and run on windows,then I did the following and everything worked fine,
1.QuickUsb.init() true,
2.QuickUsb.getDeviceList() success,
3.QuickUsb.hasPermission(_device!) return true,

but when i did QuickUsb.openDevice(_device!), always return flase,Can someone tell me why???????

Updates?

Hi!
Are you planning to update this package to add support to more recent android versions? It would be very useful! Maybe a iOS support?
Thanks!!

[quick.usb] FLAG_IMMUTABLE error for targetSDK>=31

Some info about the versions:
Flutter 3.10.0
Dart 3.0.0
ext.kotlin_version = '1.9.10'
classpath 'com.android.tools.build:gradle:7.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip

The problem:
Asking USB permission, If I have targetSdkVersion<31 everything is ok, when I put targetSdkVersion >= 31 I have the following error:

java.lang.IllegalArgumentException: com.example.flutter_quickusb: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent

Is there a way to bypass the problem?

MACOSX_DEPLOYMENT_TARGET

Hello, I have encountered a compilation error, my environment is MacOS14,Xcode15.

flutter/client/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 14.0.99. (in target 'quick_notify' from project 'Pods')

LateError (LateInitializationError: Field '_instance@166265524' has not been initialized.)

Hi ...

I'm trying to use quick_usb to build a MacOS app. I am trying to follow this example code you provide:

await QuickUsb.init();
// ...
var deviceList = await QuickUsb.getDeviceList();
// ...
await QuickUsb.exit();

However, on the first line (await QuickUsb.init();) I get the following exception thrown:

LateError (LateInitializationError: Field '_instance@166265524' has not been initialized.)

Are there suggestions on how to resolve and/or debug this issue?

Throws error LIBUSB_ERROR_NOT_FOUND

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: getConfigDesc error: LIBUSB_ERROR_NOT_FOUND
#0 _QuickUsbDesktop.getConfiguration (package:quick_usb/src/quick_usb_desktop.dart:198:9)
#1 QuickUsb.getConfiguration (package:quick_usb/quick_usb.dart:49:17)
#2 _PrinterAppState.build.. (package:printer_example/main.dart:207:62)

quick_usb need libusb (m1 and Intel) support on MacOS

I found libusb v1.0.26 are support both (arm64 and x86_x64)
Could you please update source and library for support both version?

Your source of QuickUsbDesktop

class QuickUsbMacos extends _QuickUsbDesktop {
QuickUsbMacos() {
if(arm64) { //-- I do not know detect cpu architecture and possible?
_libusb = Libusb(DynamicLibrary.open('libusb-1.0.23_arm64.dylib'));
} else {
_libusb = Libusb(DynamicLibrary.open('libusb-1.0.23_x64.dylib'));
}
}
}

We need you to fixed and publish asap.
Thank you

Macos error of 'libusb-1.0.23.dylib' (no such file)

Getting error with Macos.

'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libusb-1.0.23.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libusb-1.0.23.dylib' (no such file), '/usr/lib/libusb-1.0.23.dylib' (no such file, not in dyld cache), 'libusb-1.0.23.dylib' (no such file), '/usr/local/lib/libusb-1.0.23.dylib' (no such file), '/usr/lib/libusb-1.0.23.dylib' (no such file, not in dyld cache)

already done QuickUsbMacos.registerWith();

[quick_usb] QuickUsb.openDevice always returns false

Trying to access a keyboard via USB on Windows on the current stable version of Flutter. Devices are in the list and have the appropriate values for vendorId and productId.

Flutter Doctor:

[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22622.440], locale en-US)
    • Flutter version 3.0.5 at C:\Users\wfink\Documents\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (3 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:\Users\wfink\AppData\Local\Android\Sdk
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = C:\Users\wfink\AppData\Local\Android\Sdk
    • ANDROID_SDK_ROOT = C:\Users\wfink\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.2)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31624.102
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22622.440]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 103.0.5060.134
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 103.0.1264.77
    ! Device emulator-5562 is offline.

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Using the following code:

  void initUsb() async {
    // Initialize the usb provider
    await QuickUsb.init();

    UsbConfiguration? configuration;

    // Get the list of usb devices
    _usbList = await QuickUsb.getDeviceList();
    // Remove the usb device from the list if it is not a desired device
    _usbList = _usbList.where((element) => element.vendorId == 22348).toList();

    for (UsbDevice dev in _usbList) {
      log('device: ${dev.vendorId} : ${dev.productId} : ${dev.identifier}');

      await QuickUsb.requestPermission(_usbList.first);
      log('${dev.productId} requestPermission');

      var hasPermission = await QuickUsb.hasPermission(_usbList.first);
      log('${dev.productId} hasPermission $hasPermission');

      var openDevice = await QuickUsb.openDevice(_usbList.first);
      log('${dev.productId} openDevice $openDevice');

      //configuration = await QuickUsb.getConfiguration(0);
      log('${dev.productId} configuration $configuration');
    }

    // var configuration = await QuickUsb.getConfiguration(0);
    // log('getConfiguration $configuration');

    notifyListeners();
  }

v0.4.0 MacOS LateInitializationError

After update to 0.4.0
My mac error when running app

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: LateInitializationError: Field '_libusb@1709324630' has not been initialized.
#0 _libusb (package:quick_usb/src/quick_usb_desktop.dart)
#1 _QuickUsbDesktop.init (package:quick_usb/src/quick_usb_desktop.dart:44:12)
#2 QuickUsb.init (package:quick_usb/quick_usb.dart:13:43)
#3 main (package:qipos/main.dart:44:20)
#4 _runMainZoned.. (dart:ui/hooks.dart:130:25)
#5 _rootRun (dart:async/zone.dart:1426:13)
#6 _CustomZone.run (dart:async/zone.dart:1328:19)
#7 _runZoned (dart:async/zone.dart:1861:10)
#8 runZonedGuarded (dart:async/zone.dart:1849:12)
#9 _runMainZoned. (dart:ui/hooks.dart:126:5)
#10 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:297:19)
#11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

[SOLUTION]
Rollback to 0.3.1 work fine

[quick_usb] Documentation?

The methods and members don't seem to be documented. It'd be helpful for users of this package to have documentation.

In particular, I'd like to know what identifier and configurationCount of UsbDevice are.

When running with flutter android on new project it gives error Execution failed for task ':quick_usb:compileDebugKotlin'.

e: c:\Briefcase\flutter.pub-cache\hosted\pub.dartlang.org\quick_usb-0.4.0\android\src\main\kotlin\com\example\quick_usb\QuickUsbPlugin.kt: (20, 52): Unresolved reference: S
e: c:\Briefcase\flutter.pub-cache\hosted\pub.dartlang.org\quick_usb-0.4.0\android\src\main\kotlin\com\example\quick_usb\QuickUsbPlugin.kt: (21, 19): Unresolved reference: FLAG_MUTABLE

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':quick_usb:compileDebugKotlin'.

Feature Request

Adding custom name to channel and disabling notification sound

Help installing Quick Blue on Linux

Hi,
I'm new to flutter and I'm trying to use quick_blue to connect to a BLE device with Linux. I see that in the mono repo Linux is supported, but the packages on pub.dev do not.

I've also tried putting this into my pubspec.yaml

dependencies:
  flutter:
    sdk: flutter

  quick_blue:
    git:
      url: https://github.com/woodemi/quick.flutter.git
      path: packages/quick_blue

which results in this error I struggle to understand when trying to just run :

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method startScan on channel quick_blue/method)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:308:7)
<asynchronous suspension>
#1      MethodChannelQuickBlue.startScan (package:quick_blue/src/method_channel_quick_blue.dart:43:5)
<asynchronous suspension>


══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
The following MissingPluginException was thrown while activating platform stream on channel
quick_blue/event.scanResult:
MissingPluginException(No implementation found for method listen on channel
quick_blue/event.scanResult)

When the exception was thrown, this was the stack:
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:308:7)
<asynchronous suspension>
#1      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:652:9)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════

Here is my implementation that works from pub, but results in the above error from git method.

class BluetoothTesting extends StatelessWidget {
  const BluetoothTesting({super.key});
  @override
  Widget build(BuildContext context) {
    QuickBlue.scanResultStream.listen((result) {
      String name = result.name;
      print('onScanResult $name');
    });
    print("here");
    QuickBlue.startScan();
    return Scaffold(
      appBar: AppBar(
        title: const Text("Bluetooth Tests"),
      ),
    );
  }
}

Thanks,
Josh

No availability updates on iOS when CBCentralManager is not initialized

If I set a handler for availability change events on iOS then I do not receive events until I make another call that initializes CBCentralManager.

We should force initialize CBCentralManager when subscribing to availability events. I will make a PR for it but we will have to switch to event sink.

SerialNumber is always null on Android

SerialNumber is always null on Android (using android 11).
For targets Android 10 or higher, the app cannot read the serial number until the user has granted the app permission to access the USB device or accessory.
QuickUsb is not requesting permission.

`setNotifiable` leaks response on Windows, QuickBlue

After experiencing problems, seeing a cryptic message Warning: Failed to respond to a message. This is a memory leak., and a lot of digging, I've figured out that the setNotifiable message in QuickBlue's Window's quick_blue_plugin.cpp is not responded to. (Like, in the block starting else if (method_name.compare("setNotifiable") == 0), neither result->Success nor result->Error are called, and apparently the relevant objects are garbage collected, triggering the message.) In addition to the warning message, it seems like setNotifiable never actually happens; I don't get messages back.

Here's a log; I added logging to quick_blue_plugin.cpp (with difficulty; OutputDebugString isn't logging anything) for each of the method_name methods; --> FOO means block start, and I log <-S FOO after success and <-E FOO after failure. The key bit in the log is:

--> setNotifiable
Warning: Failed to respond to a message. This is a memory leak.

as well as the observation that there's no corresponding <-E or <-S for setNotifiable.

Launching lib\main.dart on Windows in debug mode...
Building Windows application...
Debug service listening on ws://127.0.0.1:56685/_3neNKBV6wA=/ws
Syncing files to device Windows...
[log] Test: starting gak
[log] Test: started gak
--> connect
asdf 0
asdf 0b
asdf 1
connect bluetoothAddress string: 176600912576074
connect bluetoothAddress stoull: 176600912576074
asdf 2
ConnectAsync bluetoothAddress: 176600912576074
<-S connect
--> connect
asdf 0
asdf 0b
asdf 1
connect bluetoothAddress string: 176600912576074
connect bluetoothAddress stoull: 176600912576074
asdf 2
ConnectAsync bluetoothAddress: 176600912576074
<-S connect
[log] connectTimer
[log] !connected - reconnecting
[log] _handleConnectionChange 176600912576074, connected
--> discoverServices
<-S discoverServices
--> discoverServices
<-S discoverServices
[log] _handleConnectionChange 176600912576074, connected
[log] _handleConnectionChange 176600912576074, connected
[log] _handleConnectionChange 176600912576074, connected
[log] rx connected: true
[log] rx connected: true
[log] _handleServiceDiscovery 176600912576074, 00001800-0000-1000-8000-00805f9b34fb, [00002a00-0000-1000-8000-00805f9b34fb, 00002a01-0000-1000-8000-00805f9b34fb, 00002a04-0000-1000-8000-00805f9b34fb, 00002aa6-0000-1000-8000-00805f9b34fb]
[log] _handleServiceDiscovery 176600912576074, 00001800-0000-1000-8000-00805f9b34fb, [00002a00-0000-1000-8000-00805f9b34fb, 00002a01-0000-1000-8000-00805f9b34fb, 00002a04-0000-1000-8000-00805f9b34fb, 00002aa6-0000-1000-8000-00805f9b34fb]
--> setNotifiable
Warning: Failed to respond to a message. This is a memory leak.
[log] _handleServiceDiscovery 176600912576074, 00001801-0000-1000-8000-00805f9b34fb, [00002a05-0000-1000-8000-00805f9b34fb]
[log] _handleServiceDiscovery 176600912576074, 00001801-0000-1000-8000-00805f9b34fb, [00002a05-0000-1000-8000-00805f9b34fb]
[log] _handleServiceDiscovery 176600912576074, 0000180a-0000-1000-8000-00805f9b34fb, [00002a29-0000-1000-8000-00805f9b34fb, 00002a24-0000-1000-8000-00805f9b34fb, 00002a25-0000-1000-8000-00805f9b34fb, 00002a27-0000-1000-8000-00805f9b34fb, 00002a26-0000-1000-8000-00805f9b34fb, 00002a28-0000-1000-8000-00805f9b34fb, 00002a23-0000-1000-8000-00805f9b34fb]
[log] _handleServiceDiscovery 176600912576074, 0000180a-0000-1000-8000-00805f9b34fb, [00002a29-0000-1000-8000-00805f9b34fb, 00002a24-0000-1000-8000-00805f9b34fb, 00002a25-0000-1000-8000-00805f9b34fb, 00002a27-0000-1000-8000-00805f9b34fb, 00002a26-0000-1000-8000-00805f9b34fb, 00002a28-0000-1000-8000-00805f9b34fb, 00002a23-0000-1000-8000-00805f9b34fb]
[log] _handleServiceDiscovery 176600912576074, 0000feee-0000-1000-8000-00805f9b34fb, []
[log] _handleServiceDiscovery 176600912576074, 0000feee-0000-1000-8000-00805f9b34fb, [fb005c51-02e7-f387-1cad-8acd2d8df0c8, fb005c52-02e7-f387-1cad-8acd2d8df0c8, fb005c53-02e7-f387-1cad-8acd2d8df0c8]
[log] _handleServiceDiscovery 176600912576074, 0000180d-0000-1000-8000-00805f9b34fb, []
[log] _handleServiceDiscovery 176600912576074, 0000180d-0000-1000-8000-00805f9b34fb, [00002a37-0000-1000-8000-00805f9b34fb]
[log] _handleServiceDiscovery 176600912576074, 0000180f-0000-1000-8000-00805f9b34fb, [00002a19-0000-1000-8000-00805f9b34fb]
[log] _handleServiceDiscovery 176600912576074, 0000180f-0000-1000-8000-00805f9b34fb, [00002a19-0000-1000-8000-00805f9b34fb]
[log] _handleServiceDiscovery 176600912576074, fb005c20-02e7-f387-1cad-8acd2d8df0c8, []
[log] _handleServiceDiscovery 176600912576074, fb005c20-02e7-f387-1cad-8acd2d8df0c8, [fb005c21-02e7-f387-1cad-8acd2d8df0c8, fb005c22-02e7-f387-1cad-8acd2d8df0c8, fb005c26-02e7-f387-1cad-8acd2d8df0c8]
[log] _handleServiceDiscovery 176600912576074, 6217ff4b-fb31-1140-ad5a-a45545d7ecf3, []
[log] connectTimer
[log] _handleServiceDiscovery 176600912576074, 6217ff4b-fb31-1140-ad5a-a45545d7ecf3, [6217ff4c-c8ec-b1fb-1380-3ad986708e2d, 6217ff4d-91bb-91d0-7e2a-7cd3bda8a1f3]
[log] _handleServiceDiscovery 176600912576074, fb005c80-02e7-f387-1cad-8acd2d8df0c8, []
[log] _handleServiceDiscovery 176600912576074, fb005c80-02e7-f387-1cad-8acd2d8df0c8, [fb005c81-02e7-f387-1cad-8acd2d8df0c8, fb005c82-02e7-f387-1cad-8acd2d8df0c8]
[log] connectTimer
[log] connectTimer
[log] connectTimer
[log] connectTimer
[log] Test: stopping gak
--> disconnect
<-S disconnect
--> disconnect
<-S disconnect
[log] cancelPeripheralConnection 176600912576074
[log] connectTimer
[log] Test: stopped gak
[log] Test: sleeping
[log] Test: done

does not work on raspberry pi 4

Hello.
I have a simple flutter project that works fine in my Ubuntu system.
But when I run the project in a raspberrypi 4, it shows the below error:

flutter: `quick_usb` threw an error: Invalid argument(s): Failed to load dynamic library '/usr/local/bin/lib/libusb-1.0.23.so': /usr/local/bin/lib/libusb-1.0.23.so: cannot open shared object file: No such file or directory. The app may not function as expected until you remove this plugin from pubspec.yaml
[ERROR:flutter/shell/common/shell.cc(93)] Dart Unhandled Exception: Invalid argument(s): Failed to load dynamic library '/usr/local/bin/lib/libusb-1.0.23.so': /usr/local/bin/lib/libusb-1.0.23.so: cannot open shared object file: No such file or directory, stack trace: #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
#1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
#2      QuickUsbLinux.registerWith (package:quick_usb/src/quick_usb_desktop.dart:35:37)
#3      _PluginRegistrant.register (file:///home/user1/Documents/project/.dart_tool/flutter_build/dart_plugin_registrant.dart:104:23)

also running dpkg -l libusb-1.0* shows the below answer:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                   Version      Architecture Description
+++-======================-============-============-===================================================
ii  libusb-1.0-0:arm64     2:1.0.24-3   arm64        userspace USB programming library
ii  libusb-1.0-0-dev:arm64 2:1.0.24-3   arm64        userspace USB programming library development files
ii  libusb-1.0-doc         2:1.0.24-3   all          documentation for userspace USB programming

How can I solve the problem?
Thanks.

QuickNotify not functional in macos

hello everyone
i'm trying to make quicknotify work in mac os
i'm getting request to access notification
then i'm not getting any notification
same code working on web and windows

     var hasPermission = await QuickNotify.hasPermission();
         print('hasPermission $hasPermission');
         var requestPermission = await QuickNotify.requestPermission();
        print('requestPermission $requestPermission');
        await QuickNotify.notify(
         title: 'title',
         content: 'welcome',
         );

[quick_usb] Mac M1 library loading issue

in MAc M1 it shows an error because of no library for arm64e

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libusb-1.0.23.dylib': dlopen(libusb-1.0.23.dylib, 0x0001): tried: 
'/Users/xxx/apps/xxxa/apps/xxxa/build/macos/Build/Products/Debug/xxxa.app/Contents/Frameworks/FlutterMacOS.framework/Versions/A/./libusb-1.0.23.dylib' (no such file), 
'/Users/xxx/apps/xxxa/apps/xxxa/build/macos/Build/Products/Debug/xxxa.app/Contents/Frameworks/FlutterMacOS.framework/Versions/A/../../../libusb-1.0.23.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), 
'/usr/lib/swift/libusb-1.0.23.dylib' (no such file), '/usr/lib/swift/libusb-1.0.23.dylib' (no such file), 
'/Users/xxx/apps/xxxa/apps/xxxa/build/macos/Build/Products/Debug/xxxa.app/Contents/MacOS/../Frameworks/libusb-1.0.23.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), 
'/Users/xxx/apps/xxxa/apps/xxxa/build/macos/Build/Products/Debug/xxxa.app/Contents/MacOS/Frameworks/libusb-1.0.23.dylib' (no such file), 
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libusb-1.0.23.dylib' (no such file), 
'/Users/xxx/apps/xxxa/apps/xxxa/build/macos/Build/Products/Debug/xxxa.app/Contents/MacOS/../Frameworks/libusb-1.0.23.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), 'libusb-1.0.23.dylib' (no such
 file), '/usr/local/lib/libusb-1.0.23.dylib' (no such file), '/usr/lib/libusb-1.0.23.dylib' (no such file), 
'/Users/xxx/Library/Containers/AA0A2AB2-FA78-4C6B-A651-/Data/libusb-1.0.23.dylib' (no such file)

#0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
#1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
#2      new QuickUsbMacos (package:quick_usb/src/quick_usb_desktop.dart:22:37)
#3      _platform (package:quick_usb/quick_usb.dart:25:35)
#4      QuickUsb.init (package:quick_usb/quick_usb.dart:36:33)
#5      _PrinterPopupState.getAllPrinter (package:xxxa/settings/printersPopup.dart:53:22)
#6      _PrinterPopupState.initState (package:xxxa/settings/printersPopup.dart:82:4)
#7      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4942:57)

Probable memory corruption, QuickBlue, Windows

I'm getting a variety of weird errors, focused around the gattServices map and GetServiceAsync. In particular, I keep getting an AccessViolation a few layers inside the call to insert on this line:

gattServices.insert(std::make_pair(service, s));

Some internal pointer in the map was 0xFFFFFF...E6. When I tried adding some logging to inspect it, I got errors that different pointers (like _Rootnode) were bad, like _Parent pointers of 0xcccccccc...ccc. I don't see anything in your code that looks like you're doing anything weird with gattServices, so my guess is that something else is going wrong and leaking into the map. (I'm not very good at C++, though, so. Might be wrong.)

quick_notify_plugin.vcxproj(257,3): error MSB4019. Not able to build windows app.

I'm getting the following error while building my windows app.
E:\Cloud\build\windows\plugins\quick_notify\quick_notify_plugin.vcxproj(257,3): error MSB4019: The imported project "E:\Cloud\build\windows\packages\Microsoft.Windows.CppWinRT\build\native\Microsoft.Windows.CppWinRT.props" was not found. Confirm that the expression in the Import declaration "E:\Cloud\build\windows\packages\Microsoft.Windows.CppWinRT\build\native\Microsoft.Windows.CppWinRT.props" is correct, and that the file exists on disk.

[quick_blue] The Flutter application cannot start if it has quick_blue plugin and there is no bluetooth dongle inserted into the Windows computer.

[quick_blue] Try run the example on Windows without inserted Bluetooth dongle.
App crushes on the step creation .exe file with message "An unhandled win32 exception occured in [?????]* quick_blue_example.exe"
Since this happens before flutter can draw anything on the screen, it is impossible to tell the user why the program is not running.

  • The number is different every time.

NUGET.EXE not found.

After adding quick_notify in pubscpec.yaml and run app I get :
CMake Error at flutter/ephemeral/.plugin_symlinks/quick_notify/windows/CMakeLists.txt:13 (message):
Please install this executable, and run CMake again.

quick_usb for Windows seems to construct an instance of QuickUsbMacos???

quick_usb_desktop.dart line 18 is part of class QuickUsbWindows but appears to instantiate .instance as a QuickUsbMacos instead.
QuickUsbPlatform.instance = QuickUsbMacos();

I'm no expert, but that smells suspicious. Is it good? Classes QuickUsbMacos and QuickUsbLinux do much more obvious things.

LateInitializationError on Windows. After updating to Flutter 3.10 and Dart 3.0.0

• Flutter version 3.10.0 on channel stable at D:\Flutter
• Framework revision 84a1e904f4 (5 days ago), 2023-05-09 07:41:44 -0700
• Engine revision d44b5a94c9
• Dart version 3.0.0
• DevTools version 2.23.1

I'm using flutter stable channel, recently updated to Flutter 3.10 and Dart 3.0.0. Now the QuickUsb library does not work. After calling var init = await QuickUsb.init(); a LateError occurs (LateInitializationError: field '_instance@326265524' was not initialized).

This happens on the Windows 11 platform, everything is fine on Android. Not tested on other platforms. I tried to clear the cache in .dart_tool, it did not help.

Quick USB MacOS (Intel) Failed to load dynamic library 'libusb-1.0.23.dylib'

flutter: quick_usb threw an error: Invalid argument(s): Failed to load dynamic library 'libusb-1.0.23.dylib': dlopen(libusb-1.0.23.dylib, 0x0001): tried: '/Volumes/Data/Projects/SWTH/qipos/build/macos/Build/Products/Debug/QiPOS Anywhere.app/Contents/Frameworks/FlutterMacOS.framework/Versions/A/./libusb-1.0.23.dylib' (no such file), '/Volumes/Data/Projects/SWTH/qipos/build/macos/Build/Products/Debug/QiPOS Anywhere.app/Contents/Frameworks/FlutterMacOS.framework/Versions/A/../../../libusb-1.0.23.dylib' (no such file), '/usr/lib/swift/libusb-1.0.23.dylib' (no such file), '/usr/lib/swift/libusb-1.0.23.dylib' (no such file), '/Volumes/Data/Projects/SWTH/qipos/build/macos/Build/Products/Debug/QiPOS Anywhere.app/Contents/MacOS/../Frameworks/libusb-1.0.23.dylib' (no such file), '/Volumes/Data/Projects/SWTH/qipos/build/macos/Build/Products/Debug/QiPOS Anywhere.app/Contents/MacOS/Frameworks/libusb-1.0.23.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libusb-1.0.23.dylib' (no such file), '/Volumes/Data/Projects/SWTH/qipos/build/macos/Build/Products/Debug/QiPOS Anywhere.app/Contents/MacOS/../Frameworks/libusb-1.0.23.dylib' (no such file), 'libusb-1.0.23.dylib' (no such file), '/usr/local/lib/libusb-1.0.23.dylib' (no such file), '/usr/lib/libusb-1.0.23.dylib' (no such file), '/Users/arkom/Library/Containers/app.qipos/Data/libusb-1.0.23.dylib' (no such file). The app may not function as expected until you remove this plugin from pubspec.yaml

Web

Hi! Does it work on web and windows platform?

Running on isolate instance has not been initialized on windows

Using version 0.4.0 quick_usb init doen't work on isolate.
I'haven't this problem using the prevoius version 0.3.1.
I've attached an example.
Best Regards
Alex

import 'dart:async';
import 'dart:isolate';

import 'package:flutter/material.dart';
import 'package:quick_usb/quick_usb.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();

runApp(MyHome());
}

class MyHome extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: MyApp(),
),
);
}
}

class MyApp extends StatefulWidget {
@OverRide
_MyAppState createState() => _MyAppState();
}

class _MyAppState extends State {
@OverRide
void initState() {
super.initState();
init();
}

Future init() async {
UsbService.usbRecvPort = ReceivePort();
await Isolate.spawn(UsbService.loopUsb, UsbService.usbRecvPort!.sendPort);
}

@OverRide
Widget build(BuildContext context) {
return _buildColumn();
}

void log(String info) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(info)));
}

Widget _buildColumn() {
return Column(
children: [
_init_exit(),
_getDeviceList(),
],
);
}

Widget _init_exit() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ElevatedButton(
child: Text('init'),
onPressed: () async {
var init = await QuickUsb.init();
log('init $init');
},
),
ElevatedButton(
child: Text('exit'),
onPressed: () async {
await QuickUsb.exit();
log('exit');
},
),
],
);
}

List? _deviceList;

Widget _getDeviceList() {
return ElevatedButton(
child: Text('getDeviceList'),
onPressed: () async {
_deviceList = await QuickUsb.getDeviceList();
log('deviceList $_deviceList');
},
);
}
}

class UsbService {
static SendPort? usbSendPort;
static ReceivePort? usbRecvPort;

static void loopUsb(SendPort sendPort) async {
ReceivePort p = ReceivePort();
sendPort.send(p.sendPort);

while (true) {
  await Future.delayed(const Duration(seconds: 1));
  try {
    var init = await QuickUsb.init();
    print('init $init');

    var list = await QuickUsb.getDeviceList();
    print(list);

    await QuickUsb.exit();
  } catch (e) {
    print(e);
  }
}

}
}

`message['characteristics']` is sometimes missing, causing a crash; QuickBlue, Windows

QuickBlue, Windows. message['characteristics'] is sometimes missing on the following line, causing a crash

List<String> characteristics = (message['characteristics'] as List).cast();

I think it's related to the stuff in

winrt::fire_and_forget QuickBluePlugin::DiscoverServicesAsync(BluetoothDeviceAgent &bluetoothDeviceAgent) {

Looks like the dart code expects that whenever message['ServiceState'] == 'discovered', message['characteristics'] will be present, but in the cpp code in DiscoverServicesAsync, of the two calls to Send, the first doesn't have it, and the second MIGHT not have it. (Indeed, for some reason some of the characteristics that should be present for one of my devices aren't there. That might itself be a separate issue.) In the dart code, (message['characteristics'] ?? []) prevents the crash, but I'm unsure if there's an underlying bug.

Access violation (device is null pointer), QuickBlue, Windows, ConnectAsync

After adding a delay to my program and attaching Visual Studio to debug it, I've now started to figure out some of these crashes.

Under some circumstances, device is null in ConnectAsync in quick_blue_plugin.cpp:

auto servicesResult = co_await device.GetGattServicesAsync();

Adding a null check (and return) makes it not crash, though it should probably also do some kind of error reporting.

I think it's null sometimes when the app hasn't scanned for devices. It doesn't seem like it's always needed, though. I don't know if that's a thing that can be solved in QuickBlue, or if it's a thing required by the windows API. The device IDs seem consistent, even across devices, so I don't know why scanning would be necessary. (It'd be nice if we could use MAC addresses, but like, the device IDs work.)

Side note - I'm discovering a lot of bugs, BUT this is still the most functional windows-supporting BLE library out of the three I've tested so far, so thanks for your work.

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.