Skip to content

Commit

Permalink
Update SysML Import
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickRitchie committed Oct 31, 2023
1 parent 57ecd35 commit efa14cc
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace MTConnect.Devices.Json
var components = new List<IComponent>();

{{- for type in types }}{{ i = i + 1 }}
if (!{{type.type}}.IsNullOrEmpty()) foreach (var component in {{type.type}}) components.Add(component.ToComponent());
if (!{{type.type}}.IsNullOrEmpty()) foreach (var component in {{type.type}}) components.Add(component.ToComponent({{type.name}}.TypeId));
{{ end }}

return components;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class JsonCellDefinition
[JsonPropertyName("subType")]
public string SubType { get; set; }

[JsonPropertyName("description")]
[JsonPropertyName("Description")]
public JsonDescription Description { get; set; }


Expand Down
2 changes: 1 addition & 1 deletion src/MTConnect.NET-JSON-cppagent/Devices/JsonChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class JsonChannel
[JsonPropertyName("calibrationInitials")]
public string CalibrationInitials { get; set; }

[JsonPropertyName("description")]
[JsonPropertyName("Description")]
public JsonDescription Description { get; set; }


Expand Down
9 changes: 3 additions & 6 deletions src/MTConnect.NET-JSON-cppagent/Devices/JsonComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ public class JsonComponent
[JsonPropertyName("id")]
public string Id { get; set; }

[JsonPropertyName("type")]
public string Type { get; set; }

[JsonPropertyName("name")]
public string Name { get; set; }

Expand Down Expand Up @@ -60,7 +57,7 @@ public JsonComponent(IComponent component)
Uuid = component.Uuid;
Name = component.Name;
NativeName = component.NativeName;
Type = component.Type;
//Type = component.Type;
if (component.Description != null) Description = new JsonDescription(component.Description);
if (component.SampleRate > 0) SampleRate = component.SampleRate;
if (component.SampleInterval > 0) SampleInterval = component.SampleInterval;
Expand Down Expand Up @@ -95,15 +92,15 @@ public JsonComponent(IComponent component)

public override string ToString() => JsonFunctions.Convert(this);

public Component ToComponent()
public Component ToComponent(string componentType)
{
var component = new Component();

component.Id = Id;
component.Uuid = Uuid;
component.Name = Name;
component.NativeName = NativeName;
component.Type = Type;
component.Type = componentType;
if (Description != null) component.Description = Description.ToDescription();
component.SampleRate = SampleRate.HasValue ? SampleRate.Value : 0;
component.SampleInterval = SampleInterval.HasValue ? SampleInterval.Value : 0;
Expand Down
228 changes: 114 additions & 114 deletions src/MTConnect.NET-JSON-cppagent/Devices/JsonComponents.g.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ namespace MTConnect.Devices.Json
{
public class JsonSensorConfiguration
{
[JsonPropertyName("firmwareVersion")]
[JsonPropertyName("FirmwareVersion")]
public string FirmwareVersion { get; set; }

[JsonPropertyName("calibrationDate")]
[JsonPropertyName("CalibrationDate")]
public DateTime CalibrationDate { get; set; }

[JsonPropertyName("nextCalibrationDate")]
[JsonPropertyName("NextCalibrationDate")]
public DateTime NextCalibrationDate { get; set; }

[JsonPropertyName("calibrationInitials")]
[JsonPropertyName("CalibrationInitials")]
public string CalibrationInitials { get; set; }

[JsonPropertyName("channels")]
[JsonPropertyName("Channels")]
public List<JsonChannel> Channels { get; set; }


Expand Down
12 changes: 6 additions & 6 deletions src/MTConnect.NET-JSON/Assets/QIF/JsonQIFDocumentWrapperAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public class JsonQIFDocumentWrapperAsset


[JsonPropertyName("qifDocumentType")]
public string QifDocumentType { get; set; }
public string QIFDocumentType { get; set; }

[JsonPropertyName("qifDocument")]
public string QifDocument { get; set; }
public string QIFDocument { get; set; }


public JsonQIFDocumentWrapperAsset() { }
Expand All @@ -54,8 +54,8 @@ public JsonQIFDocumentWrapperAsset(IQIFDocumentWrapperAsset asset)

if (asset.Description != null) Description = new JsonDescription(asset.Description);

QifDocumentType = asset.QifDocumentType.ToString();
//QifDocument = asset.QIFDocument; ??
QIFDocumentType = asset.QifDocumentType.ToString();
QIFDocument = asset.QIFDocument;
}
}

Expand All @@ -72,8 +72,8 @@ public IQIFDocumentWrapperAsset ToQIFDocumentWrapperAsset()

if (Description != null) asset.Description = Description.ToDescription();

asset.QifDocumentType = QifDocumentType.ConvertEnum<QIFDocumentType>();
//asset.QifDocument = QifDocument; ??
asset.QifDocumentType = QIFDocumentType.ConvertEnum<QIFDocumentType>();
asset.QIFDocument = QIFDocument;
return asset;
}
}
Expand Down

0 comments on commit efa14cc

Please sign in to comment.