-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
44cf3b0
commit c41cbbf
Showing
7 changed files
with
207 additions
and
75 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
...JSON/Assets/ComponentConfigurationParameters/JsonComponentConfigurationParametersAsset.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,82 @@ | ||
// Copyright (c) 2023 TrakHound Inc., All Rights Reserved. | ||
// TrakHound Inc. licenses this file to you under the MIT license. | ||
|
||
using MTConnect.Assets.ComponentConfigurationParameters; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace MTConnect.Assets.Json.ComponentConfigurationParameters | ||
{ | ||
public class JsonComponentConfigurationParametersAsset | ||
{ | ||
[JsonPropertyName("assetId")] | ||
public string AssetId { get; set; } | ||
|
||
[JsonPropertyName("type")] | ||
public string Type { get; set; } | ||
|
||
[JsonPropertyName("timestamp")] | ||
public DateTime Timestamp { get; set; } | ||
|
||
[JsonPropertyName("deviceUuid")] | ||
public string DeviceUuid { get; set; } | ||
|
||
[JsonPropertyName("removed")] | ||
public bool Removed { get; set; } | ||
|
||
[JsonPropertyName("description")] | ||
public string Description { get; set; } | ||
|
||
[JsonPropertyName("parameterSets")] | ||
public IEnumerable<JsonParameterSet> ParameterSets { get; set; } | ||
|
||
|
||
public JsonComponentConfigurationParametersAsset() { } | ||
|
||
public JsonComponentConfigurationParametersAsset(IComponentConfigurationParametersAsset asset) | ||
{ | ||
if (asset != null) | ||
{ | ||
AssetId = asset.AssetId; | ||
Type = asset.Type; | ||
Timestamp = asset.Timestamp; | ||
DeviceUuid = asset.DeviceUuid; | ||
Removed = asset.Removed; | ||
|
||
//if (asset.Description != null) Description = new JsonDescription(asset.Description); | ||
|
||
if (!asset.ParameterSets.IsNullOrEmpty()) | ||
{ | ||
var jsonParameterSets = new List<JsonParameterSet>(); | ||
} | ||
} | ||
} | ||
|
||
|
||
public IComponentConfigurationParametersAsset ToComponentConfigurationParametersAsset() | ||
{ | ||
var asset = new ComponentConfigurationParametersAsset(); | ||
|
||
asset.AssetId = AssetId; | ||
asset.Type = Type; | ||
asset.Timestamp = Timestamp; | ||
asset.DeviceUuid = DeviceUuid; | ||
asset.Removed = Removed; | ||
|
||
//if (Description != null) asset.Description = Description.ToDescription(); | ||
|
||
if (!ParameterSets.IsNullOrEmpty()) | ||
{ | ||
var parameterSets = new List<IParameterSet>(); | ||
foreach (var parameterSet in ParameterSets) | ||
{ | ||
parameterSets.Add(parameterSet.ToParameterSet()); | ||
} | ||
asset.ParameterSets = parameterSets; | ||
} | ||
|
||
return asset; | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/MTConnect.NET-JSON/Assets/ComponentConfigurationParameters/JsonParameter.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,63 @@ | ||
// Copyright (c) 2023 TrakHound Inc., All Rights Reserved. | ||
// TrakHound Inc. licenses this file to you under the MIT license. | ||
|
||
using MTConnect.Assets.ComponentConfigurationParameters; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace MTConnect.Assets.Json.ComponentConfigurationParameters | ||
{ | ||
public class JsonParameter | ||
{ | ||
[JsonPropertyName("identifier")] | ||
public string Identifier { get; set; } | ||
|
||
[JsonPropertyName("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonPropertyName("maximum")] | ||
public double? Maximum { get; set; } | ||
|
||
[JsonPropertyName("minimum")] | ||
public double? Minimum { get; set; } | ||
|
||
[JsonPropertyName("nominal")] | ||
public double? Nominal { get; set; } | ||
|
||
[JsonPropertyName("units")] | ||
public string Units { get; set; } | ||
|
||
[JsonPropertyName("value")] | ||
public string Value { get; set; } | ||
|
||
|
||
public JsonParameter() { } | ||
|
||
public JsonParameter(IParameter parameter) | ||
{ | ||
if (parameter != null) | ||
{ | ||
Identifier = parameter.Identifier; | ||
Name = parameter.Name; | ||
Maximum = parameter.Maximum; | ||
Minimum = parameter.Minimum; | ||
Nominal = parameter.Nominal; | ||
Units = parameter.Units; | ||
Value = parameter.Value; | ||
} | ||
} | ||
|
||
|
||
public IParameter ToParameter() | ||
{ | ||
var parameter = new Parameter(); | ||
parameter.Identifier = Identifier; | ||
parameter.Name = Name; | ||
parameter.Maximum = Maximum; | ||
parameter.Minimum = Minimum; | ||
parameter.Nominal = Nominal; | ||
parameter.Units = Units; | ||
parameter.Value = Value; | ||
return parameter; | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/MTConnect.NET-JSON/Assets/ComponentConfigurationParameters/JsonParameterSet.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,58 @@ | ||
// Copyright (c) 2023 TrakHound Inc., All Rights Reserved. | ||
// TrakHound Inc. licenses this file to you under the MIT license. | ||
|
||
using MTConnect.Assets.ComponentConfigurationParameters; | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace MTConnect.Assets.Json.ComponentConfigurationParameters | ||
{ | ||
public class JsonParameterSet | ||
{ | ||
[JsonPropertyName("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonPropertyName("parameters")] | ||
public IEnumerable<JsonParameter> Parameters { get; set; } | ||
|
||
|
||
public JsonParameterSet() { } | ||
|
||
public JsonParameterSet(IParameterSet parameterSet) | ||
{ | ||
if (parameterSet != null) | ||
{ | ||
Name = parameterSet.Name; | ||
|
||
if (!parameterSet.Parameters.IsNullOrEmpty()) | ||
{ | ||
var jsonParameters = new List<JsonParameter>(); | ||
foreach (var parameter in parameterSet.Parameters) | ||
{ | ||
jsonParameters.Add(new JsonParameter(parameter)); | ||
} | ||
Parameters = jsonParameters; | ||
} | ||
} | ||
} | ||
|
||
|
||
public IParameterSet ToParameterSet() | ||
{ | ||
var parameterSet = new ParameterSet(); | ||
parameterSet.Name = Name; | ||
|
||
if (!Parameters.IsNullOrEmpty()) | ||
{ | ||
var parameters = new List<IParameter>(); | ||
foreach (var parameter in Parameters) | ||
{ | ||
parameters.Add(parameter.ToParameter()); | ||
} | ||
parameterSet.Parameters = parameters; | ||
} | ||
|
||
return parameterSet; | ||
} | ||
} | ||
} |
61 changes: 0 additions & 61 deletions
61
src/MTConnect.NET-JSON/Assets/CuttingTools/JsonCuttingItemCollection - Copy.cs
This file was deleted.
Oops, something went wrong.
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