Add netcore and refactoring

This commit is contained in:
BlubbFish 2019-11-25 18:49:57 +01:00
parent e61b7106e2
commit ce73086734
8 changed files with 180 additions and 113 deletions

View File

@ -1,10 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.136
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iot-Interfaces", "Iot-Interfaces\Iot-Interfaces.csproj", "{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +17,10 @@ Global
{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Release|Any CPU.Build.0 = Release|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BlubbFish.Utils.IoT.Interfaces {
public interface IMqtt {

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BlubbFish.Utils.IoT.Interfaces {
public interface ISenml {

View File

@ -46,5 +46,16 @@
<Compile Include="Language\Senml.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\CONTRIBUTING.md" />
<Content Include="..\LICENSE" />
<Content Include="..\README.md" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Utils\Utils\Utils.csproj">
<Project>{fac8ce64-bf13-4ece-8097-aeb5dd060098}</Project>
<Name>Utils</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RootNamespace>BlubbFish.Utils.IoT.Interfaces</RootNamespace>
<AssemblyName>Iot-Interfaces</AssemblyName>
<PackageId>Interfaces.IoT.Utils.BlubbFish</PackageId>
<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
<NeutralLanguage>de-DE</NeutralLanguage>
<Description>Interfaces for IoT-Stuff</Description>
<Authors>BlubbFish</Authors>
<Company>BlubbFish</Company>
<Copyright>Copyright © BlubbFish 2018 - 02.05.2018</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>http://git.blubbfish.net/vs_utils/Iot-Interfaces</PackageProjectUrl>
<RepositoryUrl>http://git.blubbfish.net/vs_utils/Iot-Interfaces.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Utils\Utils\Utils_Core.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="../CONTRIBUTING.md" />
<Content Include="../LICENSE" />
<Content Include="../README.md" />
</ItemGroup>
<ItemGroup>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>

View File

@ -1,14 +1,15 @@
using System;
using System.ComponentModel;
using System.Reflection;
using System.Diagnostics.CodeAnalysis;
namespace BlubbFish.Utils.IoT.Interfaces.Language {
public abstract class Senml {
#pragma warning disable IDE1006 // Benennungsstile
[SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Must be lowercase")]
public String n { get; }
[SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Must be lowercase")]
public String u { get; }
[SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Must be lowercase")]
public Int32 t { get; }
#pragma warning restore IDE1006 // Benennungsstile
public enum Units {
[Description("%")]
@ -27,36 +28,21 @@ namespace BlubbFish.Utils.IoT.Interfaces.Language {
public Senml(String name, Units unit) {
this.n = name;
this.u = this.GetEnumDescription(unit);
this.u = Helper.GetEnumDescription(unit);
this.t = 0;
}
private String GetEnumDescription(Enum value) {
FieldInfo fi = value.GetType().GetField(value.ToString());
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
if (attributes != null && attributes.Length > 0) {
return attributes[0].Description;
} else {
return value.ToString();
}
}
}
public class SenmlBool : Senml {
#pragma warning disable IDE1006 // Benennungsstile
[SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Must be lowercase")]
public Boolean bv { get; }
#pragma warning restore IDE1006 // Benennungsstile
public SenmlBool(String name, Units unit, Boolean level) : base(name, unit) {
this.bv = level;
}
public SenmlBool(String name, Units unit, Boolean level) : base(name, unit) => this.bv = level;
}
public class SenmlDouble : Senml {
#pragma warning disable IDE1006 // Benennungsstile
[SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Must be lowercase")]
public Double v { get; }
#pragma warning restore IDE1006 // Benennungsstile
public SenmlDouble(String name, Units unit, Double level) : base(name, unit) {
this.v = level;
}
public SenmlDouble(String name, Units unit, Double level) : base(name, unit) => this.v = level;
}
}

View File

@ -1,4 +1,6 @@
using System.Reflection;
#if NETCOREAPP
#else
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@ -10,9 +12,10 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("BlubbFish")]
[assembly: AssemblyProduct("Iot-Interfaces")]
[assembly: AssemblyCopyright("Copyright © 2018 - 02.05.2018")]
[assembly: AssemblyCopyright("Copyright © BlubbFish 2018 - 02.05.2018")]
[assembly: AssemblyTrademark("BlubbFish")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("de-DE")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
@ -32,5 +35,6 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
#endif

31
Iot-Interfaces_Core.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Iot-Interfaces_Core", "Iot-Interfaces\Iot-Interfaces_Core.csproj", "{C673B8CF-FCAD-4FEF-9744-DB3E6E546C12}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils_Core", "..\Utils\Utils\Utils_Core.csproj", "{99709124-FAB4-479B-BB01-A34733FF4190}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C673B8CF-FCAD-4FEF-9744-DB3E6E546C12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C673B8CF-FCAD-4FEF-9744-DB3E6E546C12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C673B8CF-FCAD-4FEF-9744-DB3E6E546C12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C673B8CF-FCAD-4FEF-9744-DB3E6E546C12}.Release|Any CPU.Build.0 = Release|Any CPU
{99709124-FAB4-479B-BB01-A34733FF4190}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99709124-FAB4-479B-BB01-A34733FF4190}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99709124-FAB4-479B-BB01-A34733FF4190}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99709124-FAB4-479B-BB01-A34733FF4190}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {81CC4108-C7A3-4B34-A0EE-7EC946F58C28}
EndGlobalSection
EndGlobal