From 7794c882b496ba76298e5baf8fe459ef723d84e1 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Tue, 5 Mar 2024 15:23:01 +0100 Subject: [PATCH 1/4] Use connectToDevice because it is more reliable --- lib/src/ledger/ledger_ble_connection_manager.dart | 5 +---- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/src/ledger/ledger_ble_connection_manager.dart b/lib/src/ledger/ledger_ble_connection_manager.dart index 3c520d7..948a960 100644 --- a/lib/src/ledger/ledger_ble_connection_manager.dart +++ b/lib/src/ledger/ledger_ble_connection_manager.dart @@ -36,11 +36,8 @@ class LedgerBleConnectionManager extends BleConnectionManager { StreamSubscription? subscription; await disconnect(device); - subscription = _bleManager - .connectToAdvertisingDevice( + subscription = _bleManager.connectToDevice( id: device.id, - withServices: [Uuid.parse(serviceId)], - prescanDuration: options?.prescanDuration ?? _options.prescanDuration, connectionTimeout: options?.connectionTimeout ?? _options.connectionTimeout, ) diff --git a/pubspec.yaml b/pubspec.yaml index 9638599..e339b4a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ledger_flutter description: A Flutter plugin to scan, connect & sign transactions using your Ledger Nano devices -version: 1.0.1 +version: 1.0.1-cake homepage: https://developers.ledger.com/ repository: https://github.com/RootSoft/ledger-flutter issue_tracker: https://github.com/RootSoft/ledger-flutter/issues From da0cf2c0247e4aec8050acb96995e9ed5dd29071 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Tue, 5 Mar 2024 15:23:57 +0100 Subject: [PATCH 2/4] Don't filter responses with length of 2 --- lib/src/ledger/ledger_gatt_reader.dart | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/src/ledger/ledger_gatt_reader.dart b/lib/src/ledger/ledger_gatt_reader.dart index 488a27b..5c4e971 100644 --- a/lib/src/ledger/ledger_gatt_reader.dart +++ b/lib/src/ledger/ledger_gatt_reader.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:typed_data'; -import 'package:ledger_flutter/src/exceptions/ledger_exception.dart'; import 'package:ledger_flutter/src/utils/buffer.dart'; class LedgerGattReader { @@ -16,8 +15,6 @@ class LedgerGattReader { /// the protocol being used static const versionCla = 0x00; - static const errorDataSize = 2; - var currentSequence = 0; var remainingBytes = 0; var payload = []; @@ -82,14 +79,7 @@ class LedgerGattReader { }) { reset(); - if (data.length > errorDataSize) { - onData?.call(data); - } else if (data.length == errorDataSize) { - final errorCode = ByteData.sublistView(data).getInt16(0); - onError?.call(LedgerException(errorCode: errorCode)); - } else { - onError?.call(LedgerException()); - } + onData?.call(data); } /// Reset the reader From 73ac82cff012ca60c8d74023df5ed4775e9d3e36 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Tue, 5 Mar 2024 15:30:19 +0100 Subject: [PATCH 3/4] Don't filter responses with length of 2 --- lib/src/ledger/ledger_gatt_reader.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/src/ledger/ledger_gatt_reader.dart b/lib/src/ledger/ledger_gatt_reader.dart index 5c4e971..03d854c 100644 --- a/lib/src/ledger/ledger_gatt_reader.dart +++ b/lib/src/ledger/ledger_gatt_reader.dart @@ -57,7 +57,6 @@ class LedgerGattReader { _handleData( Uint8List.fromList(payload), onData: onData, - onError: onError, ); } else if (remainingBytes > 0) { // wait for next message @@ -75,10 +74,8 @@ class LedgerGattReader { void _handleData( Uint8List data, { void Function(Uint8List event)? onData, - Function? onError, }) { reset(); - onData?.call(data); } From 312efc765f9b97416f6d857e06aed8f1b5d7ccb7 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Tue, 5 Mar 2024 15:31:41 +0100 Subject: [PATCH 4/4] Increment version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index e339b4a..ed961b6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ledger_flutter description: A Flutter plugin to scan, connect & sign transactions using your Ledger Nano devices -version: 1.0.1-cake +version: 1.0.2 homepage: https://developers.ledger.com/ repository: https://github.com/RootSoft/ledger-flutter issue_tracker: https://github.com/RootSoft/ledger-flutter/issues