Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help]: Getting 20 byte only, requestMtu not working, getting full data on native android app #652

Closed
1 task done
zubair999 opened this issue Nov 2, 2023 · 2 comments
Labels
help Questions, help, observations, or possible bugs

Comments

@zubair999
Copy link

zubair999 commented Nov 2, 2023

Requirements

  • I've looked at the README 'Common Problems' section

Have you checked this problem on the example app?

No

FlutterBluePlus Version

1.20.7

Flutter Version

3.10.6

What OS?

Android

OS Version

Android 5

Bluetooth Module

C2541

What is your problem?

I have received the data from my ble but data is only 20 byte and I am requesting for the increase mtu size after connecting to the ble but still I am getting same data.
I also installed the Serial Bluetooth Terminal(Simple App from Playstore on which I am getting the whole data perfectly without requesting anyting.

These are two library of the Android Native App which I clone android run android app on which I am getting whole data
https://github.com/kai-morich/SimpleBluetoothTerminal
https://github.com/kai-morich/SimpleBluetoothLeTerminal

So it means my device is ok,

Then why requestMtu is not working on Flutter Blue Plus even after requestMtu show success
Kindly help on, I am stuck for so many days.

Logs

I am getting data
@zubair999 zubair999 added the help Questions, help, observations, or possible bugs label Nov 2, 2023
@zubair999 zubair999 changed the title [Help]: [Help]: Getting 20 byte only, requestMtu not working, getting full data on native android app(Urgent!!!!!!!!!)Help Nov 2, 2023
@chipweinberger chipweinberger changed the title [Help]: Getting 20 byte only, requestMtu not working, getting full data on native android app(Urgent!!!!!!!!!)Help [Help]: Getting 20 byte only, requestMtu not working, getting full data on native android app Nov 2, 2023
@chipweinberger
Copy link
Collaborator

use onValueReceived and setNotify

@zubair999
Copy link
Author

zubair999 commented Nov 2, 2023

I am already using onValueReceived

void printValue() async {
    _services.forEach((service) {
      if (service.uuid.toString() == SERVICE_UUID) {
        service.characteristics.forEach((characteristic) {
          if (characteristic.uuid.toString() == CHARACTERISTIC_UUID) {
            characteristic.setNotifyValue(!characteristic.isNotifying);
            characteristic.onValueReceived.listen((data) {
              print(">>>>>>>>>>>>>>>>");
              if (utf8.decode(data).contains("Orient")) {
                String stream1 = utf8.decode(data);
                print(stream1);
              }
            });
          }
        });
      }
    });
  }

This is the function I which I using to print the values in the debug console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help Questions, help, observations, or possible bugs
Projects
None yet
Development

No branches or pull requests

2 participants