diff --git a/README-BEFORE-UPDATE-REFS.txt b/README-BEFORE-UPDATE-REFS.txt
new file mode 100644
index 00000000..7e70948c
--- /dev/null
+++ b/README-BEFORE-UPDATE-REFS.txt
@@ -0,0 +1,6 @@
+Notes on updating the project references:
+
+IMPORTANT VERSION CONSTRAINTS:
+- System.Threading.Tasks.Extensions must not be updated beyond version 4.5.4
+ Reason: The VS2019 extension will fail due to a transitive dependency conflict between
+ Compilers.Services.Unsafe and System.Collections.Immutable.
diff --git a/USB Test App WPF/App.xaml b/USB Test App WPF/App.xaml
index 9c9d0fa6..2b5a5628 100644
--- a/USB Test App WPF/App.xaml
+++ b/USB Test App WPF/App.xaml
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
diff --git a/USB Test App WPF/App.xaml.cs b/USB Test App WPF/App.xaml.cs
index 5a9b0818..9d965321 100644
--- a/USB Test App WPF/App.xaml.cs
+++ b/USB Test App WPF/App.xaml.cs
@@ -2,6 +2,10 @@
// Copyright (c) .NET Foundation and Contributors
// See LICENSE file in the project root for full license information.
//
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
using CommonServiceLocator;
using nanoFramework.ANT.Services.NanoFrameworkService;
@@ -9,6 +13,7 @@
using Serial_Test_App_WPF.ViewModel;
using System;
using System.Collections.Generic;
+using CommunityToolkit.Mvvm.DependencyInjection;
namespace Serial_Test_App_WPF
{
@@ -27,12 +32,12 @@ public App()
vml = new ViewModelLocator();
var serialClient = CreateSerialDebugClient();
- ServiceLocator.Current.GetInstance().SerialDebugService = serialClient;
+ Ioc.Default.GetService().SerialDebugService = serialClient;
}
private void App_Exit(object sender, System.Windows.ExitEventArgs e)
{
- var serialClient = ServiceLocator.Current.GetInstance().SerialDebugService;
+ var serialClient = Ioc.Default.GetService().SerialDebugService;
serialClient.SerialDebugClient.StopDeviceWatchers();
}
diff --git a/USB Test App WPF/FodyWeavers.xml b/USB Test App WPF/FodyWeavers.xml
deleted file mode 100644
index 4e68ed1a..00000000
--- a/USB Test App WPF/FodyWeavers.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/USB Test App WPF/FodyWeavers.xsd b/USB Test App WPF/FodyWeavers.xsd
deleted file mode 100644
index 2f1b8aae..00000000
--- a/USB Test App WPF/FodyWeavers.xsd
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Used to control if the On_PropertyName_Changed feature is enabled.
-
-
-
-
- Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.
-
-
-
-
- Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.
-
-
-
-
- Used to control if equality checks should use the Equals method resolved from the base class.
-
-
-
-
- Used to control if equality checks should use the static Equals method resolved from the base class.
-
-
-
-
-
-
-
- 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
-
-
-
-
- A comma-separated list of error codes that can be safely ignored in assembly verification.
-
-
-
-
- 'false' to turn off automatic generation of the XML Schema file.
-
-
-
-
-
\ No newline at end of file
diff --git a/USB Test App WPF/MainWindow.xaml b/USB Test App WPF/MainWindow.xaml
index 05fb1fff..1501596e 100644
--- a/USB Test App WPF/MainWindow.xaml
+++ b/USB Test App WPF/MainWindow.xaml
@@ -4,7 +4,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Serial_Test_App_WPF"
- xmlns:ViewModel="clr-namespace:Serial_Test_App_WPF.ViewModel" x:Class="Serial_Test_App_WPF.MainWindow"
+ xmlns:ViewModel="clr-namespace:Serial_Test_App_WPF.ViewModel"
+ x:Class="Serial_Test_App_WPF.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="374" Width="570.729">
@@ -54,7 +55,5 @@
-
-
diff --git a/USB Test App WPF/MainWindow.xaml.cs b/USB Test App WPF/MainWindow.xaml.cs
index ee743bb9..caae5677 100644
--- a/USB Test App WPF/MainWindow.xaml.cs
+++ b/USB Test App WPF/MainWindow.xaml.cs
@@ -855,7 +855,7 @@ private void SetDeviceConfigButton_Click(object sender, RoutedEventArgs e)
Password = "1234",
Authentication = AuthenticationType.WPA2,
Encryption = EncryptionType.WPA2,
- Options = Wireless80211_ConfigurationOptions.AutoConnect
+ Wireless80211Options = Wireless80211_ConfigurationOptions.AutoConnect
};
// write wireless configuration to device
diff --git a/USB Test App WPF/Serial Test App WPF.csproj b/USB Test App WPF/Serial Test App WPF.csproj
index 6ec12954..84583f50 100644
--- a/USB Test App WPF/Serial Test App WPF.csproj
+++ b/USB Test App WPF/Serial Test App WPF.csproj
@@ -104,22 +104,20 @@
2.0.7
-
- 4.2.1
- runtime; build; native; contentfiles; analyzers
- all
+
+ 8.3.2
-
- 5.4.1.1
+
+ 6.0.2
1.14.2
-
- 2.6.1
+
+ 8.0.0
- 4.5.4
+ 4.6.0
4.5.0
diff --git a/USB Test App WPF/ViewModel/MainViewModel.cs b/USB Test App WPF/ViewModel/MainViewModel.cs
index 5e489f2b..ef0d20f9 100644
--- a/USB Test App WPF/ViewModel/MainViewModel.cs
+++ b/USB Test App WPF/ViewModel/MainViewModel.cs
@@ -1,13 +1,11 @@
-//
+//
// Copyright (c) .NET Foundation and Contributors
// See LICENSE file in the project root for full license information.
//
-using GalaSoft.MvvmLight;
using nanoFramework.ANT.Services.NanoFrameworkService;
using nanoFramework.Tools.Debugger;
using nanoFramework.Tools.Debugger.WireProtocol;
-using PropertyChanged;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -16,6 +14,7 @@
using System.Windows;
using System.Windows.Data;
using System.Windows.Threading;
+using CommunityToolkit.Mvvm.ComponentModel;
namespace Serial_Test_App_WPF.ViewModel
{
@@ -31,12 +30,15 @@ namespace Serial_Test_App_WPF.ViewModel
/// See http://www.galasoft.ch/mvvm
///
///
- [AddINotifyPropertyChangedInterface]
- public class MainViewModel : ViewModelBase
+ public class MainViewModel : ObservableObject
{
private readonly object _lockObj = new object();
- INFSerialDebugClientService _serialDebugService;
+ private INFSerialDebugClientService _serialDebugService;
+ private ObservableCollection _availableDevices;
+ private NanoDeviceBase _selectedDevice;
+ private List _availableTransportTypes;
+ private TransportType _selectedTransportType;
///
/// Initializes a new instance of the MainViewModel class.
@@ -53,34 +55,24 @@ public MainViewModel()
////}
}
- public INFSerialDebugClientService SerialDebugService
- {
- get
- {
- return _serialDebugService;
- }
-
+ public INFSerialDebugClientService SerialDebugService
+ {
+ get => _serialDebugService;
set
{
- if (_serialDebugService == value)
+ if (SetProperty(ref _serialDebugService, value))
{
- return;
- }
+ SelectedTransportType = TransportType.Serial;
- _serialDebugService = value;
+ AvailableDevices = _serialDebugService.SerialDebugClient.NanoFrameworkDevices;
- RaisePropertyChanged("SerialDebugService");
+ // need to do this in order to allow sync from another thread
+ BindingOperations.EnableCollectionSynchronization(AvailableDevices, _lockObj);
- SelectedTransportType = TransportType.Serial;
+ SerialDebugService.SerialDebugClient.NanoFrameworkDevices.CollectionChanged += NanoFrameworkDevices_CollectionChanged;
- AvailableDevices = _serialDebugService.SerialDebugClient.NanoFrameworkDevices;
-
- // need to do this in order to allow sync from another thread
- BindingOperations.EnableCollectionSynchronization(AvailableDevices, _lockObj);
-
- SerialDebugService.SerialDebugClient.NanoFrameworkDevices.CollectionChanged += NanoFrameworkDevices_CollectionChanged;
-
- SerialDebugService.SerialDebugClient.LogMessageAvailable += SerialDebugClient_LogMessageAvailable1;
+ SerialDebugService.SerialDebugClient.LogMessageAvailable += SerialDebugClient_LogMessageAvailable1;
+ }
}
}
@@ -95,7 +87,7 @@ private void SerialDebugClient_LogMessageAvailable1(object sender, StringEventAr
}
catch
{
- // catch all as the dispatcher is ont always available and that's OK
+ // catch all as the dispatcher is not always available and that's OK
}
}
@@ -106,7 +98,11 @@ private void SerialDebugClient_LogMessageAvailable(object sender, StringEventArg
}));
}
- public ObservableCollection AvailableDevices { get; set; }
+ public ObservableCollection AvailableDevices
+ {
+ get => _availableDevices;
+ set => SetProperty(ref _availableDevices, value);
+ }
private void NanoFrameworkDevices_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
@@ -119,7 +115,6 @@ private void NanoFrameworkDevices_CollectionChanged(object sender, System.Collec
// break;
case TransportType.Serial:
-
break;
default:
@@ -129,17 +124,27 @@ private void NanoFrameworkDevices_CollectionChanged(object sender, System.Collec
// if there's just one, select it
SelectedDevice = (AvailableDevices.Count == 1) ? AvailableDevices.First() : null;
-
}));
}
- public NanoDeviceBase SelectedDevice { get; set; }
+ public NanoDeviceBase SelectedDevice
+ {
+ get => _selectedDevice;
+ set => SetProperty(ref _selectedDevice, value);
+ }
#region Transport
- public List AvailableTransportTypes { get; set; }
-
- public TransportType SelectedTransportType { get; set; }
+ public List AvailableTransportTypes
+ {
+ get => _availableTransportTypes;
+ set => SetProperty(ref _availableTransportTypes, value);
+ }
+ public TransportType SelectedTransportType
+ {
+ get => _selectedTransportType;
+ set => SetProperty(ref _selectedTransportType, value);
+ }
#endregion
}
-}
\ No newline at end of file
+}
diff --git a/USB Test App WPF/ViewModel/ViewModelLocator.cs b/USB Test App WPF/ViewModel/ViewModelLocator.cs
index d24dc25f..b52d03b8 100644
--- a/USB Test App WPF/ViewModel/ViewModelLocator.cs
+++ b/USB Test App WPF/ViewModel/ViewModelLocator.cs
@@ -1,51 +1,37 @@
-//
+//
// Copyright (c) .NET Foundation and Contributors
// See LICENSE file in the project root for full license information.
//
-using CommonServiceLocator;
-using GalaSoft.MvvmLight.Ioc;
+using CommunityToolkit.Mvvm.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection;
+using Serial_Test_App_WPF.ViewModel;
namespace Serial_Test_App_WPF.ViewModel
{
- ///
- /// This class contains static references to all the view models in the
- /// application and provides an entry point for the bindings.
- ///
public class ViewModelLocator
{
- ///
- /// Initializes a new instance of the ViewModelLocator class.
- ///
- public ViewModelLocator()
- {
- ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
-
- ////if (ViewModelBase.IsInDesignModeStatic)
- ////{
- //// // Create design time view services and models
- //// SimpleIoc.Default.Register();
- ////}
- ////else
- ////{
- //// // Create run time view services and models
- //// SimpleIoc.Default.Register();
- ////}
-
- SimpleIoc.Default.Register();
- }
+ private static bool _isConfigured = false;
+ private static readonly object _lock = new object();
- public MainViewModel Main
+ public ViewModelLocator()
{
- get
+ if (!_isConfigured)
{
- return ServiceLocator.Current.GetInstance();
+ lock (_lock)
+ {
+ if (!_isConfigured)
+ {
+ Ioc.Default.ConfigureServices(
+ new ServiceCollection()
+ .AddSingleton()
+ .BuildServiceProvider());
+ _isConfigured = true;
+ }
+ }
}
}
-
- public static void Cleanup()
- {
- // TODO Clear the ViewModels
- }
+
+ public MainViewModel Main => Ioc.Default.GetService();
}
-}
\ No newline at end of file
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Net/FodyWeavers.xml b/nanoFramework.Tools.DebugLibrary.Net/FodyWeavers.xml
deleted file mode 100644
index 4e68ed1a..00000000
--- a/nanoFramework.Tools.DebugLibrary.Net/FodyWeavers.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/nanoFramework.Tools.DebugLibrary.Net/FodyWeavers.xsd b/nanoFramework.Tools.DebugLibrary.Net/FodyWeavers.xsd
deleted file mode 100644
index 558d2c37..00000000
--- a/nanoFramework.Tools.DebugLibrary.Net/FodyWeavers.xsd
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Used to control if the On_PropertyName_Changed feature is enabled.
-
-
-
-
- Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.
-
-
-
-
- Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.
-
-
-
-
- Used to control if equality checks should use the Equals method resolved from the base class.
-
-
-
-
- Used to control if equality checks should use the static Equals method resolved from the base class.
-
-
-
-
-
-
-
- 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
-
-
-
-
- A comma-separated list of error codes that can be safely ignored in assembly verification.
-
-
-
-
- 'false' to turn off automatic generation of the XML Schema file.
-
-
-
-
-
\ No newline at end of file
diff --git a/nanoFramework.Tools.DebugLibrary.Net/nanoFramework.Tools.DebugLibrary.Net.csproj b/nanoFramework.Tools.DebugLibrary.Net/nanoFramework.Tools.DebugLibrary.Net.csproj
index 8841aa66..18107670 100644
--- a/nanoFramework.Tools.DebugLibrary.Net/nanoFramework.Tools.DebugLibrary.Net.csproj
+++ b/nanoFramework.Tools.DebugLibrary.Net/nanoFramework.Tools.DebugLibrary.Net.csproj
@@ -61,38 +61,29 @@
-
- 4.2.1
- runtime; build; native; contentfiles; analyzers
- all
-
+
- 1.1.1
+ 8.0.0
runtime; build; native; contentfiles; analyzers; buildtransitive
all
- 3.6.132
+ 3.6.146
runtime; build; native; contentfiles; analyzers
all
- 6.5.0
+ 6.12.1
runtime; build; native; contentfiles; analyzers; buildtransitive
all
- 7.2.3
-
-
- 2.6.1
+ 8.5.0
- 7.0.0
+ 8.0.0
-
-
-
+
\ No newline at end of file
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.NetworkConfigurationProperties.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.NetworkConfigurationProperties.cs
new file mode 100644
index 00000000..cf37a17f
--- /dev/null
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.NetworkConfigurationProperties.cs
@@ -0,0 +1,101 @@
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+using CommunityToolkit.Mvvm.ComponentModel;
+using System.Net;
+using System.Text;
+
+namespace nanoFramework.Tools.Debugger
+{
+ public partial class DeviceConfiguration
+ {
+ /////////////////////////////////////////////////////////////
+
+ public class NetworkConfigurationProperties : NetworkConfigurationPropertiesBase
+ {
+ internal const uint EmptySpecificConfigValue = uint.MaxValue;
+
+ private bool _isUnknown = true;
+
+ public bool IsUnknown
+ {
+ get => _isUnknown;
+ set => SetProperty(ref _isUnknown, value);
+ }
+
+ public NetworkConfigurationProperties() : base()
+ {
+ }
+
+ public NetworkConfigurationProperties(NetworkConfigurationBase value)
+ {
+ MacAddress = value.MacAddress;
+
+ IPv4Address = new IPAddress(value.IPv4Address);
+ IPv4NetMask = new IPAddress(value.IPv4NetMask);
+ IPv4GatewayAddress = new IPAddress(value.IPv4GatewayAddress);
+ IPv4DNSAddress1 = new IPAddress(value.IPv4DNSAddress1);
+ IPv4DNSAddress2 = new IPAddress(value.IPv4DNSAddress2);
+
+ IPv6Address = ToIPv6Address(value.IPv6Address);
+ IPv6NetMask = ToIPv6Address(value.IPv6NetMask);
+ IPv6GatewayAddress = ToIPv6Address(value.IPv6GatewayAddress);
+ IPv6DNSAddress1 = ToIPv6Address(value.IPv6DNSAddress1);
+ IPv6DNSAddress2 = ToIPv6Address(value.IPv6DNSAddress2);
+
+ InterfaceType = (NetworkInterfaceType)value.InterfaceType;
+ StartupAddressMode = (AddressMode)value.StartupAddressMode;
+ AutomaticDNS = value.AutomaticDNS != 0;
+
+ if (value.SpecificConfigId == EmptySpecificConfigValue)
+ {
+ SpecificConfigId = null;
+ }
+ else
+ {
+ SpecificConfigId = value.SpecificConfigId;
+ }
+
+ // reset unknown flag
+ IsUnknown = false;
+ }
+
+ // operator to allow casting a NetworkConfigurationProperties object to NetworkConfigurationBase
+ public static explicit operator NetworkConfigurationBase(NetworkConfigurationProperties value)
+ {
+ var networkConfig = new NetworkConfigurationBase()
+ {
+ Marker = Encoding.UTF8.GetBytes(MarkerConfigurationNetwork_v1),
+
+ MacAddress = value.MacAddress,
+
+ IPv4Address = FromIPv4Address(value.IPv4Address),
+ IPv4NetMask = FromIPv4Address(value.IPv4NetMask),
+ IPv4GatewayAddress = FromIPv4Address(value.IPv4GatewayAddress),
+ IPv4DNSAddress1 = FromIPv4Address(value.IPv4DNSAddress1),
+ IPv4DNSAddress2 = FromIPv4Address(value.IPv4DNSAddress2),
+
+ IPv6Address = FromIPv6Address(value.IPv6Address),
+ IPv6NetMask = FromIPv6Address(value.IPv6NetMask),
+ IPv6GatewayAddress = FromIPv6Address(value.IPv6GatewayAddress),
+ IPv6DNSAddress1 = FromIPv6Address(value.IPv6DNSAddress1),
+ IPv6DNSAddress2 = FromIPv6Address(value.IPv6DNSAddress2),
+ InterfaceType = (byte)value.InterfaceType,
+ StartupAddressMode = (byte)value.StartupAddressMode,
+ };
+
+ networkConfig.AutomaticDNS = value.AutomaticDNS ? (byte)1 : (byte)0;
+ networkConfig.SpecificConfigId = value.SpecificConfigId ?? EmptySpecificConfigValue;
+
+ return networkConfig;
+ }
+ }
+ }
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.Wireless80211ConfigurationProperties.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.Wireless80211ConfigurationProperties.cs
new file mode 100644
index 00000000..63720fd3
--- /dev/null
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.Wireless80211ConfigurationProperties.cs
@@ -0,0 +1,70 @@
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+using CommunityToolkit.Mvvm.ComponentModel;
+using System;
+using System.Text;
+
+namespace nanoFramework.Tools.Debugger
+{
+ public partial class DeviceConfiguration
+ {
+ public class Wireless80211ConfigurationProperties : Wireless80211ConfigurationPropertiesBase
+ {
+ private bool _isUnknown = true;
+
+ public bool IsUnknown
+ {
+ get => _isUnknown;
+ set => SetProperty(ref _isUnknown, value);
+ }
+
+ public Wireless80211ConfigurationProperties()
+ {
+ }
+
+ public Wireless80211ConfigurationProperties(Wireless80211ConfigurationBase config)
+ {
+ Id = config.Id;
+ Authentication = (AuthenticationType)config.Authentication;
+ Encryption = (EncryptionType)config.Encryption;
+ Radio = (RadioType)config.Radio;
+ Ssid = Encoding.UTF8.GetString(config.Ssid).Trim('\0');
+ Password = Encoding.UTF8.GetString(config.Password).Trim('\0');
+ Wireless80211Options = (Wireless80211_ConfigurationOptions)config.Options;
+
+ // reset unknown flag
+ IsUnknown = false;
+ }
+
+ // operator to allow casting a Wireless80211ConfigurationProperties object to Wireless80211ConfigurationBase
+ public static explicit operator Wireless80211ConfigurationBase(Wireless80211ConfigurationProperties value)
+ {
+ var networkWirelessConfig = new Wireless80211ConfigurationBase()
+ {
+ Marker = Encoding.UTF8.GetBytes(MarkerConfigurationWireless80211_v1),
+
+ Id = value.Id,
+ Authentication = (byte)value.Authentication,
+ Encryption = (byte)value.Encryption,
+ Radio = (byte)value.Radio,
+ Options = (byte)value.Wireless80211Options
+ };
+
+ // the following ones are strings so they need to be copied over to the array
+ // this is required to when serializing the class the struct size matches the one in the native end
+ Array.Copy(Encoding.UTF8.GetBytes(value.Ssid), 0, networkWirelessConfig.Ssid, 0, value.Ssid.Length);
+ Array.Copy(Encoding.UTF8.GetBytes(value.Password), 0, networkWirelessConfig.Password, 0, value.Password.Length);
+
+ return networkWirelessConfig;
+ }
+ }
+ }
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.WirelessAPConfigurationProperties.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.WirelessAPConfigurationProperties.cs
new file mode 100644
index 00000000..39d2bd18
--- /dev/null
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.WirelessAPConfigurationProperties.cs
@@ -0,0 +1,74 @@
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+using CommunityToolkit.Mvvm.ComponentModel;
+using System;
+using System.Text;
+
+namespace nanoFramework.Tools.Debugger
+{
+ public partial class DeviceConfiguration
+ {
+ public class WirelessAPConfigurationProperties : WirelessAPConfigurationPropertiesBase
+ {
+ private bool _isUnknown = true;
+
+ public bool IsUnknown
+ {
+ get => _isUnknown;
+ set => SetProperty(ref _isUnknown, value);
+ }
+
+ public WirelessAPConfigurationProperties()
+ {
+ }
+
+ public WirelessAPConfigurationProperties(WirelessAPConfigurationBase config)
+ {
+ Id = config.Id;
+ Authentication = (AuthenticationType)config.Authentication;
+ Encryption = (EncryptionType)config.Encryption;
+ Radio = (RadioType)config.Radio;
+ Ssid = Encoding.UTF8.GetString(config.Ssid).Trim('\0');
+ Password = Encoding.UTF8.GetString(config.Password).Trim('\0');
+ WirelessAPOptions = (WirelessAP_ConfigurationOptions)config.Options;
+ Channel = config.Channel;
+ MaxConnections = config.MaxConnections;
+
+ // reset unknown flag
+ IsUnknown = false;
+ }
+
+ // operator to allow casting a WirelessAPConfigurationProperties object to WirelessAPConfigurationBase
+ public static explicit operator WirelessAPConfigurationBase(WirelessAPConfigurationProperties value)
+ {
+ var networkWirelessConfig = new WirelessAPConfigurationBase()
+ {
+ Marker = Encoding.UTF8.GetBytes(MarkerConfigurationWireless80211AP_v1),
+
+ Id = value.Id,
+ Authentication = (byte)value.Authentication,
+ Encryption = (byte)value.Encryption,
+ Radio = (byte)value.Radio,
+ Options = (byte)value.WirelessAPOptions,
+ Channel = value.Channel,
+ MaxConnections = value.MaxConnections
+ };
+
+ // the following ones are strings so they need to be copied over to the array
+ // this is required to when serializing the class the struct size matches the one in the native end
+ Array.Copy(Encoding.UTF8.GetBytes(value.Ssid), 0, networkWirelessConfig.Ssid, 0, value.Ssid.Length);
+ Array.Copy(Encoding.UTF8.GetBytes(value.Password), 0, networkWirelessConfig.Password, 0, value.Password.Length);
+
+ return networkWirelessConfig;
+ }
+ }
+ }
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.X509CaRootBundleProperties.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.X509CaRootBundleProperties.cs
new file mode 100644
index 00000000..acf5cd72
--- /dev/null
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.X509CaRootBundleProperties.cs
@@ -0,0 +1,56 @@
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+using CommunityToolkit.Mvvm.ComponentModel;
+using System.Text;
+
+namespace nanoFramework.Tools.Debugger
+{
+ public partial class DeviceConfiguration
+ {
+ public class X509CaRootBundleProperties : X509CaRootBundlePropertiesBase
+ {
+ private bool _isUnknown = true;
+
+ public bool IsUnknown
+ {
+ get => _isUnknown;
+ set => SetProperty(ref _isUnknown, value);
+ }
+
+ public X509CaRootBundleProperties()
+ {
+ }
+
+ public X509CaRootBundleProperties(X509CaRootBundleBase certificate)
+ {
+ CertificateSize = (uint)certificate.Certificate.Length;
+ Certificate = certificate.Certificate;
+
+ // reset unknown flag
+ IsUnknown = false;
+ }
+
+ // operator to allow casting a X509CaRootBundleProperties object to X509CaRootBundleBase
+ public static explicit operator X509CaRootBundleBase(X509CaRootBundleProperties value)
+ {
+ var x509Certificate = new X509CaRootBundleBase()
+ {
+ Marker = Encoding.UTF8.GetBytes(MarkerConfigurationX509CaRootBundle_v1),
+
+ CertificateSize = (uint)value.Certificate.Length,
+ Certificate = value.Certificate,
+ };
+
+ return x509Certificate;
+ }
+ }
+ }
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.X509DeviceCertificatesProperties.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.X509DeviceCertificatesProperties.cs
new file mode 100644
index 00000000..982a6e96
--- /dev/null
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.X509DeviceCertificatesProperties.cs
@@ -0,0 +1,56 @@
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+using CommunityToolkit.Mvvm.ComponentModel;
+using System.Text;
+
+namespace nanoFramework.Tools.Debugger
+{
+ public partial class DeviceConfiguration
+ {
+ public class X509DeviceCertificatesProperties : X509DeviceCertificatesPropertiesBase
+ {
+ private bool _isUnknown = true;
+
+ public bool IsUnknown
+ {
+ get => _isUnknown;
+ set => SetProperty(ref _isUnknown, value);
+ }
+
+ public X509DeviceCertificatesProperties()
+ {
+ }
+
+ public X509DeviceCertificatesProperties(X509DeviceCertificatesBase certificate)
+ {
+ CertificateSize = (uint)certificate.Certificate.Length;
+ Certificate = certificate.Certificate;
+
+ // reset unknown flag
+ IsUnknown = false;
+ }
+
+ // operator to allow casting a X509DeviceCertificatesProperties object to X509DeviceCertificatesBase
+ public static explicit operator X509DeviceCertificatesBase(X509DeviceCertificatesProperties value)
+ {
+ var x509Certificate = new X509DeviceCertificatesBase()
+ {
+ Marker = Encoding.UTF8.GetBytes(MarkerConfigurationX509DeviceCertificate_v1),
+
+ CertificateSize = (uint)value.Certificate.Length,
+ Certificate = value.Certificate,
+ };
+
+ return x509Certificate;
+ }
+ }
+ }
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.cs
index fbbc655a..9b7c4edb 100644
--- a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.cs
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/DeviceConfiguration.cs
@@ -3,14 +3,10 @@
// See LICENSE file in the project root for full license information.
//
-using nanoFramework.Tools.Debugger.WireProtocol;
-using PropertyChanged;
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.Linq;
using System.Net;
-using System.Text;
namespace nanoFramework.Tools.Debugger
{
@@ -164,251 +160,5 @@ static internal uint[] FromIPv6Address(IPAddress address)
}
/////////////////////////////////////////////////////////////
-
- [AddINotifyPropertyChangedInterface]
- public class NetworkConfigurationProperties : NetworkConfigurationPropertiesBase
- {
- internal const uint EmptySpecificConfigValue = uint.MaxValue;
-
- public bool IsUnknown { get; set; } = true;
-
- public NetworkConfigurationProperties() : base()
- {
-
- }
-
- public NetworkConfigurationProperties(NetworkConfigurationBase value)
- {
- MacAddress = value.MacAddress;
-
- IPv4Address = new IPAddress(value.IPv4Address);
- IPv4NetMask = new IPAddress(value.IPv4NetMask);
- IPv4GatewayAddress = new IPAddress(value.IPv4GatewayAddress);
- IPv4DNSAddress1 = new IPAddress(value.IPv4DNSAddress1);
- IPv4DNSAddress2 = new IPAddress(value.IPv4DNSAddress2);
-
- IPv6Address = ToIPv6Address(value.IPv6Address);
- IPv6NetMask = ToIPv6Address(value.IPv6NetMask);
- IPv6GatewayAddress = ToIPv6Address(value.IPv6GatewayAddress);
- IPv6DNSAddress1 = ToIPv6Address(value.IPv6DNSAddress1);
- IPv6DNSAddress2 = ToIPv6Address(value.IPv6DNSAddress2);
-
- InterfaceType = (NetworkInterfaceType)value.InterfaceType;
- StartupAddressMode = (AddressMode)value.StartupAddressMode;
- AutomaticDNS = value.AutomaticDNS != 0;
-
- if (value.SpecificConfigId == EmptySpecificConfigValue)
- {
- SpecificConfigId = null;
- }
- else
- {
- SpecificConfigId = value.SpecificConfigId;
- }
-
- // reset unknown flag
- IsUnknown = false;
- }
-
- // operator to allow cast_ing a NetworkConfigurationProperties object to NetworkConfigurationBase
- public static explicit operator NetworkConfigurationBase(NetworkConfigurationProperties value)
- {
- var networkConfig = new NetworkConfigurationBase()
- {
- Marker = Encoding.UTF8.GetBytes(MarkerConfigurationNetwork_v1),
-
- MacAddress = value.MacAddress,
-
- IPv4Address = FromIPv4Address(value.IPv4Address),
- IPv4NetMask = FromIPv4Address(value.IPv4NetMask),
- IPv4GatewayAddress = FromIPv4Address(value.IPv4GatewayAddress),
- IPv4DNSAddress1 = FromIPv4Address(value.IPv4DNSAddress1),
- IPv4DNSAddress2 = FromIPv4Address(value.IPv4DNSAddress2),
-
- IPv6Address = FromIPv6Address(value.IPv6Address),
- IPv6NetMask = FromIPv6Address(value.IPv6NetMask),
- IPv6GatewayAddress = FromIPv6Address(value.IPv6GatewayAddress),
- IPv6DNSAddress1 = FromIPv6Address(value.IPv6DNSAddress1),
- IPv6DNSAddress2 = FromIPv6Address(value.IPv6DNSAddress2),
- InterfaceType = (byte)value.InterfaceType,
- StartupAddressMode = (byte)value.StartupAddressMode,
- };
-
- networkConfig.AutomaticDNS = value.AutomaticDNS ? (byte)1 : (byte)0;
- networkConfig.SpecificConfigId = value.SpecificConfigId ?? EmptySpecificConfigValue;
-
- return networkConfig;
- }
-
- }
-
- [AddINotifyPropertyChangedInterface]
- public class Wireless80211ConfigurationProperties : Wireless80211ConfigurationPropertiesBase
- {
- public bool IsUnknown { get; set; } = true;
-
- public Wireless80211ConfigurationProperties()
- {
-
- }
-
- public Wireless80211ConfigurationProperties(Wireless80211ConfigurationBase config)
- {
- Id = config.Id;
- Authentication = (AuthenticationType)config.Authentication;
- Encryption = (EncryptionType)config.Encryption;
- Radio = (RadioType)config.Radio;
- Ssid = Encoding.UTF8.GetString(config.Ssid).Trim('\0');
- Password = Encoding.UTF8.GetString(config.Password).Trim('\0');
- Options = (Wireless80211_ConfigurationOptions)config.Options;
-
- // reset unknown flag
- IsUnknown = false;
- }
-
- // operator to allow cast_ing a Wireless80211ConfigurationProperties object to Wireless80211ConfigurationBase
- public static explicit operator Wireless80211ConfigurationBase(Wireless80211ConfigurationProperties value)
- {
- var networkWirelessConfig = new Wireless80211ConfigurationBase()
- {
- Marker = Encoding.UTF8.GetBytes(MarkerConfigurationWireless80211_v1),
-
- Id = value.Id,
- Authentication = (byte)value.Authentication,
- Encryption = (byte)value.Encryption,
- Radio = (byte)value.Radio,
- Options = (byte)value.Options
- };
-
- // the following ones are strings so they need to be copied over to the array
- // this is required to when serializing the class the struct size matches the one in the native end
- Array.Copy(Encoding.UTF8.GetBytes(value.Ssid), 0, networkWirelessConfig.Ssid, 0, value.Ssid.Length);
- Array.Copy(Encoding.UTF8.GetBytes(value.Password), 0, networkWirelessConfig.Password, 0, value.Password.Length);
-
- return networkWirelessConfig;
- }
-
- }
-
- [AddINotifyPropertyChangedInterface]
- public class WirelessAPConfigurationProperties : WirelessAPConfigurationPropertiesBase
- {
- public bool IsUnknown { get; set; } = true;
-
- public WirelessAPConfigurationProperties()
- {
-
- }
-
- public WirelessAPConfigurationProperties(WirelessAPConfigurationBase config)
- {
- Id = config.Id;
- Authentication = (AuthenticationType)config.Authentication;
- Encryption = (EncryptionType)config.Encryption;
- Radio = (RadioType)config.Radio;
- Ssid = Encoding.UTF8.GetString(config.Ssid).Trim('\0');
- Password = Encoding.UTF8.GetString(config.Password).Trim('\0');
- Options = (WirelessAP_ConfigurationOptions)config.Options;
-
- // reset unknown flag
- IsUnknown = false;
- }
-
- // operator to allow cast_ing a WirelessAPConfigurationProperties object to WirelessAPConfigurationBase
- public static explicit operator WirelessAPConfigurationBase(WirelessAPConfigurationProperties value)
- {
- var networkWirelessConfig = new WirelessAPConfigurationBase()
- {
- Marker = Encoding.UTF8.GetBytes(MarkerConfigurationWireless80211AP_v1),
-
- Id = value.Id,
- Authentication = (byte)value.Authentication,
- Encryption = (byte)value.Encryption,
- Radio = (byte)value.Radio,
- Options = (byte)value.Options,
- Channel = value.Channel,
- MaxConnections = value.MaxConnections
- };
-
- // the following ones are strings so they need to be copied over to the array
- // this is required to when serializing the class the struct size matches the one in the native end
- Array.Copy(Encoding.UTF8.GetBytes(value.Ssid), 0, networkWirelessConfig.Ssid, 0, value.Ssid.Length);
- Array.Copy(Encoding.UTF8.GetBytes(value.Password), 0, networkWirelessConfig.Password, 0, value.Password.Length);
-
- return networkWirelessConfig;
- }
-
- }
-
- [AddINotifyPropertyChangedInterface]
- public class X509CaRootBundleProperties : X509CaRootBundlePropertiesBase
- {
- public bool IsUnknown { get; set; } = true;
-
- public X509CaRootBundleProperties()
- {
-
- }
-
- public X509CaRootBundleProperties(X509CaRootBundleBase certificate)
- {
- CertificateSize = (uint)certificate.Certificate.Length;
- Certificate = certificate.Certificate;
-
- // reset unknown flag
- IsUnknown = false;
- }
-
- // operator to allow cast_ing a X509CaRootBundleBaseProperties object to X509CaRootBundleBase
- public static explicit operator X509CaRootBundleBase(X509CaRootBundleProperties value)
- {
- var x509Certificate = new X509CaRootBundleBase()
- {
- Marker = Encoding.UTF8.GetBytes(MarkerConfigurationX509CaRootBundle_v1),
-
- CertificateSize = (uint)value.Certificate.Length,
- Certificate = value.Certificate,
- };
-
- return x509Certificate;
- }
- }
-
- [AddINotifyPropertyChangedInterface]
- public class X509DeviceCertificatesProperties : X509DeviceCertificatesPropertiesBase
- {
- public bool IsUnknown { get; set; } = true;
-
- public X509DeviceCertificatesProperties()
- {
-
- }
-
- public X509DeviceCertificatesProperties(X509DeviceCertificatesBase certificate)
- {
- CertificateSize = (uint)certificate.Certificate.Length;
- Certificate = certificate.Certificate;
-
- // reset unknown flag
- IsUnknown = false;
- }
-
- // operator to allow cast_ing a X509DeviceCertificatesBaseProperties object to X509DeviceCertificatesBase
- public static explicit operator X509DeviceCertificatesBase(X509DeviceCertificatesProperties value)
- {
- var x509Certificate = new X509DeviceCertificatesBase()
- {
- Marker = Encoding.UTF8.GetBytes(MarkerConfigurationX509DeviceCertificate_v1),
-
- CertificateSize = (uint)value.Certificate.Length,
- Certificate = value.Certificate,
- };
-
- return x509Certificate;
- }
- }
-
- /////////////////////////////////////////////////////////////
-
}
}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/NetworkConfigurationPropertiesBase.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/NetworkConfigurationPropertiesBase.cs
index ac16420e..94c6217b 100644
--- a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/NetworkConfigurationPropertiesBase.cs
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/NetworkConfigurationPropertiesBase.cs
@@ -3,29 +3,118 @@
// See LICENSE file in the project root for full license information.
//
-using PropertyChanged;
+using CommunityToolkit.Mvvm.ComponentModel;
using System.Net;
namespace nanoFramework.Tools.Debugger
{
- [AddINotifyPropertyChangedInterface]
- public class NetworkConfigurationPropertiesBase
+ public class NetworkConfigurationPropertiesBase : ObservableObject
{
- public IPAddress IPv4Address { get; set; }
- public IPAddress IPv4DNSAddress1 { get; set; }
- public IPAddress IPv4DNSAddress2 { get; set; }
- public IPAddress IPv4GatewayAddress { get; set; }
- public IPAddress IPv4NetMask { get; set; }
- public IPAddress IPv6Address { get; set; }
- public IPAddress IPv6DNSAddress1 { get; set; }
- public IPAddress IPv6DNSAddress2 { get; set; }
- public IPAddress IPv6GatewayAddress { get; set; }
- public IPAddress IPv6NetMask { get; set; }
- public byte[] MacAddress { get; set; }
- public NetworkInterfaceType InterfaceType { get; set; }
- public AddressMode StartupAddressMode { get; set; }
- public uint? SpecificConfigId { get; set; }
- public bool AutomaticDNS { get; set; }
+ private IPAddress _ipv4Address;
+ private IPAddress _ipv4DNSAddress1;
+ private IPAddress _ipv4DNSAddress2;
+ private IPAddress _ipv4GatewayAddress;
+ private IPAddress _ipv4NetMask;
+ private IPAddress _ipv6Address;
+ private IPAddress _ipv6DNSAddress1;
+ private IPAddress _ipv6DNSAddress2;
+ private IPAddress _ipv6GatewayAddress;
+ private IPAddress _ipv6NetMask;
+ private byte[] _macAddress;
+ private NetworkInterfaceType _interfaceType;
+ private AddressMode _startupAddressMode;
+ private uint? _specificConfigId;
+ private bool _automaticDNS;
+
+ public IPAddress IPv4Address
+ {
+ get => _ipv4Address;
+ set => SetProperty(ref _ipv4Address, value);
+ }
+
+ public IPAddress IPv4DNSAddress1
+ {
+ get => _ipv4DNSAddress1;
+ set => SetProperty(ref _ipv4DNSAddress1, value);
+ }
+
+ public IPAddress IPv4DNSAddress2
+ {
+ get => _ipv4DNSAddress2;
+ set => SetProperty(ref _ipv4DNSAddress2, value);
+ }
+
+ public IPAddress IPv4GatewayAddress
+ {
+ get => _ipv4GatewayAddress;
+ set => SetProperty(ref _ipv4GatewayAddress, value);
+ }
+
+ public IPAddress IPv4NetMask
+ {
+ get => _ipv4NetMask;
+ set => SetProperty(ref _ipv4NetMask, value);
+ }
+
+ public IPAddress IPv6Address
+ {
+ get => _ipv6Address;
+ set => SetProperty(ref _ipv6Address, value);
+ }
+
+ public IPAddress IPv6DNSAddress1
+ {
+ get => _ipv6DNSAddress1;
+ set => SetProperty(ref _ipv6DNSAddress1, value);
+ }
+
+ public IPAddress IPv6DNSAddress2
+ {
+ get => _ipv6DNSAddress2;
+ set => SetProperty(ref _ipv6DNSAddress2, value);
+ }
+
+ public IPAddress IPv6GatewayAddress
+ {
+ get => _ipv6GatewayAddress;
+ set => SetProperty(ref _ipv6GatewayAddress, value);
+ }
+
+ public IPAddress IPv6NetMask
+ {
+ get => _ipv6NetMask;
+ set => SetProperty(ref _ipv6NetMask, value);
+ }
+
+ public byte[] MacAddress
+ {
+ get => _macAddress;
+ set => SetProperty(ref _macAddress, value);
+ }
+
+ public NetworkInterfaceType InterfaceType
+ {
+ get => _interfaceType;
+ set => SetProperty(ref _interfaceType, value);
+ }
+
+ public AddressMode StartupAddressMode
+ {
+ get => _startupAddressMode;
+ set => SetProperty(ref _startupAddressMode, value);
+ }
+
+ public uint? SpecificConfigId
+ {
+ get => _specificConfigId;
+ set => SetProperty(ref _specificConfigId, value);
+ }
+
+ public bool AutomaticDNS
+ {
+ get => _automaticDNS;
+ set => SetProperty(ref _automaticDNS, value);
+ }
public NetworkConfigurationPropertiesBase()
{
@@ -33,4 +122,4 @@ public NetworkConfigurationPropertiesBase()
InterfaceType = NetworkInterfaceType.Ethernet;
}
}
-}
\ No newline at end of file
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/Wireless80211ConfigurationPropertiesBase.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/Wireless80211ConfigurationPropertiesBase.cs
index 01d08471..699f75df 100644
--- a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/Wireless80211ConfigurationPropertiesBase.cs
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/Wireless80211ConfigurationPropertiesBase.cs
@@ -3,51 +3,13 @@
// See LICENSE file in the project root for full license information.
//
-using PropertyChanged;
-
namespace nanoFramework.Tools.Debugger
{
///
/// Base class for wireless 802.11 configuration properties.
///
- [AddINotifyPropertyChangedInterface]
- public class Wireless80211ConfigurationPropertiesBase
+ public class Wireless80211ConfigurationPropertiesBase : WirelessConfigurationPropertiesBase
{
- ///
- /// Id of the configuration.
- ///
- public uint Id { get; set; }
-
- ///
- /// Authentication type for the network.
- ///
- public AuthenticationType Authentication { get; set; }
-
- ///
- /// Encryption type for the network.
- ///
- public EncryptionType Encryption { get; set; }
-
- ///
- /// Radio type for the network.
- ///
- public RadioType Radio { get; set; }
-
- ///
- /// SSID of the network.
- ///
- /// Maximum allowed length for network password is 32.
- public string Ssid { get; set; }
-
- ///
- /// Password for the network.
- ///
- /// Maximum allowed length for network password is 64
- public string Password { get; set; }
-
- ///
- /// Configuration options for the network.
- ///
- public Wireless80211_ConfigurationOptions Options { get; set; }
+ // No additional properties needed for now
}
-}
\ No newline at end of file
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/WirelessAPConfigurationPropertiesBase.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/WirelessAPConfigurationPropertiesBase.cs
index 84bb2181..53e5169d 100644
--- a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/WirelessAPConfigurationPropertiesBase.cs
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/WirelessAPConfigurationPropertiesBase.cs
@@ -3,61 +3,37 @@
// See LICENSE file in the project root for full license information.
//
-using PropertyChanged;
-
namespace nanoFramework.Tools.Debugger
{
///
- /// Base class for wireless Access Poing configuration properties.
+ /// Base class for wireless Access Point configuration properties.
///
- [AddINotifyPropertyChangedInterface]
- public class WirelessAPConfigurationPropertiesBase
+ public class WirelessAPConfigurationPropertiesBase : WirelessConfigurationPropertiesBase
{
- ///
- /// Id of the configuration.
- ///
- public uint Id { get; set; }
-
- ///
- /// Authentication type for the network.
- ///
- public AuthenticationType Authentication { get; set; }
-
- ///
- /// Encryption type for the network.
- ///
- public EncryptionType Encryption { get; set; }
-
- ///
- /// Radio type for the network.
- ///
- public RadioType Radio { get; set; }
+ private byte _channel;
+ private byte _maxConnections;
///
- /// SSID of the network.
+ /// Channel for the network.
///
- /// Maximum allowed length for network password is 32.
- public string Ssid { get; set; }
+ public byte Channel
+ {
+ get => _channel;
+ set => SetProperty(ref _channel, value);
+ }
///
- /// Password for the network.
+ /// Maximum number of connections allowed.
///
- /// Maximum allowed length for network password is 64
- public string Password { get; set; }
+ public byte MaxConnections
+ {
+ get => _maxConnections;
+ set => SetProperty(ref _maxConnections, value);
+ }
///
/// Configuration options for the network.
///
- public WirelessAP_ConfigurationOptions Options { get; set; }
-
- ///
- /// Channel for the network.
- ///
- public byte Channel { get; set; }
-
- ///
- /// Maximum number of connections allowed.
- ///
- public byte MaxConnections { get; set; }
+ public WirelessAP_ConfigurationOptions WirelessAPOptions { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/WirelessConfigurationPropertiesBase.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/WirelessConfigurationPropertiesBase.cs
new file mode 100644
index 00000000..22e9c39f
--- /dev/null
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/WirelessConfigurationPropertiesBase.cs
@@ -0,0 +1,88 @@
+//
+// Copyright (c) .NET Foundation and Contributors
+// See LICENSE file in the project root for full license information.
+//
+
+using CommunityToolkit.Mvvm.ComponentModel;
+
+namespace nanoFramework.Tools.Debugger
+{
+ ///
+ /// Base class for common wireless configuration properties.
+ ///
+ public class WirelessConfigurationPropertiesBase : ObservableObject
+ {
+ private uint _id;
+ private AuthenticationType _authentication;
+ private EncryptionType _encryption;
+ private RadioType _radio;
+ private string _ssid;
+ private string _password;
+ private Wireless80211_ConfigurationOptions _options;
+
+ ///
+ /// Id of the configuration.
+ ///
+ public uint Id
+ {
+ get => _id;
+ set => SetProperty(ref _id, value);
+ }
+
+ ///
+ /// Authentication type for the network.
+ ///
+ public AuthenticationType Authentication
+ {
+ get => _authentication;
+ set => SetProperty(ref _authentication, value);
+ }
+
+ ///
+ /// Encryption type for the network.
+ ///
+ public EncryptionType Encryption
+ {
+ get => _encryption;
+ set => SetProperty(ref _encryption, value);
+ }
+
+ ///
+ /// Radio type for the network.
+ ///
+ public RadioType Radio
+ {
+ get => _radio;
+ set => SetProperty(ref _radio, value);
+ }
+
+ ///
+ /// SSID of the network.
+ ///
+ /// Maximum allowed length for network password is 32.
+ public string Ssid
+ {
+ get => _ssid;
+ set => SetProperty(ref _ssid, value);
+ }
+
+ ///
+ /// Password for the network.
+ ///
+ /// Maximum allowed length for network password is 64
+ public string Password
+ {
+ get => _password;
+ set => SetProperty(ref _password, value);
+ }
+
+ ///
+ /// Configuration options for the network.
+ ///
+ public Wireless80211_ConfigurationOptions Wireless80211Options
+ {
+ get => _options;
+ set => SetProperty(ref _options, value);
+ }
+ }
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/X509CaRootBundlePropertiesBase.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/X509CaRootBundlePropertiesBase.cs
index fe2c5268..f8af2d59 100644
--- a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/X509CaRootBundlePropertiesBase.cs
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/X509CaRootBundlePropertiesBase.cs
@@ -3,25 +3,31 @@
// See LICENSE file in the project root for full license information.
//
-using PropertyChanged;
+using CommunityToolkit.Mvvm.ComponentModel;
namespace nanoFramework.Tools.Debugger
{
- [AddINotifyPropertyChangedInterface]
- public class X509CaRootBundlePropertiesBase
+ public class X509CaRootBundlePropertiesBase : ObservableObject
{
private byte[] _certificate;
+ private uint _certificateSize;
- public uint CertificateSize { get; set; }
+ public uint CertificateSize
+ {
+ get => _certificateSize;
+ set => SetProperty(ref _certificateSize, value);
+ }
public byte[] Certificate
{
get => _certificate;
set
{
- _certificate = value;
- CertificateSize = (uint)value.Length;
+ if (SetProperty(ref _certificate, value))
+ {
+ CertificateSize = (uint)value.Length;
+ }
}
}
}
-}
\ No newline at end of file
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/X509DeviceCertificatesPropertiesBase.cs b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/X509DeviceCertificatesPropertiesBase.cs
index 7adfa337..e0848ec2 100644
--- a/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/X509DeviceCertificatesPropertiesBase.cs
+++ b/nanoFramework.Tools.DebugLibrary.Shared/DeviceConfiguration/X509DeviceCertificatesPropertiesBase.cs
@@ -3,25 +3,31 @@
// See LICENSE file in the project root for full license information.
//
-using PropertyChanged;
+using CommunityToolkit.Mvvm.ComponentModel;
namespace nanoFramework.Tools.Debugger
{
- [AddINotifyPropertyChangedInterface]
- public class X509DeviceCertificatesPropertiesBase
+ public class X509DeviceCertificatesPropertiesBase : ObservableObject
{
private byte[] _certificate;
+ private uint _certificateSize;
- public uint CertificateSize { get; set; }
+ public uint CertificateSize
+ {
+ get => _certificateSize;
+ set => SetProperty(ref _certificateSize, value);
+ }
public byte[] Certificate
{
get => _certificate;
set
{
- _certificate = value;
- CertificateSize = (uint)value.Length;
+ if (SetProperty(ref _certificate, value))
+ {
+ CertificateSize = (uint)value.Length;
+ }
}
}
}
-}
\ No newline at end of file
+}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/Extensions/OutputExtensions.cs b/nanoFramework.Tools.DebugLibrary.Shared/Extensions/OutputExtensions.cs
index 81e1e480..6e6eed05 100644
--- a/nanoFramework.Tools.DebugLibrary.Shared/Extensions/OutputExtensions.cs
+++ b/nanoFramework.Tools.DebugLibrary.Shared/Extensions/OutputExtensions.cs
@@ -244,7 +244,7 @@ public static string ToStringForOutput(this DeviceConfiguration.Wireless80211Con
output.AppendLine($"radio: {wireless80211Configuration.Radio.ToString()}");
output.AppendLine($"ssid: {wireless80211Configuration.Ssid}");
output.AppendLine($"pwd: {wireless80211Configuration.Password}");
- output.AppendLine($"options: 0x{wireless80211Configuration.Options}");
+ output.AppendLine($"options: 0x{wireless80211Configuration.Wireless80211Options}");
output.AppendLine("");
return output.ToString();
@@ -268,7 +268,7 @@ public static string ToStringForOutput(this DeviceConfiguration.WirelessAPConfig
output.AppendLine($"radio: {wirelesAPConfiguration.Radio.ToString()}");
output.AppendLine($"ssid: {wirelesAPConfiguration.Ssid}");
output.AppendLine($"pwd: {wirelesAPConfiguration.Password}");
- output.AppendLine($"options: 0x{wirelesAPConfiguration.Options}");
+ output.AppendLine($"options: 0x{wirelesAPConfiguration.WirelessAPOptions}");
output.AppendLine($"channel: {wirelesAPConfiguration.Channel.ToString()}");
output.AppendLine($"max connections: {wirelesAPConfiguration.MaxConnections.ToString()}");
output.AppendLine("");
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/NFDevice/NanoDevice.cs b/nanoFramework.Tools.DebugLibrary.Shared/NFDevice/NanoDevice.cs
index 216e6a39..380eb19f 100644
--- a/nanoFramework.Tools.DebugLibrary.Shared/NFDevice/NanoDevice.cs
+++ b/nanoFramework.Tools.DebugLibrary.Shared/NFDevice/NanoDevice.cs
@@ -4,19 +4,29 @@
// See LICENSE file in the project root for full license information.
//
-using nanoFramework.Tools.Debugger.WireProtocol;
-using PropertyChanged;
using System;
using nanoFramework.Tools.Debugger.PortTcpIp;
+using nanoFramework.Tools.Debugger.WireProtocol;
namespace nanoFramework.Tools.Debugger
{
- [AddINotifyPropertyChangedInterface]
public class NanoDevice : NanoDeviceBase, IDisposable, INanoDevice where T : new()
{
- public T Device { get; set; }
+ private T _device;
+ private string _deviceId;
+ private bool _disposed;
- public string DeviceId { get; set; }
+ public T Device
+ {
+ get => _device;
+ set => SetProperty(ref _device, value);
+ }
+
+ public string DeviceId
+ {
+ get => _deviceId;
+ set => SetProperty(ref _deviceId, value);
+ }
public NanoDevice()
{
@@ -30,8 +40,6 @@ public NanoDevice()
#region Disposable implementation
- public bool disposed { get; private set; }
-
~NanoDevice()
{
Dispose(false);
@@ -39,7 +47,7 @@ public NanoDevice()
private void Dispose(bool disposing)
{
- if (!disposed)
+ if (!_disposed)
{
if (disposing)
{
@@ -53,7 +61,7 @@ private void Dispose(bool disposing)
// required to catch exceptions from Engine dispose calls
}
- disposed = true;
+ _disposed = true;
}
}
}
@@ -64,6 +72,7 @@ private void Dispose(bool disposing)
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
#endregion
@@ -78,7 +87,7 @@ public ConnectPortResult Connect()
{
return ConnectionPort.ConnectDevice();
}
-
+
return ConnectPortResult.NotConnected;
}
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/NFDevice/NanoDeviceBase.cs b/nanoFramework.Tools.DebugLibrary.Shared/NFDevice/NanoDeviceBase.cs
index 12a00a38..f2fd5548 100644
--- a/nanoFramework.Tools.DebugLibrary.Shared/NFDevice/NanoDeviceBase.cs
+++ b/nanoFramework.Tools.DebugLibrary.Shared/NFDevice/NanoDeviceBase.cs
@@ -1,95 +1,119 @@
-//
+//
// Copyright (c) .NET Foundation and Contributors
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
// See LICENSE file in the project root for full license information.
//
-using nanoFramework.Tools.Debugger.WireProtocol;
-using PropertyChanged;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
+using CommunityToolkit.Mvvm.ComponentModel;
using nanoFramework.Tools.Debugger.Extensions;
using nanoFramework.Tools.Debugger.PortTcpIp;
+using nanoFramework.Tools.Debugger.WireProtocol;
namespace nanoFramework.Tools.Debugger
{
- [AddINotifyPropertyChangedInterface]
- public abstract class NanoDeviceBase
+ public abstract class NanoDeviceBase : ObservableObject
{
- ///
- /// nanoFramework debug engine.
- ///
- ///
- public Engine DebugEngine { get; set; }
+ private Engine _debugEngine;
+ private TransportType _transport;
+ private IPort _connectionPort;
+ private string _connectionId;
+ private string _targetName;
+ private string _platform;
+ private string _serialNumber;
+ private Guid _deviceUniqueId;
+ private INanoFrameworkDeviceInfo _deviceInfo;
///
- /// Creates a new debug engine for this nanoDevice.
+ /// nanoFramework debug engine.
///
- public void CreateDebugEngine()
+ public Engine DebugEngine
{
- DebugEngine = new Engine(this);
-
- DebugEngine.DefaultTimeout = Transport switch
- {
- TransportType.Serial => NanoSerialDevice.SafeDefaultTimeout,
- TransportType.TcpIp => NanoNetworkDevice.SafeDefaultTimeout,
- _ => throw new NotImplementedException()
- };
+ get => _debugEngine;
+ set => SetProperty(ref _debugEngine, value);
}
///
- /// Creates a new debug engine for this nanoDevice.
+ /// Transport to the device.
///
- ///
- public void CreateDebugEngine(int timeoutMilliseconds)
+ public TransportType Transport
{
- DebugEngine = new Engine(this);
- DebugEngine.DefaultTimeout = NanoSerialDevice.SafeDefaultTimeout;
+ get => _transport;
+ set => SetProperty(ref _transport, value);
}
- ///
- /// Transport to the device.
- ///
- public TransportType Transport { get; set; }
-
///
/// Port here this device is connected.
///
- public IPort ConnectionPort { get; set; }
+ public IPort ConnectionPort
+ {
+ get => _connectionPort;
+ set => SetProperty(ref _connectionPort, value);
+ }
///
/// Id of the connection to the device.
///
- public string ConnectionId { get; internal set; }
+ public string ConnectionId
+ {
+ get => _connectionId;
+ internal set => SetProperty(ref _connectionId, value);
+ }
///
/// Device description.
///
- public string Description => TargetName + " @ " + ConnectionId;
+ public string Description => $"{TargetName} @ {ConnectionId}";
///
/// Target name.
///
- public string TargetName { get; internal set; }
+ public string TargetName
+ {
+ get => _targetName;
+ internal set => SetProperty(ref _targetName, value);
+ }
///
/// Target platform.
///
- public string Platform { get; internal set; }
+ public string Platform
+ {
+ get => _platform;
+ internal set => SetProperty(ref _platform, value);
+ }
///
- /// Device serial number (if define on the target).
+ /// Device serial number (if defined on the target).
///
- public string SerialNumber { get; internal set; }
+ public string SerialNumber
+ {
+ get => _serialNumber;
+ internal set => SetProperty(ref _serialNumber, value);
+ }
///
/// Unique ID of the NanoDevice.
///
- public Guid DeviceUniqueId { get; internal set; }
+ public Guid DeviceUniqueId
+ {
+ get => _deviceUniqueId;
+ internal set => SetProperty(ref _deviceUniqueId, value);
+ }
+
+ ///
+ /// Detailed info about the NanoFramework device hardware, solution and CLR.
+ ///
+ public INanoFrameworkDeviceInfo DeviceInfo
+ {
+ get => _deviceInfo;
+ internal set => SetProperty(ref _deviceInfo, value);
+ }
///
/// Version of nanoBooter.
@@ -127,43 +151,20 @@ public Version CLRVersion
}
}
- ///
- /// Detailed info about the NanoFramework device hardware, solution and CLR.
- ///
- public INanoFrameworkDeviceInfo DeviceInfo { get; internal set; }
-
///
/// This indicates if the device has a proprietary bootloader.
///
- public bool HasProprietaryBooter
- {
- get
- {
- return DebugEngine != null && DebugEngine.HasProprietaryBooter;
- }
- }
+ public bool HasProprietaryBooter => DebugEngine != null && DebugEngine.HasProprietaryBooter;
///
/// This indicates if the target device has nanoBooter.
///
- public bool HasNanoBooter
- {
- get
- {
- return DebugEngine != null && DebugEngine.HasNanoBooter;
- }
- }
+ public bool HasNanoBooter => DebugEngine != null && DebugEngine.HasNanoBooter;
///
- /// This indicates if the target device is IFU capable.
+ /// This indicates if the target device is IFU capable.
///
- public bool IsIFUCapable
- {
- get
- {
- return DebugEngine != null && DebugEngine.IsIFUCapable;
- }
- }
+ public bool IsIFUCapable => DebugEngine != null && DebugEngine.IsIFUCapable;
private readonly object m_serverCert = null;
private readonly Dictionary m_execSrecHash = new Dictionary();
@@ -173,13 +174,6 @@ public bool IsIFUCapable
private readonly AutoResetEvent m_evtMicroBooterError = new AutoResetEvent(false);
private readonly ManualResetEvent m_evtMicroBooterStart = new ManualResetEvent(false);
- protected NanoDeviceBase()
- {
- DeviceInfo = new NanoFrameworkDeviceInfo(this);
-
- DeviceUniqueId = Guid.NewGuid();
- }
-
private bool IsCLRDebuggerEnabled
{
get
@@ -202,8 +196,42 @@ private bool IsCLRDebuggerEnabled
public object DeviceBase { get; internal set; }
+ protected NanoDeviceBase()
+ {
+ DeviceInfo = new NanoFrameworkDeviceInfo(this);
+
+ DeviceUniqueId = Guid.NewGuid();
+ }
+
public abstract void Disconnect(bool force = false);
+ ///
+ /// Creates a new debug engine for this nanoDevice.
+ /// Transport to the device.
+ ///
+ public void CreateDebugEngine()
+ {
+ DebugEngine = new Engine(this);
+
+ DebugEngine.DefaultTimeout = Transport switch
+ {
+ TransportType.Serial => NanoSerialDevice.SafeDefaultTimeout,
+ TransportType.TcpIp => NanoNetworkDevice.SafeDefaultTimeout,
+ _ => throw new NotImplementedException()
+ };
+ }
+
+ ///
+ /// Creates a new debug engine for this nanoDevice.
+ /// Transport to the device.
+ ///
+ ///
+ public void CreateDebugEngine(int timeoutMilliseconds)
+ {
+ DebugEngine = new Engine(this);
+ DebugEngine.DefaultTimeout = NanoSerialDevice.SafeDefaultTimeout;
+ }
+
///
/// Get from device.
/// If the device information has been retrieved before this method returns the cached data, unless the force argument is true.
diff --git a/nanoFramework.Tools.DebugLibrary.Shared/nanoFramework.Tools.DebugLibrary.Net.projitems b/nanoFramework.Tools.DebugLibrary.Shared/nanoFramework.Tools.DebugLibrary.Net.projitems
index d95bcc7e..097f1019 100644
--- a/nanoFramework.Tools.DebugLibrary.Shared/nanoFramework.Tools.DebugLibrary.Net.projitems
+++ b/nanoFramework.Tools.DebugLibrary.Shared/nanoFramework.Tools.DebugLibrary.Net.projitems
@@ -17,6 +17,11 @@
+
+
+
+
+
@@ -24,6 +29,7 @@
+
diff --git a/nanoFramework.Tools.Debugger.sln b/nanoFramework.Tools.Debugger.sln
index d01d7198..04691daf 100644
--- a/nanoFramework.Tools.Debugger.sln
+++ b/nanoFramework.Tools.Debugger.sln
@@ -16,6 +16,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C4E43092-51E8-46C3-8C7A-FD05E9A29FE2}"
ProjectSection(SolutionItems) = preProject
..\azure-pipelines.yml = ..\azure-pipelines.yml
+ README-BEFORE-UPDATE-REFS.txt = README-BEFORE-UPDATE-REFS.txt
..\README.md = ..\README.md
version.json = version.json
EndProjectSection
diff --git a/version.json b/version.json
index 737b0d39..b14fdfa5 100644
--- a/version.json
+++ b/version.json
@@ -1,6 +1,6 @@
-{
+{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
- "version": "2.4",
+ "version": "2.5",
"assemblyVersion": {
"precision": "minor"
},