Enhance getSystemDevice API on macOS with Broader Default Services Fi… (#121)
* Enhance getSystemDevice API on macOS with Broader Default Services Filter * Update docs * Update darwin/Classes/UniversalBlePlugin.swift Co-authored-by: Foti Dim <foti@navideck.com> * Reorder fields * Use ScanFilter ui for getting system devices --------- Co-authored-by: Foti Dim <fdimanidis@gmail.com> Co-authored-by: Foti Dim <foti@navideck.com>
This commit is contained in:
+14
-11
@@ -71,6 +71,19 @@ class _MyAppState extends State<MyApp> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _getSystemDevices() async {
|
||||
List<BleDevice> devices = await UniversalBle.getSystemDevices(
|
||||
withServices: scanFilter?.withServices,
|
||||
);
|
||||
if (devices.isEmpty) {
|
||||
showSnackbar("No Connected Devices Found");
|
||||
}
|
||||
setState(() {
|
||||
_bleDevices.clear();
|
||||
_bleDevices.addAll(devices);
|
||||
});
|
||||
}
|
||||
|
||||
void _showScanFilterBottomSheet() {
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
@@ -179,17 +192,7 @@ class _MyAppState extends State<MyApp> {
|
||||
if (BleCapabilities.supportsConnectedDevicesApi)
|
||||
PlatformButton(
|
||||
text: 'Connected Devices',
|
||||
onPressed: () async {
|
||||
List<BleDevice> devices =
|
||||
await UniversalBle.getSystemDevices();
|
||||
if (devices.isEmpty) {
|
||||
showSnackbar("No Connected Devices Found");
|
||||
}
|
||||
setState(() {
|
||||
_bleDevices.clear();
|
||||
_bleDevices.addAll(devices);
|
||||
});
|
||||
},
|
||||
onPressed: _getSystemDevices,
|
||||
),
|
||||
PlatformButton(
|
||||
text: 'Queue: ${_queueType.name}',
|
||||
|
||||
@@ -115,19 +115,19 @@ class _ScanFilterWidgetState extends State<ScanFilterWidget> {
|
||||
const Divider(),
|
||||
const SizedBox(height: 10),
|
||||
TextFormField(
|
||||
controller: widget.servicesFilterController,
|
||||
controller: widget.namePrefixController,
|
||||
maxLines: 2,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Services",
|
||||
labelText: "Name Prefixes",
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TextFormField(
|
||||
controller: widget.namePrefixController,
|
||||
controller: widget.servicesFilterController,
|
||||
maxLines: 2,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Name Prefixes",
|
||||
labelText: "Services",
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user