.NET Console

The simplest CLI. No bells and whistles, but it gets the job done!

We'll build two versions: One will retrieve sensor data using our REST service, and the other will call the gRPC service.

Console Project for REST

https://github.com/jfcarr/dotnet-iot-tui/tree/main/src/ConsoleClient

Steps:

  1. Create the project, using console as the project type.
  2. Add a project reference to SenseHatLib.csproj
  3. App settings:
    1. Copy the appsettings.default.json file to appsettings.json, and update the setting values.
    2. Add appsettings content entry to the .csproj file.
  4. Implement details in Program.cs

Console Project for gRPC

https://github.com/jfcarr/dotnet-iot-tui/tree/main/src/SenseHatGrpcClient

Steps:

  1. Create the project, using console as the project type.
  2. Add package references to support gRPC: Google.Protobuf, Grpc.Net.Client, and Grpc.Tools.
  3. Add a project reference to SenseHatLib.csproj
  4. App settings:
    1. Copy the appsettings.default.json file to appsettings.json, and update the setting values.
    2. Add appsettings content entry to the .csproj file.
  5. Protocol buffer:
    1. Copy the protocol buffer file from the gRPC service project, and update the namespace.
    2. Add a Protobuf entry to the project file.
  6. Implement details in Program.cs