diff --git a/Laerdal.Dfu.sln b/Laerdal.Dfu.sln
index 2264f7b..78f986c 100644
--- a/Laerdal.Dfu.sln
+++ b/Laerdal.Dfu.sln
@@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Misc", "_Misc", "{37EBD209
.github\workflows\github-actions.yml = .github\workflows\github-actions.yml
.gitignore = .gitignore
global.json = global.json
+ Laerdal.Scripts\Laerdal.GenerateSignAndUploadSbom.sh = Laerdal.Scripts\Laerdal.GenerateSignAndUploadSbom.sh
EndProjectSection
EndProject
Global
diff --git a/Laerdal.Dfu/Laerdal.Dfu.csproj b/Laerdal.Dfu/Laerdal.Dfu.csproj
index fb4dd7c..6a8becf 100644
--- a/Laerdal.Dfu/Laerdal.Dfu.csproj
+++ b/Laerdal.Dfu/Laerdal.Dfu.csproj
@@ -14,7 +14,8 @@
$(TargetFrameworks)net8.0;
$(TargetFrameworks)net8.0-ios;
- $(TargetFrameworks)net8.0-android
+ $(TargetFrameworks)net8.0-android;
+ $(TargetFrameworks)net8.0-maccatalyst
@@ -33,27 +34,39 @@
- 34
- 21.0
- 21.0
+ 34
+ 21.0
+ 21.0
- 17.0
- 14.2
- 14.2
+ 17.0
+ 14.2
+ 14.2
+
+
+ 17.0
+ 13.1
+ 13.1
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
-
-
+
+
-
+
true
true
@@ -81,12 +94,18 @@
-
+
+
-
+
+
-
+
+
+
+
+
diff --git a/Laerdal.Dfu/Laerdal.Dfu.csproj.DotSettings b/Laerdal.Dfu/Laerdal.Dfu.csproj.DotSettings
index 06347ba..e304b59 100644
--- a/Laerdal.Dfu/Laerdal.Dfu.csproj.DotSettings
+++ b/Laerdal.Dfu/Laerdal.Dfu.csproj.DotSettings
@@ -1,5 +1,10 @@
+ True
+ True
True
+ True
+ True
+ True
True
True
True
diff --git a/Laerdal.Dfu/Platforms/Android/DfuInstallation.cs b/Laerdal.Dfu/Platforms.Droid/DfuInstallation.cs
similarity index 97%
rename from Laerdal.Dfu/Platforms/Android/DfuInstallation.cs
rename to Laerdal.Dfu/Platforms.Droid/DfuInstallation.cs
index 7f165ee..d751140 100644
--- a/Laerdal.Dfu/Platforms/Android/DfuInstallation.cs
+++ b/Laerdal.Dfu/Platforms.Droid/DfuInstallation.cs
@@ -1,201 +1,201 @@
-using Android.App;
-using Android.OS;
-
-using Java.Lang;
-
-using Laerdal.Dfu.Specific;
-
-using System;
-using System.Globalization;
-using System.Linq;
-
-namespace Laerdal.Dfu
-{
- public partial class DfuInstallation
- {
- public Func CustomDfuServiceInitiatorConfiguration { get; set; } = (dfuInitiator) => dfuInitiator;
-
- private void SetInitiator()
- {
- DfuProgressListener = new DfuProgressListener(this);
- DfuLogger = new DfuLogger(DeviceId);
-
- Initiator = new Laerdal.Dfu.Bindings.Android.DfuServiceInitiator(DeviceId).SetZip(FileUrl);
-
- // PacketsReceiptNotifications
- Initiator = Initiator.SetPacketsReceiptNotificationsEnabled(PacketReceiptNotificationParameter.HasValue);
- Initiator = Initiator.SetPacketsReceiptNotificationsValue(PacketReceiptNotificationParameter ?? Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.DefaultPrnValue);
-
- // DataObjectPreparationDelay
- Initiator = Initiator.SetPrepareDataObjectDelay((long) (DataObjectPreparationDelay ?? 0));
-
- // DisableResume
- if (DisableResume ?? false)
- {
- Initiator = Initiator.DisableResume();
- }
-
- // AlternativeAdvertisingName
- if (!string.IsNullOrEmpty(AlternativeAdvertisingName))
- {
- Initiator = Initiator.SetDeviceName(AlternativeAdvertisingName);
- }
-
- // ForceScanningForNewAddressInLegacyDfu
- if (ForceScanningForNewAddressInLegacyDfu.HasValue)
- {
- Initiator = Initiator.SetForceScanningForNewAddressInLegacyDfu(ForceScanningForNewAddressInLegacyDfu.Value);
- }
-
- // EnableUnsafeExperimentalButtonlessServiceInSecureDfu
- if (EnableUnsafeExperimentalButtonlessServiceInSecureDfu.HasValue)
- {
- Initiator = Initiator.SetUnsafeExperimentalButtonlessServiceInSecureDfuEnabled(EnableUnsafeExperimentalButtonlessServiceInSecureDfu.Value);
- }
-
- // ForceDfu
- if (ForceDfu.HasValue)
- {
- Initiator = Initiator.SetForceDfu(ForceDfu.Value);
- }
-
- // DisableMtuRequest
- if (DisableMtuRequest ?? false)
- {
- Initiator = Initiator.DisableMtuRequest();
- }
-
- // DisableNotification
- if (DisableNotification.HasValue)
- {
- Initiator = Initiator.SetDisableNotification(DisableNotification.Value);
- }
-
- // MbrSize
- Initiator = Initiator.SetMbrSize(MbrSize ?? Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.DefaultMbrSize);
-
- // Scope
- if (Scope.HasValue)
- {
- Initiator = Initiator.SetScope((int) Scope.Value);
- }
-
- // Foreground
- if (Foreground.HasValue)
- {
- Initiator = Initiator.SetForeground(Foreground.Value);
- }
-
- // KeepBond
- if (KeepBond.HasValue)
- {
- Initiator = Initiator.SetKeepBond(KeepBond.Value);
- }
-
- // RestoreBond
- if (RestoreBond.HasValue)
- {
- Initiator = Initiator.SetRestoreBond(RestoreBond.Value);
- }
-
- // Mtu
- if (Mtu.HasValue)
- {
- Initiator = Initiator.SetMtu(Mtu.Value);
- }
-
- // NumberOfRetries
- if (NumberOfRetries.HasValue)
- {
- Initiator = Initiator.SetNumberOfRetries(NumberOfRetries.Value);
- }
-
- // For Oreo progress
- if ((int) Build.VERSION.SdkInt >= 26)
- {
- Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.CreateDfuNotificationChannel(Android.App.Application.Context);
- }
-
- Initiator = CustomDfuServiceInitiatorConfiguration?.Invoke(Initiator);
-
- // public DfuServiceInitiator SetCurrentMtu(int mtu)
- // public DfuServiceInitiator SetCustomUuidsForButtonlessDfuWithBondSharing(UUID buttonlessDfuServiceUuid, UUID buttonlessDfuControlPointUuid)
- // public DfuServiceInitiator SetCustomUuidsForButtonlessDfuWithoutBondSharing(UUID buttonlessDfuServiceUuid, UUID buttonlessDfuControlPointUuid)
- // public DfuServiceInitiator SetCustomUuidsForExperimentalButtonlessDfu(UUID buttonlessDfuServiceUuid, UUID buttonlessDfuControlPointUuid)
- // public DfuServiceInitiator SetCustomUuidsForLegacyDfu(UUID dfuServiceUuid, UUID dfuControlPointUuid, UUID dfuPacketUuid, UUID dfuVersionUuid)
- // public DfuServiceInitiator SetCustomUuidsForSecureDfu(UUID dfuServiceUuid, UUID dfuControlPointUuid, UUID dfuPacketUuid)
- }
-
- public Laerdal.Dfu.Bindings.Android.DfuServiceInitiator Initiator { get; private set; }
-
- public Laerdal.Dfu.Bindings.Android.DfuServiceController Controller { get; private set; }
-
- private DfuProgressListener DfuProgressListener { get; set;}
-
- private DfuLogger DfuLogger { get; set;}
-
- public DfuInstallation(string deviceId, string fileUrl) : base(deviceId, fileUrl)
- {
- }
-
- public DfuInstallation() : base()
- {
- }
-
- public override void Start()
- {
- if (Controller != null)
- {
- throw new System.Exception("Controller is already set.");
- }
-
- SetInitiator();
- Controller = Initiator.Start(Android.App.Application.Context, Class.FromType(typeof(DfuService)));
- }
-
- public override void Pause()
- {
- Controller?.Pause();
- }
-
- public override void Resume()
- {
- Controller?.Resume();
- }
-
- public override void Abort()
- {
- Controller?.Abort();
- }
-
- protected override void Dispose(bool disposing)
- {
- DfuProgressListener?.Dispose();
- if (disposing)
- {
- Initiator?.Dispose();
- Controller?.Dispose();
- DfuLogger?.Dispose();
- }
- }
-
- public bool CheckDeviceAddress(string deviceAddress)
- {
- if (deviceAddress == DeviceId)
- {
- return true;
- }
-
- var parsed = DeviceId.Split(':').Select(p => int.Parse(p, NumberStyles.HexNumber)).ToList();
- parsed[^1] += 1;
- var deviceAddressPlusOne = string.Join(":", parsed.Select(p => p.ToString("X2")));
-
- if (deviceAddress == deviceAddressPlusOne)
- {
- return true;
- }
-
- return false;
- }
- }
+using Android.App;
+using Android.OS;
+
+using Java.Lang;
+
+using Laerdal.Dfu.Specific;
+
+using System;
+using System.Globalization;
+using System.Linq;
+
+namespace Laerdal.Dfu
+{
+ public partial class DfuInstallation
+ {
+ public Func CustomDfuServiceInitiatorConfiguration { get; set; } = (dfuInitiator) => dfuInitiator;
+
+ private void SetInitiator()
+ {
+ DfuProgressListener = new DfuProgressListener(this);
+ DfuLogger = new DfuLogger(DeviceId);
+
+ Initiator = new Laerdal.Dfu.Bindings.Android.DfuServiceInitiator(DeviceId).SetZip(FileUrl);
+
+ // PacketsReceiptNotifications
+ Initiator = Initiator.SetPacketsReceiptNotificationsEnabled(PacketReceiptNotificationParameter.HasValue);
+ Initiator = Initiator.SetPacketsReceiptNotificationsValue(PacketReceiptNotificationParameter ?? Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.DefaultPrnValue);
+
+ // DataObjectPreparationDelay
+ Initiator = Initiator.SetPrepareDataObjectDelay((long) (DataObjectPreparationDelay ?? 0));
+
+ // DisableResume
+ if (DisableResume ?? false)
+ {
+ Initiator = Initiator.DisableResume();
+ }
+
+ // AlternativeAdvertisingName
+ if (!string.IsNullOrEmpty(AlternativeAdvertisingName))
+ {
+ Initiator = Initiator.SetDeviceName(AlternativeAdvertisingName);
+ }
+
+ // ForceScanningForNewAddressInLegacyDfu
+ if (ForceScanningForNewAddressInLegacyDfu.HasValue)
+ {
+ Initiator = Initiator.SetForceScanningForNewAddressInLegacyDfu(ForceScanningForNewAddressInLegacyDfu.Value);
+ }
+
+ // EnableUnsafeExperimentalButtonlessServiceInSecureDfu
+ if (EnableUnsafeExperimentalButtonlessServiceInSecureDfu.HasValue)
+ {
+ Initiator = Initiator.SetUnsafeExperimentalButtonlessServiceInSecureDfuEnabled(EnableUnsafeExperimentalButtonlessServiceInSecureDfu.Value);
+ }
+
+ // ForceDfu
+ if (ForceDfu.HasValue)
+ {
+ Initiator = Initiator.SetForceDfu(ForceDfu.Value);
+ }
+
+ // DisableMtuRequest
+ if (DisableMtuRequest ?? false)
+ {
+ Initiator = Initiator.DisableMtuRequest();
+ }
+
+ // DisableNotification
+ if (DisableNotification.HasValue)
+ {
+ Initiator = Initiator.SetDisableNotification(DisableNotification.Value);
+ }
+
+ // MbrSize
+ Initiator = Initiator.SetMbrSize(MbrSize ?? Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.DefaultMbrSize);
+
+ // Scope
+ if (Scope.HasValue)
+ {
+ Initiator = Initiator.SetScope((int) Scope.Value);
+ }
+
+ // Foreground
+ if (Foreground.HasValue)
+ {
+ Initiator = Initiator.SetForeground(Foreground.Value);
+ }
+
+ // KeepBond
+ if (KeepBond.HasValue)
+ {
+ Initiator = Initiator.SetKeepBond(KeepBond.Value);
+ }
+
+ // RestoreBond
+ if (RestoreBond.HasValue)
+ {
+ Initiator = Initiator.SetRestoreBond(RestoreBond.Value);
+ }
+
+ // Mtu
+ if (Mtu.HasValue)
+ {
+ Initiator = Initiator.SetMtu(Mtu.Value);
+ }
+
+ // NumberOfRetries
+ if (NumberOfRetries.HasValue)
+ {
+ Initiator = Initiator.SetNumberOfRetries(NumberOfRetries.Value);
+ }
+
+ // For Oreo progress
+ if ((int) Build.VERSION.SdkInt >= 26)
+ {
+ Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.CreateDfuNotificationChannel(Android.App.Application.Context);
+ }
+
+ Initiator = CustomDfuServiceInitiatorConfiguration?.Invoke(Initiator);
+
+ // public DfuServiceInitiator SetCurrentMtu(int mtu)
+ // public DfuServiceInitiator SetCustomUuidsForButtonlessDfuWithBondSharing(UUID buttonlessDfuServiceUuid, UUID buttonlessDfuControlPointUuid)
+ // public DfuServiceInitiator SetCustomUuidsForButtonlessDfuWithoutBondSharing(UUID buttonlessDfuServiceUuid, UUID buttonlessDfuControlPointUuid)
+ // public DfuServiceInitiator SetCustomUuidsForExperimentalButtonlessDfu(UUID buttonlessDfuServiceUuid, UUID buttonlessDfuControlPointUuid)
+ // public DfuServiceInitiator SetCustomUuidsForLegacyDfu(UUID dfuServiceUuid, UUID dfuControlPointUuid, UUID dfuPacketUuid, UUID dfuVersionUuid)
+ // public DfuServiceInitiator SetCustomUuidsForSecureDfu(UUID dfuServiceUuid, UUID dfuControlPointUuid, UUID dfuPacketUuid)
+ }
+
+ public Laerdal.Dfu.Bindings.Android.DfuServiceInitiator Initiator { get; private set; }
+
+ public Laerdal.Dfu.Bindings.Android.DfuServiceController Controller { get; private set; }
+
+ private DfuProgressListener DfuProgressListener { get; set;}
+
+ private DfuLogger DfuLogger { get; set;}
+
+ public DfuInstallation(string deviceId, string fileUrl) : base(deviceId, fileUrl)
+ {
+ }
+
+ public DfuInstallation() : base()
+ {
+ }
+
+ public override void Start()
+ {
+ if (Controller != null)
+ {
+ throw new System.Exception("Controller is already set.");
+ }
+
+ SetInitiator();
+ Controller = Initiator.Start(Android.App.Application.Context, Class.FromType(typeof(DfuService)));
+ }
+
+ public override void Pause()
+ {
+ Controller?.Pause();
+ }
+
+ public override void Resume()
+ {
+ Controller?.Resume();
+ }
+
+ public override void Abort()
+ {
+ Controller?.Abort();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ DfuProgressListener?.Dispose();
+ if (disposing)
+ {
+ Initiator?.Dispose();
+ Controller?.Dispose();
+ DfuLogger?.Dispose();
+ }
+ }
+
+ public bool CheckDeviceAddress(string deviceAddress)
+ {
+ if (deviceAddress == DeviceId)
+ {
+ return true;
+ }
+
+ var parsed = DeviceId.Split(':').Select(p => int.Parse(p, NumberStyles.HexNumber)).ToList();
+ parsed[^1] += 1;
+ var deviceAddressPlusOne = string.Join(":", parsed.Select(p => p.ToString("X2")));
+
+ if (deviceAddress == deviceAddressPlusOne)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
}
\ No newline at end of file
diff --git a/Laerdal.Dfu/Platforms/Android/Specific/DfuLogger.cs b/Laerdal.Dfu/Platforms.Droid/Specific/DfuLogger.cs
similarity index 96%
rename from Laerdal.Dfu/Platforms/Android/Specific/DfuLogger.cs
rename to Laerdal.Dfu/Platforms.Droid/Specific/DfuLogger.cs
index 3f4a58b..1d98048 100644
--- a/Laerdal.Dfu/Platforms/Android/Specific/DfuLogger.cs
+++ b/Laerdal.Dfu/Platforms.Droid/Specific/DfuLogger.cs
@@ -1,32 +1,32 @@
-using Android.App;
-using Laerdal.Dfu.Enums;
-
-namespace Laerdal.Dfu.Specific
-{
- public class DfuLogger : Java.Lang.Object, Laerdal.Dfu.Bindings.Android.IDfuLogListener
- {
- public string DeviceAddress { get; }
-
- public DfuLogger(string deviceAddress)
- {
- DeviceAddress = deviceAddress;
-
- Laerdal.Dfu.Bindings.Android.DfuServiceListenerHelper.RegisterLogListener(Android.App.Application.Context, this);
- }
-
- protected override void Dispose(bool disposing)
- {
- Laerdal.Dfu.Bindings.Android.DfuServiceListenerHelper.UnregisterLogListener(Android.App.Application.Context, this);
-
- base.Dispose(disposing);
- }
-
- public void OnLogEvent(string deviceAddress, int level, string message)
- {
- if (deviceAddress != DeviceAddress)
- return;
-
- Events.OnDfuMessageReceived((DfuLogLevel) level, $"{deviceAddress} : {message}");
- }
- }
+using Android.App;
+using Laerdal.Dfu.Enums;
+
+namespace Laerdal.Dfu.Specific
+{
+ public class DfuLogger : Java.Lang.Object, Laerdal.Dfu.Bindings.Android.IDfuLogListener
+ {
+ public string DeviceAddress { get; }
+
+ public DfuLogger(string deviceAddress)
+ {
+ DeviceAddress = deviceAddress;
+
+ Laerdal.Dfu.Bindings.Android.DfuServiceListenerHelper.RegisterLogListener(Android.App.Application.Context, this);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ Laerdal.Dfu.Bindings.Android.DfuServiceListenerHelper.UnregisterLogListener(Android.App.Application.Context, this);
+
+ base.Dispose(disposing);
+ }
+
+ public void OnLogEvent(string deviceAddress, int level, string message)
+ {
+ if (deviceAddress != DeviceAddress)
+ return;
+
+ Events.OnDfuMessageReceived((DfuLogLevel) level, $"{deviceAddress} : {message}");
+ }
+ }
}
\ No newline at end of file
diff --git a/Laerdal.Dfu/Platforms/Android/Specific/DfuNotificationActivity.cs b/Laerdal.Dfu/Platforms.Droid/Specific/DfuNotificationActivity.cs
similarity index 97%
rename from Laerdal.Dfu/Platforms/Android/Specific/DfuNotificationActivity.cs
rename to Laerdal.Dfu/Platforms.Droid/Specific/DfuNotificationActivity.cs
index d47e148..aa8acec 100644
--- a/Laerdal.Dfu/Platforms/Android/Specific/DfuNotificationActivity.cs
+++ b/Laerdal.Dfu/Platforms.Droid/Specific/DfuNotificationActivity.cs
@@ -1,30 +1,30 @@
-using Android.App;
-using Android.OS;
-
-namespace Laerdal.Dfu.Specific
-{
- public class DfuNotificationActivity : Activity
- {
- protected override void OnCreate(Bundle savedInstanceState)
- {
- base.OnCreate(savedInstanceState);
-
- // Original Nordic-code below. We assume the app can take care of itself.
- // Not very useful hooking up notification click to app... If you need it: make your own DfuService+DfuNotification
- /*
- // If this activity is the root activity of the task, the app is not running
- if (IsTaskRoot)
- {
- // Start the app before finishing
- var intent = new Intent(this, typeof(MainActivity));
- intent.SetFlags(ActivityFlags.NewTask);
- intent.PutExtras(intent.Extras);
- StartActivity(intent);
- }
- */
-
- // Now finish, which will drop you to the activity at which you were at the top of the task stack
- Finish();
- }
- }
+using Android.App;
+using Android.OS;
+
+namespace Laerdal.Dfu.Specific
+{
+ public class DfuNotificationActivity : Activity
+ {
+ protected override void OnCreate(Bundle savedInstanceState)
+ {
+ base.OnCreate(savedInstanceState);
+
+ // Original Nordic-code below. We assume the app can take care of itself.
+ // Not very useful hooking up notification click to app... If you need it: make your own DfuService+DfuNotification
+ /*
+ // If this activity is the root activity of the task, the app is not running
+ if (IsTaskRoot)
+ {
+ // Start the app before finishing
+ var intent = new Intent(this, typeof(MainActivity));
+ intent.SetFlags(ActivityFlags.NewTask);
+ intent.PutExtras(intent.Extras);
+ StartActivity(intent);
+ }
+ */
+
+ // Now finish, which will drop you to the activity at which you were at the top of the task stack
+ Finish();
+ }
+ }
}
\ No newline at end of file
diff --git a/Laerdal.Dfu/Platforms/Android/Specific/DfuProgressListener.cs b/Laerdal.Dfu/Platforms.Droid/Specific/DfuProgressListener.cs
similarity index 97%
rename from Laerdal.Dfu/Platforms/Android/Specific/DfuProgressListener.cs
rename to Laerdal.Dfu/Platforms.Droid/Specific/DfuProgressListener.cs
index 2bab3af..7d3ac2c 100644
--- a/Laerdal.Dfu/Platforms/Android/Specific/DfuProgressListener.cs
+++ b/Laerdal.Dfu/Platforms.Droid/Specific/DfuProgressListener.cs
@@ -1,115 +1,115 @@
-using Android.App;
-using Laerdal.Dfu.Enums;
-
-namespace Laerdal.Dfu.Specific
-{
- public class DfuProgressListener : Laerdal.Dfu.Bindings.Android.DfuProgressListenerAdapter
- {
- private DfuInstallation DfuInstallation { get; }
-
- public DfuProgressListener(DfuInstallation dfuInstallation)
- {
- DfuInstallation = dfuInstallation;
- Laerdal.Dfu.Bindings.Android.DfuServiceListenerHelper.RegisterProgressListener(Android.App.Application.Context, this);
- }
-
- protected override void Dispose(bool disposing)
- {
- Laerdal.Dfu.Bindings.Android.DfuServiceListenerHelper.UnregisterProgressListener(Android.App.Application.Context, this);
- base.Dispose(disposing);
- }
-
- public override void OnError(string deviceAddress,
- int error,
- int errorType,
- string message)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.OnDfuError((DfuError) error, message);
- }
-
- public override void OnDeviceConnected(string deviceAddress)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.Connected;
- }
-
- public override void OnDeviceConnecting(string deviceAddress)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.Connecting;
- }
-
- public override void OnDeviceDisconnected(string deviceAddress)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.Disconnected;
- }
-
- public override void OnDeviceDisconnecting(string deviceAddress)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.Disconnecting;
- }
-
- public override void OnDfuAborted(string deviceAddress)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.Aborted;
- }
-
- public override void OnDfuCompleted(string deviceAddress)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.Completed;
- }
-
- public override void OnFirmwareValidating(string deviceAddress)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.Validating;
- }
-
- public override void OnDfuProcessStarted(string deviceAddress)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.Started;
- }
-
- public override void OnDfuProcessStarting(string deviceAddress)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.Starting;
- }
-
- public override void OnEnablingDfuMode(string deviceAddress)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.EnablingDfuMode;
- }
-
- public override void OnProgressChanged(string deviceAddress,
- int percent,
- float speed,
- float avgSpeed,
- int currentPart,
- int partsTotal)
- {
- if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
-
- DfuInstallation.State = DfuState.Uploading;
- DfuInstallation.OnProgressChanged(percent / 100D, speed, avgSpeed);
- }
- }
+using Android.App;
+using Laerdal.Dfu.Enums;
+
+namespace Laerdal.Dfu.Specific
+{
+ public class DfuProgressListener : Laerdal.Dfu.Bindings.Android.DfuProgressListenerAdapter
+ {
+ private DfuInstallation DfuInstallation { get; }
+
+ public DfuProgressListener(DfuInstallation dfuInstallation)
+ {
+ DfuInstallation = dfuInstallation;
+ Laerdal.Dfu.Bindings.Android.DfuServiceListenerHelper.RegisterProgressListener(Android.App.Application.Context, this);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ Laerdal.Dfu.Bindings.Android.DfuServiceListenerHelper.UnregisterProgressListener(Android.App.Application.Context, this);
+ base.Dispose(disposing);
+ }
+
+ public override void OnError(string deviceAddress,
+ int error,
+ int errorType,
+ string message)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.OnDfuError((DfuError) error, message);
+ }
+
+ public override void OnDeviceConnected(string deviceAddress)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.Connected;
+ }
+
+ public override void OnDeviceConnecting(string deviceAddress)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.Connecting;
+ }
+
+ public override void OnDeviceDisconnected(string deviceAddress)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.Disconnected;
+ }
+
+ public override void OnDeviceDisconnecting(string deviceAddress)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.Disconnecting;
+ }
+
+ public override void OnDfuAborted(string deviceAddress)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.Aborted;
+ }
+
+ public override void OnDfuCompleted(string deviceAddress)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.Completed;
+ }
+
+ public override void OnFirmwareValidating(string deviceAddress)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.Validating;
+ }
+
+ public override void OnDfuProcessStarted(string deviceAddress)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.Started;
+ }
+
+ public override void OnDfuProcessStarting(string deviceAddress)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.Starting;
+ }
+
+ public override void OnEnablingDfuMode(string deviceAddress)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.EnablingDfuMode;
+ }
+
+ public override void OnProgressChanged(string deviceAddress,
+ int percent,
+ float speed,
+ float avgSpeed,
+ int currentPart,
+ int partsTotal)
+ {
+ if (!DfuInstallation.CheckDeviceAddress(deviceAddress)) { return; }
+
+ DfuInstallation.State = DfuState.Uploading;
+ DfuInstallation.OnProgressChanged(percent / 100D, speed, avgSpeed);
+ }
+ }
}
\ No newline at end of file
diff --git a/Laerdal.Dfu/Platforms/Android/Specific/DfuService.cs b/Laerdal.Dfu/Platforms.Droid/Specific/DfuService.cs
similarity index 97%
rename from Laerdal.Dfu/Platforms/Android/Specific/DfuService.cs
rename to Laerdal.Dfu/Platforms.Droid/Specific/DfuService.cs
index 8905378..7ca77cf 100644
--- a/Laerdal.Dfu/Platforms/Android/Specific/DfuService.cs
+++ b/Laerdal.Dfu/Platforms.Droid/Specific/DfuService.cs
@@ -1,40 +1,40 @@
-using Android.App;
-using Android.Content.PM;
-
-using Java.Lang;
-
-namespace Laerdal.Dfu.Specific
+using Android.App;
+using Android.Content.PM;
+
+using Java.Lang;
+
+namespace Laerdal.Dfu.Specific
{
- [Service(ForegroundServiceType = ForegroundService.TypeConnectedDevice)]
- public class DfuService : Laerdal.Dfu.Bindings.Android.DfuBaseService
- {
- public DfuService()
- {
-
- }
-
- protected override bool IsDebug => true;
-
- protected override Class NotificationTarget => Class.FromType(typeof(DfuNotificationActivity));
-
- /*
- * As a target activity the NotificationActivity is returned, not the MainActivity. This is because
- * the notification must create a new task:
- *
- * intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- *
- * when you press it. You can use NotificationActivity to check whether the new activity
- * is a root activity (that means no other activity was open earlier) or that some
- * other activity is already open. In the latter case the NotificationActivity will just be
- * closed. The system will restore the previous activity. However, if the application has been
- * closed during upload and you click the notification, a NotificationActivity will
- * be launched as a root activity. It will create and start the main activity and
- * terminate itself.
- *
- * This method may be used to restore the target activity in case the application
- * was closed or is open. It may also be used to recreate an activity history using
- * startActivities(...).
- */
- }
+ [Service(ForegroundServiceType = ForegroundService.TypeConnectedDevice)]
+ public class DfuService : Laerdal.Dfu.Bindings.Android.DfuBaseService
+ {
+ public DfuService()
+ {
+
+ }
+
+ protected override bool IsDebug => true;
+
+ protected override Class NotificationTarget => Class.FromType(typeof(DfuNotificationActivity));
+
+ /*
+ * As a target activity the NotificationActivity is returned, not the MainActivity. This is because
+ * the notification must create a new task:
+ *
+ * intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ *
+ * when you press it. You can use NotificationActivity to check whether the new activity
+ * is a root activity (that means no other activity was open earlier) or that some
+ * other activity is already open. In the latter case the NotificationActivity will just be
+ * closed. The system will restore the previous activity. However, if the application has been
+ * closed during upload and you click the notification, a NotificationActivity will
+ * be launched as a root activity. It will create and start the main activity and
+ * terminate itself.
+ *
+ * This method may be used to restore the target activity in case the application
+ * was closed or is open. It may also be used to recreate an activity history using
+ * startActivities(...).
+ */
+ }
}
\ No newline at end of file
diff --git a/Laerdal.Dfu/Platforms/iOS/DfuInstallation.cs b/Laerdal.Dfu/Platforms.iOSandMacCatalyst/DfuInstallation.cs
similarity index 97%
rename from Laerdal.Dfu/Platforms/iOS/DfuInstallation.cs
rename to Laerdal.Dfu/Platforms.iOSandMacCatalyst/DfuInstallation.cs
index 1c00c0a..f81820d 100644
--- a/Laerdal.Dfu/Platforms/iOS/DfuInstallation.cs
+++ b/Laerdal.Dfu/Platforms.iOSandMacCatalyst/DfuInstallation.cs
@@ -1,130 +1,130 @@
-using CoreFoundation;
-
-using Foundation;
-
-using Laerdal.Dfu.Specific;
-
-namespace Laerdal.Dfu
-{
- public partial class DfuInstallation
- {
- public static Func Queue { get; set; } = () => DispatchQueue.GetGlobalQueue(DispatchQueuePriority.Default);
- public static Func DelegateQueue { get; set; } = () => DispatchQueue.GetGlobalQueue(DispatchQueuePriority.Default);
- public static Func ProgressQueue { get; set; } = () => DispatchQueue.GetGlobalQueue(DispatchQueuePriority.Default);
- public static Func LoggerQueue { get; set; } = () => DispatchQueue.GetGlobalQueue(DispatchQueuePriority.Default);
-
- public Func CustomDfuServiceInitiatorConfiguration { get; set; } = (dfuInitiator) => dfuInitiator;
-
- private void SetInitiator()
- {
- DfuProgressDelegate = new DfuProgressDelegate(this);
- DfuServiceDelegate = new DfuServiceDelegate(this);
- DfuPeripheralSelectorDelegate = new DfuPeripheralSelectorDelegate(this);
-
- Firmware = new Laerdal.Dfu.Bindings.iOS.DFUFirmware(new NSUrl(FileUrl, false), out NSError error);
-
- Initiator = new Laerdal.Dfu.Bindings.iOS.DFUServiceInitiator(Queue.Invoke(),
- DelegateQueue.Invoke(),
- ProgressQueue.Invoke(),
- LoggerQueue.Invoke(),
- null)
- {
- Logger = new DfuLogger(),
- WeakProgressDelegate = DfuProgressDelegate,
- WeakDelegate = DfuServiceDelegate,
- };
- Initiator = Initiator.WithFirmware(Firmware);
-
- // PacketsReceiptNotifications
- if (PacketReceiptNotificationParameter.HasValue)
- Initiator.PacketReceiptNotificationParameter = PacketReceiptNotificationParameter.Value;
-
- // DataObjectPreparationDelay
- if (DataObjectPreparationDelay.HasValue)
- Initiator.DataObjectPreparationDelay = DataObjectPreparationDelay.Value;
-
- // DisableResume
- if (DisableResume.HasValue)
- Initiator.DisableResume = DisableResume.Value;
-
- // AlternativeAdvertisingName
- Initiator.AlternativeAdvertisingNameEnabled = !string.IsNullOrEmpty(AlternativeAdvertisingName);
- Initiator.AlternativeAdvertisingName = AlternativeAdvertisingName;
-
- // ForceScanningForNewAddressInLegacyDfu
- if (ForceScanningForNewAddressInLegacyDfu.HasValue)
- Initiator.ForceScanningForNewAddressInLegacyDfu = ForceScanningForNewAddressInLegacyDfu.Value;
-
- // EnableUnsafeExperimentalButtonlessServiceInSecureDfu
- if (EnableUnsafeExperimentalButtonlessServiceInSecureDfu.HasValue)
- Initiator.ForceScanningForNewAddressInLegacyDfu = EnableUnsafeExperimentalButtonlessServiceInSecureDfu.Value;
-
- // ForceDfu
- if (ForceDfu.HasValue)
- Initiator.ForceDfu = ForceDfu.Value;
-
- // ConnectionTimeout
- if (ConnectionTimeout.HasValue)
- Initiator.ConnectionTimeout = ConnectionTimeout.Value;
-
- Initiator = CustomDfuServiceInitiatorConfiguration?.Invoke(Initiator);
-
- // public DFUUuidHelper UuidHelper {get; set;}
- }
-
- public Laerdal.Dfu.Bindings.iOS.DFUServiceInitiator Initiator { get; private set; }
-
- public Laerdal.Dfu.Bindings.iOS.DFUServiceController Controller { get; private set; }
-
- public Laerdal.Dfu.Bindings.iOS.DFUFirmware Firmware { get; private set;}
-
- private DfuProgressDelegate DfuProgressDelegate { get; set;}
-
- private DfuServiceDelegate DfuServiceDelegate { get; set;}
-
- private DfuPeripheralSelectorDelegate DfuPeripheralSelectorDelegate { get; set;}
-
- public DfuInstallation(string deviceId, string fileUrl) : base(deviceId, fileUrl)
- {
- }
-
- public DfuInstallation() : base()
- {
- }
-
- public override void Start()
- {
- if (Controller != null)
- {
- throw new System.Exception("Controller is already set.");
- }
- SetInitiator();
- Controller = Initiator.StartWithTargetWithIdentifier(new NSUuid(DeviceId));
- }
-
- public override void Pause()
- {
- Controller?.Pause();
- }
-
- public override void Resume()
- {
- Controller?.Resume();
- }
-
- public override void Abort()
- {
- Controller?.Abort();
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- Initiator?.Dispose();
- Controller?.Dispose();
- Firmware?.Dispose();
- }
- }
- }
+using CoreFoundation;
+
+using Foundation;
+
+using Laerdal.Dfu.Specific;
+
+namespace Laerdal.Dfu
+{
+ public partial class DfuInstallation
+ {
+ public static Func Queue { get; set; } = () => DispatchQueue.GetGlobalQueue(DispatchQueuePriority.Default);
+ public static Func DelegateQueue { get; set; } = () => DispatchQueue.GetGlobalQueue(DispatchQueuePriority.Default);
+ public static Func ProgressQueue { get; set; } = () => DispatchQueue.GetGlobalQueue(DispatchQueuePriority.Default);
+ public static Func LoggerQueue { get; set; } = () => DispatchQueue.GetGlobalQueue(DispatchQueuePriority.Default);
+
+ public Func CustomDfuServiceInitiatorConfiguration { get; set; } = (dfuInitiator) => dfuInitiator;
+
+ private void SetInitiator()
+ {
+ DfuProgressDelegate = new DfuProgressDelegate(this);
+ DfuServiceDelegate = new DfuServiceDelegate(this);
+ DfuPeripheralSelectorDelegate = new DfuPeripheralSelectorDelegate(this);
+
+ Firmware = new Laerdal.Dfu.Bindings.iOS.DFUFirmware(new NSUrl(FileUrl, false), out NSError error);
+
+ Initiator = new Laerdal.Dfu.Bindings.iOS.DFUServiceInitiator(Queue.Invoke(),
+ DelegateQueue.Invoke(),
+ ProgressQueue.Invoke(),
+ LoggerQueue.Invoke(),
+ null)
+ {
+ Logger = new DfuLogger(),
+ WeakProgressDelegate = DfuProgressDelegate,
+ WeakDelegate = DfuServiceDelegate,
+ };
+ Initiator = Initiator.WithFirmware(Firmware);
+
+ // PacketsReceiptNotifications
+ if (PacketReceiptNotificationParameter.HasValue)
+ Initiator.PacketReceiptNotificationParameter = PacketReceiptNotificationParameter.Value;
+
+ // DataObjectPreparationDelay
+ if (DataObjectPreparationDelay.HasValue)
+ Initiator.DataObjectPreparationDelay = DataObjectPreparationDelay.Value;
+
+ // DisableResume
+ if (DisableResume.HasValue)
+ Initiator.DisableResume = DisableResume.Value;
+
+ // AlternativeAdvertisingName
+ Initiator.AlternativeAdvertisingNameEnabled = !string.IsNullOrEmpty(AlternativeAdvertisingName);
+ Initiator.AlternativeAdvertisingName = AlternativeAdvertisingName;
+
+ // ForceScanningForNewAddressInLegacyDfu
+ if (ForceScanningForNewAddressInLegacyDfu.HasValue)
+ Initiator.ForceScanningForNewAddressInLegacyDfu = ForceScanningForNewAddressInLegacyDfu.Value;
+
+ // EnableUnsafeExperimentalButtonlessServiceInSecureDfu
+ if (EnableUnsafeExperimentalButtonlessServiceInSecureDfu.HasValue)
+ Initiator.ForceScanningForNewAddressInLegacyDfu = EnableUnsafeExperimentalButtonlessServiceInSecureDfu.Value;
+
+ // ForceDfu
+ if (ForceDfu.HasValue)
+ Initiator.ForceDfu = ForceDfu.Value;
+
+ // ConnectionTimeout
+ if (ConnectionTimeout.HasValue)
+ Initiator.ConnectionTimeout = ConnectionTimeout.Value;
+
+ Initiator = CustomDfuServiceInitiatorConfiguration?.Invoke(Initiator);
+
+ // public DFUUuidHelper UuidHelper {get; set;}
+ }
+
+ public Laerdal.Dfu.Bindings.iOS.DFUServiceInitiator Initiator { get; private set; }
+
+ public Laerdal.Dfu.Bindings.iOS.DFUServiceController Controller { get; private set; }
+
+ public Laerdal.Dfu.Bindings.iOS.DFUFirmware Firmware { get; private set;}
+
+ private DfuProgressDelegate DfuProgressDelegate { get; set;}
+
+ private DfuServiceDelegate DfuServiceDelegate { get; set;}
+
+ private DfuPeripheralSelectorDelegate DfuPeripheralSelectorDelegate { get; set;}
+
+ public DfuInstallation(string deviceId, string fileUrl) : base(deviceId, fileUrl)
+ {
+ }
+
+ public DfuInstallation() : base()
+ {
+ }
+
+ public override void Start()
+ {
+ if (Controller != null)
+ {
+ throw new System.Exception("Controller is already set.");
+ }
+ SetInitiator();
+ Controller = Initiator.StartWithTargetWithIdentifier(new NSUuid(DeviceId));
+ }
+
+ public override void Pause()
+ {
+ Controller?.Pause();
+ }
+
+ public override void Resume()
+ {
+ Controller?.Resume();
+ }
+
+ public override void Abort()
+ {
+ Controller?.Abort();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ Initiator?.Dispose();
+ Controller?.Dispose();
+ Firmware?.Dispose();
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Laerdal.Dfu/Platforms/iOS/Specific/DfuLogger.cs b/Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuLogger.cs
similarity index 96%
rename from Laerdal.Dfu/Platforms/iOS/Specific/DfuLogger.cs
rename to Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuLogger.cs
index 91e8216..592f446 100644
--- a/Laerdal.Dfu/Platforms/iOS/Specific/DfuLogger.cs
+++ b/Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuLogger.cs
@@ -1,11 +1,11 @@
-namespace Laerdal.Dfu.Specific
-{
- public class DfuLogger : Laerdal.Dfu.Bindings.iOS.LoggerDelegate
- {
- public override void Message(Laerdal.Dfu.Bindings.iOS.LogLevel level, string message)
- {
- Events.OnDfuMessageReceived((Laerdal.Dfu.Enums.DfuLogLevel) level, message);
- }
- }
-
+namespace Laerdal.Dfu.Specific
+{
+ public class DfuLogger : Laerdal.Dfu.Bindings.iOS.LoggerDelegate
+ {
+ public override void Message(Laerdal.Dfu.Bindings.iOS.LogLevel level, string message)
+ {
+ Events.OnDfuMessageReceived((Laerdal.Dfu.Enums.DfuLogLevel) level, message);
+ }
+ }
+
}
\ No newline at end of file
diff --git a/Laerdal.Dfu/Platforms/iOS/Specific/DfuPeripheralSelectorDelegate.cs b/Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuPeripheralSelectorDelegate.cs
similarity index 97%
rename from Laerdal.Dfu/Platforms/iOS/Specific/DfuPeripheralSelectorDelegate.cs
rename to Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuPeripheralSelectorDelegate.cs
index 20041ea..57c00ca 100644
--- a/Laerdal.Dfu/Platforms/iOS/Specific/DfuPeripheralSelectorDelegate.cs
+++ b/Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuPeripheralSelectorDelegate.cs
@@ -1,23 +1,23 @@
-using CoreBluetooth;
-using Foundation;
-
-namespace Laerdal.Dfu.Specific
-{
- public class DfuPeripheralSelectorDelegate : Laerdal.Dfu.Bindings.iOS.IDFUPeripheralSelectorDelegate
- {
- private DfuInstallation DfuInstallation { get; }
-
- public DfuPeripheralSelectorDelegate(DfuInstallation dfuInstallation)
- {
- DfuInstallation = dfuInstallation;
- }
-
- public override bool Select(CBPeripheral peripheral,
- NSDictionary advertisementData,
- NSNumber rssi,
- string name)
- {
- return DfuInstallation.DeviceId == peripheral.Identifier.ToString();
- }
- }
+using CoreBluetooth;
+using Foundation;
+
+namespace Laerdal.Dfu.Specific
+{
+ public class DfuPeripheralSelectorDelegate : Laerdal.Dfu.Bindings.iOS.IDFUPeripheralSelectorDelegate
+ {
+ private DfuInstallation DfuInstallation { get; }
+
+ public DfuPeripheralSelectorDelegate(DfuInstallation dfuInstallation)
+ {
+ DfuInstallation = dfuInstallation;
+ }
+
+ public override bool Select(CBPeripheral peripheral,
+ NSDictionary advertisementData,
+ NSNumber rssi,
+ string name)
+ {
+ return DfuInstallation.DeviceId == peripheral.Identifier.ToString();
+ }
+ }
}
\ No newline at end of file
diff --git a/Laerdal.Dfu/Platforms/iOS/Specific/DfuProgressDelegate.cs b/Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuProgressDelegate.cs
similarity index 97%
rename from Laerdal.Dfu/Platforms/iOS/Specific/DfuProgressDelegate.cs
rename to Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuProgressDelegate.cs
index 4d23049..be10675 100644
--- a/Laerdal.Dfu/Platforms/iOS/Specific/DfuProgressDelegate.cs
+++ b/Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuProgressDelegate.cs
@@ -1,23 +1,23 @@
-using System;
-
-namespace Laerdal.Dfu.Specific
-{
- public class DfuProgressDelegate : Laerdal.Dfu.Bindings.iOS.DFUProgressDelegate
- {
- private DfuInstallation DfuInstallation { get; }
-
- public DfuProgressDelegate(DfuInstallation dfuInstallation)
- {
- DfuInstallation = dfuInstallation;
- }
-
- public override void OutOf(nint part,
- nint totalParts,
- nint progress,
- double currentSpeedBytesPerSecond,
- double avgSpeedBytesPerSecond)
- {
- DfuInstallation?.OnProgressChanged((int) progress / 100D, currentSpeedBytesPerSecond, avgSpeedBytesPerSecond);
- }
- }
+using System;
+
+namespace Laerdal.Dfu.Specific
+{
+ public class DfuProgressDelegate : Laerdal.Dfu.Bindings.iOS.DFUProgressDelegate
+ {
+ private DfuInstallation DfuInstallation { get; }
+
+ public DfuProgressDelegate(DfuInstallation dfuInstallation)
+ {
+ DfuInstallation = dfuInstallation;
+ }
+
+ public override void OutOf(nint part,
+ nint totalParts,
+ nint progress,
+ double currentSpeedBytesPerSecond,
+ double avgSpeedBytesPerSecond)
+ {
+ DfuInstallation?.OnProgressChanged((int) progress / 100D, currentSpeedBytesPerSecond, avgSpeedBytesPerSecond);
+ }
+ }
}
\ No newline at end of file
diff --git a/Laerdal.Dfu/Platforms/iOS/Specific/DfuServiceDelegate.cs b/Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuServiceDelegate.cs
similarity index 97%
rename from Laerdal.Dfu/Platforms/iOS/Specific/DfuServiceDelegate.cs
rename to Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuServiceDelegate.cs
index 109443d..e18e1d8 100644
--- a/Laerdal.Dfu/Platforms/iOS/Specific/DfuServiceDelegate.cs
+++ b/Laerdal.Dfu/Platforms.iOSandMacCatalyst/Specific/DfuServiceDelegate.cs
@@ -1,22 +1,22 @@
-namespace Laerdal.Dfu.Specific
-{
- public class DfuServiceDelegate : Laerdal.Dfu.Bindings.iOS.DFUServiceDelegate
- {
- private DfuInstallation DfuInstallation { get; }
-
- public DfuServiceDelegate(DfuInstallation dfuInstallation)
- {
- DfuInstallation = dfuInstallation;
- }
-
- public override void DfuError(Laerdal.Dfu.Bindings.iOS.DFUError error, string message)
- {
- DfuInstallation?.OnDfuError((Laerdal.Dfu.Enums.DfuError) (long) error, message);
- }
-
- public override void DfuStateDidChangeTo(Laerdal.Dfu.Bindings.iOS.DFUState state)
- {
- DfuInstallation.State = (Laerdal.Dfu.Enums.DfuState) (long) state;
- }
- }
+namespace Laerdal.Dfu.Specific
+{
+ public class DfuServiceDelegate : Laerdal.Dfu.Bindings.iOS.DFUServiceDelegate
+ {
+ private DfuInstallation DfuInstallation { get; }
+
+ public DfuServiceDelegate(DfuInstallation dfuInstallation)
+ {
+ DfuInstallation = dfuInstallation;
+ }
+
+ public override void DfuError(Laerdal.Dfu.Bindings.iOS.DFUError error, string message)
+ {
+ DfuInstallation?.OnDfuError((Laerdal.Dfu.Enums.DfuError) (long) error, message);
+ }
+
+ public override void DfuStateDidChangeTo(Laerdal.Dfu.Bindings.iOS.DFUState state)
+ {
+ DfuInstallation.State = (Laerdal.Dfu.Enums.DfuState) (long) state;
+ }
+ }
}
\ No newline at end of file
diff --git a/Laerdal.Scripts/Laerdal.GenerateSignAndUploadSbom.sh b/Laerdal.Scripts/Laerdal.GenerateSignAndUploadSbom.sh
old mode 100755
new mode 100644
index 6fd1b6c..d9a3b18
--- a/Laerdal.Scripts/Laerdal.GenerateSignAndUploadSbom.sh
+++ b/Laerdal.Scripts/Laerdal.GenerateSignAndUploadSbom.sh
@@ -17,7 +17,6 @@ declare sbom_signing_key_file_path=""
declare dependency_tracker_url=""
declare dependency_tracker_api_key_file_path=""
-
function parse_arguments() {
while [[ $# -gt 0 ]]; do
@@ -197,9 +196,10 @@ function install_tools() {
function generate_sign_and_upload_sbom() {
# set -x
- # GENERATE SBOM
+ # GENERATE SBOM we intentionally disable package restore because the packages are already restored at this point
dotnet-CycloneDX "${csproj_file_path}" \
--exclude-dev \
+ --disable-package-restore \
--include-project-references \
\
--output "${output_directory_path}" \
diff --git a/Laerdal.Scripts/Laerdal.SetupBuildEnvironment.sh b/Laerdal.Scripts/Laerdal.SetupBuildEnvironment.sh
index a4c4697..fa08d34 100755
--- a/Laerdal.Scripts/Laerdal.SetupBuildEnvironment.sh
+++ b/Laerdal.Scripts/Laerdal.SetupBuildEnvironment.sh
@@ -76,8 +76,10 @@ dotnet \
maui \
ios \
android \
+ maccatalyst \
maui-ios \
- maui-android --version "${DOTNET_TARGET_WORKLOAD_VERSION}"
+ maui-android \
+ maui-maccatalyst --version "${DOTNET_TARGET_WORKLOAD_VERSION}"
declare exitCode=$?
if [ $exitCode != 0 ]; then
echo "##vso[task.logissue type=error]Failed to restore dotnet workloads."