Skip to content

Commit

Permalink
Update 6.0.9
Browse files Browse the repository at this point in the history
- Fixed issue with Device MTConnectVersion and Hash output
- Removed InstanceId property for Device (not in MTConnect Standard but was used in old MQTT protocol)
  • Loading branch information
PatrickRitchie committed Dec 28, 2023
1 parent 792092c commit e444ec9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Reflection;

[assembly: AssemblyVersion("6.0.8")]
[assembly: AssemblyFileVersion("6.0.8")]
[assembly: AssemblyVersion("6.0.9")]
[assembly: AssemblyFileVersion("6.0.9")]
[assembly: AssemblyCompany("TrakHound Inc.")]
[assembly: AssemblyCopyright("Copyright (c) 2023 TrakHound Inc., All Rights Reserved.")]
2 changes: 1 addition & 1 deletion libraries/MTConnect.NET-Common/Devices/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ public static Device Process(IDevice device, Version mtconnectVersion)
if (mtconnectVersion >= MTConnectVersions.Version13) obj.References = device.References;
if (mtconnectVersion >= MTConnectVersions.Version17) obj.Configuration = device.Configuration;
if (mtconnectVersion >= MTConnectVersions.Version18) obj.CoordinateSystemIdRef = device.CoordinateSystemIdRef;
obj.MTConnectVersion = device.MTConnectVersion != null ? device.MTConnectVersion : mtconnectVersion;
if (mtconnectVersion >= MTConnectVersions.Version17) obj.MTConnectVersion = device.MTConnectVersion != null ? device.MTConnectVersion : mtconnectVersion;
if (mtconnectVersion >= MTConnectVersions.Version22) obj.Hash = device.Hash;

// Add DataItems
Expand Down
8 changes: 4 additions & 4 deletions libraries/MTConnect.NET-JSON-cppagent/Devices/JsonDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public class JsonDevice
[JsonPropertyName("uuid")]
public string Uuid { get; set; }

[JsonPropertyName("instanceId")]
public long InstanceId { get; set; }
[JsonPropertyName("hash")]
public string Hash { get; set; }

[JsonPropertyName("iso841Class")]
public string Iso841Class { get; set; }
Expand Down Expand Up @@ -67,7 +67,7 @@ public JsonDevice(IDevice device)
Name = device.Name;
NativeName = device.NativeName;
Uuid = device.Uuid;
InstanceId = device.InstanceId;
Hash = device.Hash;
if (device.SampleRate > 0) SampleRate = device.SampleRate;
if (device.SampleInterval > 0) SampleInterval = device.SampleInterval;
Iso841Class = device.Iso841Class;
Expand Down Expand Up @@ -113,7 +113,7 @@ public Device ToDevice()
device.Name = Name;
device.NativeName = NativeName;
device.Uuid = Uuid;
device.InstanceId = InstanceId;
device.Hash = Hash;
device.SampleRate = SampleRate.HasValue ? SampleRate.Value : 0;
device.SampleInterval = SampleInterval.HasValue ? SampleInterval.Value : 0;
device.Iso841Class = Iso841Class;
Expand Down
8 changes: 4 additions & 4 deletions libraries/MTConnect.NET-JSON/Devices/JsonDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class JsonDevice
[JsonPropertyName("uuid")]
public string Uuid { get; set; }

[JsonPropertyName("instanceId")]
public long InstanceId { get; set; }
[JsonPropertyName("hash")]
public string Hash { get; set; }

[JsonPropertyName("iso841Class")]
public string Iso841Class { get; set; }
Expand Down Expand Up @@ -74,7 +74,7 @@ public JsonDevice(IDevice device)
Name = device.Name;
NativeName = device.NativeName;
Uuid = device.Uuid;
InstanceId = device.InstanceId;
Hash = device.Hash;
if (device.SampleRate > 0) SampleRate = device.SampleRate;
if (device.SampleInterval > 0) SampleInterval = device.SampleInterval;
Iso841Class = device.Iso841Class;
Expand Down Expand Up @@ -137,7 +137,7 @@ public Device ToDevice()
device.Name = Name;
device.NativeName = NativeName;
device.Uuid = Uuid;
device.InstanceId = InstanceId;
device.Hash = Hash;
device.SampleRate = SampleRate.HasValue ? SampleRate.Value : 0;
device.SampleInterval = SampleInterval.HasValue ? SampleInterval.Value : 0;
device.Iso841Class = Iso841Class;
Expand Down
4 changes: 2 additions & 2 deletions libraries/MTConnect.NET-XML/Devices/XmlDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected IDevice ToDevice(Device device)
device.SampleInterval = SampleInterval;
device.Iso841Class = Iso841Class;
device.CoordinateSystemIdRef = CoordinateSystemIdRef;
device.Hash = device.Hash;
device.Hash = Hash;
if (Version.TryParse(MTConnectVersion, out var mtconnectVersion))
{
device.MTConnectVersion = mtconnectVersion;
Expand Down Expand Up @@ -236,7 +236,7 @@ public static void WriteXml(XmlWriter writer, IDevice device, bool outputComment
if (device.SampleRate > 0) writer.WriteAttributeString("sampleRate", device.SampleRate.ToString());
if (!string.IsNullOrEmpty(device.CoordinateSystemIdRef)) writer.WriteAttributeString("coordinateSystemIdRef", device.CoordinateSystemIdRef);
if (device.MTConnectVersion != null) writer.WriteAttributeString("mtconnectVersion", device.MTConnectVersion.ToString());
if (device.MTConnectVersion != null && device.MTConnectVersion >= MTConnectVersions.Version22) writer.WriteAttributeString("hash", device.Hash);
if (!string.IsNullOrEmpty(device.Hash)) writer.WriteAttributeString("hash", device.Hash);

// Write Description
XmlDescription.WriteXml(writer, device.Description);
Expand Down

0 comments on commit e444ec9

Please sign in to comment.