Skip to content

Commit

Permalink
Fixed issue with reading DataItem from Json cppagent format
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickRitchie committed Dec 9, 2023
1 parent 36c0111 commit d18c515
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libraries/MTConnect.NET-JSON-cppagent/Devices/JsonDataItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ public DataItem ToDataItem()
dataItem.Relationships = relationships;
}

dataItem.Representation = Representation.ConvertEnum<DataItemRepresentation>();
dataItem.ResetTrigger = ResetTrigger.ConvertEnum<DataItemResetTrigger>();
dataItem.CoordinateSystem = CoordinateSystem.ConvertEnum<DataItemCoordinateSystem>();
dataItem.Representation = !string.IsNullOrEmpty(Representation) ? Representation.ConvertEnum<DataItemRepresentation>() : DataItemRepresentation.VALUE;
dataItem.ResetTrigger = !string.IsNullOrEmpty(ResetTrigger) ? ResetTrigger.ConvertEnum<DataItemResetTrigger>() : null;
dataItem.CoordinateSystem = !string.IsNullOrEmpty(CoordinateSystem) ? CoordinateSystem.ConvertEnum<DataItemCoordinateSystem>() : DataItemCoordinateSystem.MACHINE;
dataItem.CoordinateSystemIdRef = CoordinateSystemIdRef;
if (Constraints != null) dataItem.Constraints = Constraints.ToConstraints();
if (Definition != null) dataItem.Definition = Definition.ToDefinition();
dataItem.Units = Units;
dataItem.Statistic = Statistic.ConvertEnum<DataItemStatistic>();
dataItem.Statistic = !string.IsNullOrEmpty(Statistic) ? Statistic.ConvertEnum<DataItemStatistic>() : null;
dataItem.SignificantDigits = SignificantDigits.HasValue ? SignificantDigits.Value : 0;

// Filters
Expand Down

0 comments on commit d18c515

Please sign in to comment.