-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a08a551
commit ededffe
Showing
30 changed files
with
945 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
build/MTConnect.NET-SysML-Import/Json-cppagent/CuttingToolMeasurementsModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using MTConnect.SysML.Models.Assets; | ||
|
||
namespace MTConnect.SysML.Json_cppagent | ||
{ | ||
public class CuttingToolMeasurementsModel | ||
{ | ||
public List<MTConnectCuttingToolMeasurementModel> Types { get; set; } = new(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
build/MTConnect.NET-SysML-Import/Json-cppagent/Templates/Measurements.scriban
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (c) 2023 TrakHound Inc., All Rights Reserved. | ||
// TrakHound Inc. licenses this file to you under the MIT license. | ||
|
||
using MTConnect.Assets.CuttingTools; | ||
using MTConnect.Assets.CuttingTools.Measurements; | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace MTConnect.Assets.Json.CuttingTools | ||
{ | ||
public class JsonMeasurements | ||
{ | ||
{{- for type in types }} | ||
[JsonPropertyName("{{type.type_id}}")] | ||
public List<JsonMeasurement> {{type.name}}s { get; set; } | ||
|
||
{{ end }} | ||
|
||
public JsonMeasurements() { } | ||
|
||
public JsonMeasurements(IEnumerable<IMeasurement> measurements) | ||
{ | ||
if (!measurements.IsNullOrEmpty()) | ||
{ | ||
foreach (var measurement in measurements) | ||
{ | ||
switch (measurement.Type) | ||
{ | ||
{{- for type in types }} | ||
case {{type.name}}.TypeId: | ||
if ({{type.name}}s == null) {{type.name}}s = new List<JsonMeasurement>(); | ||
{{type.name}}s.Add(new JsonMeasurement(measurement)); | ||
break; | ||
|
||
{{ end }} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
public IEnumerable<IMeasurement> ToMeasurements() | ||
{ | ||
var measurements = new List<IMeasurement>(); | ||
|
||
{{ for type in types }} | ||
if (!{{type.name}}s.IsNullOrEmpty()) foreach (var measurement in {{type.name}}s) measurements.Add(measurement.ToMeasurement({{type.name}}.TypeId)); | ||
{{- end }} | ||
|
||
return measurements; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/MTConnect.NET-JSON-cppagent/Assets/CuttingTools/JsonCutterStatus.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2023 TrakHound Inc., All Rights Reserved. | ||
// TrakHound Inc. licenses this file to you under the MIT license. | ||
|
||
using MTConnect.Assets.CuttingTools; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace MTConnect.Assets.Json.CuttingTools | ||
{ | ||
public class JsonCutterStatus | ||
{ | ||
[JsonPropertyName("value")] | ||
public string Value { get; set; } | ||
|
||
|
||
public JsonCutterStatus() { } | ||
|
||
public JsonCutterStatus(CutterStatusType cutterStatus) | ||
{ | ||
Value = cutterStatus.ToString(); | ||
} | ||
|
||
|
||
public CutterStatusType ToCutterStatus() | ||
{ | ||
return Value.ConvertEnum<CutterStatusType>(); | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/MTConnect.NET-JSON-cppagent/Assets/CuttingTools/JsonCutterStatusCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) 2023 TrakHound Inc., All Rights Reserved. | ||
// TrakHound Inc. licenses this file to you under the MIT license. | ||
|
||
using MTConnect.Assets.CuttingTools; | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace MTConnect.Assets.Json.CuttingTools | ||
{ | ||
public class JsonCutterStatusCollection | ||
{ | ||
[JsonPropertyName("Status")] | ||
public IEnumerable<JsonCutterStatus> Status { get; set; } | ||
|
||
|
||
public JsonCutterStatusCollection() { } | ||
|
||
public JsonCutterStatusCollection(IEnumerable<CutterStatusType> cutterStatuses) | ||
{ | ||
if (!cutterStatuses.IsNullOrEmpty()) | ||
{ | ||
var status = new List<JsonCutterStatus>(); | ||
foreach (var cutterStatus in cutterStatuses) | ||
{ | ||
status.Add(new JsonCutterStatus(cutterStatus)); | ||
} | ||
Status = status; | ||
} | ||
} | ||
|
||
|
||
public IEnumerable<CutterStatusType> ToCutterStatus() | ||
{ | ||
if (!Status.IsNullOrEmpty()) | ||
{ | ||
var statuses = new List<CutterStatusType>(); | ||
|
||
foreach (var status in Status) | ||
{ | ||
statuses.Add(status.ToCutterStatus()); | ||
} | ||
|
||
return statuses; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
Oops, something went wrong.