Init
This commit is contained in:
17
Domain/Data.cs
Normal file
17
Domain/Data.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Domain;
|
||||
|
||||
public record class Data(
|
||||
double ConcentrationIndex,
|
||||
double RelaxationIndex,
|
||||
double CognitiveControl,
|
||||
double CognitiveLoad,
|
||||
double Alpha,
|
||||
double Beta,
|
||||
double Theta,
|
||||
double Smr,
|
||||
double MuWave,
|
||||
bool Artifact,
|
||||
double SignalQuality,
|
||||
long PackageIndex,
|
||||
DateTime TimeOfDataGenerate
|
||||
);
|
||||
14
Domain/Domain.csproj
Normal file
14
Domain/Domain.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
71
Domain/Dto/JsonData.cs
Normal file
71
Domain/Dto/JsonData.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
namespace Domain.Dto;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class JsonData
|
||||
{
|
||||
[JsonPropertyName("concentrationIndex")]
|
||||
public double ConcentrationIndex { get; set; }
|
||||
[JsonPropertyName("relaxationIndex")]
|
||||
public double RelaxationIndex { get; set; }
|
||||
[JsonPropertyName("cognitiveControl")]
|
||||
public double CognitiveControl { get; set; }
|
||||
[JsonPropertyName("cognitiveLoad")]
|
||||
public double CognitiveLoad { get; set; }
|
||||
[JsonPropertyName("alpha")]
|
||||
public double Alpha { get; set; }
|
||||
[JsonPropertyName("beta")]
|
||||
public double Beta { get; set; }
|
||||
[JsonPropertyName("theta")]
|
||||
public double Theta { get; set; }
|
||||
[JsonPropertyName("smr")]
|
||||
public double Smr { get; set; }
|
||||
[JsonPropertyName("muWave")]
|
||||
public double MuWave { get; set; }
|
||||
[JsonPropertyName("artifact")]
|
||||
public bool Artifact { get; set; }
|
||||
[JsonPropertyName("signalQuality")]
|
||||
public double SignalQuality { get; set; }
|
||||
[JsonPropertyName("packageIndex")]
|
||||
public long PackageIndex { get; set; }
|
||||
[JsonPropertyName("timeOfDataGenerate")]
|
||||
public DateTime TimeOfDataGenerate { get; set; }
|
||||
|
||||
public JsonData() { }
|
||||
|
||||
public JsonData(Data data)
|
||||
{
|
||||
ConcentrationIndex = data.ConcentrationIndex;
|
||||
RelaxationIndex = data.RelaxationIndex;
|
||||
CognitiveControl = data.CognitiveControl;
|
||||
CognitiveLoad = data.CognitiveLoad;
|
||||
Alpha = data.Alpha;
|
||||
Beta = data.Beta;
|
||||
Theta = data.Theta;
|
||||
Smr = data.Smr;
|
||||
MuWave = data.MuWave;
|
||||
Artifact = data.Artifact;
|
||||
SignalQuality = data.SignalQuality;
|
||||
PackageIndex = data.PackageIndex;
|
||||
TimeOfDataGenerate = data.TimeOfDataGenerate;
|
||||
}
|
||||
|
||||
public Data ToData()
|
||||
{
|
||||
return new Data(
|
||||
ConcentrationIndex,
|
||||
RelaxationIndex,
|
||||
CognitiveControl,
|
||||
CognitiveLoad,
|
||||
Alpha,
|
||||
Beta,
|
||||
Theta,
|
||||
Smr,
|
||||
MuWave,
|
||||
Artifact,
|
||||
SignalQuality,
|
||||
PackageIndex,
|
||||
TimeOfDataGenerate
|
||||
);
|
||||
}
|
||||
}
|
||||
72
Domain/Dto/MessagePackData.cs
Normal file
72
Domain/Dto/MessagePackData.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
namespace Domain.Dto;
|
||||
|
||||
using MessagePack;
|
||||
|
||||
[MessagePackObject]
|
||||
public class MessagePackData
|
||||
{
|
||||
[Key("concentrationIndex")]
|
||||
public double ConcentrationIndex { get; set; }
|
||||
[Key("relaxationIndex")]
|
||||
public double RelaxationIndex { get; set; }
|
||||
[Key("cognitiveControl")]
|
||||
public double CognitiveControl { get; set; }
|
||||
[Key("cognitiveLoad")]
|
||||
public double CognitiveLoad { get; set; }
|
||||
[Key("alpha")]
|
||||
public double Alpha { get; set; }
|
||||
[Key("beta")]
|
||||
public double Beta { get; set; }
|
||||
[Key("theta")]
|
||||
public double Theta { get; set; }
|
||||
[Key("smr")]
|
||||
public double Smr { get; set; }
|
||||
[Key("muWave")]
|
||||
public double MuWave { get; set; }
|
||||
[Key("artifact")]
|
||||
public bool Artifact { get; set; }
|
||||
[Key("signalQuality")]
|
||||
public double SignalQuality { get; set; }
|
||||
[Key("packageIndex")]
|
||||
public long PackageIndex { get; set; }
|
||||
[Key("timeOfDataGenerate")]
|
||||
public DateTime TimeOfDataGenerate { get; set; }
|
||||
|
||||
public MessagePackData() { }
|
||||
|
||||
public MessagePackData(Data data)
|
||||
{
|
||||
ConcentrationIndex = data.ConcentrationIndex;
|
||||
RelaxationIndex = data.RelaxationIndex;
|
||||
CognitiveControl = data.CognitiveControl;
|
||||
CognitiveLoad = data.CognitiveLoad;
|
||||
Alpha = data.Alpha;
|
||||
Beta = data.Beta;
|
||||
Theta = data.Theta;
|
||||
Smr = data.Smr;
|
||||
MuWave = data.MuWave;
|
||||
Artifact = data.Artifact;
|
||||
SignalQuality = data.SignalQuality;
|
||||
PackageIndex = data.PackageIndex;
|
||||
TimeOfDataGenerate = data.TimeOfDataGenerate;
|
||||
}
|
||||
|
||||
public Data ToData()
|
||||
{
|
||||
return new Data(
|
||||
ConcentrationIndex,
|
||||
RelaxationIndex,
|
||||
CognitiveControl,
|
||||
CognitiveLoad,
|
||||
Alpha,
|
||||
Beta,
|
||||
Theta,
|
||||
Smr,
|
||||
MuWave,
|
||||
Artifact,
|
||||
SignalQuality,
|
||||
PackageIndex,
|
||||
TimeOfDataGenerate
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user