Constantin Ziesche | 857c7ab | 2020-02-25 11:24:51 +0100 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2020 Robert Bosch GmbH |
| 3 | * Author: Constantin Ziesche (constantin.ziesche@bosch.com) |
| 4 | * |
| 5 | * This program and the accompanying materials are made available under the |
| 6 | * terms of the Eclipse Public License 2.0 which is available at |
| 7 | * http://www.eclipse.org/legal/epl-2.0 |
| 8 | * |
| 9 | * SPDX-License-Identifier: EPL-2.0 |
| 10 | *******************************************************************************/ |
| 11 | using BaSyx.Models.Core.Common; |
| 12 | using Newtonsoft.Json; |
| 13 | using System.Xml.Serialization; |
| 14 | |
| 15 | namespace BaSyx.Models.Export.EnvironmentDataSpecifications |
| 16 | { |
| 17 | [XmlType("dataSpecificationIEC61360", Namespace = AssetAdministrationShellEnvironment_V1_0.IEC61360_NAMESPACE)] |
| 18 | public class EnvironmentDataSpecificationIEC61360_V1_0 |
| 19 | { |
| 20 | [JsonProperty("preferredName")] |
| 21 | [XmlArray("preferredName")] |
| 22 | [XmlArrayItem("langString", Namespace = AssetAdministrationShellEnvironment_V1_0.AAS_NAMESPACE)] |
| 23 | public LangStringSet PreferredName { get; set; } |
| 24 | |
| 25 | [JsonProperty("shortName")] |
| 26 | [XmlElement("shortName")] |
| 27 | public string ShortName { get; set; } |
| 28 | |
| 29 | [JsonProperty("unit")] |
| 30 | [XmlElement("unit")] |
| 31 | public string Unit { get; set; } |
| 32 | |
| 33 | [JsonProperty("unitId")] |
| 34 | [XmlElement("unitId")] |
| 35 | public EnvironmentReference_V1_0 UnitId { get; set; } |
| 36 | |
| 37 | [JsonProperty("valueFormat")] |
| 38 | [XmlElement("valueFormat")] |
| 39 | public string ValueFormat { get; set; } |
| 40 | |
| 41 | [JsonProperty("sourceOfDefinition")] |
| 42 | [XmlArray("sourceOfDefinition")] |
| 43 | [XmlArrayItem("langString", Namespace = AssetAdministrationShellEnvironment_V1_0.AAS_NAMESPACE)] |
| 44 | public LangStringSet SourceOfDefinition { get; set; } |
| 45 | |
| 46 | [JsonProperty("symbol")] |
| 47 | [XmlElement("symbol")] |
| 48 | public string Symbol { get; set; } |
| 49 | |
| 50 | [JsonProperty("dataType")] |
| 51 | [XmlElement("dataType")] |
| 52 | public string DataType { get; set; } |
| 53 | |
| 54 | [JsonProperty("definition")] |
| 55 | [XmlArray("definition")] |
| 56 | [XmlArrayItem("langString", Namespace = AssetAdministrationShellEnvironment_V1_0.AAS_NAMESPACE)] |
| 57 | public LangStringSet Definition { get; set; } |
Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 58 | |
| 59 | public bool ShouldSerializeSourceOfDefinition() |
| 60 | { |
| 61 | if (SourceOfDefinition == null || SourceOfDefinition.Count == 0) |
| 62 | return false; |
| 63 | else |
| 64 | return true; |
| 65 | } |
| 66 | |
| 67 | public bool ShouldSerializeDefinition() |
| 68 | { |
| 69 | if (Definition == null || Definition.Count == 0) |
| 70 | return false; |
| 71 | else |
| 72 | return true; |
| 73 | } |
Constantin Ziesche | 857c7ab | 2020-02-25 11:24:51 +0100 | [diff] [blame] | 74 | } |
| 75 | } |