diff --git a/NucuCar.Domain/NucuCar.Domain.csproj b/NucuCar.Domain/NucuCar.Domain.csproj new file mode 100644 index 0000000..d15bbc4 --- /dev/null +++ b/NucuCar.Domain/NucuCar.Domain.csproj @@ -0,0 +1,24 @@ + + + + netcoreapp3.0 + + + + + Both + Public + True + + True + obj/Debug/netcoreapp3.0/ + MSBuild:Compile + + + + + + + + + diff --git a/NucuCar.Domain/Protos/NucuCarSensors.proto b/NucuCar.Domain/Protos/NucuCarSensors.proto new file mode 100644 index 0000000..597af46 --- /dev/null +++ b/NucuCar.Domain/Protos/NucuCarSensors.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +import "google/protobuf/empty.proto"; + +package NucuCarSensorsProto; + +// General + +enum SensorStateEnum { + Error = 0; + Uninitialized = 1; + Initialized = 2; +} + +// Environment Sensor +service EnvironmentSensorGrpcService { + rpc GetSensorState(google.protobuf.Empty) returns (NucuCarSensorState) {} + rpc GetSensorMeasurement(google.protobuf.Empty) returns (EnvironmentSensorMeasurement) {} +} + +message EnvironmentSensorMeasurement { + double Temperature = 1; + double Pressure = 2; + double Humidity = 3; + double VolatileOrganicCompound = 4; +} + +message NucuCarSensorState { + SensorStateEnum state = 1; +} \ No newline at end of file diff --git a/NucuCar.Sensors/EnvironmentSensor/BackgroundWorker.cs b/NucuCar.Sensors/EnvironmentSensor/BackgroundWorker.cs index 0a7a891..a0b420e 100644 --- a/NucuCar.Sensors/EnvironmentSensor/BackgroundWorker.cs +++ b/NucuCar.Sensors/EnvironmentSensor/BackgroundWorker.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using NucuCarGrpcSensors; +using NucuCarSensorsProto; namespace NucuCar.Sensors.EnvironmentSensor { diff --git a/NucuCar.Sensors/EnvironmentSensor/GrpcService.cs b/NucuCar.Sensors/EnvironmentSensor/GrpcService.cs index 789c133..2d790b5 100644 --- a/NucuCar.Sensors/EnvironmentSensor/GrpcService.cs +++ b/NucuCar.Sensors/EnvironmentSensor/GrpcService.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Google.Protobuf.WellKnownTypes; using Grpc.Core; using Microsoft.Extensions.Logging; -using NucuCarGrpcSensors; +using NucuCarSensorsProto; namespace NucuCar.Sensors.EnvironmentSensor { diff --git a/NucuCar.Sensors/EnvironmentSensor/Sensor.cs b/NucuCar.Sensors/EnvironmentSensor/Sensor.cs index 5160d70..5e51cda 100644 --- a/NucuCar.Sensors/EnvironmentSensor/Sensor.cs +++ b/NucuCar.Sensors/EnvironmentSensor/Sensor.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Iot.Device.Bmxx80; using Iot.Device.Bmxx80.PowerMode; using Microsoft.Extensions.Logging; -using NucuCarGrpcSensors; +using NucuCarSensorsProto; namespace NucuCar.Sensors.EnvironmentSensor { diff --git a/NucuCar.Sensors/NucuCar.Sensors.csproj b/NucuCar.Sensors/NucuCar.Sensors.csproj index 8860e6e..13d2f86 100644 --- a/NucuCar.Sensors/NucuCar.Sensors.csproj +++ b/NucuCar.Sensors/NucuCar.Sensors.csproj @@ -78,16 +78,8 @@ - + - - Both - Public - True - - True - obj/Debug/netcoreapp3.0/ - MSBuild:Compile - + diff --git a/NucuCar.Sensors/Program.cs b/NucuCar.Sensors/Program.cs index 39f26ba..3ad740b 100644 --- a/NucuCar.Sensors/Program.cs +++ b/NucuCar.Sensors/Program.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using NucuCar.Sensors.EnvironmentSensor; +using NucuCar.Sensors; namespace NucuCar.Sensors { @@ -14,7 +14,10 @@ namespace NucuCar.Sensors public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) - .ConfigureServices((hostContext, services) => { services.AddHostedService(); }) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } } \ No newline at end of file diff --git a/NucuCar.Sensors/Protos/NucuCarSensors.proto b/NucuCar.Sensors/Protos/NucuCarSensors.proto deleted file mode 100644 index 3107eb5..0000000 --- a/NucuCar.Sensors/Protos/NucuCarSensors.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; -import "google/protobuf/empty.proto"; - -package NucuCarGrpcSensors; - -// General - -enum SensorStateEnum { - Error = 0; - Uninitialized = 1; - Initialized = 2; -} - -// Environment Sensor -service EnvironmentSensorGrpcService { - rpc GetSensorState(google.protobuf.Empty) returns (NucuCarSensorState) {} - rpc GetSensorMeasurement(google.protobuf.Empty) returns (EnvironmentSensorMeasurement) {} -} - -message EnvironmentSensorMeasurement { - double Temperature = 1; - double Pressure = 2; - double Humidity = 3; - double VolatileOrganicCompound = 4; -} - -message NucuCarSensorState { - SensorStateEnum state = 1; -} \ No newline at end of file diff --git a/NucuCar.TestClient/NucuCar.TestClient.csproj b/NucuCar.TestClient/NucuCar.TestClient.csproj index ee99b5b..007150d 100644 --- a/NucuCar.TestClient/NucuCar.TestClient.csproj +++ b/NucuCar.TestClient/NucuCar.TestClient.csproj @@ -10,7 +10,7 @@ - + diff --git a/NucuCar.TestClient/Program.cs b/NucuCar.TestClient/Program.cs index 809ff4f..cf2c63b 100644 --- a/NucuCar.TestClient/Program.cs +++ b/NucuCar.TestClient/Program.cs @@ -3,8 +3,7 @@ using System.Net.Http; using System.Threading.Tasks; using Google.Protobuf.WellKnownTypes; using Grpc.Net.Client; -using NucuCar.Sensors; -using NucuCarGrpcSensors; +using NucuCarSensorsProto; namespace NucuCar.TestClient { diff --git a/NucuCar.sln b/NucuCar.sln index a5f7632..1945c3c 100644 --- a/NucuCar.sln +++ b/NucuCar.sln @@ -4,6 +4,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.Sensors", "NucuCar. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.TestClient", "NucuCar.TestClient\NucuCar.TestClient.csproj", "{402BE859-07C7-4C77-8F3A-E727988CCFAD}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.Domain", "NucuCar.Domain\NucuCar.Domain.csproj", "{36BDA186-4C90-43C6-8991-A16DE245F91A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -18,5 +20,9 @@ Global {402BE859-07C7-4C77-8F3A-E727988CCFAD}.Debug|Any CPU.Build.0 = Debug|Any CPU {402BE859-07C7-4C77-8F3A-E727988CCFAD}.Release|Any CPU.ActiveCfg = Release|Any CPU {402BE859-07C7-4C77-8F3A-E727988CCFAD}.Release|Any CPU.Build.0 = Release|Any CPU + {36BDA186-4C90-43C6-8991-A16DE245F91A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36BDA186-4C90-43C6-8991-A16DE245F91A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36BDA186-4C90-43C6-8991-A16DE245F91A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36BDA186-4C90-43C6-8991-A16DE245F91A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal