OneDriver.PowerSupply.Basic 1.2.1

dotnet add package OneDriver.PowerSupply.Basic --version 1.2.1
                    
NuGet\Install-Package OneDriver.PowerSupply.Basic -Version 1.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OneDriver.PowerSupply.Basic" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OneDriver.PowerSupply.Basic" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="OneDriver.PowerSupply.Basic" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OneDriver.PowerSupply.Basic --version 1.2.1
                    
#r "nuget: OneDriver.PowerSupply.Basic, 1.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OneDriver.PowerSupply.Basic@1.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OneDriver.PowerSupply.Basic&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=OneDriver.PowerSupply.Basic&version=1.2.1
                    
Install as a Cake Tool

Release Notes - Cloud-to-Device (C2D) Support

Overview

This release adds support for Cloud-to-Device (C2D) messaging, allowing remote control of the Power Supply device from Azure IoT Hub. In addition to existing real-time telemetry streaming, the device can now receive remote commands such as setting voltage, setting current, and toggling channels.


What's New?

✅ Cloud-to-Device (C2D) Message Handling

  • Implemented background listener using DeviceClient.ReceiveAsync() to process incoming C2D messages.
  • Supported C2D commands:
    • setVoltage: Sets voltage on a specified channel.
    • setCurrent: Sets current on a specified channel.
    • allChannelsOn: Turns all channels ON.
    • allChannelsOff: Turns all channels OFF.

🧠 Intelligent Command Parsing

  • Incoming JSON messages are parsed using Newtonsoft.Json.
  • Commands are matched by an action field and applied accordingly.
  • Invalid or unknown commands are logged without interrupting the loop.

🔄 Continuous Listening

  • C2D listener runs in a background task started from Program.cs.
  • Operates independently of gRPC streaming for telemetry.

Usage Instructions

1. Start the Device App

Run the gRPC server application. On first run, you'll be prompted to enter your Azure IoT Hub device connection string:

dotnet run

2. Open Device Connection (from client)

Use a gRPC client to call:

  • OpenConnection with the correct COM port.
  • StreamProcessData to start telemetry (optional but typical).

3. Send C2D Messages

Send a cloud message using Azure CLI or the Azure Portal.

Example JSON Message:
{
  "action": "setVoltage",
  "channel": 0,
  "voltage": 12.5
}

Other supported actions: setCurrent, allChannelsOn, allChannelsOff.

Azure CLI Example:

az iot device c2d-message send \
  --hub-name korad-power-hub \
  --device-id korad-powersupply-01 \
  --data '{"action":"setVoltage","channel":0,"voltage":12.5}'

Security

  • The device only accepts commands via secure MQTT connection using Azure IoT Hub authentication.
  • Messages are acknowledged and removed from the queue only after successful processing.

What's Next?

  • Extend C2D to include mode switching and parameter validation.
  • Add feedback (cloud-to-cloud) message confirmation to report command success.

C2D support now brings two-way communication to your Power Supply system—enabling full remote monitoring and control from the cloud! ✨

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on OneDriver.PowerSupply.Basic:

Package Downloads
OneDriver.PowerSupply.Factory

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.1 155 4/6/2025
1.2.0 124 4/6/2025
1.1.0 171 4/2/2025
1.0.0 138 3/26/2025