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

为什么扫描的蓝牙设备名称基本都显示是未命名的设备呢? #29

Closed
Villian95 opened this issue Feb 27, 2023 · 1 comment

Comments

@Villian95
Copy link

No description provided.

@ggokbudak
Copy link

FlutterBlueElves.instance
.startScan(500000, isAllowDuplicates: true)
.listen((event) {
setState(() {
final existingDeviceIndex =
_persistentScanList.lastIndexWhere(
//LAST INDEXİ ALACAK ŞEKİLDE GÜNCELLENDİ
(element) => element.macAddress == event.macAddress,
);

                  if (existingDeviceIndex != -1) {
                    // Eğer cihaz listede varsa, güncel zamanı kaydet
                    _persistentScanList[existingDeviceIndex] = event;
                  } else {
                    // Eğer cihaz listede yoksa, yeni cihaz olarak ekle
                    _persistentScanList.add(event);
                  }

                  if (event.macAddress != null && ///YOU CAN CHECK THİS!!!!
                      event.name != null &&
                      int.tryParse(event.name!) != null) {
                    _scanResultList.insert(0, event);
                  }
                  ParseDataForNode();
                  //logScanResults();
                  //sad();
                });
              }).onDone(() {
                setState(() {
                  _isScaning = false;
                  _persistentScanList.clear();
                });
              });
            }
          }
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants