From d40add60f462f853f86fedd258ec4e84eeedd8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Tue, 18 Dec 2018 14:14:40 +0000 Subject: [PATCH] Updates for nanoFramework MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update NuGets to latest stable versions. - Update SSL API calls to match latest changes. - Update dependencies in nuspecs. - Add ServiceBus example. Signed-off-by: José Simões --- .../Device.SmallMemory.nanoFramework.nfproj | 13 +- .../NetworkHelpers.cs | 138 ++++++++++++++++++ .../Program.cs | 9 +- .../packages.config | 4 +- .../Device.Thermometer.nanoFramework.nfproj | 16 +- .../Program.cs | 8 + .../packages.config | 7 +- .../Program.cs | 51 +++++++ .../Properties/AssemblyInfo.cs | 33 +++++ .../ServiceBus.EventHub.nanoFramework.nfproj | 56 +++++++ .../packages.config | 6 + amqp-nanoFramework.sln | 47 +++--- nanoFramework/Amqp.Micro.nanoFramework.nfproj | 20 +-- nanoFramework/Amqp.nanoFramework.nfproj | 20 +-- nanoFramework/Test.Amqp.nanoFramework.nfproj | 22 ++- nanoFramework/packages.config | 10 +- netmf/NetMF/TcpTransport.cs | 12 ++ netmf/NetMFLite/Client.cs | 2 +- nuspec/AMQPNetLite.nanoFramework.nuspec | 10 +- nuspec/AMQPNetMicro.nanoFramework.nuspec | 10 +- 20 files changed, 419 insertions(+), 75 deletions(-) create mode 100644 Examples/Device/Device.SmallMemory.nanoFramework/NetworkHelpers.cs create mode 100644 Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/Program.cs create mode 100644 Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/Properties/AssemblyInfo.cs create mode 100644 Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/ServiceBus.EventHub.nanoFramework.nfproj create mode 100644 Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/packages.config diff --git a/Examples/Device/Device.SmallMemory.nanoFramework/Device.SmallMemory.nanoFramework.nfproj b/Examples/Device/Device.SmallMemory.nanoFramework/Device.SmallMemory.nanoFramework.nfproj index d45a7b5..0398c09 100644 --- a/Examples/Device/Device.SmallMemory.nanoFramework/Device.SmallMemory.nanoFramework.nfproj +++ b/Examples/Device/Device.SmallMemory.nanoFramework/Device.SmallMemory.nanoFramework.nfproj @@ -18,6 +18,7 @@ + @@ -25,8 +26,16 @@ - - ..\..\..\packages\nanoFramework.CoreLibrary.1.0.6-preview-021\lib\mscorlib.dll + + ..\..\..\packages\nanoFramework.CoreLibrary.1.1.0\lib\mscorlib.dll + + + ..\..\..\packages\nanoFramework.Runtime.Events.1.0.2\lib\nanoFramework.Runtime.Events.dll + True + True + + + ..\..\..\packages\nanoFramework.System.Net.1.0.2\lib\System.Net.dll True True diff --git a/Examples/Device/Device.SmallMemory.nanoFramework/NetworkHelpers.cs b/Examples/Device/Device.SmallMemory.nanoFramework/NetworkHelpers.cs new file mode 100644 index 0000000..182fe69 --- /dev/null +++ b/Examples/Device/Device.SmallMemory.nanoFramework/NetworkHelpers.cs @@ -0,0 +1,138 @@ +// ------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation +// All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this +// file except in compliance with the License. You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +// EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR +// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR +// NON-INFRINGEMENT. +// +// See the Apache Version 2.0 License for specific language governing permissions and +// limitations under the License. +// ------------------------------------------------------------------------------------ + +using nanoFramework.Runtime.Events; +using System; +using System.Net.NetworkInformation; +using System.Threading; + +namespace nanoFramework.Networking +{ + public class NetworkHelpers + { + // this is required if the device is connecting through Wi-Fi (typically ESP32 devices) + private const string c_SSID = "myssid"; + private const string c_AP_PASSWORD = "mypassword"; + + private static bool _requiresDateTime; + + /// + /// Event signalling that the target has a valid IP address. + /// + static public ManualResetEvent IpAddressAvailable = new ManualResetEvent(false); + + /// + /// Event signalling that the target has valid . + /// + static public ManualResetEvent DateTimeAvailable = new ManualResetEvent(false); + + public static void SetupAndConnectNetwork(bool requiresDateTime = false) + { + NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(AddressChangedCallback); + + _requiresDateTime = requiresDateTime; + + new Thread(WorkingThread).Start(); + } + + internal static void WorkingThread() + { + NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces(); + + if (nis.Length > 0) + { + // get the first interface + NetworkInterface ni = nis[0]; + + if (ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211) + { + // network interface is Wi-Fi + Console.WriteLine("Network connection is: Wi-Fi"); + + Wireless80211Configuration wc = Wireless80211Configuration.GetAllWireless80211Configurations()[ni.SpecificConfigId]; + if (wc.Ssid != c_SSID && wc.Password != c_AP_PASSWORD) + { + // have to update Wi-Fi configuration + wc.Ssid = c_SSID; + wc.Password = c_AP_PASSWORD; + wc.SaveConfiguration(); + } + else + { // Wi-Fi configuration matches + } + } + else + { + // network interface is Ethernet + Console.WriteLine("Network connection is: Ethernet"); + + ni.EnableAutomaticDns(); + ni.EnableDhcp(); + } + + // check if we have an IP + CheckIP(); + + if (_requiresDateTime) + { + IpAddressAvailable.WaitOne(); + + SetDateTime(); + } + } + else + { + throw new NotSupportedException("ERROR: there is no network interface configured.\r\nOpen the 'Edit Network Configuration' in Device Explorer and configure one."); + } + } + + private static void SetDateTime() + { + Console.WriteLine("Setting up system clock..."); + + // if SNTP is available and enabled on target device this can be skipped because we should have a valid date & time + while (DateTime.UtcNow.Year < 2018) + { + Console.WriteLine("Waiting for valid date time..."); + // wait for valid date & time + Thread.Sleep(1000); + } + + DateTimeAvailable.Set(); + } + + private static void CheckIP() + { + Console.WriteLine("Checking for IP"); + + NetworkInterface ni = NetworkInterface.GetAllNetworkInterfaces()[0]; + if (ni.IPv4Address != null && ni.IPv4Address.Length > 0) + { + if (ni.IPv4Address[0] != '0') + { + Console.WriteLine($"We have an IP: {ni.IPv4Address}"); + IpAddressAvailable.Set(); + } + } + } + + static void AddressChangedCallback(object sender, EventArgs e) + { + CheckIP(); + } + } +} diff --git a/Examples/Device/Device.SmallMemory.nanoFramework/Program.cs b/Examples/Device/Device.SmallMemory.nanoFramework/Program.cs index 2b0bc56..5473597 100644 --- a/Examples/Device/Device.SmallMemory.nanoFramework/Program.cs +++ b/Examples/Device/Device.SmallMemory.nanoFramework/Program.cs @@ -19,7 +19,7 @@ using System; using System.Threading; using Amqp; using Amqp.Types; - +using nanoFramework.Networking; namespace Device.SmallMemory { @@ -42,6 +42,13 @@ namespace Device.SmallMemory public static void Main() { + // setup and connect network + NetworkHelpers.SetupAndConnectNetwork(true); + + // wait for network and valid system date time + NetworkHelpers.IpAddressAvailable.WaitOne(); + NetworkHelpers.DateTimeAvailable.WaitOne(); + Send(); } diff --git a/Examples/Device/Device.SmallMemory.nanoFramework/packages.config b/Examples/Device/Device.SmallMemory.nanoFramework/packages.config index 5a3abb0..fd4d7cb 100644 --- a/Examples/Device/Device.SmallMemory.nanoFramework/packages.config +++ b/Examples/Device/Device.SmallMemory.nanoFramework/packages.config @@ -1,4 +1,6 @@  - + + + \ No newline at end of file diff --git a/Examples/Device/Device.Thermometer.nanoFramework/Device.Thermometer.nanoFramework.nfproj b/Examples/Device/Device.Thermometer.nanoFramework/Device.Thermometer.nanoFramework.nfproj index 6c869ff..caf2539 100644 --- a/Examples/Device/Device.Thermometer.nanoFramework/Device.Thermometer.nanoFramework.nfproj +++ b/Examples/Device/Device.Thermometer.nanoFramework/Device.Thermometer.nanoFramework.nfproj @@ -18,6 +18,7 @@ + @@ -25,18 +26,21 @@ - - ..\..\..\packages\nanoFramework.CoreLibrary.1.0.6-preview-021\lib\mscorlib.dll + + ..\..\..\packages\nanoFramework.CoreLibrary.1.1.0\lib\mscorlib.dll + + + ..\..\..\packages\nanoFramework.Runtime.Events.1.0.2\lib\nanoFramework.Runtime.Events.dll True True - - ..\..\..\packages\nanoFramework.Runtime.Events.1.0.2-preview-023\lib\nanoFramework.Runtime.Events.dll + + ..\..\..\packages\nanoFramework.System.Net.1.0.2\lib\System.Net.dll True True - - ..\..\..\packages\nanoFramework.Windows.Devices.Gpio.1.0.2-preview-025\lib\Windows.Devices.Gpio.dll + + ..\..\..\packages\nanoFramework.Windows.Devices.Gpio.1.0.2\lib\Windows.Devices.Gpio.dll True True diff --git a/Examples/Device/Device.Thermometer.nanoFramework/Program.cs b/Examples/Device/Device.Thermometer.nanoFramework/Program.cs index 365f58d..c89cae7 100644 --- a/Examples/Device/Device.Thermometer.nanoFramework/Program.cs +++ b/Examples/Device/Device.Thermometer.nanoFramework/Program.cs @@ -18,6 +18,7 @@ using System; using System.Threading; using Amqp; +using nanoFramework.Networking; using Windows.Devices.Gpio; using AmqpTrace = Amqp.Trace; @@ -45,6 +46,9 @@ namespace Device.Thermometer public static void Main() { + // setup and connect network + NetworkHelpers.SetupAndConnectNetwork(true); + // setup user button // F769I-DISCO -> USER_BUTTON is @ PA0 -> (0 * 16) + 0 = 0 _userButton = GpioController.GetDefault().OpenPin(0); @@ -58,6 +62,10 @@ namespace Device.Thermometer temperature = 68; changed = new AutoResetEvent(true); + // wait for network and valid system date time + NetworkHelpers.IpAddressAvailable.WaitOne(); + NetworkHelpers.DateTimeAvailable.WaitOne(); + new Thread(Listen).Start(); Thread.Sleep(Timeout.Infinite); diff --git a/Examples/Device/Device.Thermometer.nanoFramework/packages.config b/Examples/Device/Device.Thermometer.nanoFramework/packages.config index 25a8828..9b25037 100644 --- a/Examples/Device/Device.Thermometer.nanoFramework/packages.config +++ b/Examples/Device/Device.Thermometer.nanoFramework/packages.config @@ -1,6 +1,7 @@  - - - + + + + \ No newline at end of file diff --git a/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/Program.cs b/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/Program.cs new file mode 100644 index 0000000..0df01e9 --- /dev/null +++ b/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/Program.cs @@ -0,0 +1,51 @@ +// ------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation +// All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this +// file except in compliance with the License. You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +// EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR +// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR +// NON-INFRINGEMENT. +// +// See the Apache Version 2.0 License for specific language governing permissions and +// limitations under the License. +// ------------------------------------------------------------------------------------ + +using System; +using Amqp; +using nanoFramework.Networking; +using ServiceBus.Scenarios; +using AmqpTrace = Amqp.Trace; + +namespace ServiceBus.EventHub +{ + public class Program + { + public static void Main() + { + // setup and connect network + NetworkHelpers.SetupAndConnectNetwork(true); + + AmqpTrace.TraceLevel = TraceLevel.Information; + AmqpTrace.TraceListener = (l, f, a) => Console.WriteLine(Fx.Format(f, a)); + Connection.DisableServerCertValidation = true; + + // wait for network and valid system date time + NetworkHelpers.IpAddressAvailable.WaitOne(); + NetworkHelpers.DateTimeAvailable.WaitOne(); + + try + { + new EventHubsExample().Run(); + } + catch (Exception e) + { + AmqpTrace.WriteLine(TraceLevel.Error, e.ToString()); + } + } + } +} \ No newline at end of file diff --git a/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/Properties/AssemblyInfo.cs b/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2461d52 --- /dev/null +++ b/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ServiceBus.EventHub")] +[assembly: AssemblyDescription("AMQP Lite Servicebus EventHub example project for nanoFramework")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ServiceBus.EventHub")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/ServiceBus.EventHub.nanoFramework.nfproj b/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/ServiceBus.EventHub.nanoFramework.nfproj new file mode 100644 index 0000000..7af39b9 --- /dev/null +++ b/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/ServiceBus.EventHub.nanoFramework.nfproj @@ -0,0 +1,56 @@ + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 87b9bb65-b55f-4639-8de9-6612c7675c22 + Exe + Properties + 512 + ServiceBus.EventHub.nanoFramework + ServiceBus.EventHub.nanoFramework + v1.0 + + + + + + + + + + + + + + + ..\packages\nanoFramework.CoreLibrary.1.1.0\lib\mscorlib.dll + True + True + + + ..\packages\nanoFramework.Runtime.Events.1.0.2\lib\nanoFramework.Runtime.Events.dll + True + True + + + ..\packages\nanoFramework.System.Net.1.0.2\lib\System.Net.dll + True + True + + + + + + + + + + + + \ No newline at end of file diff --git a/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/packages.config b/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/packages.config new file mode 100644 index 0000000..fd4d7cb --- /dev/null +++ b/Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/amqp-nanoFramework.sln b/amqp-nanoFramework.sln index ce3f288..a6e49ad 100644 --- a/amqp-nanoFramework.sln +++ b/amqp-nanoFramework.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27703.2047 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Amqp.nanoFramework", "nanoFramework\Amqp.nanoFramework.nfproj", "{85CCCE74-74B0-426A-AE98-CC37E3C269C0}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Amqp.nanoFramework", "nanoFramework\Amqp.nanoFramework.nfproj", "{FD8A8669-2183-4D5C-87B7-1CAB4CD26E90}" EndProject -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Amqp.Micro.nanoFramework", "nanoFramework\Amqp.Micro.nanoFramework.nfproj", "{3FEB1DBC-D7FA-4F64-9F22-260755DC5CFB}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Amqp.Micro.nanoFramework", "nanoFramework\Amqp.Micro.nanoFramework.nfproj", "{F66A975C-A958-4D17-BCF3-AC28CE9D460B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{293DB0BF-B993-42B0-953E-200F01869A92}" EndProject @@ -13,7 +13,9 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Device.Thermometer.nanoFram EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Device.SmallMemory.nanoFramework", "Examples\Device\Device.SmallMemory.nanoFramework\Device.SmallMemory.nanoFramework.nfproj", "{058153C5-5319-43B3-A10B-C50521ED02EA}" EndProject -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Test.Amqp.nanoFramework", "nanoFramework\Test.Amqp.nanoFramework.nfproj", "{BB6F7AFC-95FA-4D1B-9D81-B5F9266EDFD2}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Test.Amqp.nanoFramework", "nanoFramework\Test.Amqp.nanoFramework.nfproj", "{3E5028BE-B7FA-4D5D-A931-132032FD1171}" +EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "ServiceBus.EventHub.nanoFramework", "Examples\ServiceBus\ServiceBus.EventHub.nanoFramework\ServiceBus.EventHub.nanoFramework.nfproj", "{87B9BB65-B55F-4639-8DE9-6612C7675C22}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,16 +23,16 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {85CCCE74-74B0-426A-AE98-CC37E3C269C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {85CCCE74-74B0-426A-AE98-CC37E3C269C0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {85CCCE74-74B0-426A-AE98-CC37E3C269C0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {85CCCE74-74B0-426A-AE98-CC37E3C269C0}.Release|Any CPU.Build.0 = Release|Any CPU - {85CCCE74-74B0-426A-AE98-CC37E3C269C0}.Release|Any CPU.Deploy.0 = Release|Any CPU - {3FEB1DBC-D7FA-4F64-9F22-260755DC5CFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3FEB1DBC-D7FA-4F64-9F22-260755DC5CFB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3FEB1DBC-D7FA-4F64-9F22-260755DC5CFB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3FEB1DBC-D7FA-4F64-9F22-260755DC5CFB}.Release|Any CPU.Build.0 = Release|Any CPU - {3FEB1DBC-D7FA-4F64-9F22-260755DC5CFB}.Release|Any CPU.Deploy.0 = Release|Any CPU + {FD8A8669-2183-4D5C-87B7-1CAB4CD26E90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD8A8669-2183-4D5C-87B7-1CAB4CD26E90}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD8A8669-2183-4D5C-87B7-1CAB4CD26E90}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD8A8669-2183-4D5C-87B7-1CAB4CD26E90}.Release|Any CPU.Build.0 = Release|Any CPU + {FD8A8669-2183-4D5C-87B7-1CAB4CD26E90}.Release|Any CPU.Deploy.0 = Release|Any CPU + {F66A975C-A958-4D17-BCF3-AC28CE9D460B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F66A975C-A958-4D17-BCF3-AC28CE9D460B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F66A975C-A958-4D17-BCF3-AC28CE9D460B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F66A975C-A958-4D17-BCF3-AC28CE9D460B}.Release|Any CPU.Build.0 = Release|Any CPU + {F66A975C-A958-4D17-BCF3-AC28CE9D460B}.Release|Any CPU.Deploy.0 = Release|Any CPU {AA510BD3-3AA7-4D0C-8B2E-FD03FEE288F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AA510BD3-3AA7-4D0C-8B2E-FD03FEE288F4}.Debug|Any CPU.Build.0 = Debug|Any CPU {AA510BD3-3AA7-4D0C-8B2E-FD03FEE288F4}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -38,16 +40,20 @@ Global {AA510BD3-3AA7-4D0C-8B2E-FD03FEE288F4}.Release|Any CPU.Deploy.0 = Release|Any CPU {058153C5-5319-43B3-A10B-C50521ED02EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {058153C5-5319-43B3-A10B-C50521ED02EA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {058153C5-5319-43B3-A10B-C50521ED02EA}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {058153C5-5319-43B3-A10B-C50521ED02EA}.Release|Any CPU.ActiveCfg = Release|Any CPU {058153C5-5319-43B3-A10B-C50521ED02EA}.Release|Any CPU.Build.0 = Release|Any CPU {058153C5-5319-43B3-A10B-C50521ED02EA}.Release|Any CPU.Deploy.0 = Release|Any CPU - {BB6F7AFC-95FA-4D1B-9D81-B5F9266EDFD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BB6F7AFC-95FA-4D1B-9D81-B5F9266EDFD2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BB6F7AFC-95FA-4D1B-9D81-B5F9266EDFD2}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {BB6F7AFC-95FA-4D1B-9D81-B5F9266EDFD2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BB6F7AFC-95FA-4D1B-9D81-B5F9266EDFD2}.Release|Any CPU.Build.0 = Release|Any CPU - {BB6F7AFC-95FA-4D1B-9D81-B5F9266EDFD2}.Release|Any CPU.Deploy.0 = Release|Any CPU + {3E5028BE-B7FA-4D5D-A931-132032FD1171}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E5028BE-B7FA-4D5D-A931-132032FD1171}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E5028BE-B7FA-4D5D-A931-132032FD1171}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E5028BE-B7FA-4D5D-A931-132032FD1171}.Release|Any CPU.Build.0 = Release|Any CPU + {3E5028BE-B7FA-4D5D-A931-132032FD1171}.Release|Any CPU.Deploy.0 = Release|Any CPU + {87B9BB65-B55F-4639-8DE9-6612C7675C22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {87B9BB65-B55F-4639-8DE9-6612C7675C22}.Debug|Any CPU.Build.0 = Debug|Any CPU + {87B9BB65-B55F-4639-8DE9-6612C7675C22}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {87B9BB65-B55F-4639-8DE9-6612C7675C22}.Release|Any CPU.ActiveCfg = Release|Any CPU + {87B9BB65-B55F-4639-8DE9-6612C7675C22}.Release|Any CPU.Build.0 = Release|Any CPU + {87B9BB65-B55F-4639-8DE9-6612C7675C22}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -55,6 +61,7 @@ Global GlobalSection(NestedProjects) = preSolution {AA510BD3-3AA7-4D0C-8B2E-FD03FEE288F4} = {293DB0BF-B993-42B0-953E-200F01869A92} {058153C5-5319-43B3-A10B-C50521ED02EA} = {293DB0BF-B993-42B0-953E-200F01869A92} + {87B9BB65-B55F-4639-8DE9-6612C7675C22} = {293DB0BF-B993-42B0-953E-200F01869A92} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BD6F2812-CD19-4447-B98C-4961F6F0BDC8} diff --git a/nanoFramework/Amqp.Micro.nanoFramework.nfproj b/nanoFramework/Amqp.Micro.nanoFramework.nfproj index 8d52729..1d90fc7 100644 --- a/nanoFramework/Amqp.Micro.nanoFramework.nfproj +++ b/nanoFramework/Amqp.Micro.nanoFramework.nfproj @@ -104,28 +104,28 @@ - - ..\packages\nanoFramework.CoreLibrary.1.0.6-preview-021\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.1.0\lib\mscorlib.dll True True - - ..\packages\nanoFramework.Runtime.Events.1.0.2-preview-023\lib\nanoFramework.Runtime.Events.dll + + ..\packages\nanoFramework.Runtime.Events.1.0.2\lib\nanoFramework.Runtime.Events.dll True True - - ..\packages\nanoFramework.Runtime.Native.1.0.2-preview-016\lib\nanoFramework.Runtime.Native.dll + + ..\packages\nanoFramework.Runtime.Native.1.0.2\lib\nanoFramework.Runtime.Native.dll True True - - ..\packages\nanoFramework.System.Math.1.0.2-preview-015\lib\System.Math.dll + + ..\packages\nanoFramework.System.Math.1.0.2\lib\System.Math.dll True True - - ..\packages\nanoFramework.System.Net.1.0.2-preview-023\lib\System.Net.dll + + ..\packages\nanoFramework.System.Net.1.0.2\lib\System.Net.dll True True diff --git a/nanoFramework/Amqp.nanoFramework.nfproj b/nanoFramework/Amqp.nanoFramework.nfproj index 27cb1be..8b1f9d5 100644 --- a/nanoFramework/Amqp.nanoFramework.nfproj +++ b/nanoFramework/Amqp.nanoFramework.nfproj @@ -293,28 +293,28 @@ - - ..\packages\nanoFramework.CoreLibrary.1.0.6-preview-021\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.1.0\lib\mscorlib.dll True True - - ..\packages\nanoFramework.Runtime.Events.1.0.2-preview-023\lib\nanoFramework.Runtime.Events.dll + + ..\packages\nanoFramework.Runtime.Events.1.0.2\lib\nanoFramework.Runtime.Events.dll True True - - ..\packages\nanoFramework.Runtime.Native.1.0.2-preview-016\lib\nanoFramework.Runtime.Native.dll + + ..\packages\nanoFramework.Runtime.Native.1.0.2\lib\nanoFramework.Runtime.Native.dll True True - - ..\packages\nanoFramework.System.Math.1.0.2-preview-015\lib\System.Math.dll + + ..\packages\nanoFramework.System.Math.1.0.2\lib\System.Math.dll True True - - ..\packages\nanoFramework.System.Net.1.0.2-preview-023\lib\System.Net.dll + + ..\packages\nanoFramework.System.Net.1.0.2\lib\System.Net.dll True True diff --git a/nanoFramework/Test.Amqp.nanoFramework.nfproj b/nanoFramework/Test.Amqp.nanoFramework.nfproj index 8350e29..6ce571c 100644 --- a/nanoFramework/Test.Amqp.nanoFramework.nfproj +++ b/nanoFramework/Test.Amqp.nanoFramework.nfproj @@ -34,18 +34,28 @@ - - ..\packages\nanoFramework.CoreLibrary.1.0.6-preview-021\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.1.0\lib\mscorlib.dll True True - - ..\packages\nanoFramework.Runtime.Events.1.0.2-preview-023\lib\nanoFramework.Runtime.Events.dll + + ..\packages\nanoFramework.Runtime.Events.1.0.2\lib\nanoFramework.Runtime.Events.dll True True - - ..\packages\nanoFramework.System.Net.1.0.2-preview-023\lib\System.Net.dll + + ..\packages\nanoFramework.Runtime.Native.1.0.2\lib\nanoFramework.Runtime.Native.dll + True + True + + + ..\packages\nanoFramework.System.Math.1.0.2\lib\System.Math.dll + True + True + + + ..\packages\nanoFramework.System.Net.1.0.2\lib\System.Net.dll True True diff --git a/nanoFramework/packages.config b/nanoFramework/packages.config index e355dfd..f7846a8 100644 --- a/nanoFramework/packages.config +++ b/nanoFramework/packages.config @@ -1,8 +1,8 @@  - - - - - + + + + + \ No newline at end of file diff --git a/netmf/NetMF/TcpTransport.cs b/netmf/NetMF/TcpTransport.cs index 66c78db..a108edf 100644 --- a/netmf/NetMF/TcpTransport.cs +++ b/netmf/NetMF/TcpTransport.cs @@ -70,11 +70,23 @@ namespace Amqp if (address.UseSsl) { SslSocket sslSocket = new SslSocket(socket); + +#if (MF_FRAMEWORK_VERSION_V4_2 || MF_FRAMEWORK_VERSION_V4_3 || MF_FRAMEWORK_VERSION_V4_4) sslSocket.AuthenticateAsClient( address.Host, null, noVerification ? SslVerification.NoVerification : SslVerification.VerifyPeer, SslProtocols.Default); +#elif (NANOFRAMEWORK_V1_0) + + sslSocket.SslVerification = noVerification ? SslVerification.NoVerification : SslVerification.VerifyPeer; + + sslSocket.AuthenticateAsClient( + address.Host, + null, + SslProtocols.TLSv11); +#endif + this.socketTransport = sslSocket; } else diff --git a/netmf/NetMFLite/Client.cs b/netmf/NetMFLite/Client.cs index c9ad078..b24317b 100644 --- a/netmf/NetMFLite/Client.cs +++ b/netmf/NetMFLite/Client.cs @@ -777,7 +777,7 @@ namespace Amqp #if (MF_FRAMEWORK_VERSION_V4_2 || MF_FRAMEWORK_VERSION_V4_3 || MF_FRAMEWORK_VERSION_V4_4) sslStream.AuthenticateAsClient(host, null, SslVerification.VerifyPeer, SslProtocols.TLSv1); #elif (NANOFRAMEWORK_V1_0) - sslStream.AuthenticateAsClient(host, null, SslVerification.VerifyPeer, SslProtocols.TLSv11); + sslStream.AuthenticateAsClient(host, null, SslProtocols.TLSv11); #endif stream = sslStream; diff --git a/nuspec/AMQPNetLite.nanoFramework.nuspec b/nuspec/AMQPNetLite.nanoFramework.nuspec index f81c58a..6b845fb 100644 --- a/nuspec/AMQPNetLite.nanoFramework.nuspec +++ b/nuspec/AMQPNetLite.nanoFramework.nuspec @@ -18,11 +18,11 @@ Copyright 2014 AMQP net netmf nf nanoframework - - - - - + + + + + diff --git a/nuspec/AMQPNetMicro.nanoFramework.nuspec b/nuspec/AMQPNetMicro.nanoFramework.nuspec index 180be6b..c270324 100644 --- a/nuspec/AMQPNetMicro.nanoFramework.nuspec +++ b/nuspec/AMQPNetMicro.nanoFramework.nuspec @@ -14,11 +14,11 @@ Copyright 2014 AMQP netmf nf nanoframework - - - - - + + + + +