Fix
This commit is contained in:
70
Technosoftware/DaAeHdaClient/Hda/Aggregate.cs
Normal file
70
Technosoftware/DaAeHdaClient/Hda/Aggregate.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// The description of an item aggregate supported by the server.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaAggregate : ICloneable
|
||||
{
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// A unique identifier for the aggregate.
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The unique name for the aggregate.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A short description of the aggregate.
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Returns a string that represents the current object.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a shallow copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone() { return MemberwiseClone(); }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
178
Technosoftware/DaAeHdaClient/Hda/AggregateCollection.cs
Normal file
178
Technosoftware/DaAeHdaClient/Hda/AggregateCollection.cs
Normal file
@@ -0,0 +1,178 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// The description of an item aggregate supported by the server.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaAggregateCollection : ICloneable, ICollection
|
||||
{
|
||||
#region Fields
|
||||
private TsCHdaAggregate[] hdaAggregates_ = new TsCHdaAggregate[0];
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Creates an empty collection.
|
||||
/// </summary>
|
||||
public TsCHdaAggregateCollection()
|
||||
{
|
||||
// do nothing.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object with any Aggregates contained in the collection.
|
||||
/// </summary>
|
||||
/// <param name="collection">A collection containing aggregate descriptions.</param>
|
||||
public TsCHdaAggregateCollection(ICollection collection)
|
||||
{
|
||||
Init(collection);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Returns the aggregate at the specified index.
|
||||
/// </summary>
|
||||
public TsCHdaAggregate this[int index]
|
||||
{
|
||||
get => hdaAggregates_[index];
|
||||
set => hdaAggregates_[index] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Returns the first aggregate with the specified id.
|
||||
/// </summary>
|
||||
public TsCHdaAggregate Find(int id)
|
||||
{
|
||||
foreach (var aggregate in hdaAggregates_)
|
||||
{
|
||||
if (aggregate.Id == id)
|
||||
{
|
||||
return aggregate;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object with any aggregates contained in the collection.
|
||||
/// </summary>
|
||||
/// <param name="collection">A collection containing aggregate descriptions.</param>
|
||||
public void Init(ICollection collection)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if (collection != null)
|
||||
{
|
||||
var aggregates = new ArrayList(collection.Count);
|
||||
|
||||
foreach (var value in collection)
|
||||
{
|
||||
if (value.GetType() == typeof(TsCHdaAggregate))
|
||||
{
|
||||
aggregates.Add(OpcConvert.Clone(value));
|
||||
}
|
||||
}
|
||||
|
||||
hdaAggregates_ = (TsCHdaAggregate[])aggregates.ToArray(typeof(TsCHdaAggregate));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all aggregates in the collection.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
hdaAggregates_ = new TsCHdaAggregate[0];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
return new TsCHdaAggregateCollection(this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => hdaAggregates_?.Length ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
hdaAggregates_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCHdaAggregate[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return hdaAggregates_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
141
Technosoftware/DaAeHdaClient/Hda/AggregateId.cs
Normal file
141
Technosoftware/DaAeHdaClient/Hda/AggregateId.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines constants for well-known item aggregates.
|
||||
/// </summary>
|
||||
/// <remarks>This indicates the aggregate to be used when retrieving processed history. The precise meaning of each aggregate may be server specific. Aggregates not supported by the server shall return E_INVALIDARG in the error code for that aggregate. Additional aggregates may be defined by vendors. Server specific aggregates must be defined with values beginning at 0x80000000. The OPC foundation reserves all aggregates IDs from 0 to 0x7fffffff.</remarks>
|
||||
public class TsCHdaAggregateID
|
||||
{
|
||||
#region Constants
|
||||
/// <summary>
|
||||
/// Do not retrieve an aggregate.
|
||||
/// </summary>
|
||||
public const int NoAggregate = 0;
|
||||
/// <summary>
|
||||
/// Do not retrieve an aggregate. This is used for retrieving interpolated values.
|
||||
/// </summary>
|
||||
public const int Interpolative = 1;
|
||||
/// <summary>
|
||||
/// Retrieve the totalized value (time integral) of the data over the re-sample interval.
|
||||
/// </summary>
|
||||
public const int Total = 2;
|
||||
/// <summary>
|
||||
/// Retrieve the average data over the re-sample interval.
|
||||
/// </summary>
|
||||
public const int Average = 3;
|
||||
/// <summary>
|
||||
/// Retrieve the time weighted average data over the re-sample interval.
|
||||
/// </summary>
|
||||
public const int TimeAverage = 4;
|
||||
/// <summary>
|
||||
/// Retrieve the number of raw values over the re-sample interval.
|
||||
/// </summary>
|
||||
public const int Count = 5;
|
||||
/// <summary>
|
||||
/// Retrieve the standard deviation over the re-sample interval.
|
||||
/// </summary>
|
||||
public const int StandardDeviation = 6;
|
||||
/// <summary>
|
||||
/// Retrieve the minimum value in the re-sample interval and the timestamp of the minimum value.
|
||||
/// </summary>
|
||||
public const int MinimumActualTime = 7;
|
||||
/// <summary>
|
||||
/// Retrieve the minimum value in the re-sample interval.
|
||||
/// </summary>
|
||||
public const int Minimum = 8;
|
||||
/// <summary>
|
||||
/// Retrieve the maximum value in the re-sample interval and the timestamp of the maximum value.
|
||||
/// </summary>
|
||||
public const int MaximumActualTime = 9;
|
||||
/// <summary>
|
||||
/// Retrieve the maximum value in the re-sample interval.
|
||||
/// </summary>
|
||||
public const int Maximum = 10;
|
||||
/// <summary>
|
||||
/// Retrieve the value at the beginning of the re-sample interval. The time stamp is the time stamp of the beginning of the interval.
|
||||
/// </summary>
|
||||
public const int Start = 11;
|
||||
/// <summary>
|
||||
/// Retrieve the value at the end of the re-sample interval. The time stamp is the time stamp of the end of the interval.
|
||||
/// </summary>
|
||||
public const int End = 12;
|
||||
/// <summary>
|
||||
/// Retrieve the difference between the first and last value in the re-sample interval.
|
||||
/// </summary>
|
||||
public const int Delta = 13;
|
||||
/// <summary>
|
||||
/// Retrieve the slope of the regression line over the re-sample interval.
|
||||
/// </summary>
|
||||
public const int RegSlope = 14;
|
||||
/// <summary>
|
||||
/// Retrieve the intercept of the regression line over the re-sample interval. This is the value of the regression line at the start of the interval.
|
||||
/// </summary>
|
||||
public const int RegConst = 15;
|
||||
/// <summary>
|
||||
/// Retrieve the standard deviation of the regression line over the re-sample interval.
|
||||
/// </summary>
|
||||
public const int RegDev = 16;
|
||||
/// <summary>
|
||||
/// Retrieve the variance over the sample interval.
|
||||
/// </summary>
|
||||
public const int Variance = 17;
|
||||
/// <summary>
|
||||
/// Retrieve the difference between the minimum and maximum value over the sample interval.
|
||||
/// </summary>
|
||||
public const int Range = 18;
|
||||
/// <summary>
|
||||
/// Retrieve the duration (in seconds) of time in the interval during which the data is good.
|
||||
/// </summary>
|
||||
public const int DurationGood = 19;
|
||||
/// <summary>
|
||||
/// Retrieve the duration (in seconds) of time in the interval during which the data is bad.
|
||||
/// </summary>
|
||||
public const int DurationBad = 20;
|
||||
/// <summary>
|
||||
/// Retrieve the percent of data (1 equals 100 percent) in the interval which has good quality.
|
||||
/// </summary>
|
||||
public const int PercentGood = 21;
|
||||
/// <summary>
|
||||
/// Retrieve the percent of data (1 equals 100 percent) in the interval which has bad quality.
|
||||
/// </summary>
|
||||
public const int PercentBad = 22;
|
||||
/// <summary>
|
||||
/// Retrieve the worst quality of data in the interval.
|
||||
/// </summary>
|
||||
public const int WorstQuality = 23;
|
||||
/// <summary>
|
||||
/// Retrieve the number of annotations in the interval.
|
||||
/// </summary>
|
||||
public const int Annotations = 24;
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
private TsCHdaAggregateID() { }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
84
Technosoftware/DaAeHdaClient/Hda/AnnotationValue.cs
Normal file
84
Technosoftware/DaAeHdaClient/Hda/AnnotationValue.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// An annotation associated with an item.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaAnnotationValue : ICloneable
|
||||
{
|
||||
#region Fields
|
||||
private DateTime timestamp_ = DateTime.MinValue;
|
||||
private DateTime creationTime_ = DateTime.MinValue;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// The timestamp for the annotation.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime Timestamp
|
||||
{
|
||||
get => timestamp_;
|
||||
set => timestamp_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text of the annotation.
|
||||
/// </summary>
|
||||
public string Annotation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time when the annotation was created.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime CreationTime
|
||||
{
|
||||
get => creationTime_;
|
||||
set => creationTime_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The user who created the annotation.
|
||||
/// </summary>
|
||||
public string User { get; set; }
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
return MemberwiseClone();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
348
Technosoftware/DaAeHdaClient/Hda/AnnotationValueCollection.cs
Normal file
348
Technosoftware/DaAeHdaClient/Hda/AnnotationValueCollection.cs
Normal file
@@ -0,0 +1,348 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of item values passed to write or returned from a read operation.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaAnnotationValueCollection : TsCHdaItem, IOpcResult, ITsCHdaActualTime, IList
|
||||
{
|
||||
#region Fields
|
||||
private ArrayList values_ = new ArrayList();
|
||||
private DateTime startTime_ = DateTime.MinValue;
|
||||
private DateTime endTime_ = DateTime.MinValue;
|
||||
private OpcResult result_ = OpcResult.S_OK;
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCHdaAnnotationValueCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemIdentifier object.
|
||||
/// </summary>
|
||||
public TsCHdaAnnotationValueCollection(OpcItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified Item object.
|
||||
/// </summary>
|
||||
public TsCHdaAnnotationValueCollection(TsCHdaItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemValueCollection object.
|
||||
/// </summary>
|
||||
public TsCHdaAnnotationValueCollection(TsCHdaAnnotationValueCollection item)
|
||||
: base(item)
|
||||
{
|
||||
values_ = new ArrayList(item.values_.Count);
|
||||
|
||||
foreach (TsCHdaItemValue value in item.values_)
|
||||
{
|
||||
values_.Add(value.Clone());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Accessor for elements in the collection.
|
||||
/// </summary>
|
||||
public TsCHdaAnnotationValue this[int index]
|
||||
{
|
||||
get => (TsCHdaAnnotationValue)values_[index];
|
||||
set => values_[index] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IOpcResult Members
|
||||
/// <summary>
|
||||
/// The error id for the result of an operation on an item.
|
||||
/// </summary>
|
||||
public OpcResult Result
|
||||
{
|
||||
get => result_;
|
||||
set => result_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vendor specific diagnostic information (not the localized error text).
|
||||
/// </summary>
|
||||
public string DiagnosticInfo { get; set; }
|
||||
#endregion
|
||||
|
||||
#region IActualTime Members
|
||||
/// <summary>
|
||||
/// The actual start time used by a server while processing a request.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime StartTime
|
||||
{
|
||||
get => startTime_;
|
||||
set => startTime_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The actual end time used by a server while processing a request.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime EndTime
|
||||
{
|
||||
get => endTime_;
|
||||
set => endTime_ = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public override object Clone()
|
||||
{
|
||||
var collection = (TsCHdaAnnotationValueCollection)base.Clone();
|
||||
|
||||
collection.values_ = new ArrayList(values_.Count);
|
||||
|
||||
foreach (TsCHdaAnnotationValue value in values_)
|
||||
{
|
||||
collection.values_.Add(value.Clone());
|
||||
}
|
||||
|
||||
return collection;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => values_?.Count ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
values_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCHdaAnnotationValue[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return values_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList Members
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the IList is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the element at the specified index.
|
||||
/// </summary>
|
||||
object IList.this[int index]
|
||||
{
|
||||
get => values_[index];
|
||||
|
||||
set
|
||||
{
|
||||
if (!(value is TsCHdaAnnotationValue))
|
||||
{
|
||||
throw new ArgumentException("May only add AnnotationValue objects into the collection.");
|
||||
}
|
||||
|
||||
values_[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the IList item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the item to remove.</param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
values_.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
if (!(value is TsCHdaAnnotationValue))
|
||||
{
|
||||
throw new ArgumentException("May only add AnnotationValue objects into the collection.");
|
||||
}
|
||||
|
||||
values_.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(object value)
|
||||
{
|
||||
values_.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return values_.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all items from the IList.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
values_.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return values_.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(object value)
|
||||
{
|
||||
if (!(value is TsCHdaAnnotationValue))
|
||||
{
|
||||
throw new ArgumentException("May only add AnnotationValue objects into the collection.");
|
||||
}
|
||||
|
||||
return values_.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the IList has a fixed size.
|
||||
/// </summary>
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, TsCHdaAnnotationValue value)
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(TsCHdaAnnotationValue value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(TsCHdaAnnotationValue value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(TsCHdaAnnotationValue value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(TsCHdaAnnotationValue value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
75
Technosoftware/DaAeHdaClient/Hda/Attribute.cs
Normal file
75
Technosoftware/DaAeHdaClient/Hda/Attribute.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// The description of an item attribute supported by the server.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaAttribute : ICloneable
|
||||
{
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// A unique identifier for the attribute.
|
||||
/// </summary>
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The unique name for the attribute.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A short description of the attribute.
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The data type of the attribute.
|
||||
/// </summary>
|
||||
public Type DataType { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Returns a string that represents the current object.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a shallow copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone() { return MemberwiseClone(); }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
174
Technosoftware/DaAeHdaClient/Hda/AttributeCollection.cs
Normal file
174
Technosoftware/DaAeHdaClient/Hda/AttributeCollection.cs
Normal file
@@ -0,0 +1,174 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// The description of an item attribute supported by the server.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaAttributeCollection : ICloneable, ICollection
|
||||
{
|
||||
#region Fields
|
||||
private TsCHdaAttribute[] hdaAttributes_ = new TsCHdaAttribute[0];
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Creates an empty collection.
|
||||
/// </summary>
|
||||
public TsCHdaAttributeCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object with any Attributes contained in the collection.
|
||||
/// </summary>
|
||||
/// <param name="collection">A collection containing attribute descriptions.</param>
|
||||
public TsCHdaAttributeCollection(ICollection collection)
|
||||
{
|
||||
Init(collection);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Returns the attribute at the specified index.
|
||||
/// </summary>
|
||||
public TsCHdaAttribute this[int index]
|
||||
{
|
||||
get => hdaAttributes_[index];
|
||||
set => hdaAttributes_[index] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Returns the first attribute with the specified id.
|
||||
/// </summary>
|
||||
public TsCHdaAttribute Find(int id)
|
||||
{
|
||||
foreach (var attribute in hdaAttributes_)
|
||||
{
|
||||
if (attribute.ID == id)
|
||||
{
|
||||
return attribute;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object with any attributes contained in the collection.
|
||||
/// </summary>
|
||||
/// <param name="collection">A collection containing attribute descriptions.</param>
|
||||
public void Init(ICollection collection)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if (collection != null)
|
||||
{
|
||||
var attributes = new ArrayList(collection.Count);
|
||||
|
||||
foreach (var value in collection)
|
||||
{
|
||||
if (value.GetType() == typeof(TsCHdaAttribute))
|
||||
{
|
||||
attributes.Add(OpcConvert.Clone(value));
|
||||
}
|
||||
}
|
||||
hdaAttributes_ = (TsCHdaAttribute[])attributes.ToArray(typeof(TsCHdaAttribute));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all attributes in the collection.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
hdaAttributes_ = new TsCHdaAttribute[0];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
return new TsCHdaAttributeCollection(this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => hdaAttributes_?.Length ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
hdaAttributes_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Attribute[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return hdaAttributes_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
72
Technosoftware/DaAeHdaClient/Hda/AttributeID.cs
Normal file
72
Technosoftware/DaAeHdaClient/Hda/AttributeID.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines constants for well-known item attributes.
|
||||
/// </summary>
|
||||
public class TsCHdaAttributeID
|
||||
{
|
||||
/// <remarks/>
|
||||
public const int DATA_TYPE = 0x01;
|
||||
/// <remarks/>
|
||||
public const int DESCRIPTION = 0x02;
|
||||
/// <remarks/>
|
||||
public const int ENG_UNITS = 0x03;
|
||||
/// <remarks/>
|
||||
public const int STEPPED = 0x04;
|
||||
/// <remarks/>
|
||||
public const int ARCHIVING = 0x05;
|
||||
/// <remarks/>
|
||||
public const int DERIVE_EQUATION = 0x06;
|
||||
/// <remarks/>
|
||||
public const int NODE_NAME = 0x07;
|
||||
/// <remarks/>
|
||||
public const int PROCESS_NAME = 0x08;
|
||||
/// <remarks/>
|
||||
public const int SOURCE_NAME = 0x09;
|
||||
/// <remarks/>
|
||||
public const int SOURCE_TYPE = 0x0a;
|
||||
/// <remarks/>
|
||||
public const int NORMAL_MAXIMUM = 0x0b;
|
||||
/// <remarks/>
|
||||
public const int NORMAL_MINIMUM = 0x0c;
|
||||
/// <remarks/>
|
||||
public const int ITEMID = 0x0d;
|
||||
/// <remarks/>
|
||||
public const int MAX_TIME_INT = 0x0e;
|
||||
/// <remarks/>
|
||||
public const int MIN_TIME_INT = 0x0f;
|
||||
/// <remarks/>
|
||||
public const int EXCEPTION_DEV = 0x10;
|
||||
/// <remarks/>
|
||||
public const int EXCEPTION_DEV_TYPE = 0x11;
|
||||
/// <remarks/>
|
||||
public const int HIGH_ENTRY_LIMIT = 0x12;
|
||||
/// <remarks/>
|
||||
public const int LOW_ENTRY_LIMIT = 0x13;
|
||||
}
|
||||
}
|
||||
69
Technosoftware/DaAeHdaClient/Hda/AttributeValue.cs
Normal file
69
Technosoftware/DaAeHdaClient/Hda/AttributeValue.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// The value of an attribute at a point in time.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaAttributeValue : ICloneable
|
||||
{
|
||||
#region Fields
|
||||
private DateTime timestamp_ = DateTime.MinValue;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// The value of the data.
|
||||
/// </summary>
|
||||
public object Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The timestamp associated with the value.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime Timestamp
|
||||
{
|
||||
get => timestamp_;
|
||||
set => timestamp_ = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
var clone = (TsCHdaAttributeValue)MemberwiseClone();
|
||||
clone.Value = OpcConvert.Clone(Value);
|
||||
return clone;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
323
Technosoftware/DaAeHdaClient/Hda/AttributeValueCollection.cs
Normal file
323
Technosoftware/DaAeHdaClient/Hda/AttributeValueCollection.cs
Normal file
@@ -0,0 +1,323 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// The set of values for an item attribute over a period of time.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaAttributeValueCollection : IOpcResult, ICollection, ICloneable, IList
|
||||
{
|
||||
#region Fields
|
||||
private OpcResult result_ = OpcResult.S_OK;
|
||||
private ArrayList attributeValues_ = new ArrayList();
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCHdaAttributeValueCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemIdentifier object.
|
||||
/// </summary>
|
||||
public TsCHdaAttributeValueCollection(TsCHdaAttribute attribute)
|
||||
{
|
||||
AttributeID = attribute.ID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified AttributeValueCollection object.
|
||||
/// </summary>
|
||||
public TsCHdaAttributeValueCollection(TsCHdaAttributeValueCollection collection)
|
||||
{
|
||||
attributeValues_ = new ArrayList(collection.attributeValues_.Count);
|
||||
|
||||
foreach (TsCHdaAttributeValue value in collection.attributeValues_)
|
||||
{
|
||||
attributeValues_.Add(value.Clone());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// A unique identifier for the attribute.
|
||||
/// </summary>
|
||||
public int AttributeID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Accessor for elements in the collection.
|
||||
/// </summary>
|
||||
public TsCHdaAttributeValue this[int index]
|
||||
{
|
||||
get => (TsCHdaAttributeValue)attributeValues_[index];
|
||||
set => attributeValues_[index] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IOpcResult Members
|
||||
/// <summary>
|
||||
/// The error id for the result of an operation on an item.
|
||||
/// </summary>
|
||||
public OpcResult Result
|
||||
{
|
||||
get => result_;
|
||||
set => result_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vendor specific diagnostic information (not the localized error text).
|
||||
/// </summary>
|
||||
public string DiagnosticInfo { get; set; }
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
var collection = (TsCHdaAttributeValueCollection)MemberwiseClone();
|
||||
|
||||
collection.attributeValues_ = new ArrayList(attributeValues_.Count);
|
||||
|
||||
foreach (TsCHdaAttributeValue value in attributeValues_)
|
||||
{
|
||||
collection.attributeValues_.Add(value.Clone());
|
||||
}
|
||||
|
||||
return collection;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => attributeValues_?.Count ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
attributeValues_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCHdaAttributeValue[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return attributeValues_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList Members
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the IList is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the element at the specified index.
|
||||
/// </summary>
|
||||
object IList.this[int index]
|
||||
{
|
||||
get => attributeValues_[index];
|
||||
|
||||
set
|
||||
{
|
||||
if (!(value is TsCHdaAttributeValue))
|
||||
{
|
||||
throw new ArgumentException("May only add AttributeValue objects into the collection.");
|
||||
}
|
||||
|
||||
attributeValues_[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the IList item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the item to remove.</param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
attributeValues_.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
if (!(value is TsCHdaAttributeValue))
|
||||
{
|
||||
throw new ArgumentException("May only add AttributeValue objects into the collection.");
|
||||
}
|
||||
|
||||
attributeValues_.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(object value)
|
||||
{
|
||||
attributeValues_.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return attributeValues_.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all items from the IList.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
attributeValues_.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return attributeValues_.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(object value)
|
||||
{
|
||||
if (!(value is TsCHdaAttributeValue))
|
||||
{
|
||||
throw new ArgumentException("May only add AttributeValue objects into the collection.");
|
||||
}
|
||||
|
||||
return attributeValues_.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the IList has a fixed size.
|
||||
/// </summary>
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, TsCHdaAttributeValue value)
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(TsCHdaAttributeValue value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(TsCHdaAttributeValue value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(TsCHdaAttributeValue value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(TsCHdaAttributeValue value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
75
Technosoftware/DaAeHdaClient/Hda/BrowseElement.cs
Normal file
75
Technosoftware/DaAeHdaClient/Hda/BrowseElement.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the description of an element in the server's address space.
|
||||
/// </summary>
|
||||
public class TsCHdaBrowseElement : OpcItem
|
||||
{
|
||||
#region Fields
|
||||
private TsCHdaAttributeValueCollection attributes_ = new TsCHdaAttributeValueCollection();
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// The name of element within its branch.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the element is an item with associated data in the archive.
|
||||
/// </summary>
|
||||
public bool IsItem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the element has child elements.
|
||||
/// </summary>
|
||||
public bool HasChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The current values of any attributes associated with the item.
|
||||
/// </summary>
|
||||
public TsCHdaAttributeValueCollection Attributes
|
||||
{
|
||||
get => attributes_;
|
||||
set => attributes_ = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep-copy of the object.
|
||||
/// </summary>
|
||||
public override object Clone()
|
||||
{
|
||||
var element = (TsCHdaBrowseElement)MemberwiseClone();
|
||||
element.Attributes = (TsCHdaAttributeValueCollection)attributes_.Clone();
|
||||
return element;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
72
Technosoftware/DaAeHdaClient/Hda/BrowseFilter.cs
Normal file
72
Technosoftware/DaAeHdaClient/Hda/BrowseFilter.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a filter to apply to an item attribute when browsing.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaBrowseFilter : ICloneable
|
||||
{
|
||||
#region Fields
|
||||
private TsCHdaOperator filterOperator_ = TsCHdaOperator.Equal;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// The attribute id to use when filtering.
|
||||
/// </summary>
|
||||
public int AttributeID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The operator to use when testing if the filter condition is met.
|
||||
/// </summary>
|
||||
public TsCHdaOperator Operator
|
||||
{
|
||||
get => filterOperator_;
|
||||
set => filterOperator_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value of the filter. The '*' and '?' wildcard characters are permitted.
|
||||
/// </summary>
|
||||
public object FilterValue { get; set; }
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep-copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
var filter = (TsCHdaBrowseFilter)MemberwiseClone();
|
||||
filter.FilterValue = OpcConvert.Clone(FilterValue);
|
||||
return filter;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
178
Technosoftware/DaAeHdaClient/Hda/BrowseFilterCollection.cs
Normal file
178
Technosoftware/DaAeHdaClient/Hda/BrowseFilterCollection.cs
Normal file
@@ -0,0 +1,178 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of attribute filters used when browsing the server address space.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaBrowseFilterCollection : OpcItem, ICollection
|
||||
{
|
||||
#region Fields
|
||||
private TsCHdaBrowseFilter[] browseFilters_ = new TsCHdaBrowseFilter[0];
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Creates an empty collection.
|
||||
/// </summary>
|
||||
public TsCHdaBrowseFilterCollection()
|
||||
{
|
||||
// do nothing.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object with any BrowseFilter contained in the collection.
|
||||
/// </summary>
|
||||
/// <param name="collection">A collection containing browse filters.</param>
|
||||
public TsCHdaBrowseFilterCollection(ICollection collection)
|
||||
{
|
||||
Init(collection);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Returns the browse filter at the specified index.
|
||||
/// </summary>
|
||||
public TsCHdaBrowseFilter this[int index]
|
||||
{
|
||||
get => browseFilters_[index];
|
||||
set => browseFilters_[index] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Returns the browse filter for the specified attribute id.
|
||||
/// </summary>
|
||||
public TsCHdaBrowseFilter Find(int id)
|
||||
{
|
||||
foreach (var filter in browseFilters_)
|
||||
{
|
||||
if (filter.AttributeID == id)
|
||||
{
|
||||
return filter;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object with any attribute values contained in the collection.
|
||||
/// </summary>
|
||||
/// <param name="collection">A collection containing attribute values.</param>
|
||||
public void Init(ICollection collection)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if (collection != null)
|
||||
{
|
||||
var values = new ArrayList(collection.Count);
|
||||
|
||||
foreach (var value in collection)
|
||||
{
|
||||
if (value.GetType() == typeof(TsCHdaBrowseFilter))
|
||||
{
|
||||
values.Add(OpcConvert.Clone(value));
|
||||
}
|
||||
}
|
||||
|
||||
browseFilters_ = (TsCHdaBrowseFilter[])values.ToArray(typeof(TsCHdaBrowseFilter));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all attribute values in the collection.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
browseFilters_ = new TsCHdaBrowseFilter[0];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public override object Clone()
|
||||
{
|
||||
return new TsCHdaBrowseFilterCollection(this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => browseFilters_?.Length ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects in to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
browseFilters_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCHdaBrowseFilter[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return browseFilters_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
52
Technosoftware/DaAeHdaClient/Hda/BrowsePosition.cs
Normal file
52
Technosoftware/DaAeHdaClient/Hda/BrowsePosition.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores the state of a browse operation.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaBrowsePosition : IOpcBrowsePosition
|
||||
{
|
||||
#region IDisposable Members
|
||||
/// <summary>
|
||||
/// Releases any unmanaged resources held by the object.
|
||||
/// </summary>
|
||||
public virtual void Dispose() { }
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a shallow copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
return (TsCHdaBrowsePosition)MemberwiseClone();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
53
Technosoftware/DaAeHdaClient/Hda/EditType.cs
Normal file
53
Technosoftware/DaAeHdaClient/Hda/EditType.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// The types of modifications that can be applied to an item.
|
||||
/// </summary>
|
||||
public enum TsCHdaEditType
|
||||
{
|
||||
/// <summary>
|
||||
/// The item was inserted.
|
||||
/// </summary>
|
||||
Insert = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The item was replaced.
|
||||
/// </summary>
|
||||
Replace = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The item was inserted or replaced during an insert/replace operation.
|
||||
/// </summary>
|
||||
InsertReplace = 3,
|
||||
|
||||
/// <summary>
|
||||
/// The item was deleted.
|
||||
/// </summary>
|
||||
Delete = 4
|
||||
}
|
||||
}
|
||||
44
Technosoftware/DaAeHdaClient/Hda/IActualTime.cs
Normal file
44
Technosoftware/DaAeHdaClient/Hda/IActualTime.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A interface used to actual time information associated with a result.
|
||||
/// </summary>
|
||||
public interface ITsCHdaActualTime
|
||||
{
|
||||
/// <summary>
|
||||
/// The actual start time used by a server while processing a request.
|
||||
/// </summary>
|
||||
DateTime StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The actual end time used by a server while processing a request.
|
||||
/// </summary>
|
||||
DateTime EndTime { get; set; }
|
||||
}
|
||||
}
|
||||
63
Technosoftware/DaAeHdaClient/Hda/IBrowser.cs
Normal file
63
Technosoftware/DaAeHdaClient/Hda/IBrowser.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines functionality that is common to all OPC Data Access servers.
|
||||
/// </summary>
|
||||
public interface ITsCHdaBrowser : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the set of attribute filters used by the browser.
|
||||
/// </summary>
|
||||
TsCHdaBrowseFilterCollection Filters { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Browses the server's address space at the specified branch.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item id of the branch to search.</param>
|
||||
/// <returns>The set of elements that meet the filter criteria.</returns>
|
||||
TsCHdaBrowseElement[] Browse(OpcItem itemId);
|
||||
|
||||
/// <summary>
|
||||
/// Begins a browsing the server's address space at the specified branch.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item id of the branch to search.</param>
|
||||
/// <param name="maxElements">The maximum number of elements to return.</param>
|
||||
/// <param name="position">The position object used to continue a browse operation.</param>
|
||||
/// <returns>The set of elements that meet the filter criteria.</returns>
|
||||
TsCHdaBrowseElement[] Browse(OpcItem itemId, int maxElements, out IOpcBrowsePosition position);
|
||||
|
||||
/// <summary>
|
||||
/// Continues browsing the server's address space at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="maxElements">The maximum number of elements to return.</param>
|
||||
/// <param name="position">The position object used to continue a browse operation.</param>
|
||||
/// <returns>The set of elements that meet the filter criteria.</returns>
|
||||
TsCHdaBrowseElement[] BrowseNext(int maxElements, ref IOpcBrowsePosition position);
|
||||
}
|
||||
}
|
||||
546
Technosoftware/DaAeHdaClient/Hda/IServer.cs
Normal file
546
Technosoftware/DaAeHdaClient/Hda/IServer.cs
Normal file
@@ -0,0 +1,546 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines functionality that is common to all OPC Historical Data Access servers.
|
||||
/// </summary>
|
||||
public interface ITsCHdaServer : IOpcServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the current server status.
|
||||
/// </summary>
|
||||
/// <returns>The current server status.</returns>
|
||||
OpcServerStatus GetServerStatus();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the item attributes supported by the server.
|
||||
/// </summary>
|
||||
/// <returns>The a set of item attributes and their descriptions.</returns>
|
||||
TsCHdaAttribute[] GetAttributes();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the aggregates supported by the server.
|
||||
/// </summary>
|
||||
/// <returns>The a set of aggregates and their descriptions.</returns>
|
||||
TsCHdaAggregate[] GetAggregates();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a object used to browse the server address space.
|
||||
/// </summary>
|
||||
/// <param name="filters">The set of attribute filters to use when browsing.</param>
|
||||
/// <param name="results">A result code for each individual filter.</param>
|
||||
/// <returns>A browser object that must be released by calling Dispose().</returns>
|
||||
ITsCHdaBrowser CreateBrowser(TsCHdaBrowseFilter[] filters, out OpcResult[] results);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a set of items.
|
||||
/// </summary>
|
||||
/// <param name="items">The identifiers for the items to create.</param>
|
||||
/// <returns>The results for each item containing the server handle and result code.</returns>
|
||||
OpcItemResult[] CreateItems(OpcItem[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Releases a set of previously created items.
|
||||
/// </summary>
|
||||
/// <param name="items">The server handles for the items to release.</param>
|
||||
/// <returns>The results for each item containing the result code.</returns>
|
||||
OpcItemResult[] ReleaseItems(OpcItem[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Validates a set of items.
|
||||
/// </summary>
|
||||
/// <param name="items">The identifiers for the items to validate.</param>
|
||||
/// <returns>The results for each item containing the result code.</returns>
|
||||
OpcItemResult[] ValidateItems(OpcItem[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Reads raw (unprocessed) data from the historian database for a set of items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="maxValues">The number of values to be read for each item.</param>
|
||||
/// <param name="includeBounds">Whether the bounding item values should be returned.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <returns>A set of values, qualities and timestamps within the requested time range for each item.</returns>
|
||||
TsCHdaItemValueCollection[] ReadRaw(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
int maxValues,
|
||||
bool includeBounds,
|
||||
OpcItem[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to read raw data from the historian database for a set of items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="maxValues">The number of values to be read for each item.</param>
|
||||
/// <param name="includeBounds">Whether the bounding item values should be returned.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] ReadRaw(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
int maxValues,
|
||||
bool includeBounds,
|
||||
OpcItem[] items,
|
||||
object requestHandle,
|
||||
TsCHdaReadValuesCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Requests that the server periodically send notifications when new data becomes available for a set of items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="updateInterval">The frequency, in seconds, that the server should check for new data.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] AdviseRaw(
|
||||
TsCHdaTime startTime,
|
||||
decimal updateInterval,
|
||||
OpcItem[] items,
|
||||
object requestHandle,
|
||||
TsCHdaDataUpdateEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Begins the playback raw data from the historian database for a set of items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="maxValues">The number of values to be read for each item.</param>
|
||||
/// <param name="updateInterval">The frequency, in seconds, that the server send data.</param>
|
||||
/// <param name="playbackDuration">The duration, in seconds, of the timespan returned with each update.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] PlaybackRaw(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
int maxValues,
|
||||
decimal updateInterval,
|
||||
decimal playbackDuration,
|
||||
OpcItem[] items,
|
||||
object requestHandle,
|
||||
TsCHdaDataUpdateEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Reads processed data from the historian database for a set of items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="resampleInterval">The interval between returned values.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <returns>A set of values, qualities and timestamps within the requested time range for each item.</returns>
|
||||
TsCHdaItemValueCollection[] ReadProcessed(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
decimal resampleInterval,
|
||||
TsCHdaItem[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to read processed data from the historian database for a set of items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="resampleInterval">The interval between returned values.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] ReadProcessed(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
decimal resampleInterval,
|
||||
TsCHdaItem[] items,
|
||||
object requestHandle,
|
||||
TsCHdaReadValuesCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Requests that the server periodically send notifications when new data becomes available for a set of items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="resampleInterval">The interval between returned values.</param>
|
||||
/// <param name="numberOfIntervals">The number of resample intervals that the server should return in each callback.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] AdviseProcessed(
|
||||
TsCHdaTime startTime,
|
||||
decimal resampleInterval,
|
||||
int numberOfIntervals,
|
||||
TsCHdaItem[] items,
|
||||
object requestHandle,
|
||||
TsCHdaDataUpdateEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Begins the playback of processed data from the historian database for a set of items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="resampleInterval">The interval between returned values.</param>
|
||||
/// <param name="numberOfIntervals">The number of resample intervals that the server should return in each callback.</param>
|
||||
/// <param name="updateInterval">The frequency, in seconds, that the server send data.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] PlaybackProcessed(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
decimal resampleInterval,
|
||||
int numberOfIntervals,
|
||||
decimal updateInterval,
|
||||
TsCHdaItem[] items,
|
||||
object requestHandle,
|
||||
TsCHdaDataUpdateEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Reads data from the historian database for a set of items at specific times.
|
||||
/// </summary>
|
||||
/// <param name="timestamps">The set of timestamps to use when reading items values.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <returns>A set of values, qualities and timestamps within the requested time range for each item.</returns>
|
||||
TsCHdaItemValueCollection[] ReadAtTime(DateTime[] timestamps, OpcItem[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to read item values at specific times.
|
||||
/// </summary>
|
||||
/// <param name="timestamps">The set of timestamps to use when reading items values.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] ReadAtTime(
|
||||
DateTime[] timestamps,
|
||||
OpcItem[] items,
|
||||
object requestHandle,
|
||||
TsCHdaReadValuesCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Reads item values that have been deleted or replaced.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="maxValues">The number of values to be read for each item.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <returns>A set of values, qualities and timestamps within the requested time range for each item.</returns>
|
||||
TsCHdaModifiedValueCollection[] ReadModified(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
int maxValues,
|
||||
OpcItem[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to read item values that have been deleted or replaced.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="maxValues">The number of values to be read for each item.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] ReadModified(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
int maxValues,
|
||||
OpcItem[] items,
|
||||
object requestHandle,
|
||||
TsCHdaReadValuesCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Reads the current or historical values for the attributes of an item.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="item">The item to read (must include the item name).</param>
|
||||
/// <param name="attributeIDs">The attributes to read.</param>
|
||||
/// <returns>A set of attribute values for each requested attribute.</returns>
|
||||
TsCHdaItemAttributeCollection ReadAttributes(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
OpcItem item,
|
||||
int[] attributeIDs);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to read the attributes of an item.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="item">The item to read (must include the item name).</param>
|
||||
/// <param name="attributeIDs">The attributes to read.</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the attribute ids.</returns>
|
||||
TsCHdaResultCollection ReadAttributes(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
OpcItem item,
|
||||
int[] attributeIDs,
|
||||
object requestHandle,
|
||||
TsCHdaReadAttributesCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Reads any annotations for an item within the a time interval.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <returns>A set of annotations within the requested time range for each item.</returns>
|
||||
TsCHdaAnnotationValueCollection[] ReadAnnotations(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
OpcItem[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to read the annotations for a set of items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to read.</param>
|
||||
/// <param name="endTime">The end of the history period to be read.</param>
|
||||
/// <param name="items">The set of items to read (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] ReadAnnotations(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
OpcItem[] items,
|
||||
object requestHandle,
|
||||
TsCHdaReadAnnotationsCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Inserts annotations for one or more items.
|
||||
/// </summary>
|
||||
/// <param name="items">A list of annotations to add for each item (must include the item name).</param>
|
||||
/// <returns>The results of the insert operation for each annotation set.</returns>
|
||||
TsCHdaResultCollection[] InsertAnnotations(TsCHdaAnnotationValueCollection[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to inserts annotations for one or more items.
|
||||
/// </summary>
|
||||
/// <param name="items">A list of annotations to add for each item (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] InsertAnnotations(
|
||||
TsCHdaAnnotationValueCollection[] items,
|
||||
object requestHandle,
|
||||
TsCHdaUpdateCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Inserts the values into the history database for one or more items.
|
||||
/// </summary>
|
||||
/// <param name="items">The set of values to insert.</param>
|
||||
/// <param name="replace">Whether existing values should be replaced.</param>
|
||||
/// <returns></returns>
|
||||
TsCHdaResultCollection[] Insert(TsCHdaItemValueCollection[] items, bool replace);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to inserts values for one or more items.
|
||||
/// </summary>
|
||||
/// <param name="items">The set of values to insert.</param>
|
||||
/// <param name="replace">Whether existing values should be replaced.</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] Insert(
|
||||
TsCHdaItemValueCollection[] items,
|
||||
bool replace,
|
||||
object requestHandle,
|
||||
TsCHdaUpdateCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Replace the values into the history database for one or more items.
|
||||
/// </summary>
|
||||
/// <param name="items">The set of values to replace.</param>
|
||||
/// <returns></returns>
|
||||
TsCHdaResultCollection[] Replace(TsCHdaItemValueCollection[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to replace values for one or more items.
|
||||
/// </summary>
|
||||
/// <param name="items">The set of values to replace.</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] Replace(
|
||||
TsCHdaItemValueCollection[] items,
|
||||
object requestHandle,
|
||||
TsCHdaUpdateCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the values with the specified time domain for one or more items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to delete.</param>
|
||||
/// <param name="endTime">The end of the history period to be delete.</param>
|
||||
/// <param name="items">The set of items to delete (must include the item name).</param>
|
||||
/// <returns>The results of the delete operation for each item.</returns>
|
||||
OpcItemResult[] Delete(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
OpcItem[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to delete values for one or more items.
|
||||
/// </summary>
|
||||
/// <param name="startTime">The beginning of the history period to delete.</param>
|
||||
/// <param name="endTime">The end of the history period to be delete.</param>
|
||||
/// <param name="items">The set of items to delete (must include the item name).</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] Delete(
|
||||
TsCHdaTime startTime,
|
||||
TsCHdaTime endTime,
|
||||
OpcItem[] items,
|
||||
object requestHandle,
|
||||
TsCHdaUpdateCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the values at the specified times for one or more items.
|
||||
/// </summary>
|
||||
/// <param name="items">The set of timestamps to delete for one or more items.</param>
|
||||
/// <returns>The results of the operation for each timestamp.</returns>
|
||||
TsCHdaResultCollection[] DeleteAtTime(TsCHdaItemTimeCollection[] items);
|
||||
|
||||
/// <summary>
|
||||
/// Sends an asynchronous request to delete values for one or more items at a specified times.
|
||||
/// </summary>
|
||||
/// <param name="items">The set of timestamps to delete for one or more items.</param>
|
||||
/// <param name="requestHandle">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
/// <param name="request">An object that contains the state of the request (used to cancel the request).</param>
|
||||
/// <returns>A set of results containing any errors encountered when the server validated the items.</returns>
|
||||
OpcItemResult[] DeleteAtTime(
|
||||
TsCHdaItemTimeCollection[] items,
|
||||
object requestHandle,
|
||||
TsCHdaUpdateCompleteEventHandler callback,
|
||||
out IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Cancels an asynchronous request.
|
||||
/// </summary>
|
||||
/// <param name="request">The state object for the request to cancel.</param>
|
||||
void CancelRequest(IOpcRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Cancels an asynchronous request.
|
||||
/// </summary>
|
||||
/// <param name="request">The state object for the request to cancel.</param>
|
||||
/// <param name="callback">A delegate used to receive notifications when the request completes.</param>
|
||||
void CancelRequest(IOpcRequest request, TsCHdaCancelCompleteEventHandler callback);
|
||||
|
||||
}
|
||||
|
||||
#region Delegate Declarations
|
||||
|
||||
/// <summary>
|
||||
/// Used to receive notifications when an exception occurs while processing a callback.
|
||||
/// </summary>
|
||||
/// <param name="request">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="exception">Exception which occured.</param>
|
||||
public delegate void TsCHdaCallbackExceptionEventHandler(IOpcRequest request, Exception exception);
|
||||
|
||||
/// <summary>
|
||||
/// Used to receive data update notifications.
|
||||
/// </summary>
|
||||
/// <param name="request">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="results">A collection of results.</param>
|
||||
public delegate void TsCHdaDataUpdateEventHandler(IOpcRequest request, TsCHdaItemValueCollection[] results);
|
||||
|
||||
/// <summary>
|
||||
/// Used to receive notifications when a read values request completes.
|
||||
/// </summary>
|
||||
/// <param name="request">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="results">A collection of results.</param>
|
||||
public delegate void TsCHdaReadValuesCompleteEventHandler(IOpcRequest request, TsCHdaItemValueCollection[] results);
|
||||
|
||||
/// <summary>
|
||||
/// Used to receive notifications when a read attributes request completes.
|
||||
/// </summary>
|
||||
/// <param name="request">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="results">A collection of results.</param>
|
||||
public delegate void TsCHdaReadAttributesCompleteEventHandler(IOpcRequest request, TsCHdaItemAttributeCollection results);
|
||||
|
||||
/// <summary>
|
||||
/// Used to receive notifications when a read annotations request completes.
|
||||
/// </summary>
|
||||
/// <param name="request">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="results">A collection of results.</param>
|
||||
public delegate void TsCHdaReadAnnotationsCompleteEventHandler(IOpcRequest request, TsCHdaAnnotationValueCollection[] results);
|
||||
|
||||
/// <summary>
|
||||
/// Used to receive notifications when an update request completes.
|
||||
/// </summary>
|
||||
/// <param name="request">An identifier for the request assigned by the caller.</param>
|
||||
/// <param name="results">A collection of results.</param>
|
||||
public delegate void TsCHdaUpdateCompleteEventHandler(IOpcRequest request, TsCHdaResultCollection[] results);
|
||||
|
||||
/// <summary>
|
||||
/// Used to receive notifications when a request is cancelled.
|
||||
/// </summary>
|
||||
/// <param name="request">An identifier for the request assigned by the caller.</param>
|
||||
public delegate void TsCHdaCancelCompleteEventHandler(IOpcRequest request);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
74
Technosoftware/DaAeHdaClient/Hda/Item.cs
Normal file
74
Technosoftware/DaAeHdaClient/Hda/Item.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes an item used in a request for processed or raw data.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaItem : OpcItem
|
||||
{
|
||||
#region Fields
|
||||
private int aggregate_ = TsCHdaAggregateID.NoAggregate;
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCHdaItem() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemIdentifier object.
|
||||
/// </summary>
|
||||
public TsCHdaItem(OpcItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified Item object.
|
||||
/// </summary>
|
||||
public TsCHdaItem(TsCHdaItem item)
|
||||
: base(item)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
Aggregate = item.Aggregate;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// The aggregate to use to process the data.
|
||||
/// </summary>
|
||||
public int Aggregate
|
||||
{
|
||||
get => aggregate_;
|
||||
set => aggregate_ = value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
345
Technosoftware/DaAeHdaClient/Hda/ItemAttributeCollection.cs
Normal file
345
Technosoftware/DaAeHdaClient/Hda/ItemAttributeCollection.cs
Normal file
@@ -0,0 +1,345 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of item attribute values passed to write or returned from a read operation.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaItemAttributeCollection : OpcItem, IOpcResult, ITsCHdaActualTime, IList
|
||||
{
|
||||
#region Fields
|
||||
private DateTime startTime_ = DateTime.MinValue;
|
||||
private DateTime endTime_ = DateTime.MinValue;
|
||||
private ArrayList attributes_ = new ArrayList();
|
||||
private OpcResult result_ = OpcResult.S_OK;
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCHdaItemAttributeCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemIdentifier object.
|
||||
/// </summary>
|
||||
public TsCHdaItemAttributeCollection(OpcItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemAttributeCollection object.
|
||||
/// </summary>
|
||||
public TsCHdaItemAttributeCollection(TsCHdaItemAttributeCollection item)
|
||||
: base(item)
|
||||
{
|
||||
attributes_ = new ArrayList(item.attributes_.Count);
|
||||
|
||||
foreach (TsCHdaAttributeValueCollection value in item.attributes_)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
attributes_.Add(value.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Accessor for elements in the collection.
|
||||
/// </summary>
|
||||
public TsCHdaAttributeValueCollection this[int index]
|
||||
{
|
||||
get => (TsCHdaAttributeValueCollection)attributes_[index];
|
||||
set => attributes_[index] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IOpcResult Members
|
||||
/// <summary>
|
||||
/// The error id for the result of an operation on an item.
|
||||
/// </summary>
|
||||
public OpcResult Result
|
||||
{
|
||||
get => result_;
|
||||
set => result_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vendor specific diagnostic information (not the localized error text).
|
||||
/// </summary>
|
||||
public string DiagnosticInfo { get; set; }
|
||||
#endregion
|
||||
|
||||
#region IActualTime Members
|
||||
/// <summary>
|
||||
/// The actual start time used by a server while processing a request.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime StartTime
|
||||
{
|
||||
get => startTime_;
|
||||
set => startTime_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The actual end time used by a server while processing a request.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime EndTime
|
||||
{
|
||||
get => endTime_;
|
||||
set => endTime_ = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public override object Clone()
|
||||
{
|
||||
var collection = (TsCHdaItemAttributeCollection)base.Clone();
|
||||
|
||||
collection.attributes_ = new ArrayList(attributes_.Count);
|
||||
|
||||
foreach (TsCHdaAttributeValueCollection value in attributes_)
|
||||
{
|
||||
collection.attributes_.Add(value.Clone());
|
||||
}
|
||||
|
||||
return collection;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => attributes_?.Count ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
attributes_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCHdaAttributeValueCollection[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return attributes_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList Members
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the IList is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the element at the specified index.
|
||||
/// </summary>
|
||||
object IList.this[int index]
|
||||
{
|
||||
get => attributes_[index];
|
||||
|
||||
set
|
||||
{
|
||||
if (!(value is TsCHdaAttributeValueCollection))
|
||||
{
|
||||
throw new ArgumentException("May only add AttributeValueCollection objects into the collection.");
|
||||
}
|
||||
|
||||
attributes_[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the IList item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the item to remove.</param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
attributes_.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
if (!(value is TsCHdaAttributeValueCollection))
|
||||
{
|
||||
throw new ArgumentException("May only add AttributeValueCollection objects into the collection.");
|
||||
}
|
||||
|
||||
attributes_.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(object value)
|
||||
{
|
||||
attributes_.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return attributes_.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all items from the IList.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
attributes_.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return attributes_.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(object value)
|
||||
{
|
||||
if (!(value is TsCHdaAttributeValueCollection))
|
||||
{
|
||||
throw new ArgumentException("May only add AttributeValueCollection objects into the collection.");
|
||||
}
|
||||
|
||||
return attributes_.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the IList has a fixed size.
|
||||
/// </summary>
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, TsCHdaAttributeValueCollection value)
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(TsCHdaAttributeValueCollection value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(TsCHdaAttributeValueCollection value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(TsCHdaAttributeValueCollection value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(TsCHdaAttributeValueCollection value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
315
Technosoftware/DaAeHdaClient/Hda/ItemCollection.cs
Normal file
315
Technosoftware/DaAeHdaClient/Hda/ItemCollection.cs
Normal file
@@ -0,0 +1,315 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of items.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaItemCollection : ICloneable, IList
|
||||
{
|
||||
#region Fields
|
||||
private ArrayList items_ = new ArrayList();
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCHdaItemCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ResultCollection object.
|
||||
/// </summary>
|
||||
public TsCHdaItemCollection(TsCHdaItemCollection items)
|
||||
{
|
||||
if (items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (TsCHdaItem item in items)
|
||||
{
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the item at the specified index.
|
||||
/// </summary>
|
||||
public TsCHdaItem this[int index]
|
||||
{
|
||||
get => (TsCHdaItem)items_[index];
|
||||
set => items_[index] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the first item with the specified item id.
|
||||
/// </summary>
|
||||
public TsCHdaItem this[OpcItem itemId]
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (TsCHdaItem item in items_)
|
||||
{
|
||||
if (itemId.Key == item.Key)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
var clone = (TsCHdaItemCollection)MemberwiseClone();
|
||||
|
||||
clone.items_ = new ArrayList();
|
||||
|
||||
foreach (TsCHdaItem item in items_)
|
||||
{
|
||||
clone.items_.Add(item.Clone());
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => items_?.Count ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
items_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCHdaItem[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return items_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the IList is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly => false;
|
||||
/// <summary>
|
||||
/// Gets or sets the element at the specified index.
|
||||
/// </summary>
|
||||
object IList.this[int index]
|
||||
{
|
||||
get => items_[index];
|
||||
|
||||
set
|
||||
{
|
||||
if (!(value is TsCHdaItem))
|
||||
{
|
||||
throw new ArgumentException("May only add Item objects into the collection.");
|
||||
}
|
||||
|
||||
items_[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the IList item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the item to remove.</param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
items_.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
if (!(value is TsCHdaItem))
|
||||
{
|
||||
throw new ArgumentException("May only add Item objects into the collection.");
|
||||
}
|
||||
|
||||
items_.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(object value)
|
||||
{
|
||||
items_.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return items_.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all items from the IList.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
items_.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return items_.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(object value)
|
||||
{
|
||||
if (!(value is TsCHdaItem))
|
||||
{
|
||||
throw new ArgumentException("May only add Item objects into the collection.");
|
||||
}
|
||||
|
||||
return items_.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the IList has a fixed size.
|
||||
/// </summary>
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, TsCHdaItem value)
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(TsCHdaItem value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(TsCHdaItem value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(TsCHdaItem value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(TsCHdaItem value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
85
Technosoftware/DaAeHdaClient/Hda/ItemResult.cs
Normal file
85
Technosoftware/DaAeHdaClient/Hda/ItemResult.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the results for an item used in a read processed or raw data request.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaItemResult : TsCHdaItem, IOpcResult
|
||||
{
|
||||
#region Fields
|
||||
private OpcResult result_ = OpcResult.S_OK;
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initialize object with default values.
|
||||
/// </summary>
|
||||
public TsCHdaItemResult() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize object with the specified ItemIdentifier object.
|
||||
/// </summary>
|
||||
public TsCHdaItemResult(OpcItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified Item object.
|
||||
/// </summary>
|
||||
public TsCHdaItemResult(TsCHdaItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize object with the specified ItemResult object.
|
||||
/// </summary>
|
||||
public TsCHdaItemResult(TsCHdaItemResult item)
|
||||
: base(item)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
Result = item.Result;
|
||||
DiagnosticInfo = item.DiagnosticInfo;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IOpcResult Members
|
||||
/// <summary>
|
||||
/// The error id for the result of an operation on an item.
|
||||
/// </summary>
|
||||
public OpcResult Result
|
||||
{
|
||||
get => result_;
|
||||
set => result_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vendor specific diagnostic information (not the localized error text).
|
||||
/// </summary>
|
||||
public string DiagnosticInfo { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
299
Technosoftware/DaAeHdaClient/Hda/ItemTimeCollection.cs
Normal file
299
Technosoftware/DaAeHdaClient/Hda/ItemTimeCollection.cs
Normal file
@@ -0,0 +1,299 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of results passed to write or returned from an insert, replace or delete operation.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaItemTimeCollection : OpcItem, IList
|
||||
{
|
||||
#region Fields
|
||||
private ArrayList times_ = new ArrayList();
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCHdaItemTimeCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemIdentifier object.
|
||||
/// </summary>
|
||||
public TsCHdaItemTimeCollection(OpcItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemTimeCollection object.
|
||||
/// </summary>
|
||||
public TsCHdaItemTimeCollection(TsCHdaItemTimeCollection item)
|
||||
: base(item)
|
||||
{
|
||||
times_ = new ArrayList(item.times_.Count);
|
||||
|
||||
foreach (DateTime value in item.times_)
|
||||
{
|
||||
times_.Add(value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Accessor for elements in the collection.
|
||||
/// </summary>
|
||||
public DateTime this[int index]
|
||||
{
|
||||
get => (DateTime)times_[index];
|
||||
set => times_[index] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public override object Clone()
|
||||
{
|
||||
var collection = (TsCHdaItemTimeCollection)base.Clone();
|
||||
|
||||
collection.times_ = new ArrayList(times_.Count);
|
||||
|
||||
foreach (DateTime value in times_)
|
||||
{
|
||||
collection.times_.Add(value);
|
||||
}
|
||||
|
||||
return collection;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => times_?.Count ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
times_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(DateTime[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return times_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList Members
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the IList is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the element at the specified index.
|
||||
/// </summary>
|
||||
object IList.this[int index]
|
||||
{
|
||||
get => times_[index];
|
||||
|
||||
set
|
||||
{
|
||||
if (!(value is DateTime))
|
||||
{
|
||||
throw new ArgumentException("May only add DateTime objects into the collection.");
|
||||
}
|
||||
|
||||
times_[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the IList item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the item to remove.</param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
times_.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
if (!(value is DateTime))
|
||||
{
|
||||
throw new ArgumentException("May only add DateTime objects into the collection.");
|
||||
}
|
||||
|
||||
times_.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(object value)
|
||||
{
|
||||
times_.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return times_.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all items from the IList.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
times_.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return times_.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(object value)
|
||||
{
|
||||
if (!(value is DateTime))
|
||||
{
|
||||
throw new ArgumentException("May only add DateTime objects into the collection.");
|
||||
}
|
||||
|
||||
return times_.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the IList has a fixed size.
|
||||
/// </summary>
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, DateTime value)
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(DateTime value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(DateTime value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(DateTime value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(DateTime value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
93
Technosoftware/DaAeHdaClient/Hda/ItemValue.cs
Normal file
93
Technosoftware/DaAeHdaClient/Hda/ItemValue.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
#pragma warning disable 618
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A value of an item at in instant of time.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaItemValue : ICloneable
|
||||
{
|
||||
#region Fields
|
||||
private DateTime timestamp_ = DateTime.MinValue;
|
||||
private Da.TsCDaQuality daQuality_ = Da.TsCDaQuality.Bad;
|
||||
private TsCHdaQuality historianQuality_ = TsCHdaQuality.NoData;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// The value of the item.
|
||||
/// </summary>
|
||||
public object Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The timestamp associated with the value.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime Timestamp
|
||||
{
|
||||
get => timestamp_;
|
||||
set => timestamp_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The quality associated with the value when it was acquired from the data source.
|
||||
/// </summary>
|
||||
public Da.TsCDaQuality Quality
|
||||
{
|
||||
get => daQuality_;
|
||||
set => daQuality_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The quality associated with the value when it was retrieved from the hiatorian database.
|
||||
/// </summary>
|
||||
public TsCHdaQuality HistorianQuality
|
||||
{
|
||||
get => historianQuality_;
|
||||
set => historianQuality_ = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public object Clone()
|
||||
{
|
||||
var value = (TsCHdaItemValue)MemberwiseClone();
|
||||
value.Value = OpcConvert.Clone(Value);
|
||||
return value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
369
Technosoftware/DaAeHdaClient/Hda/ItemValueCollection.cs
Normal file
369
Technosoftware/DaAeHdaClient/Hda/ItemValueCollection.cs
Normal file
@@ -0,0 +1,369 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of item values passed to write or returned from a read operation.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaItemValueCollection : TsCHdaItem, IOpcResult, ITsCHdaActualTime, ICollection, ICloneable, IList
|
||||
{
|
||||
#region Fields
|
||||
private DateTime startTime_ = DateTime.MinValue;
|
||||
private DateTime endTime_ = DateTime.MinValue;
|
||||
private ArrayList values_ = new ArrayList();
|
||||
private OpcResult result_ = OpcResult.S_OK;
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCHdaItemValueCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemIdentifier object.
|
||||
/// </summary>
|
||||
public TsCHdaItemValueCollection(OpcItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified Item object.
|
||||
/// </summary>
|
||||
public TsCHdaItemValueCollection(TsCHdaItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemValueCollection object.
|
||||
/// </summary>
|
||||
public TsCHdaItemValueCollection(TsCHdaItemValueCollection item)
|
||||
: base(item)
|
||||
{
|
||||
values_ = new ArrayList(item.values_.Count);
|
||||
|
||||
foreach (TsCHdaItemValue value in item.values_)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
values_.Add(value.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Accessor for elements in the collection.
|
||||
/// </summary>
|
||||
public TsCHdaItemValue this[int index]
|
||||
{
|
||||
get => (TsCHdaItemValue)values_[index];
|
||||
set => values_[index] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Appends another value collection to the collection.
|
||||
/// </summary>
|
||||
public void AddRange(TsCHdaItemValueCollection collection)
|
||||
{
|
||||
if (collection != null)
|
||||
{
|
||||
foreach (TsCHdaItemValue value in collection)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
values_.Add(value.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IOpcResult Members
|
||||
/// <summary>
|
||||
/// The error id for the result of an operation on an item.
|
||||
/// </summary>
|
||||
public OpcResult Result
|
||||
{
|
||||
get => result_;
|
||||
set => result_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vendor specific diagnostic information (not the localized error text).
|
||||
/// </summary>
|
||||
public string DiagnosticInfo { get; set; }
|
||||
#endregion
|
||||
|
||||
#region IActualTime Members
|
||||
/// <summary>
|
||||
/// The actual start time used by a server while processing a request.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime StartTime
|
||||
{
|
||||
get => startTime_;
|
||||
set => startTime_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The actual end time used by a server while processing a request.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime EndTime
|
||||
{
|
||||
get => endTime_;
|
||||
set => endTime_ = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public override object Clone()
|
||||
{
|
||||
var collection = (TsCHdaItemValueCollection)base.Clone();
|
||||
|
||||
collection.values_ = new ArrayList(values_.Count);
|
||||
|
||||
foreach (TsCHdaItemValue value in values_)
|
||||
{
|
||||
collection.values_.Add(value.Clone());
|
||||
}
|
||||
|
||||
return collection;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => values_?.Count ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
values_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCHdaItemValue[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return values_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList Members
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the IList is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the element at the specified index.
|
||||
/// </summary>
|
||||
object IList.this[int index]
|
||||
{
|
||||
get => values_[index];
|
||||
|
||||
set
|
||||
{
|
||||
if (!(value is TsCHdaItemValue))
|
||||
{
|
||||
throw new ArgumentException("May only add ItemValue objects into the collection.");
|
||||
}
|
||||
|
||||
values_[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the IList item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the item to remove.</param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
values_.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
if (!(value is TsCHdaItemValue))
|
||||
{
|
||||
throw new ArgumentException("May only add ItemValue objects into the collection.");
|
||||
}
|
||||
|
||||
values_.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(object value)
|
||||
{
|
||||
values_.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return values_.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all items from the IList.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
values_.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return values_.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(object value)
|
||||
{
|
||||
if (!(value is TsCHdaItemValue))
|
||||
{
|
||||
throw new ArgumentException("May only add ItemValue objects into the collection.");
|
||||
}
|
||||
|
||||
return values_.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the IList has a fixed size.
|
||||
/// </summary>
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, TsCHdaItemValue value)
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(TsCHdaItemValue value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(TsCHdaItemValue value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(TsCHdaItemValue value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(TsCHdaItemValue value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
90
Technosoftware/DaAeHdaClient/Hda/ItemValueResult.cs
Normal file
90
Technosoftware/DaAeHdaClient/Hda/ItemValueResult.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A result associated with a single item value.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaResult : ICloneable, IOpcResult
|
||||
{
|
||||
#region Fields
|
||||
private OpcResult result_ = OpcResult.S_OK;
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes the object with default values.
|
||||
/// </summary>
|
||||
public TsCHdaResult() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object with the specified result id.
|
||||
/// </summary>
|
||||
public TsCHdaResult(OpcResult resultId)
|
||||
{
|
||||
Result = resultId;
|
||||
DiagnosticInfo = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object with the specified result object.
|
||||
/// </summary>
|
||||
public TsCHdaResult(IOpcResult result)
|
||||
{
|
||||
Result = result.Result;
|
||||
DiagnosticInfo = result.DiagnosticInfo;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IOpcResult Members
|
||||
/// <summary>
|
||||
/// The error id for the result of an operation on an item.
|
||||
/// </summary>
|
||||
public OpcResult Result
|
||||
{
|
||||
get => result_;
|
||||
set => result_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vendor specific diagnostic information (not the localized error text).
|
||||
/// </summary>
|
||||
public string DiagnosticInfo { get; set; }
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public object Clone()
|
||||
{
|
||||
return MemberwiseClone();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
67
Technosoftware/DaAeHdaClient/Hda/ModifiedValue.cs
Normal file
67
Technosoftware/DaAeHdaClient/Hda/ModifiedValue.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A value of an item at in instant of time that has be deleted or replaced.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaModifiedValue : TsCHdaItemValue
|
||||
{
|
||||
#region Fields
|
||||
private DateTime modificationTime_ = DateTime.MinValue;
|
||||
private TsCHdaEditType editType_ = TsCHdaEditType.Insert;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// The time when the value was deleted or replaced.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime ModificationTime
|
||||
{
|
||||
get => modificationTime_;
|
||||
set => modificationTime_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the value was deleted or replaced.
|
||||
/// </summary>
|
||||
public TsCHdaEditType EditType
|
||||
{
|
||||
get => editType_;
|
||||
set => editType_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The user who modified the item value.
|
||||
/// </summary>
|
||||
public string User { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
68
Technosoftware/DaAeHdaClient/Hda/ModifiedValueCollection.cs
Normal file
68
Technosoftware/DaAeHdaClient/Hda/ModifiedValueCollection.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of modified item values with a result code indicating the results of a read operation.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaModifiedValueCollection : TsCHdaItemValueCollection
|
||||
{
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initialize object with default values.
|
||||
/// </summary>
|
||||
public TsCHdaModifiedValueCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize object with the specified ItemIdentifier object.
|
||||
/// </summary>
|
||||
public TsCHdaModifiedValueCollection(OpcItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified Item object.
|
||||
/// </summary>
|
||||
public TsCHdaModifiedValueCollection(TsCHdaItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemValueCollection object.
|
||||
/// </summary>
|
||||
public TsCHdaModifiedValueCollection(TsCHdaItemValueCollection item) : base(item) { }
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Accessor for elements in the collection.
|
||||
/// </summary>
|
||||
public new TsCHdaModifiedValue this[int index]
|
||||
{
|
||||
get => (TsCHdaModifiedValue)this[index];
|
||||
set => this[index] = value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
64
Technosoftware/DaAeHdaClient/Hda/Operator.cs
Normal file
64
Technosoftware/DaAeHdaClient/Hda/Operator.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// The set of possible operators to use when applying an item attribute filter.
|
||||
/// </summary>
|
||||
public enum TsCHdaOperator
|
||||
{
|
||||
/// <summary>
|
||||
/// The attribute value is equal (or matches) to the filter.
|
||||
/// </summary>
|
||||
Equal = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The attribute value is less than the filter.
|
||||
/// </summary>
|
||||
Less,
|
||||
|
||||
/// <summary>
|
||||
/// The attribute value is less than or equal to the filter.
|
||||
/// </summary>
|
||||
LessEqual,
|
||||
|
||||
/// <summary>
|
||||
/// The attribute value is greater than the filter.
|
||||
/// </summary>
|
||||
Greater,
|
||||
|
||||
/// <summary>
|
||||
/// The attribute value is greater than or equal to the filter.
|
||||
/// </summary>
|
||||
GreaterEqual,
|
||||
|
||||
/// <summary>
|
||||
/// The attribute value is not equal (or does not match)to the filter.
|
||||
/// </summary>
|
||||
NotEqual
|
||||
}
|
||||
}
|
||||
80
Technosoftware/DaAeHdaClient/Hda/Quality.cs
Normal file
80
Technosoftware/DaAeHdaClient/Hda/Quality.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines possible HDA quality codes.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum TsCHdaQuality
|
||||
{
|
||||
/// <summary>
|
||||
/// More than one piece of data that may be hidden exists at same timestamp.
|
||||
/// </summary>
|
||||
ExtraData = 0x00010000,
|
||||
|
||||
/// <summary>
|
||||
/// Interpolated data value.
|
||||
/// </summary>
|
||||
Interpolated = 0x00020000,
|
||||
|
||||
/// <summary>
|
||||
/// Raw data
|
||||
/// </summary>
|
||||
Raw = 0x00040000,
|
||||
|
||||
/// <summary>
|
||||
/// Calculated data value, as would be returned from a ReadProcessed call.
|
||||
/// </summary>
|
||||
Calculated = 0x00080000,
|
||||
|
||||
/// <summary>
|
||||
/// No data found to provide upper or lower bound value.
|
||||
/// </summary>
|
||||
NoBound = 0x00100000,
|
||||
|
||||
/// <summary>
|
||||
/// Bad No data collected. Archiving not active (for item or all items).
|
||||
/// </summary>
|
||||
NoData = 0x00200000,
|
||||
|
||||
/// <summary>
|
||||
/// Collection started/stopped/lost.
|
||||
/// </summary>
|
||||
DataLost = 0x00400000,
|
||||
|
||||
/// <summary>
|
||||
/// Scaling or conversion error.
|
||||
/// </summary>
|
||||
Conversion = 0x00800000,
|
||||
|
||||
/// <summary>
|
||||
/// Aggregate value is for an incomplete interval.
|
||||
/// </summary>
|
||||
Partial = 0x01000000
|
||||
}
|
||||
}
|
||||
74
Technosoftware/DaAeHdaClient/Hda/RelativeTime.cs
Normal file
74
Technosoftware/DaAeHdaClient/Hda/RelativeTime.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// Possible base or offset types for relative times.
|
||||
/// </summary>
|
||||
public enum TsCHdaRelativeTime
|
||||
{
|
||||
/// <summary>
|
||||
/// Start from the current time.
|
||||
/// </summary>
|
||||
Now,
|
||||
|
||||
/// <summary>
|
||||
/// The start of the current second or an offset in seconds.
|
||||
/// </summary>
|
||||
Second,
|
||||
|
||||
/// <summary>
|
||||
/// The start of the current minutes or an offset in minutes.
|
||||
/// </summary>
|
||||
Minute,
|
||||
|
||||
/// <summary>
|
||||
/// The start of the current hour or an offset in hours.
|
||||
/// </summary>
|
||||
Hour,
|
||||
|
||||
/// <summary>
|
||||
/// The start of the current day or an offset in days.
|
||||
/// </summary>
|
||||
Day,
|
||||
|
||||
/// <summary>
|
||||
/// The start of the current week or an offset in weeks.
|
||||
/// </summary>
|
||||
Week,
|
||||
|
||||
/// <summary>
|
||||
/// The start of the current month or an offset in months.
|
||||
/// </summary>
|
||||
Month,
|
||||
|
||||
/// <summary>
|
||||
/// The start of the current year or an offset in years.
|
||||
/// </summary>
|
||||
Year
|
||||
}
|
||||
}
|
||||
299
Technosoftware/DaAeHdaClient/Hda/ResultCollection.cs
Normal file
299
Technosoftware/DaAeHdaClient/Hda/ResultCollection.cs
Normal file
@@ -0,0 +1,299 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of results passed to write or returned from an insert, replace or delete operation.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaResultCollection : OpcItem, ICollection, ICloneable, IList
|
||||
{
|
||||
#region Fields
|
||||
private ArrayList results_ = new ArrayList();
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCHdaResultCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ItemIdentifier object.
|
||||
/// </summary>
|
||||
public TsCHdaResultCollection(OpcItem item) : base(item) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified ResultCollection object.
|
||||
/// </summary>
|
||||
public TsCHdaResultCollection(TsCHdaResultCollection item)
|
||||
: base(item)
|
||||
{
|
||||
results_ = new ArrayList(item.results_.Count);
|
||||
|
||||
foreach (TsCHdaResult value in item.results_)
|
||||
{
|
||||
results_.Add(value.Clone());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Accessor for elements in the collection.
|
||||
/// </summary>
|
||||
public TsCHdaResult this[int index]
|
||||
{
|
||||
get => (TsCHdaResult)results_[index];
|
||||
set => results_[index] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public override object Clone()
|
||||
{
|
||||
var collection = (TsCHdaResultCollection)base.Clone();
|
||||
|
||||
collection.results_ = new ArrayList(results_.Count);
|
||||
|
||||
foreach (TsCHdaResultCollection value in results_)
|
||||
{
|
||||
collection.results_.Add(value.Clone());
|
||||
}
|
||||
|
||||
return collection;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => results_?.Count ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
results_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCHdaResult[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return results_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList Members
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the IList is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the element at the specified index.
|
||||
/// </summary>
|
||||
object IList.this[int index]
|
||||
{
|
||||
get => results_[index];
|
||||
|
||||
set
|
||||
{
|
||||
if (!(value is TsCHdaResult))
|
||||
{
|
||||
throw new ArgumentException("May only add Result objects into the collection.");
|
||||
}
|
||||
|
||||
results_[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the IList item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the item to remove.</param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
results_.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
if (!(value is TsCHdaResult))
|
||||
{
|
||||
throw new ArgumentException("May only add Result objects into the collection.");
|
||||
}
|
||||
|
||||
results_.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(object value)
|
||||
{
|
||||
results_.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return results_.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all items from the IList.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
results_.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return results_.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(object value)
|
||||
{
|
||||
if (!(value is TsCHdaResult))
|
||||
{
|
||||
throw new ArgumentException("May only add Result objects into the collection.");
|
||||
}
|
||||
|
||||
return results_.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the IList has a fixed size.
|
||||
/// </summary>
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, TsCHdaResult value)
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(TsCHdaResult value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(TsCHdaResult value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(TsCHdaResult value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(TsCHdaResult value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
1072
Technosoftware/DaAeHdaClient/Hda/Server.cs
Normal file
1072
Technosoftware/DaAeHdaClient/Hda/Server.cs
Normal file
File diff suppressed because it is too large
Load Diff
47
Technosoftware/DaAeHdaClient/Hda/ServerState.cs
Normal file
47
Technosoftware/DaAeHdaClient/Hda/ServerState.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
#region Using Directives
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// The set of possible server states.
|
||||
/// </summary>
|
||||
public enum TsCHdaServerState
|
||||
{
|
||||
/// <summary>
|
||||
/// The historian is running.
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The historian is not running.
|
||||
/// </summary>
|
||||
Down = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The status of the historian is indeterminate.
|
||||
/// </summary>
|
||||
Indeterminate = 3
|
||||
}
|
||||
}
|
||||
303
Technosoftware/DaAeHdaClient/Hda/Time.cs
Normal file
303
Technosoftware/DaAeHdaClient/Hda/Time.cs
Normal file
@@ -0,0 +1,303 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Text;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A time specified as either an absolute or relative value.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaTime
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private DateTime absoluteTime_ = DateTime.MinValue;
|
||||
private TsCHdaRelativeTime baseTime_ = TsCHdaRelativeTime.Now;
|
||||
private TsCHdaTimeOffsetCollection offsets_ = new TsCHdaTimeOffsetCollection();
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes the object with its default values.
|
||||
/// </summary>
|
||||
public TsCHdaTime() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object with an absolute time.
|
||||
/// </summary>
|
||||
/// <param name="time">The absolute time.</param>
|
||||
public TsCHdaTime(DateTime time)
|
||||
{
|
||||
AbsoluteTime = time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object with a relative time.
|
||||
/// </summary>
|
||||
/// <param name="time">The relative time.</param>
|
||||
public TsCHdaTime(string time)
|
||||
{
|
||||
var value = Parse(time);
|
||||
|
||||
absoluteTime_ = DateTime.MinValue;
|
||||
baseTime_ = value.baseTime_;
|
||||
offsets_ = value.offsets_;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Whether the time is a relative or absolute time.
|
||||
/// </summary>
|
||||
public bool IsRelative
|
||||
{
|
||||
get => (absoluteTime_ == DateTime.MinValue);
|
||||
set => absoluteTime_ = DateTime.MinValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The time as absolute value.
|
||||
/// The <see cref="ApplicationInstance.TimeAsUtc">ApplicationInstance.TimeAsUtc</see> property defines
|
||||
/// the time format (UTC or local time).
|
||||
/// </summary>
|
||||
public DateTime AbsoluteTime
|
||||
{
|
||||
get => absoluteTime_;
|
||||
set => absoluteTime_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The base for a relative time value.
|
||||
/// </summary>
|
||||
public TsCHdaRelativeTime BaseTime
|
||||
{
|
||||
get => baseTime_;
|
||||
set => baseTime_ = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The set of offsets to be applied to the base of a relative time.
|
||||
/// </summary>
|
||||
public TsCHdaTimeOffsetCollection Offsets => offsets_;
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Converts a relative time to an absolute time by using the system clock.
|
||||
/// </summary>
|
||||
public DateTime ResolveTime()
|
||||
{
|
||||
// nothing special to do for absolute times.
|
||||
if (!IsRelative)
|
||||
{
|
||||
return absoluteTime_;
|
||||
}
|
||||
|
||||
// get local time from the system.
|
||||
var time = DateTime.UtcNow;
|
||||
|
||||
var years = time.Year;
|
||||
var months = time.Month;
|
||||
var days = time.Day;
|
||||
var hours = time.Hour;
|
||||
var minutes = time.Minute;
|
||||
var seconds = time.Second;
|
||||
var milliseconds = time.Millisecond;
|
||||
|
||||
// move to the beginning of the period indicated by the base time.
|
||||
switch (BaseTime)
|
||||
{
|
||||
case TsCHdaRelativeTime.Year:
|
||||
{
|
||||
months = 0;
|
||||
days = 0;
|
||||
hours = 0;
|
||||
minutes = 0;
|
||||
seconds = 0;
|
||||
milliseconds = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case TsCHdaRelativeTime.Month:
|
||||
{
|
||||
days = 0;
|
||||
hours = 0;
|
||||
minutes = 0;
|
||||
seconds = 0;
|
||||
milliseconds = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case TsCHdaRelativeTime.Week:
|
||||
case TsCHdaRelativeTime.Day:
|
||||
{
|
||||
hours = 0;
|
||||
minutes = 0;
|
||||
seconds = 0;
|
||||
milliseconds = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case TsCHdaRelativeTime.Hour:
|
||||
{
|
||||
minutes = 0;
|
||||
seconds = 0;
|
||||
milliseconds = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case TsCHdaRelativeTime.Minute:
|
||||
{
|
||||
seconds = 0;
|
||||
milliseconds = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case TsCHdaRelativeTime.Second:
|
||||
{
|
||||
milliseconds = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// construct base time.
|
||||
time = new DateTime(years, months, days, hours, minutes, seconds, milliseconds);
|
||||
|
||||
// adjust to beginning of week.
|
||||
if (BaseTime == TsCHdaRelativeTime.Week && time.DayOfWeek != DayOfWeek.Sunday)
|
||||
{
|
||||
time = time.AddDays(-((int)time.DayOfWeek));
|
||||
}
|
||||
|
||||
// add offsets.
|
||||
foreach (TsCHdaTimeOffset offset in Offsets)
|
||||
{
|
||||
switch (offset.Type)
|
||||
{
|
||||
case TsCHdaRelativeTime.Year: { time = time.AddYears(offset.Value); break; }
|
||||
case TsCHdaRelativeTime.Month: { time = time.AddMonths(offset.Value); break; }
|
||||
case TsCHdaRelativeTime.Week: { time = time.AddDays(offset.Value * 7); break; }
|
||||
case TsCHdaRelativeTime.Day: { time = time.AddDays(offset.Value); break; }
|
||||
case TsCHdaRelativeTime.Hour: { time = time.AddHours(offset.Value); break; }
|
||||
case TsCHdaRelativeTime.Minute: { time = time.AddMinutes(offset.Value); break; }
|
||||
case TsCHdaRelativeTime.Second: { time = time.AddSeconds(offset.Value); break; }
|
||||
}
|
||||
}
|
||||
|
||||
// return resolved time.
|
||||
return time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a String that represents the current Object.
|
||||
/// </summary>
|
||||
/// <returns>A String that represents the current Object.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
if (!IsRelative)
|
||||
{
|
||||
return OpcConvert.ToString(absoluteTime_);
|
||||
}
|
||||
|
||||
var buffer = new StringBuilder(256);
|
||||
|
||||
buffer.Append(BaseTypeToString(BaseTime));
|
||||
buffer.Append(Offsets);
|
||||
|
||||
return buffer.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a string representation of a time.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The string representation to parse.</param>
|
||||
/// <returns>A Time object initialized with the string.</returns>
|
||||
public static TsCHdaTime Parse(string buffer)
|
||||
{
|
||||
// remove trailing and leading white spaces.
|
||||
buffer = buffer.Trim();
|
||||
|
||||
var time = new TsCHdaTime();
|
||||
|
||||
// determine if string is a relative time.
|
||||
var isRelative = false;
|
||||
|
||||
foreach (TsCHdaRelativeTime baseTime in Enum.GetValues(typeof(TsCHdaRelativeTime)))
|
||||
{
|
||||
var token = BaseTypeToString(baseTime);
|
||||
|
||||
if (buffer.StartsWith(token))
|
||||
{
|
||||
buffer = buffer.Substring(token.Length).Trim();
|
||||
time.BaseTime = baseTime;
|
||||
isRelative = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// parse an absolute time string.
|
||||
if (!isRelative)
|
||||
{
|
||||
time.AbsoluteTime = Convert.ToDateTime(buffer).ToUniversalTime();
|
||||
return time;
|
||||
}
|
||||
|
||||
// parse the offset portion of the relative time.
|
||||
if (buffer.Length > 0)
|
||||
{
|
||||
time.Offsets.Parse(buffer);
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Converts a base time to a string token.
|
||||
/// </summary>
|
||||
/// <param name="baseTime">The base time value to convert.</param>
|
||||
/// <returns>The string token representing the base time.</returns>
|
||||
private static string BaseTypeToString(TsCHdaRelativeTime baseTime)
|
||||
{
|
||||
switch (baseTime)
|
||||
{
|
||||
case TsCHdaRelativeTime.Now: { return "NOW"; }
|
||||
case TsCHdaRelativeTime.Second: { return "SECOND"; }
|
||||
case TsCHdaRelativeTime.Minute: { return "MINUTE"; }
|
||||
case TsCHdaRelativeTime.Hour: { return "HOUR"; }
|
||||
case TsCHdaRelativeTime.Day: { return "DAY"; }
|
||||
case TsCHdaRelativeTime.Week: { return "WEEK"; }
|
||||
case TsCHdaRelativeTime.Month: { return "MONTH"; }
|
||||
case TsCHdaRelativeTime.Year: { return "YEAR"; }
|
||||
}
|
||||
|
||||
throw new ArgumentOutOfRangeException(nameof(baseTime), baseTime.ToString(), @"Invalid value for relative base time.");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
70
Technosoftware/DaAeHdaClient/Hda/TimeOffset.cs
Normal file
70
Technosoftware/DaAeHdaClient/Hda/TimeOffset.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// An offset component of a relative time.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct TsCHdaTimeOffset
|
||||
{
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// A signed value indicated the magnitude of the time offset.
|
||||
/// </summary>
|
||||
public int Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time interval to use when applying the offset.
|
||||
/// </summary>
|
||||
public TsCHdaRelativeTime Type { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Internal Methods
|
||||
/// <summary>
|
||||
/// Converts a offset type to a string token.
|
||||
/// </summary>
|
||||
/// <param name="offsetType">The offset type value to convert.</param>
|
||||
/// <returns>The string token representing the offset type.</returns>
|
||||
internal static string OffsetTypeToString(TsCHdaRelativeTime offsetType)
|
||||
{
|
||||
switch (offsetType)
|
||||
{
|
||||
case TsCHdaRelativeTime.Second: { return "S"; }
|
||||
case TsCHdaRelativeTime.Minute: { return "M"; }
|
||||
case TsCHdaRelativeTime.Hour: { return "H"; }
|
||||
case TsCHdaRelativeTime.Day: { return "D"; }
|
||||
case TsCHdaRelativeTime.Week: { return "W"; }
|
||||
case TsCHdaRelativeTime.Month: { return "MO"; }
|
||||
case TsCHdaRelativeTime.Year: { return "Y"; }
|
||||
}
|
||||
|
||||
throw new ArgumentOutOfRangeException(nameof(offsetType), offsetType.ToString(), @"Invalid value for relative time offset type.");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
265
Technosoftware/DaAeHdaClient/Hda/TimeOffsetCollection.cs
Normal file
265
Technosoftware/DaAeHdaClient/Hda/TimeOffsetCollection.cs
Normal file
@@ -0,0 +1,265 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of time offsets used in a relative time.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaTimeOffsetCollection : ArrayList
|
||||
{
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Accessor for elements in the time offset collection.
|
||||
/// </summary>
|
||||
public new TsCHdaTimeOffset this[int index]
|
||||
{
|
||||
get => this[index];
|
||||
set => this[index] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// Adds a new offset to the collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The offset value.</param>
|
||||
/// <param name="type">The offset type.</param>
|
||||
public int Add(int value, TsCHdaRelativeTime type)
|
||||
{
|
||||
var offset = new TsCHdaTimeOffset { Value = value, Type = type };
|
||||
|
||||
return base.Add(offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a String that represents the current Object.
|
||||
/// </summary>
|
||||
/// <returns>A String that represents the current Object.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var buffer = new StringBuilder(256);
|
||||
|
||||
foreach (TsCHdaTimeOffset offset in (ICollection)this)
|
||||
{
|
||||
if (offset.Value >= 0)
|
||||
{
|
||||
buffer.Append("+");
|
||||
}
|
||||
|
||||
buffer.AppendFormat("{0}", offset.Value);
|
||||
buffer.Append(TsCHdaTimeOffset.OffsetTypeToString(offset.Type));
|
||||
}
|
||||
|
||||
return buffer.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the collection from a set of offsets contained in a string.
|
||||
/// </summary>
|
||||
/// <param name="buffer">A string containing the time offset fields.</param>
|
||||
public void Parse(string buffer)
|
||||
{
|
||||
// clear existing offsets.
|
||||
Clear();
|
||||
|
||||
// parse the offsets.
|
||||
var positive = true;
|
||||
var magnitude = 0;
|
||||
var units = "";
|
||||
var state = 0;
|
||||
|
||||
// state = 0 - looking for start of next offset field.
|
||||
// state = 1 - looking for beginning of offset value.
|
||||
// state = 2 - reading offset value.
|
||||
// state = 3 - reading offset type.
|
||||
|
||||
for (var ii = 0; ii < buffer.Length; ii++)
|
||||
{
|
||||
// check for sign part of the offset field.
|
||||
if (buffer[ii] == '+' || buffer[ii] == '-')
|
||||
{
|
||||
if (state == 3)
|
||||
{
|
||||
Add(CreateOffset(positive, magnitude, units));
|
||||
|
||||
magnitude = 0;
|
||||
units = "";
|
||||
state = 0;
|
||||
}
|
||||
|
||||
if (state != 0)
|
||||
{
|
||||
throw new FormatException("Unexpected token encountered while parsing relative time string.");
|
||||
}
|
||||
|
||||
positive = buffer[ii] == '+';
|
||||
state = 1;
|
||||
}
|
||||
|
||||
// check for integer part of the offset field.
|
||||
else if (char.IsDigit(buffer, ii))
|
||||
{
|
||||
if (state == 3)
|
||||
{
|
||||
Add(CreateOffset(positive, magnitude, units));
|
||||
|
||||
magnitude = 0;
|
||||
units = "";
|
||||
state = 0;
|
||||
}
|
||||
|
||||
if (state != 0 && state != 1 && state != 2)
|
||||
{
|
||||
throw new FormatException("Unexpected token encountered while parsing relative time string.");
|
||||
}
|
||||
|
||||
magnitude *= 10;
|
||||
magnitude += Convert.ToInt32(buffer[ii] - '0');
|
||||
|
||||
state = 2;
|
||||
}
|
||||
|
||||
// check for units part of the offset field.
|
||||
else if (!char.IsWhiteSpace(buffer, ii))
|
||||
{
|
||||
if (state != 2 && state != 3)
|
||||
{
|
||||
throw new FormatException("Unexpected token encountered while parsing relative time string.");
|
||||
}
|
||||
|
||||
units += buffer[ii];
|
||||
state = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// process final field.
|
||||
if (state == 3)
|
||||
{
|
||||
Add(CreateOffset(positive, magnitude, units));
|
||||
state = 0;
|
||||
}
|
||||
|
||||
// check final state.
|
||||
if (state != 0)
|
||||
{
|
||||
throw new FormatException("Unexpected end of string encountered while parsing relative time string.");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCHdaTimeOffset[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList Members
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, TsCHdaTimeOffset value)
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(TsCHdaTimeOffset value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(TsCHdaTimeOffset value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(TsCHdaTimeOffset value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(TsCHdaTimeOffset value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
/// <summary>
|
||||
/// Creates a new offset object from the components extracted from a string.
|
||||
/// </summary>
|
||||
private static TsCHdaTimeOffset CreateOffset(bool positive, int magnitude, string units)
|
||||
{
|
||||
foreach (TsCHdaRelativeTime offsetType in Enum.GetValues(typeof(TsCHdaRelativeTime)))
|
||||
{
|
||||
if (offsetType == TsCHdaRelativeTime.Now)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (units == TsCHdaTimeOffset.OffsetTypeToString(offsetType))
|
||||
{
|
||||
var offset = new TsCHdaTimeOffset { Value = (positive) ? magnitude : -magnitude, Type = offsetType };
|
||||
|
||||
return offset;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ArgumentOutOfRangeException(nameof(units), units, @"String is not a valid offset time type.");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
1042
Technosoftware/DaAeHdaClient/Hda/Trend.cs
Normal file
1042
Technosoftware/DaAeHdaClient/Hda/Trend.cs
Normal file
File diff suppressed because it is too large
Load Diff
309
Technosoftware/DaAeHdaClient/Hda/TrendCollection.cs
Normal file
309
Technosoftware/DaAeHdaClient/Hda/TrendCollection.cs
Normal file
@@ -0,0 +1,309 @@
|
||||
#region Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
// Web: https://www.technosoftware.com
|
||||
//
|
||||
// The source code in this file is covered under a dual-license scenario:
|
||||
// - Owner of a purchased license: SCLA 1.0
|
||||
// - GPL V3: everybody else
|
||||
//
|
||||
// SCLA license terms accompanied with this source code.
|
||||
// See SCLA 1.0: https://technosoftware.com/license/Source_Code_License_Agreement.pdf
|
||||
//
|
||||
// GNU General Public License as published by the Free Software Foundation;
|
||||
// version 3 of the License are accompanied with this source code.
|
||||
// See https://technosoftware.com/license/GPLv3License.txt
|
||||
//
|
||||
// This source code is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#endregion Copyright (c) 2011-2023 Technosoftware GmbH. All rights reserved
|
||||
|
||||
#region Using Directives
|
||||
using System;
|
||||
using System.Collections;
|
||||
#endregion
|
||||
|
||||
namespace Technosoftware.DaAeHdaClient.Hda
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of items.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class TsCHdaTrendCollection : ICloneable, IList
|
||||
{
|
||||
#region Fields
|
||||
private ArrayList trends_ = new ArrayList();
|
||||
#endregion
|
||||
|
||||
#region Constructors, Destructor, Initialization
|
||||
/// <summary>
|
||||
/// Initializes object with the default values.
|
||||
/// </summary>
|
||||
public TsCHdaTrendCollection() { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes object with the specified TrendValueCollection object.
|
||||
/// </summary>
|
||||
public TsCHdaTrendCollection(TsCHdaTrendCollection items)
|
||||
{
|
||||
if (items != null)
|
||||
{
|
||||
foreach (TsCHdaTrend item in items)
|
||||
{
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Gets the trend at the specified index.
|
||||
/// </summary>
|
||||
public TsCHdaTrend this[int index] => (TsCHdaTrend)trends_[index];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the first trend with the specified name.
|
||||
/// </summary>
|
||||
public TsCHdaTrend this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (TsCHdaTrend trend in trends_)
|
||||
{
|
||||
if (trend.Name == name)
|
||||
{
|
||||
return trend;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICloneable Members
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the object.
|
||||
/// </summary>
|
||||
public virtual object Clone()
|
||||
{
|
||||
var clone = (TsCHdaTrendCollection)MemberwiseClone();
|
||||
|
||||
clone.trends_ = new ArrayList();
|
||||
|
||||
foreach (TsCHdaTrend trend in trends_)
|
||||
{
|
||||
clone.trends_.Add(trend.Clone());
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of objects in the collection.
|
||||
/// </summary>
|
||||
public int Count => trends_?.Count ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(Array array, int index)
|
||||
{
|
||||
trends_?.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the objects to an Array, starting at a the specified index.
|
||||
/// </summary>
|
||||
/// <param name="array">The one-dimensional Array that is the destination for the objects.</param>
|
||||
/// <param name="index">The zero-based index in the Array at which copying begins.</param>
|
||||
public void CopyTo(TsCHdaTrend[] array, int index)
|
||||
{
|
||||
CopyTo((Array)array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether access to the ICollection is synchronized (thread-safe).
|
||||
/// </summary>
|
||||
public object SyncRoot => this;
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through a collection.
|
||||
/// </summary>
|
||||
/// <returns>An IEnumerator that can be used to iterate through the collection.</returns>
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return trends_.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList Members
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the IList is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the element at the specified index.
|
||||
/// </summary>
|
||||
object IList.this[int index]
|
||||
{
|
||||
get => trends_[index];
|
||||
|
||||
set
|
||||
{
|
||||
if (!(value is TsCHdaTrend))
|
||||
{
|
||||
throw new ArgumentException("May only add Trend objects into the collection.");
|
||||
}
|
||||
|
||||
trends_[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the IList item at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index of the item to remove.</param>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
trends_.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
if (!(value is TsCHdaTrend))
|
||||
{
|
||||
throw new ArgumentException("May only add Trend objects into the collection.");
|
||||
}
|
||||
|
||||
trends_.Insert(index, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(object value)
|
||||
{
|
||||
trends_.Remove(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return trends_.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all items from the IList.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
trends_.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return trends_.IndexOf(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(object value)
|
||||
{
|
||||
if (!(value is TsCHdaTrend))
|
||||
{
|
||||
throw new ArgumentException("May only add Trend objects into the collection.");
|
||||
}
|
||||
|
||||
return trends_.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the IList has a fixed size.
|
||||
/// </summary>
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
/// <summary>
|
||||
/// Inserts an item to the IList at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which value should be inserted.</param>
|
||||
/// <param name="value">The Object to insert into the IList. </param>
|
||||
public void Insert(int index, TsCHdaTrend value)
|
||||
{
|
||||
Insert(index, (object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the first occurrence of a specific object from the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to remove from the IList.</param>
|
||||
public void Remove(TsCHdaTrend value)
|
||||
{
|
||||
Remove((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the IList contains a specific value.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>true if the Object is found in the IList; otherwise, false.</returns>
|
||||
public bool Contains(TsCHdaTrend value)
|
||||
{
|
||||
return Contains((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the index of a specific item in the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to locate in the IList.</param>
|
||||
/// <returns>The index of value if found in the list; otherwise, -1.</returns>
|
||||
public int IndexOf(TsCHdaTrend value)
|
||||
{
|
||||
return IndexOf((object)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the IList.
|
||||
/// </summary>
|
||||
/// <param name="value">The Object to add to the IList. </param>
|
||||
/// <returns>The position into which the new element was inserted.</returns>
|
||||
public int Add(TsCHdaTrend value)
|
||||
{
|
||||
return Add((object)value);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user