Skip to content

Commit 124a8e5

Browse files
committed
Smaller code style fixes.
1 parent 042cf43 commit 124a8e5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/SparkplugNet/Core/Node/SparkplugNodeBase.Device.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public partial class SparkplugNodeBase<T>
3030
/// <exception cref="ArgumentNullException">Thrown if the options are null.</exception>
3131
/// <exception cref="Exception">Thrown if the MQTT client is not connected.</exception>
3232
/// <returns>A <see cref="MqttClientPublishResult"/>.</returns>
33-
public async Task<MqttClientPublishResult> PublishDeviceBirthMessage(List<T> knownMetrics, string deviceIdentifier, ILogger<KnownMetricStorage>? logger = null)
33+
public async Task<MqttClientPublishResult> PublishDeviceBirthMessage(
34+
List<T> knownMetrics,
35+
string deviceIdentifier,
36+
ILogger<KnownMetricStorage>? logger = null)
3437
{
3538
if (this.Options is null)
3639
{
@@ -166,8 +169,8 @@ protected virtual async Task<MqttClientPublishResult> PublishMessageForDevice(IE
166169
throw new ArgumentNullException(deviceIdentifier, $"The known metrics for the device {deviceIdentifier} aren't set properly.");
167170
}
168171

169-
// Get the data message.
170-
var dataMessage = this.messageGenerator.GetSparkplugDeviceDataMessage(
172+
// Get the device data message.
173+
var deviceDataMessage = this.messageGenerator.GetSparkplugDeviceDataMessage(
171174
this.NameSpace,
172175
this.Options.GroupIdentifier,
173176
this.Options.EdgeNodeIdentifier,
@@ -181,6 +184,6 @@ protected virtual async Task<MqttClientPublishResult> PublishMessageForDevice(IE
181184
this.IncrementLastSequenceNumber();
182185

183186
// Publish the message.
184-
return await this.client.PublishAsync(dataMessage);
187+
return await this.client.PublishAsync(deviceDataMessage);
185188
}
186189
}

src/SparkplugNet/Core/Node/SparkplugNodeBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,18 +392,21 @@ private async Task SubscribeInternal()
392392
throw new ArgumentNullException(nameof(this.Options));
393393
}
394394

395+
// Subscribe to the node command topic.
395396
var nodeCommandSubscribeTopic = SparkplugTopicGenerator.GetNodeCommandSubscribeTopic(
396397
this.NameSpace,
397398
this.Options.GroupIdentifier,
398399
this.Options.EdgeNodeIdentifier);
399400
await this.client.SubscribeAsync(nodeCommandSubscribeTopic, (MqttQualityOfServiceLevel)SparkplugQualityOfServiceLevel.AtLeastOnce);
400401

402+
// Subscribe to the device command topic.
401403
var deviceCommandSubscribeTopic = SparkplugTopicGenerator.GetWildcardDeviceCommandSubscribeTopic(
402404
this.NameSpace,
403405
this.Options.GroupIdentifier,
404406
this.Options.EdgeNodeIdentifier);
405407
await this.client.SubscribeAsync(deviceCommandSubscribeTopic, (MqttQualityOfServiceLevel)SparkplugQualityOfServiceLevel.AtLeastOnce);
406408

409+
// Subscribe to the state topic.
407410
var stateSubscribeTopic = SparkplugTopicGenerator.GetStateSubscribeTopic(this.Options.ScadaHostIdentifier);
408411
await this.client.SubscribeAsync(stateSubscribeTopic, (MqttQualityOfServiceLevel)SparkplugQualityOfServiceLevel.AtLeastOnce);
409412
}

0 commit comments

Comments
 (0)