Skip to content

Conversation

@longkerdandy
Copy link
Owner

Updated README to add TCK compatibility test results in table format.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Eclipse™ Sparkplug™ TCK (Test Compatibility Kit) compatibility test results to the README and implements supporting functionality to enable TCK testing. The changes include adding scan rate command support, introducing a profile-based configuration system, and enhancing the host application's subscription management.

Key Changes:

  • Added TCK compatibility test results table to README showing 5 passed tests and 1 unsupported feature
  • Implemented scan rate command functionality for both Edge Nodes and Devices
  • Introduced profile-based configuration system (IProfile interface with TCK and MIMIC implementations) to support different deployment scenarios

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
README.md Added TCK compatibility test results section with test status table
SparkplugHostApplication.cs Enhanced logging with MQTT client ID, improved subscription management to support wildcard topics
SparkplugHostApplicationExtensions.cs Added PublishEdgeNodeScanRateCommandAsync and PublishDeviceScanRateCommandAsync methods with validation
SparkplugClientOptions.cs Added AlwaysSubscribeToWildcardTopic property to support TCK test requirements
Program.cs Refactored to use profile-based configuration with command-line argument support
SimpleHostApplication.cs Extended SendCommandAsync to support both Rebirth and ScanRate command types
IProfile.cs New interface defining contract for configuration profiles
TckApplicationProfile.cs New profile for TCK testing with localhost broker configuration
MimicApplicationProfile.cs New profile for MIMIC simulator with HiveMQ broker configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +64 to +89
if (scanRate <= 0)
throw new ArgumentOutOfRangeException(nameof(scanRate), scanRate, "Scan rate must be greater than zero.");

var payload = CreateScanRatePayload(true, scanRate);
return hostApplication.PublishEdgeNodeCommandMessageAsync(groupId, edgeNodeId, payload);
}

/// <summary>
/// Sends a Scan Rate command to a specific Device
/// </summary>
/// <param name="hostApplication">The Sparkplug Host Application instance</param>
/// <param name="groupId">The Sparkplug Group ID</param>
/// <param name="edgeNodeId">The Sparkplug Edge Node ID</param>
/// <param name="deviceId">The Sparkplug Device ID</param>
/// <param name="scanRate">The scan rate value in milliseconds</param>
/// <returns>The MQTT Client Publish Result</returns>
public static Task<MqttClientPublishResult> PublishDeviceScanRateCommandAsync(
this SparkplugHostApplication hostApplication, string groupId, string edgeNodeId, string deviceId,
long scanRate)
{
ArgumentNullException.ThrowIfNull(hostApplication);
SparkplugNamespace.ValidateNamespaceElement(groupId, nameof(groupId));
SparkplugNamespace.ValidateNamespaceElement(edgeNodeId, nameof(edgeNodeId));
SparkplugNamespace.ValidateNamespaceElement(deviceId, nameof(deviceId));
if (scanRate <= 0)
throw new ArgumentOutOfRangeException(nameof(scanRate), scanRate, "Scan rate must be greater than zero.");
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The scan rate validation logic if (scanRate <= 0) throw new ArgumentOutOfRangeException(...) is duplicated in both PublishEdgeNodeScanRateCommandAsync (lines 64-65) and PublishDeviceScanRateCommandAsync (lines 88-89). Consider extracting this validation into a private helper method to reduce code duplication and ensure consistency.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@longkerdandy longkerdandy merged commit 4f84390 into develop Nov 19, 2025
4 checks passed
@longkerdandy longkerdandy deleted the feature/tck-compatibility-testing branch November 19, 2025 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants