From 074135511729fce5103a09835b5ca47728e53f93 Mon Sep 17 00:00:00 2001 From: Kyriakos Sidiropoulos Date: Wed, 23 Oct 2024 19:28:04 +0200 Subject: [PATCH 1/2] feat (build.gradle): no.nordicsemi.android:mcumgr-ble and no.nordicsemi.android:mcumgr-core upgraded to version 2.2.1 --- .../mcumgr-laerdal-wrapper/build.gradle | 10 +++---- ...Mgr.Bindings.Android.NativeBuilder.targets | 26 +++++++++---------- ...erdal.McuMgr.Bindings.Android.NetX.targets | 6 ++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Laerdal.McuMgr.Bindings.Android.Native/mcumgr-laerdal-wrapper/build.gradle b/Laerdal.McuMgr.Bindings.Android.Native/mcumgr-laerdal-wrapper/build.gradle index 4be60049..aad9008a 100644 --- a/Laerdal.McuMgr.Bindings.Android.Native/mcumgr-laerdal-wrapper/build.gradle +++ b/Laerdal.McuMgr.Bindings.Android.Native/mcumgr-laerdal-wrapper/build.gradle @@ -38,12 +38,12 @@ android { } dependencies { - implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.1' + implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1' - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'no.nordicsemi.android:mcumgr-ble:2.0.2' - implementation 'no.nordicsemi.android:mcumgr-core:2.0.2' - implementation 'com.google.android.material:material:1.8.0' + implementation 'androidx.appcompat:appcompat:1.7.0' + implementation 'no.nordicsemi.android:mcumgr-ble:2.2.1' + implementation 'no.nordicsemi.android:mcumgr-core:2.2.1' + implementation 'com.google.android.material:material:1.12.0' } // repositories { diff --git a/Laerdal.McuMgr.Bindings.Android/Laerdal.McuMgr.Bindings.Android.NativeBuilder.targets b/Laerdal.McuMgr.Bindings.Android/Laerdal.McuMgr.Bindings.Android.NativeBuilder.targets index d467da65..b8eacda9 100644 --- a/Laerdal.McuMgr.Bindings.Android/Laerdal.McuMgr.Bindings.Android.NativeBuilder.targets +++ b/Laerdal.McuMgr.Bindings.Android/Laerdal.McuMgr.Bindings.Android.NativeBuilder.targets @@ -98,10 +98,10 @@ - - - - + + + + @@ -109,19 +109,19 @@ - - - + + + - - - + + + - - - + + + diff --git a/Laerdal.McuMgr.Bindings.Android/Laerdal.McuMgr.Bindings.Android.NetX.targets b/Laerdal.McuMgr.Bindings.Android/Laerdal.McuMgr.Bindings.Android.NetX.targets index 7b1c3ba3..98969220 100644 --- a/Laerdal.McuMgr.Bindings.Android/Laerdal.McuMgr.Bindings.Android.NetX.targets +++ b/Laerdal.McuMgr.Bindings.Android/Laerdal.McuMgr.Bindings.Android.NetX.targets @@ -37,9 +37,9 @@ - - - + + + From bb40539784ac5904f512f1ed3f9e62ed2866382f Mon Sep 17 00:00:00 2001 From: Kyriakos Sidiropoulos Date: Wed, 23 Oct 2024 19:36:30 +0200 Subject: [PATCH 2/2] clean (FileUploader.cs, FileUploader.cs): trivial neutral cleanups in logging statements and on the memory-alignment parameter which got removed since it was not being taken into account --- .../Contracts/IFileDownloaderCommandable.cs | 9 +++------ .../Shared/FileDownloader/FileDownloader.cs | 15 +++++---------- .../Shared/FileUploader/FileUploader.cs | 2 +- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/Laerdal.McuMgr/Shared/FileDownloader/Contracts/IFileDownloaderCommandable.cs b/Laerdal.McuMgr/Shared/FileDownloader/Contracts/IFileDownloaderCommandable.cs index ef6281b8..fe1f4e7b 100644 --- a/Laerdal.McuMgr/Shared/FileDownloader/Contracts/IFileDownloaderCommandable.cs +++ b/Laerdal.McuMgr/Shared/FileDownloader/Contracts/IFileDownloaderCommandable.cs @@ -46,6 +46,7 @@ Task> DownloadAsync( /// /// The remote file to download. /// + /// /// The amount of time to wait for the operation to complete before bailing out. /// The maximum amount of tries before bailing out with . /// The amount of time to sleep between retries. @@ -61,7 +62,6 @@ Task> DownloadAsync( /// before https://github.com/zephyrproject-rtos/zephyr/pull/41959 was merged, the device required data to be sent with memory alignment. /// Otherwise, the device would ignore uneven bytes and reply with lower than expected offset /// causing multiple packets to be sent again dropping the speed instead of increasing it. - /// (Android only) Set the selected memory alignment. Defaults to 4 to match Nordic devices. /// The bytes of the remote file that got fetched over. Task DownloadAsync( string remoteFilePath, @@ -72,8 +72,7 @@ Task DownloadAsync( int sleepTimeBetweenRetriesInMs = 1_000, int gracefulCancellationTimeoutInMs = 2_500, int? initialMtuSize = null, - int? windowCapacity = null, - int? memoryAlignment = null + int? windowCapacity = null ); /// @@ -93,14 +92,12 @@ Task DownloadAsync( /// before https://github.com/zephyrproject-rtos/zephyr/pull/41959 was merged, the device required data to be sent with memory alignment. /// Otherwise, the device would ignore uneven bytes and reply with lower than expected offset /// causing multiple packets to be sent again dropping the speed instead of increasing it. - /// (Android only) Set the selected memory alignment. Defaults to 4 to match Nordic devices. EFileDownloaderVerdict BeginDownload( string remoteFilePath, string hostDeviceManufacturer, string hostDeviceModel, int? initialMtuSize = null, - int? windowCapacity = null, - int? memoryAlignment = null + int? windowCapacity = null ); /// Cancels the file-downloading process diff --git a/Laerdal.McuMgr/Shared/FileDownloader/FileDownloader.cs b/Laerdal.McuMgr/Shared/FileDownloader/FileDownloader.cs index 1977ac35..ebd967b5 100644 --- a/Laerdal.McuMgr/Shared/FileDownloader/FileDownloader.cs +++ b/Laerdal.McuMgr/Shared/FileDownloader/FileDownloader.cs @@ -45,8 +45,7 @@ public EFileDownloaderVerdict BeginDownload( string hostDeviceManufacturer, string hostDeviceModel, int? initialMtuSize = null, - int? windowCapacity = null, //not applicable currently but nordic considers these for future use - int? memoryAlignment = null //not applicable currently but nordic considers these for future use + int? windowCapacity = null //not applicable currently but nordic considers these for future use ) { RemoteFilePathHelpers.ValidateRemoteFilePath(remoteFilePath); // order @@ -196,8 +195,7 @@ public async Task> DownloadAsync( sleepTimeBetweenRetriesInMs: sleepTimeBetweenRetriesInMs, initialMtuSize: initialMtuSize, - windowCapacity: windowCapacity, - memoryAlignment: memoryAlignment + windowCapacity: windowCapacity ); results[path] = data; @@ -225,8 +223,7 @@ public async Task DownloadAsync( int sleepTimeBetweenRetriesInMs = 1_000, int gracefulCancellationTimeoutInMs = 2_500, int? initialMtuSize = null, - int? windowCapacity = null, - int? memoryAlignment = null + int? windowCapacity = null ) { if (maxTriesCount <= 0) @@ -263,7 +260,6 @@ public async Task DownloadAsync( { initialMtuSize = failSafeSettingsToApply.Value.initialMtuSize; windowCapacity = failSafeSettingsToApply.Value.windowCapacity; - memoryAlignment = failSafeSettingsToApply.Value.memoryAlignment; if (!didWarnOnceAboutUnstableConnection) { @@ -271,7 +267,7 @@ public async Task DownloadAsync( OnLogEmitted(new LogEmittedEventArgs( level: ELogLevel.Warning, message: $"[FD.DA.010] Attempt#{triesCount}: Connection is too unstable for downloading assets from the target device. Subsequent tries will use failsafe parameters on the connection " + - $"just in case it helps (initialMtuSize={failSafeSettingsToApply.Value.initialMtuSize}, windowCapacity={failSafeSettingsToApply.Value.windowCapacity}, memoryAlignment={failSafeSettingsToApply.Value.memoryAlignment})", + $"just in case it helps (initialMtuSize={initialMtuSize?.ToString() ?? "null"}, windowCapacity={windowCapacity?.ToString() ?? "null"})", resource: "File", category: "FileDownloader" )); @@ -284,8 +280,7 @@ public async Task DownloadAsync( hostDeviceManufacturer: hostDeviceManufacturer, initialMtuSize: initialMtuSize, - windowCapacity: windowCapacity, - memoryAlignment: memoryAlignment + windowCapacity: windowCapacity ); if (verdict != EFileDownloaderVerdict.Success) throw new ArgumentException(verdict.ToString()); diff --git a/Laerdal.McuMgr/Shared/FileUploader/FileUploader.cs b/Laerdal.McuMgr/Shared/FileUploader/FileUploader.cs index 6c2678a6..6e2c0f5a 100644 --- a/Laerdal.McuMgr/Shared/FileUploader/FileUploader.cs +++ b/Laerdal.McuMgr/Shared/FileUploader/FileUploader.cs @@ -329,7 +329,7 @@ public async Task UploadAsync( OnLogEmitted(new LogEmittedEventArgs( level: ELogLevel.Warning, message: $"[FU.UA.010] Attempt#{triesCount}: Connection is too unstable for uploading assets to the target device. Subsequent tries will use failsafe parameters on the connection " + - $"just in case it helps (byteAlignment={failSafeSettingsToApply.Value.byteAlignment}, pipelineDepth={failSafeSettingsToApply.Value.pipelineDepth}, initialMtuSize={failSafeSettingsToApply.Value.initialMtuSize}, windowCapacity={failSafeSettingsToApply.Value.windowCapacity}, memoryAlignment={failSafeSettingsToApply.Value.memoryAlignment})", + $"just in case it helps (byteAlignment={byteAlignment}, pipelineDepth={pipelineDepth}, initialMtuSize={initialMtuSize}, windowCapacity={windowCapacity}, memoryAlignment={memoryAlignment})", resource: "File", category: "FileUploader" ));