Skip to content

Commit

Permalink
Only show ScanFilter warning on web
Browse files Browse the repository at this point in the history
  • Loading branch information
fotiDim committed Dec 18, 2024
1 parent d5172c3 commit dd75894
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions example/lib/peripheral_details/peripheral_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class _PeripheralDetailPageState extends State<PeripheralDetailPage> {
}

Future<void> _discoverServices() async {
const webWarning =
"Note: Only services added in ScanFilter or WebOptions will be discovered";
try {
var services = await UniversalBle.discoverServices(widget.deviceId);
print('${services.length} services discovered');
Expand All @@ -105,14 +107,11 @@ class _PeripheralDetailPageState extends State<PeripheralDetailPage> {
if (kIsWeb) {
_addLog(
"DiscoverServices",
'${services.length} services discovered,\nNote: Only services added in ScanFilter or WebOptions will be discovered',
'${services.length} services discovered,\n$webWarning',
);
}
} catch (e) {
_addLog(
"DiscoverServicesError",
'$e\nNote: Only services added in ScanFilter or WebOptions will be discovered',
);
_addLog("DiscoverServicesError", '$e\n${kIsWeb ? webWarning : ""}');
}
}

Expand Down

0 comments on commit dd75894

Please sign in to comment.