-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
687 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.3.32825.248 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bytewizer.TlsClient", "Bytewizer.TlsClient\Bytewizer.TlsClient.csproj", "{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Debug|Any CPU.Deploy.0 = Debug|Any CPU | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Release|Any CPU.Deploy.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {9117BF18-73E8-4583-9462-AD292A7BCFB3} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\packages\GHIElectronics.TinyCLR.Core.2.2.0.4200\build\net452\GHIElectronics.TinyCLR.Core.props" Condition="Exists('..\packages\GHIElectronics.TinyCLR.Core.2.2.0.4200\build\net452\GHIElectronics.TinyCLR.Core.props')" /> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>Bytewizer.TlsClient</RootNamespace> | ||
<AssemblyName>Bytewizer.TlsClient</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<ProjectTypeGuids>{A1948822-69DD-4150-919B-F3F42EFB71CC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<LangVersion>9</LangVersion> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
<Compile Include="TlsClient.cs" /> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
<None Include="Resources\certificate.crt" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="GHIElectronics.TinyCLR.Devices.Gpio, Version=2.2.0.4200, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\GHIElectronics.TinyCLR.Devices.Gpio.2.2.0.4200\lib\net452\GHIElectronics.TinyCLR.Devices.Gpio.dll</HintPath> | ||
</Reference> | ||
<Reference Include="GHIElectronics.TinyCLR.Devices.Network, Version=2.2.0.4200, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\GHIElectronics.TinyCLR.Devices.Network.2.2.0.4200\lib\net452\GHIElectronics.TinyCLR.Devices.Network.dll</HintPath> | ||
</Reference> | ||
<Reference Include="GHIElectronics.TinyCLR.Devices.Spi, Version=2.2.0.4200, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\GHIElectronics.TinyCLR.Devices.Spi.2.2.0.4200\lib\net452\GHIElectronics.TinyCLR.Devices.Spi.dll</HintPath> | ||
</Reference> | ||
<Reference Include="GHIElectronics.TinyCLR.Devices.Uart, Version=2.2.0.4200, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\GHIElectronics.TinyCLR.Devices.Uart.2.2.0.4200\lib\net452\GHIElectronics.TinyCLR.Devices.Uart.dll</HintPath> | ||
</Reference> | ||
<Reference Include="GHIElectronics.TinyCLR.Native, Version=2.2.0.4200, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\GHIElectronics.TinyCLR.Native.2.2.0.4200\lib\net452\GHIElectronics.TinyCLR.Native.dll</HintPath> | ||
</Reference> | ||
<Reference Include="GHIElectronics.TinyCLR.Networking, Version=2.2.0.4200, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\GHIElectronics.TinyCLR.Networking.2.2.0.4200\lib\net452\GHIElectronics.TinyCLR.Networking.dll</HintPath> | ||
</Reference> | ||
<Reference Include="GHIElectronics.TinyCLR.Networking.Http, Version=2.2.0.4200, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\GHIElectronics.TinyCLR.Networking.Http.2.2.0.4200\lib\net452\GHIElectronics.TinyCLR.Networking.Http.dll</HintPath> | ||
</Reference> | ||
<Reference Include="GHIElectronics.TinyCLR.Pins, Version=2.2.0.4200, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\GHIElectronics.TinyCLR.Pins.2.2.0.4200\lib\net452\GHIElectronics.TinyCLR.Pins.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Properties\Resources.resx"> | ||
<Generator>ResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\packages\GHIElectronics.TinyCLR.Core.2.2.0.4200\build\net452\GHIElectronics.TinyCLR.Core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GHIElectronics.TinyCLR.Core.2.2.0.4200\build\net452\GHIElectronics.TinyCLR.Core.props'))" /> | ||
</Target> | ||
<Target Name="GetSSLCert" BeforeTargets="PrepareForBuild"> | ||
<Exec Command="$(SolutionDir)tools\cert2src.exe https://api.coindesk.com --path $(ProjectDir)Resources" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.3.32825.248 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bytewizer.TlsClient", "Bytewizer.TlsClient\Bytewizer.TlsClient.csproj", "{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Debug|Any CPU.Deploy.0 = Debug|Any CPU | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}.Release|Any CPU.Deploy.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {9117BF18-73E8-4583-9462-AD292A7BCFB3} | ||
EndGlobalSection | ||
EndGlobal |
53 changes: 53 additions & 0 deletions
53
sample/src/Bytewizer.TlsClient/Bytewizer.TlsClient/Bytewizer.TlsClient.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\packages\GHIElectronics.TinyCLR.Core.2.2.0.4200\build\net452\GHIElectronics.TinyCLR.Core.props" Condition="Exists('..\packages\GHIElectronics.TinyCLR.Core.2.2.0.4200\build\net452\GHIElectronics.TinyCLR.Core.props')" /> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{F4D86B90-CA9A-485E-B0E7-53CFCB4366F4}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>Bytewizer.TlsClient</RootNamespace> | ||
<AssemblyName>Bytewizer.TlsClient</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<ProjectTypeGuids>{A1948822-69DD-4150-919B-F3F42EFB71CC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<LangVersion>9</LangVersion> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\packages\GHIElectronics.TinyCLR.Core.2.2.0.4200\build\net452\GHIElectronics.TinyCLR.Core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GHIElectronics.TinyCLR.Core.2.2.0.4200\build\net452\GHIElectronics.TinyCLR.Core.props'))" /> | ||
</Target> | ||
</Project> |
15 changes: 15 additions & 0 deletions
15
sample/src/Bytewizer.TlsClient/Bytewizer.TlsClient/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Diagnostics; | ||
using System.Text; | ||
using System.Threading; | ||
|
||
namespace Bytewizer.TlsClient | ||
{ | ||
internal class Program | ||
{ | ||
static void Main() | ||
{ | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
sample/src/Bytewizer.TlsClient/Bytewizer.TlsClient/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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("Bytewizer.TlsClient")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Bytewizer.TlsClient")] | ||
[assembly: AssemblyCopyright("Copyright © 2022")] | ||
[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)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("f4d86b90-ca9a-485e-b0e7-53cfcb4366f4")] | ||
|
||
// 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")] |
4 changes: 4 additions & 0 deletions
4
sample/src/Bytewizer.TlsClient/Bytewizer.TlsClient/packages.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="GHIElectronics.TinyCLR.Core" version="2.2.0.4200" targetFramework="net48" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Threading; | ||
using System.Diagnostics; | ||
|
||
using GHIElectronics.TinyCLR.Pins; | ||
using GHIElectronics.TinyCLR.Devices.Gpio; | ||
using GHIElectronics.TinyCLR.Devices.Network; | ||
|
||
namespace Bytewizer.TlsClient | ||
{ | ||
internal class Program | ||
{ | ||
static bool _linkReady = false; | ||
|
||
public static NetworkController Controller { get; private set; } | ||
|
||
static void Main() | ||
{ | ||
var resetPin = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PG3); | ||
resetPin.SetDriveMode(GpioPinDriveMode.Output); | ||
|
||
resetPin.Write(GpioPinValue.Low); | ||
Thread.Sleep(100); | ||
|
||
resetPin.Write(GpioPinValue.High); | ||
Thread.Sleep(100); | ||
|
||
Controller = NetworkController.FromName(SC20260.NetworkController.EthernetEmac); | ||
Controller.SetCommunicationInterfaceSettings(new BuiltInNetworkCommunicationInterfaceSettings()); | ||
Controller.SetInterfaceSettings(new EthernetNetworkInterfaceSettings() | ||
{ | ||
DhcpEnable = true, | ||
DynamicDnsEnable = true, | ||
MacAddress = new byte[6] { 0x00, 0x8D, 0xB4, 0x49, 0xAD, 0xBD } | ||
}); | ||
Controller.SetAsDefaultController(); | ||
Controller.NetworkAddressChanged += NetworkController_NetworkAddressChanged; | ||
Controller.Enable(); | ||
|
||
while (_linkReady == false); | ||
|
||
var tlsClient = new TlsClient(); | ||
tlsClient.Connect("https://api.coindesk.com/v1/bpi/currentprice.json"); | ||
} | ||
|
||
private static void NetworkController_NetworkAddressChanged | ||
(NetworkController sender, NetworkAddressChangedEventArgs e) | ||
{ | ||
var ipProperties = sender.GetIPProperties(); | ||
var address = ipProperties.Address.GetAddressBytes(); | ||
|
||
_linkReady = address[0] != 0; | ||
Debug.WriteLine("IP: " + address[0] + "." + address[1] + "." + address[2] + "." + address[3]); | ||
} | ||
} | ||
} |
Oops, something went wrong.