Commit Graph

222 Commits

Author SHA1 Message Date
Tony 46f9106a27 Add .flutter-plugins-dependencies to .gitignore
Pull Request / test (push) Has been cancelled
Pull Request / pana (push) Has been cancelled
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-08 06:23:34 +08:00
Tony aaab9cc40f Update xcconfig files to include Pod support and adjust SDK versions in pubspec.lock
Pull Request / test (push) Has been cancelled
Pull Request / pana (push) Has been cancelled
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-08 04:25:20 +08:00
Tony e4b14f38aa Enhance BLE peripheral support for iOS and macOS; update README and CHANGELOG
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-08 03:55:00 +08:00
Tony 1d7108c9d0 Update Universal BLE Plugin for Peripheral Support and Code Generation
- Updated autogenerated files to reflect changes from Pigeon v26.3.4.
- Added new classes for UniversalBlePeripheralConfig, UniversalBlePeripheralService, UniversalBlePeripheralCharacteristic, UniversalBlePeripheralDescriptor, and UniversalBlePeripheralWriteEvent to handle peripheral configurations and events.
- Modified UniversalBlePlugin to implement methods for peripheral support, including StartPeripheral, StopPeripheral, UpdatePeripheralCharacteristicValue, and NotifyPeripheralCharacteristic, returning appropriate error messages for unsupported features on Windows.
- Updated HasPermissions method to include an additional parameter for Bluetooth advertising permissions.
- Adjusted method signatures and implementations across the plugin to accommodate new peripheral functionality.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-08 03:36:12 +08:00
Foti Dim dde6c084b7 Add SPM support (#223)
Pull Request / test (push) Has been cancelled
Pull Request / pana (push) Has been cancelled
* Add SPM support

* Cleanup cocoapods bits from example app

* Update package references for universal-ble in Xcode project

* Refactor notification handling and error logging in UniversalBleWeb class

* Change min sdk version

* Update CHANGELOG.md to include SPM support on Apple and requestConnectionPriority feature for version 1.3.0
2026-04-02 14:16:37 +02:00
Raphael Smith f4b197f8ae Add requestConnectionPriority support (#221)
* feat: add requestConnectionPriority

- Add BleConnectionPriority enum (balanced, highPerformance, lowPower)
- Add BleCapabilities.supportsConnectionPriorityApi flag
- Implement on Android via BluetoothGatt.requestConnectionPriority()
- Throw notSupported on iOS, macOS, Windows, Linux, and Web
- Update pigeon definition and regenerate platform channel files
- Bump version 1.2.0 -> 1.3.0

* fix: improve requestConnectionPriority implementation

- Remove redundant BleCapabilities guard in Dart layer (native handles it)
- Add BleConnectionPriority Kotlin enum mirroring Dart enum
- Map to explicit Android SDK constants via when expression
- Add firstOrNull with ILLEGAL_ARGUMENT for unknown priority values
- Add catch (e: Exception) block for broader error handling
- Fix enum doc comment (throws belongs on method, not enum)
- Remove stale capability check guidance from docs and README

---------

Co-authored-by: aqeel-bmec-co <aqeel@bmec.co>
Co-authored-by: aqeel-bmec-co <85945830+aqeel-bmec-co@users.noreply.github.com>
2026-04-01 21:15:39 +02:00
Foti Dim 7214cb8301 Remove web app workflow 2026-02-28 22:45:50 +02:00
Foti Dim 13ffda3ad7 Format 2026-02-28 21:06:58 +02:00
Foti Dim 4367381a56 Update web app link 2026-02-28 20:31:28 +02:00
Foti Dim 67fca658c9 Rename exceptions in codedoc 2026-02-28 20:16:15 +02:00
Foti Dim 722a7f43b5 Update Changelog 2026-02-28 10:18:28 +02:00
Foti Dim 57ac324705 Switch to simple example app 2026-02-28 10:04:02 +02:00
fotidim aeca9fa6a9 Add serviceData tracking in Linux advertisements 2026-02-16 07:34:57 +01:00
Foti Dim c683c09377 Update Changelog 2026-02-11 18:46:07 +01:00
Foti Dim 6ab2ed82ea Update About dialog 2026-02-11 17:20:27 +01:00
Usman Mehmood 3f4abdc5cd Fix Windows crash by handling WinRT exceptions in BLE callback paths (#217)
* Fix Windows crash by handling WinRT exceptions in BLE callback paths

This patch hardens the Windows plugin against unhandled native exceptions that could terminate the Flutter process during reconnect/disconnect flows.

- add shared `log_and_swallow` helpers for consistent native exception logging
- wrap `ConnectAsync` in defensive `try/catch` blocks, including per-service characteristic discovery
- guard `BluetoothLeDeviceConnectionStatusChanged` to prevent callback exceptions from escaping
- harden `CleanConnection` and `DisposeServices` when unregistering handlers/subscriptions
- add explicit error handling around CCCD writes in `SetNotifiableAsync`
- wrap `GattCharacteristicValueChanged` notification callback path in `try/catch`
- add `ResetState()` helper scaffold for full native BLE state cleanup on Windows

* Added missing log to an empty catch statement

* fix(windows): report native callback failures as disconnect events

- emit `OnConnectionChanged(..., false, error)` on WinRT exceptions
- clean connection state before reporting disconnect

* Update windows/src/universal_ble_plugin.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update windows/src/universal_ble_plugin.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update windows/src/helper/utils.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update windows/src/helper/utils.h

---------

Co-authored-by: Navideck Labs <130186950+navidecklabs@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-11 17:15:38 +01:00
Foti Dim ffd69a7c49 Allow saving filters 2026-02-10 22:54:14 +01:00
Foti Dim 062f6c4c8c Add active filter count display and improve UI in ScannerScreen
- Introduced a new method `_getActiveFilterCount` to calculate the number of active filters.
- Updated the filter button to show a badge with the active filter count.
- Changed the clear filter button icon for better clarity.
- Enhanced the hint style in the scan filter widget for improved visibility.
2026-02-10 21:55:02 +01:00
Foti Dim 167d84f838 Always use custom scan filter for Windows 2026-02-10 11:44:52 +01:00
Foti Dim a7f04101a0 Remove manufacturer data display from PeripheralDetailPage and add company identifier service import 2026-02-09 22:43:46 +01:00
Foti Dim 8c75e3965f Integrate SharedPreferencesAsync for improved preferences handling
- Added a new `prefs_async.dart` file to encapsulate the usage of `SharedPreferencesAsync`.
- Updated `ScanController`, `StorageService`, and `ScannerScreen` to utilize the new async preferences methods, enhancing performance and code clarity.
- Modified `devtools_options.yaml` to enable the `shared_preferences` extension.
- Refactored the `FlashOnUpdateWidget` to improve the outline animation and added a customizable border radius.
- Adjusted the favorite services loading mechanism in `PeripheralDetailPage` to be asynchronous, ensuring better state management.
2026-02-09 22:24:41 +01:00
Foti Dim 485c0808ad Refactor Bluetooth availability handling in ScannerScreen and AppDrawer
- Removed the tooltip for Bluetooth availability from ScannerScreen and integrated the BleAvailabilityIcon directly into the AppDrawer.
- Updated the AppDrawer to accept Bluetooth availability state and a callback for state changes.
- Simplified button labels in ScannerScreen and ScannedDevicesPlaceholderWidget for clarity.
- Adjusted padding for buttons to enhance UI consistency.
2026-02-09 21:47:50 +01:00
Foti Dim b49d54b900 Add scan order functionality to ScannerScreen
- Introduced an enum `ScanOrder` to define sorting options for scanned devices.
- Implemented logic to save and retrieve the selected scan order from shared preferences.
- Added a popup menu for users to select the sorting method (Last Seen, Name, RSSI).
- Updated the device list display to reflect the selected sorting order, enhancing user experience.
2026-02-09 21:37:44 +01:00
Foti Dim 061e0ae633 Make scan button persistent 2026-02-09 21:23:29 +01:00
Foti Dim 8ad6bbf125 Implement scan filter application logic in ScannerScreen
- Added a new method `_onScanFilterApplied` to handle the application of scan filters, which updates the state and clears device lists.
- Refactored the filter application logic in the bottom sheet to utilize the new method for better code organization.
- Ensured that device lists are cleared when a new filter is applied and scanning is stopped if currently active.
2026-02-09 12:49:09 +01:00
Foti Dim d90a727991 Refactor ScannedItemWidget to StatefulWidget and enhance advertisement timestamp display
- Converted ScannedItemWidget from StatelessWidget to StatefulWidget to manage state and update the UI dynamically.
- Added a timer to refresh the display of the last advertisement timestamp.
- Improved the formatting of the last seen advertisement message for better clarity.
2026-02-09 12:45:29 +01:00
Foti Dim fc6ae39a53 Display advertisements 2026-02-07 13:01:32 +01:00
Foti Dim 9df3da17ae Fix icons on Windows 2026-02-07 12:40:35 +01:00
Foti Dim 8d0739ccf5 Fix example app Windows compilation 2026-02-07 12:38:17 +01:00
Foti Dim ceda9a31f7 Background service support on Android (#215)
* - Added support for BLE scanning from background services on Android.
- Enhanced `PermissionHandler` to be activity-aware, allowing silent success for already granted permissions when no activity is available.
- Updated README with best practices for requesting permissions in foreground before background operations.

* Simplify implementation
2026-02-04 19:12:12 +01:00
Foti Dim bcf65e4573 Improve example app (#210)
* Improve example app

- Introduced utility functions for sorting BLE services and filtering characteristics based on properties.
- Updated the peripheral detail page to support reading all characteristics and improved value formatting for better readability.
- Added navigation functionality for adjacent characteristics and integrated property filters in the services list widget.
- Enhanced the services side widget to manage selected properties and provide a clearer UI for service interactions.
- Implemented copy functionality for logs and improved overall user experience in the peripheral details section.

* Remove expandable

* Automatically start scanning on launch

* Show loading indicator for discovering services

* Decrease the height of TextFormField
2026-01-23 07:29:28 +01:00
Rohit Sangwan 2f7f1f693d Add Android scan mode setting (#212)
* Add Android scan mode setting

* Format pigeon generated code

* format whole project

* Fix windows compilation because of generated code order

* Fix unwanted imports

* Add doc comment for AndroidOptions

* Update code doc
2026-01-21 15:32:40 +05:30
Rohit Sangwan dae2f5dc4d Add service-data in advertisements (#207)
* Add service-data in advertisements

* Fix windows serviceData parsing

* Resolve Ai comments

* Resolve Ai comments and validate service data

* Cleanup and Update changelog
2026-01-21 13:43:36 +05:30
Foti Dim 1334057a8a Show and filter by company name (#208)
* Update company identifier handling and enhance scanning features

- Updated `pubspec.lock` to version 1.2.0 and added `yaml` dependency.
- Introduced `CompanyIdentifierService` for loading and querying company identifiers from a new YAML file.
- Enhanced scanning functionality to support filtering by company names and IDs.
- Updated UI components to display company names alongside manufacturer data in scanned items.
- Improved search functionality to include company names in the filter criteria.

* Address AI comments

* Address AI comments

* Allow searching by company id

* Remove redundant loading state update in CompanyIdentifierService

* Enhance company ID parsing in CompanyIdentifierService

- Updated the `_parseCompanyId` method to support additional formats for company IDs, including non-prefixed strings interpreted as decimal or hexadecimal based on their content.
- Improved parsing logic to first attempt hexadecimal conversion if the string contains hex characters, enhancing flexibility in input handling.
2026-01-19 05:35:19 +01:00
Foti Dim bcfb0adc6a Improve format for discovered services (#209)
* Update the peripheral detail page to format and display discovered services more clearly, including characteristics.

* Address AI comments

* Refactor characteristic display format in peripheral detail page for improved clarity
2026-01-19 05:34:50 +01:00
Foti Dim 9e5603dc29 Enhance error logging in Bluetooth peripheral updates
- Added logic to differentiate between read and notify/indicate errors in the `didUpdateValueFor` method of `UniversalBlePlugin`.
- Improved error handling by preventing duplicate logging for read operations while maintaining appropriate logging for notify/indicate errors.
2026-01-18 22:05:01 +01:00
Foti Dim 2a65823e6c Update Bluetooth scanning UI and functionality
- Bump version to 1.2.0 in pubspec.lock.
- Enhance ScannerScreen with a Bluetooth availability tooltip and improved search filter UI.
- Refactor AppDrawer to include a queue type selection feature.
- Update ScannedDevicesPlaceholderWidget to include a 'Start Scan' button for better user interaction.
- Improve overall layout and styling for better user experience.
2026-01-18 17:11:22 +01:00
Foti Dim 60a4e2277f Add web app to app showcase 2026-01-16 07:37:35 +01:00
Foti Dim 8557a46d05 Add auto-connect support (#206)
* Add autoConnect support

* Enhance autoConnect functionality for Bluetooth devices

- Added support for managing a set of auto-connect devices in both Android and iOS implementations.
- Updated connection and disconnection logic to handle auto-reconnect scenarios appropriately.
- Improved cleanup processes to prevent unwanted reconnections when devices are manually disconnected.

* Refactor connection button and add auto-reconnect toggle

- Updated the connection button layout for better UI consistency.
- Introduced an auto-reconnect toggle to manage automatic reconnections when devices become available.
- Enhanced connection and disconnection logic to respect the auto-connect setting.

* Update version to 1.2.0 and add CHANGELOG for new features

- Bumped version to 1.2.0.
- Added CHANGELOG.md detailing new features including support for `autoConnect` and UI updates for automatic reconnection.

* Improve readme

* Refactor variable naming for clarity in Bluetooth connection logic

- Changed variable name from `isAutoConnect` to `shouldAutoConnect` for better readability and understanding of its purpose in the connection state handling.

* Refactor connection handling in UniversalBlePlugin

- Simplified connection logic by always cleaning up internal state before sending connection change callbacks.
- Ensured GATT resources are only closed when autoConnect is disabled, allowing for better management of Bluetooth connections.

* Refactor disconnection handling in UniversalBlePlugin

- Introduced a new method `handlePeripheralDisconnection` to encapsulate disconnection logic, improving code readability and maintainability.
- Updated the `centralManager` methods to utilize the new disconnection handler, ensuring consistent behavior across connection state changes.

* Update darwin/Classes/UniversalBlePlugin.swift

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Foti Dim <fotios.dimanidis@a2zebra.de>
Co-authored-by: Navideck Labs <130186950+navidecklabs@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-16 11:36:24 +05:30
Foti Dim a30e84a70c Add informational text and contact option in AppDrawer 2026-01-13 19:01:01 +01:00
Foti Dim 9d73a9f402 Add scan filter persistence using SharedPreferences
- Implemented loading and saving of scan filters (services, name prefix, manufacturer data, and search term) using SharedPreferences.
- Added functionality to apply filters from the loaded preferences.
- Updated the UI to save filters when they change or when the search is cleared.
2026-01-13 11:04:00 +01:00
Foti Dim 395bb548c9 Fix clear log button 2026-01-12 17:48:58 +01:00
EricKwok 1adfa9b485 Implement readRSSI on Android and Darwin (#203) 2026-01-05 17:49:55 +01:00
Foti Dim a5b6af6168 Enforce cxx_std_20 (#205)
* Enforce cxx_std_20

* Bump version

* Switch to private
2026-01-05 16:12:31 +01:00
Foti Dim 7a6e555275 Change button wording 2025-12-29 11:23:50 +01:00
Foti Dim 4b62d61f58 Update readme 2025-12-23 07:48:31 +01:00
Foti Dim 192ee469c3 Add tablet preview device 2025-12-21 10:58:54 +01:00
Foti Dim 9a52bd41a8 Update iOS podfile.lock 2025-12-21 10:43:56 +01:00
Foti Dim af598d13bb Update copyright date 2025-12-21 09:50:49 +01:00
Foti Dim dad326ccff Add device preview 2025-12-21 09:46:17 +01:00