Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAN-432] Upgrade android-libs to version 2.2.1 #151

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,30 +98,30 @@

<!-- these libraries are needed by the mcumgr stack even though they dont show up as dependencies inside the intellij ide -->
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/slf4j-api.jar') " DestinationFileName="slf4j-api.jar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.16/slf4j-api-2.0.16.jar"/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/jackson-core.jar') " DestinationFileName="jackson-core.jar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.17.2/jackson-core-2.17.2.jar"/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/jackson-databind.jar') " DestinationFileName="jackson-databind.jar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.17.2/jackson-databind-2.17.2.jar"/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/jackson-annotations.jar') " DestinationFileName="jackson-annotations.jar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.17.2/jackson-annotations-2.17.2.jar"/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/jackson-dataformat-cbor.jar') " DestinationFileName="jackson-dataformat-cbor.jar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.17.2/jackson-dataformat-cbor-2.17.2.jar"/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/jackson-core.jar') " DestinationFileName="jackson-core.jar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.18.0/jackson-core-2.18.0.jar"/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/jackson-databind.jar') " DestinationFileName="jackson-databind.jar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.18.0/jackson-databind-2.18.0.jar"/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/jackson-annotations.jar') " DestinationFileName="jackson-annotations.jar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.18.0/jackson-annotations-2.18.0.jar"/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/jackson-dataformat-cbor.jar') " DestinationFileName="jackson-dataformat-cbor.jar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.18.0/jackson-dataformat-cbor-2.18.0.jar"/>

<!-- kotlinx coroutines are needed by .net6+ but we settle those through explicit nuget references over to xamarin.androix.koltin -->
<!-- <DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/kotlinx-coroutines-*.jar') " DestinationFileName="kotlinx-coroutines-*.jar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-rx2/1.7.3/kotlinx-coroutines-*-1.7.3.jar"/> -->

<!-- 2. aars go here - notice the .aar postfix -->

<!-- download -->
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble-2.7.5.aar') " DestinationFileName="nordicsemi-android-ble-2.7.5.aar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/no/nordicsemi/android/ble/2.7.5/ble-2.7.5.aar "/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble-2.0.2.aar') " DestinationFileName="nordicsemi-android-mcumgr-ble-2.0.2.aar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/no/nordicsemi/android/mcumgr-ble/2.0.2/mcumgr-ble-2.0.2.aar "/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core-2.0.2.aar') " DestinationFileName="nordicsemi-android-mcumgr-core-2.0.2.aar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/no/nordicsemi/android/mcumgr-core/2.0.2/mcumgr-core-2.0.2.aar "/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble-2.9.0.aar') " DestinationFileName="nordicsemi-android-ble-2.9.0.aar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/no/nordicsemi/android/ble/2.9.0/ble-2.9.0.aar "/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble-2.2.1.aar') " DestinationFileName="nordicsemi-android-mcumgr-ble-2.2.1.aar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/no/nordicsemi/android/mcumgr-ble/2.2.1/mcumgr-ble-2.2.1.aar "/>
<DownloadFile Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core-2.2.1.aar') " DestinationFileName="nordicsemi-android-mcumgr-core-2.2.1.aar " DestinationFolder="$(AndroidLibsDependenciesFolder)" SourceUrl="https://repo1.maven.org/maven2/no/nordicsemi/android/mcumgr-core/2.2.1/mcumgr-core-2.2.1.aar "/>

<!-- unzip -->
<Unzip Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble-2.7.5.jar') " DestinationFolder="$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble-2.7.5.aar "/>
<Unzip Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble-2.0.2.jar') " DestinationFolder="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble-2.0.2.aar "/>
<Unzip Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core-2.0.2.jar') " DestinationFolder="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core-2.0.2.aar "/>
<Unzip Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble-2.9.0.jar') " DestinationFolder="$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble-2.9.0.aar "/>
<Unzip Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble-2.2.1.jar') " DestinationFolder="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble-2.2.1.aar "/>
<Unzip Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core-2.2.1.jar') " DestinationFolder="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core-2.2.1.aar "/>

<!-- copy -->
<Copy Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble-2.7.5.jar') " DestinationFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble-2.7.5.jar " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble/classes.jar "/>
<Copy Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble-2.0.2.jar') " DestinationFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble-2.0.2.jar " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble/classes.jar "/>
<Copy Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core-2.0.2.jar') " DestinationFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core-2.0.2.jar " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core/classes.jar "/>
<Copy Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble-2.9.0.jar') " DestinationFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble-2.9.0.jar " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-ble/classes.jar "/>
<Copy Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble-2.2.1.jar') " DestinationFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble-2.2.1.jar " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-ble/classes.jar "/>
<Copy Condition=" !Exists('$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core-2.2.1.jar') " DestinationFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core-2.2.1.jar " SourceFiles="$(AndroidLibsDependenciesFolder)/nordicsemi-android-mcumgr-core/classes.jar "/>
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
<AndroidJavaLibrary Include="$(AndroidLibsFolder)/Dependencies/jackson-databind.jar" />
<AndroidJavaLibrary Include="$(AndroidLibsFolder)/Dependencies/jackson-annotations.jar" />
<AndroidJavaLibrary Include="$(AndroidLibsFolder)/Dependencies/jackson-dataformat-cbor.jar" />
<AndroidJavaLibrary Include="$(AndroidLibsFolder)/Dependencies/nordicsemi-android-ble-2.7.5.jar" />
<AndroidJavaLibrary Include="$(AndroidLibsFolder)/Dependencies/nordicsemi-android-mcumgr-ble-2.0.2.jar" />
<AndroidJavaLibrary Include="$(AndroidLibsFolder)/Dependencies/nordicsemi-android-mcumgr-core-2.0.2.jar" />
<AndroidJavaLibrary Include="$(AndroidLibsFolder)/Dependencies/nordicsemi-android-ble-2.9.0.jar" />
<AndroidJavaLibrary Include="$(AndroidLibsFolder)/Dependencies/nordicsemi-android-mcumgr-ble-2.2.1.jar" />
<AndroidJavaLibrary Include="$(AndroidLibsFolder)/Dependencies/nordicsemi-android-mcumgr-core-2.2.1.jar" />
</ItemGroup>

<Target Name="PrintBindingConfiguration" AfterTargets="CoreCompile">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Task<IDictionary<string, byte[]>> DownloadAsync(
/// </summary>
/// <param name="remoteFilePath">The remote file to download.</param>
/// <param name="hostDeviceManufacturer"></param>
/// <param name="hostDeviceModel"></param>
/// <param name="timeoutForDownloadInMs">The amount of time to wait for the operation to complete before bailing out.</param>
/// <param name="maxTriesCount">The maximum amount of tries before bailing out with <see cref="AllDownloadAttemptsFailedException"/>.</param>
/// <param name="sleepTimeBetweenRetriesInMs">The amount of time to sleep between retries.</param>
Expand All @@ -61,7 +62,6 @@ Task<IDictionary<string, byte[]>> 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.</param>
/// <param name="memoryAlignment">(Android only) Set the selected memory alignment. Defaults to 4 to match Nordic devices.</param>
/// <returns>The bytes of the remote file that got fetched over.</returns>
Task<byte[]> DownloadAsync(
string remoteFilePath,
Expand All @@ -72,8 +72,7 @@ Task<byte[]> DownloadAsync(
int sleepTimeBetweenRetriesInMs = 1_000,
int gracefulCancellationTimeoutInMs = 2_500,
int? initialMtuSize = null,
int? windowCapacity = null,
int? memoryAlignment = null
int? windowCapacity = null
);

/// <summary>
Expand All @@ -93,14 +92,12 @@ Task<byte[]> 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.</param>
/// <param name="memoryAlignment">(Android only) Set the selected memory alignment. Defaults to 4 to match Nordic devices.</param>
EFileDownloaderVerdict BeginDownload(
string remoteFilePath,
string hostDeviceManufacturer,
string hostDeviceModel,
int? initialMtuSize = null,
int? windowCapacity = null,
int? memoryAlignment = null
int? windowCapacity = null
);

/// <summary>Cancels the file-downloading process</summary>
Expand Down
15 changes: 5 additions & 10 deletions Laerdal.McuMgr/Shared/FileDownloader/FileDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -196,8 +195,7 @@ public async Task<IDictionary<string, byte[]>> DownloadAsync(
sleepTimeBetweenRetriesInMs: sleepTimeBetweenRetriesInMs,

initialMtuSize: initialMtuSize,
windowCapacity: windowCapacity,
memoryAlignment: memoryAlignment
windowCapacity: windowCapacity
);

results[path] = data;
Expand Down Expand Up @@ -225,8 +223,7 @@ public async Task<byte[]> DownloadAsync(
int sleepTimeBetweenRetriesInMs = 1_000,
int gracefulCancellationTimeoutInMs = 2_500,
int? initialMtuSize = null,
int? windowCapacity = null,
int? memoryAlignment = null
int? windowCapacity = null
)
{
if (maxTriesCount <= 0)
Expand Down Expand Up @@ -263,15 +260,14 @@ public async Task<byte[]> DownloadAsync(
{
initialMtuSize = failSafeSettingsToApply.Value.initialMtuSize;
windowCapacity = failSafeSettingsToApply.Value.windowCapacity;
memoryAlignment = failSafeSettingsToApply.Value.memoryAlignment;

if (!didWarnOnceAboutUnstableConnection)
{
didWarnOnceAboutUnstableConnection = true;
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"
));
Expand All @@ -284,8 +280,7 @@ public async Task<byte[]> DownloadAsync(
hostDeviceManufacturer: hostDeviceManufacturer,

initialMtuSize: initialMtuSize,
windowCapacity: windowCapacity,
memoryAlignment: memoryAlignment
windowCapacity: windowCapacity
);
if (verdict != EFileDownloaderVerdict.Success)
throw new ArgumentException(verdict.ToString());
Expand Down
2 changes: 1 addition & 1 deletion Laerdal.McuMgr/Shared/FileUploader/FileUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public async Task UploadAsync<TData>(
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"
));
Expand Down
Loading