mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-27 12:47:31 +10:00
feat: add MeshCoreUuids class for UUID constants and device name prefixes
This commit is contained in:
@@ -39,14 +39,9 @@ import '../storage/unread_store.dart';
|
|||||||
import '../utils/app_logger.dart';
|
import '../utils/app_logger.dart';
|
||||||
import '../utils/battery_utils.dart';
|
import '../utils/battery_utils.dart';
|
||||||
import '../utils/platform_info.dart';
|
import '../utils/platform_info.dart';
|
||||||
|
import 'meshcore_uuids.dart';
|
||||||
import 'meshcore_protocol.dart';
|
import 'meshcore_protocol.dart';
|
||||||
|
|
||||||
class MeshCoreUuids {
|
|
||||||
static const String service = "6e400001-b5a3-f393-e0a9-e50e24dcca9e";
|
|
||||||
static const String rxCharacteristic = "6e400002-b5a3-f393-e0a9-e50e24dcca9e";
|
|
||||||
static const String txCharacteristic = "6e400003-b5a3-f393-e0a9-e50e24dcca9e";
|
|
||||||
}
|
|
||||||
|
|
||||||
class DirectRepeater {
|
class DirectRepeater {
|
||||||
static const int maxAgeMinutes = 30; // Max age for direct repeater info
|
static const int maxAgeMinutes = 30; // Max age for direct repeater info
|
||||||
final int pubkeyFirstByte;
|
final int pubkeyFirstByte;
|
||||||
@@ -995,7 +990,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await FlutterBluePlus.startScan(
|
await FlutterBluePlus.startScan(
|
||||||
withKeywords: ["MeshCore-", "Whisper-"],
|
withKeywords: MeshCoreUuids.deviceNamePrefixes,
|
||||||
webOptionalServices: [Guid(MeshCoreUuids.service)],
|
webOptionalServices: [Guid(MeshCoreUuids.service)],
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
androidScanMode: AndroidScanMode.lowLatency,
|
androidScanMode: AndroidScanMode.lowLatency,
|
||||||
@@ -1020,9 +1015,9 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
..addAll(
|
..addAll(
|
||||||
systemDevices
|
systemDevices
|
||||||
.where(
|
.where(
|
||||||
(device) =>
|
(device) => MeshCoreUuids.deviceNamePrefixes.any(
|
||||||
device.platformName.startsWith('MeshCore-') ||
|
device.platformName.startsWith,
|
||||||
device.platformName.startsWith('Whisper-'),
|
),
|
||||||
)
|
)
|
||||||
.map(
|
.map(
|
||||||
(device) => ScanResult(
|
(device) => ScanResult(
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class MeshCoreUuids {
|
||||||
|
static const String service = "6e400001-b5a3-f393-e0a9-e50e24dcca9e";
|
||||||
|
static const String rxCharacteristic = "6e400002-b5a3-f393-e0a9-e50e24dcca9e";
|
||||||
|
static const String txCharacteristic = "6e400003-b5a3-f393-e0a9-e50e24dcca9e";
|
||||||
|
|
||||||
|
static const List<String> deviceNamePrefixes = ["MeshCore-", "Whisper-", "Wiscore-", "HT-"];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user