95 Commits

Author SHA1 Message Date
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 13ffda3ad7 Format 2026-02-28 21:06:58 +02:00
Foti Dim 67fca658c9 Rename exceptions in codedoc 2026-02-28 20:16:15 +02:00
fotidim aeca9fa6a9 Add serviceData tracking in Linux advertisements 2026-02-16 07:34:57 +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
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 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
EricKwok 1adfa9b485 Implement readRSSI on Android and Darwin (#203) 2026-01-05 17:49:55 +01:00
Rohit Sangwan 895dcbe343 Improve example app UI (#193)
* Improve example app ui

* Store favorite services in local storage

* Use Text instead of SelectableText

* Improve colors

* Fix flutter analyzer issues

* Revert example app minimum sdk requirement

* Implement hasPermission api and improve ui flow

* More ui improvements

* Improve ScannedItem ui

* Improve control ui

* Change color theme to blue

* Minor improvements wip

* improve responsive ui and flow

* More improvements

* More improvements

* Update Mac podfile

* Fix home page scroll view

* Update app and package name

* Revert changelog

* Resolve Ai comments

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-12-21 08:51:36 +01:00
Navideck Labs d26e752e73 Update README and BLE API documentation for MTU handling (#202)
- Clarified MTU request behavior and platform limitations in README.md.
- Added best practices for MTU management in cross-platform BLE applications.
- Enhanced documentation for `requestMtu` method in UniversalBle and BleDeviceExtension to reflect best-effort nature of MTU requests and platform-specific behaviors.

Co-authored-by: Foti Dim <foti@navideck.com>
2025-12-15 07:08:01 +01:00
Rohit Sangwan 97936046e0 Implement hasPermissions API (#201)
* Implement hasPermissions api

* Bump minimum MacOS version to 10.15

* Apply suggestions from code review

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-12 22:10:21 +01:00
Rohit Sangwan 89abb3bf03 Implement Logging (#199)
* Implement Logging

* Add timestamp in OnValueChanged

* improve web and linux logging

* Implement windows and format pigeon

* Fix windows build and unity log level

* Log commands with timestamp

* Fix code doc

* Remove unnecessary import

* Update docs

* Fix crash on windows 11 because of failed pairing

* Update changelog

* Fix native code formatting
2025-12-12 18:56:43 +05:30
Rohit Sangwan fa319416ef Implement timestamp in scanResult (#198)
* Implement timestamp in scanResult

* Update pigeon

* implement windows

* Update changelog

* Fix Swift formatting

* Remove android unused import

* Format pigeon generated file
2025-12-11 19:24:13 +05:30
Rohit Sangwan 3116962e8c Implement characteristic descriptor discovery (#196)
* Implement characteristic descriptor discovery

* Improve Darwin services discovery

* Minor mac fix

* Implement Windows support

* discover descriptors in DiscoverServicesAsync api on windows

* Add withDescriptors in discoverServices api

* Implement withDescriptors for Apple and Android

* Fix ai comment and format pigeon generated file

* Resolve Ai comment

* Capitalize API

* Handle empty services scenario

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-12-10 11:36:04 +05:30
Rohit Sangwan 09bb22750a Improve disconnect api (#192)
* Improve disconnect api

* Get disconnection event on Web from callback

* Wait for disconnection result on calling disconnect

* Improve linux disconnection

* Update Changelog

* Fix Ai comments
2025-11-14 20:20:22 +05:30
Rohit Sangwan 970db165dd Implement requestPermission API (#190)
* Implement requestPermission api

* Update example ios podfile

* Update example windows dependencies

* Update Readme and Changelog

* Resolve Ai Comments

* Improve bluetooth permission handling

* Update Readme

* Improve readme

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-11-13 17:22:17 +01:00
Rohit Sangwan 34b39597fd Implement isScanning api (#188)
* Implement isScanning api

* Improve IOS scanning api

* Update Readme and Changelog
2025-11-12 14:57:44 +01:00
Rohit Sangwan acfa3200ca Implement unified and type safe error messages (#186)
* Implement unified and type safe error messages

* Fix Apple error handling

* improve linux exception handling

* improve web exception handling

* fix window imports

* update pigeon generated files

* Fix compilaton issue

* Fix windows error parsing

* Fix windows compilation

* Improve error handling on dart side

* rename _wrapFuture to _executeWithErrorHandling

* Add pigeon generation script and format generated dart file

* Update changelog

* Update readme

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-11-11 19:34:29 +01:00
Foti Dim b52ca9ee84 Add pana job 2025-11-10 21:40:31 +01:00
Kevin Evans 5689e551f7 fix: confusing param name (#182)
* fix: confusing param name

* Update lib/src/universal_ble.dart

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update lib/src/universal_ble.dart

Co-authored-by: Navideck Labs <130186950+navidecklabs@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Navideck Labs <130186950+navidecklabs@users.noreply.github.com>
2025-10-03 21:58:50 +02:00
Rohit Sangwan af873b3153 Implement exclusion filter (#175)
* Implement exclusion filter

* Fix web filters

* Apply Ai Suggestions

* Fix scanFilterTest

* Resolve Ai comments

* Update readme and changelog

* Update CHANGELOG.md

Co-authored-by: Foti Dim <foti@navideck.com>

* Update exclusion filter doc

* Fix wording

---------

Co-authored-by: Foti Dim <foti@navideck.com>
Co-authored-by: Foti Dim <fotios.dimanidis@a2zebra.de>
2025-09-01 10:31:56 +03:00
Rohit Sangwan 71e19988a9 Add clear queue api (#171)
* Add clear queue api

* Minor improvement

* Update changelog

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-07-16 12:36:39 +02:00
Rohit Sangwan 0f4bae71e1 Add timeout argument to all APIs (#172)
* Add timeout argument to all apis

* Update Version and changelog

* Bump version

* Update readme

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-07-16 11:47:48 +02:00
Rohit Sangwan 2170588045 Fix characteristic value listener and add tests (#168)
* Improve characteristic value listener

* Implement characteristic tests

* Bump version and update changelog
2025-07-08 08:13:45 +02:00
Rohit Sangwan 0758f5e91d Add high level API (#160)
* Add high-level api extensions for BleDevice and Characteristic

* Add doc comments and move few files to utils

* Add advance documentation

* Make the high level APIs the new default in the readme

* More readme cleanups

* Add pair api, improve notifications apis and deprecate writeValue

* Use highLevel apis in Example

* Rename HighLevel isPaired api to hasPairing api

* Update Readme

* Rename low level readValue api to read and update Readme

* Update UniversalBle to use new apis instead of deprecated internally

* Split queueCommand and queueCommandWithoutTimeout

* Split setNotifiable into subscribeNotifications, subscribeIndications and unsubscribe

* Fix web imports

* Update changelog

* Switch back to isPaired

Co-authored-by: Rohit Sangwan <rohitsangwan647@gmail.com>

* Fix BleDevice toString method

* Switch back to isPaired

* Change peripheral to device

* Rename cached to preferCached

* Remove preferCached from discoverServices()

* Update changelog

* Use cached services

* Add ///

* Reverse withoutResponse to withResponse to avoid negation

* Link to low level API

* Move connectionState to public readme

* Rename disableSubscriptions to unsubscribe

* Improve documentation

* Fix getService cache

* Add NotFoundException

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-06-19 13:02:14 +02:00
Rohit Sangwan 72090571a3 Add WebBluetoothGloballyDisabled exception and fix availability state (#165)
* Add WebBluetoothGloballyDisabled exception and fix availability state

* Update changelog and version

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-06-13 00:30:13 +02:00
Foti Dim fa98d2989b Switch to flutter_lints: ^6.0.0 2025-05-29 21:35:04 +02:00
Rohit Sangwan 8069ff52d5 Implement streams to get updates (#155)
* Implement streams to get updates

* Resolve comments

* Update Readme

* Apply suggestions from code review

Co-authored-by: Foti Dim <foti@navideck.com>

* Update Changelog

* Update Readme

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-05-08 12:52:18 +02:00
tfroidcoeur 3194b0ad49 Fix: linux: getSystemDevices (#154)
Make sure getSystemDevices connects the bluez client first.
This ensures that the list of devices is correctly populated.

Signed-off-by: Tim Froidcoeur <tim.froidcoeur@comate.be>
Co-authored-by: Tim Froidcoeur <tim.froidcoeur@comate.be>
2025-04-26 22:02:49 +02:00
Foti Dim 334bc1c680 Improve docs for isPaired 2025-03-19 22:17:06 +01:00
Foti Dim 3170b4b77b Improve requestMTU() docs (#140)
* Improve requestMTU() docs

* Update Linux info
2025-02-17 08:20:43 +01:00
Foti Dim 2c0d36b9d1 Improve ManufacturerDataFilter (#139)
* Improve-ManufacturerDataFilter-docs

* Improve ManufacturerDataFilter namings and code

* Perform more renamings
Add tests
2025-02-17 06:42:28 +01:00
Rohit Sangwan b1b6b680c1 Improve callbacks error handling (#130)
* Improve callbacks error handling

* Update Changelog

* Update CHANGELOG.md

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-01-15 17:23:25 +01:00
Rohit Sangwan f3411280e9 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>
2025-01-02 15:58:51 +05:30
Rohit Sangwan 1292199426 Add API to disable Bluetooth (#113)
* Add api to disable Bluetooth

* Implement Android support

* Fix apple build

* Update Readme

* Combine rows

---------

Co-authored-by: Foti Dim <fdimanidis@gmail.com>
2024-12-09 21:18:01 +05:30
Rohit Sangwan 5be22ac0e6 Remove "Characteristic already notifying" error (#110) 2024-12-09 18:48:18 +05:30
Rohit Sangwan 61e1448fe9 Improve Darwin Manager Initialization (#103)
* Improve Darwin Manager Initialization

* throw error on startScan if permission rejected

* Update Changelog
2024-12-05 13:27:53 +05:30
Foti Dim ce06a7fa39 Fix multiple app filtering in Linux (#100) 2024-11-20 16:21:59 +01:00
Foti Dim 4e225b756c Add rawName property
Co-authored-by: Rohit Sangwan <rohitsangwan647@gmail.com>
2024-10-08 17:58:38 +02:00
Rohit Sangwan e4b6bd74ba Rename filterMfdList to manufacturerDataFilters and replace mfd with msd 2024-10-03 11:59:14 +05:30
Rohit Sangwan b77d0aaeb4 Add error in connection updates (#89)
* Add error in connection updates

* implement windows

* Update changelog and Docs

* minor fix in connect()

* Add default timeout in connect

* Document new pair and connect API

* Fix Connect and Pair apis to throw proper errors and Improve logging

* remove import

* Rename PairingException and update Exception doc

* Update changelog

* Update comments

---------

Co-authored-by: Foti Dim <fdimanidis@gmail.com>
2024-09-26 23:08:25 +02:00
Foti Dim f41aceaa0e Revert "Add default timeout in Connect, Pair and IsPaired apis"
This reverts commit b978b81cb1.
2024-09-25 16:42:29 +02:00
Foti Dim 4914687284 Rename to triggersConfirmOnlyPairing 2024-09-24 17:33:00 +02:00
Foti Dim 73e4d5e68e Improve comments 2024-09-23 21:07:31 +02:00
Foti Dim 3ecbcb9b43 Rename in-app pairing capabilities (#88) 2024-09-23 07:13:41 +02:00
Foti Dim bf270c2bf4 Fix _triggersPairingWithEncryptedChar condition 2024-09-21 10:11:59 +02:00
Foti Dim c57cc778da Improve supportsInAppPairing documentation 2024-09-19 22:36:09 +02:00