#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 { /// /// Defines functionality that is common to all OPC Historical Data Access servers. /// public interface ITsCHdaServer : IOpcServer { /// /// Returns the current server status. /// /// The current server status. OpcServerStatus GetServerStatus(); /// /// Returns the item attributes supported by the server. /// /// The a set of item attributes and their descriptions. TsCHdaAttribute[] GetAttributes(); /// /// Returns the aggregates supported by the server. /// /// The a set of aggregates and their descriptions. TsCHdaAggregate[] GetAggregates(); /// /// Creates a object used to browse the server address space. /// /// The set of attribute filters to use when browsing. /// A result code for each individual filter. /// A browser object that must be released by calling Dispose(). ITsCHdaBrowser CreateBrowser(TsCHdaBrowseFilter[] filters, out OpcResult[] results); /// /// Creates a set of items. /// /// The identifiers for the items to create. /// The results for each item containing the server handle and result code. OpcItemResult[] CreateItems(OpcItem[] items); /// /// Releases a set of previously created items. /// /// The server handles for the items to release. /// The results for each item containing the result code. OpcItemResult[] ReleaseItems(OpcItem[] items); /// /// Validates a set of items. /// /// The identifiers for the items to validate. /// The results for each item containing the result code. OpcItemResult[] ValidateItems(OpcItem[] items); /// /// Reads raw (unprocessed) data from the historian database for a set of items. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The number of values to be read for each item. /// Whether the bounding item values should be returned. /// The set of items to read (must include the item name). /// A set of values, qualities and timestamps within the requested time range for each item. TsCHdaItemValueCollection[] ReadRaw( TsCHdaTime startTime, TsCHdaTime endTime, int maxValues, bool includeBounds, OpcItem[] items); /// /// Sends an asynchronous request to read raw data from the historian database for a set of items. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The number of values to be read for each item. /// Whether the bounding item values should be returned. /// The set of items to read (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] ReadRaw( TsCHdaTime startTime, TsCHdaTime endTime, int maxValues, bool includeBounds, OpcItem[] items, object requestHandle, TsCHdaReadValuesCompleteEventHandler callback, out IOpcRequest request); /// /// Requests that the server periodically send notifications when new data becomes available for a set of items. /// /// The beginning of the history period to read. /// The frequency, in seconds, that the server should check for new data. /// The set of items to read (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] AdviseRaw( TsCHdaTime startTime, decimal updateInterval, OpcItem[] items, object requestHandle, TsCHdaDataUpdateEventHandler callback, out IOpcRequest request); /// /// Begins the playback raw data from the historian database for a set of items. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The number of values to be read for each item. /// The frequency, in seconds, that the server send data. /// The duration, in seconds, of the timespan returned with each update. /// The set of items to read (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] PlaybackRaw( TsCHdaTime startTime, TsCHdaTime endTime, int maxValues, decimal updateInterval, decimal playbackDuration, OpcItem[] items, object requestHandle, TsCHdaDataUpdateEventHandler callback, out IOpcRequest request); /// /// Reads processed data from the historian database for a set of items. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The interval between returned values. /// The set of items to read (must include the item name). /// A set of values, qualities and timestamps within the requested time range for each item. TsCHdaItemValueCollection[] ReadProcessed( TsCHdaTime startTime, TsCHdaTime endTime, decimal resampleInterval, TsCHdaItem[] items); /// /// Sends an asynchronous request to read processed data from the historian database for a set of items. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The interval between returned values. /// The set of items to read (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] ReadProcessed( TsCHdaTime startTime, TsCHdaTime endTime, decimal resampleInterval, TsCHdaItem[] items, object requestHandle, TsCHdaReadValuesCompleteEventHandler callback, out IOpcRequest request); /// /// Requests that the server periodically send notifications when new data becomes available for a set of items. /// /// The beginning of the history period to read. /// The interval between returned values. /// The number of resample intervals that the server should return in each callback. /// The set of items to read (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] AdviseProcessed( TsCHdaTime startTime, decimal resampleInterval, int numberOfIntervals, TsCHdaItem[] items, object requestHandle, TsCHdaDataUpdateEventHandler callback, out IOpcRequest request); /// /// Begins the playback of processed data from the historian database for a set of items. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The interval between returned values. /// The number of resample intervals that the server should return in each callback. /// The frequency, in seconds, that the server send data. /// The set of items to read (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] PlaybackProcessed( TsCHdaTime startTime, TsCHdaTime endTime, decimal resampleInterval, int numberOfIntervals, decimal updateInterval, TsCHdaItem[] items, object requestHandle, TsCHdaDataUpdateEventHandler callback, out IOpcRequest request); /// /// Reads data from the historian database for a set of items at specific times. /// /// The set of timestamps to use when reading items values. /// The set of items to read (must include the item name). /// A set of values, qualities and timestamps within the requested time range for each item. TsCHdaItemValueCollection[] ReadAtTime(DateTime[] timestamps, OpcItem[] items); /// /// Sends an asynchronous request to read item values at specific times. /// /// The set of timestamps to use when reading items values. /// The set of items to read (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] ReadAtTime( DateTime[] timestamps, OpcItem[] items, object requestHandle, TsCHdaReadValuesCompleteEventHandler callback, out IOpcRequest request); /// /// Reads item values that have been deleted or replaced. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The number of values to be read for each item. /// The set of items to read (must include the item name). /// A set of values, qualities and timestamps within the requested time range for each item. TsCHdaModifiedValueCollection[] ReadModified( TsCHdaTime startTime, TsCHdaTime endTime, int maxValues, OpcItem[] items); /// /// Sends an asynchronous request to read item values that have been deleted or replaced. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The number of values to be read for each item. /// The set of items to read (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] ReadModified( TsCHdaTime startTime, TsCHdaTime endTime, int maxValues, OpcItem[] items, object requestHandle, TsCHdaReadValuesCompleteEventHandler callback, out IOpcRequest request); /// /// Reads the current or historical values for the attributes of an item. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The item to read (must include the item name). /// The attributes to read. /// A set of attribute values for each requested attribute. TsCHdaItemAttributeCollection ReadAttributes( TsCHdaTime startTime, TsCHdaTime endTime, OpcItem item, int[] attributeIDs); /// /// Sends an asynchronous request to read the attributes of an item. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The item to read (must include the item name). /// The attributes to read. /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the attribute ids. TsCHdaResultCollection ReadAttributes( TsCHdaTime startTime, TsCHdaTime endTime, OpcItem item, int[] attributeIDs, object requestHandle, TsCHdaReadAttributesCompleteEventHandler callback, out IOpcRequest request); /// /// Reads any annotations for an item within the a time interval. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The set of items to read (must include the item name). /// A set of annotations within the requested time range for each item. TsCHdaAnnotationValueCollection[] ReadAnnotations( TsCHdaTime startTime, TsCHdaTime endTime, OpcItem[] items); /// /// Sends an asynchronous request to read the annotations for a set of items. /// /// The beginning of the history period to read. /// The end of the history period to be read. /// The set of items to read (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] ReadAnnotations( TsCHdaTime startTime, TsCHdaTime endTime, OpcItem[] items, object requestHandle, TsCHdaReadAnnotationsCompleteEventHandler callback, out IOpcRequest request); /// /// Inserts annotations for one or more items. /// /// A list of annotations to add for each item (must include the item name). /// The results of the insert operation for each annotation set. TsCHdaResultCollection[] InsertAnnotations(TsCHdaAnnotationValueCollection[] items); /// /// Sends an asynchronous request to inserts annotations for one or more items. /// /// A list of annotations to add for each item (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] InsertAnnotations( TsCHdaAnnotationValueCollection[] items, object requestHandle, TsCHdaUpdateCompleteEventHandler callback, out IOpcRequest request); /// /// Inserts the values into the history database for one or more items. /// /// The set of values to insert. /// Whether existing values should be replaced. /// TsCHdaResultCollection[] Insert(TsCHdaItemValueCollection[] items, bool replace); /// /// Sends an asynchronous request to inserts values for one or more items. /// /// The set of values to insert. /// Whether existing values should be replaced. /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] Insert( TsCHdaItemValueCollection[] items, bool replace, object requestHandle, TsCHdaUpdateCompleteEventHandler callback, out IOpcRequest request); /// /// Replace the values into the history database for one or more items. /// /// The set of values to replace. /// TsCHdaResultCollection[] Replace(TsCHdaItemValueCollection[] items); /// /// Sends an asynchronous request to replace values for one or more items. /// /// The set of values to replace. /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] Replace( TsCHdaItemValueCollection[] items, object requestHandle, TsCHdaUpdateCompleteEventHandler callback, out IOpcRequest request); /// /// Deletes the values with the specified time domain for one or more items. /// /// The beginning of the history period to delete. /// The end of the history period to be delete. /// The set of items to delete (must include the item name). /// The results of the delete operation for each item. OpcItemResult[] Delete( TsCHdaTime startTime, TsCHdaTime endTime, OpcItem[] items); /// /// Sends an asynchronous request to delete values for one or more items. /// /// The beginning of the history period to delete. /// The end of the history period to be delete. /// The set of items to delete (must include the item name). /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] Delete( TsCHdaTime startTime, TsCHdaTime endTime, OpcItem[] items, object requestHandle, TsCHdaUpdateCompleteEventHandler callback, out IOpcRequest request); /// /// Deletes the values at the specified times for one or more items. /// /// The set of timestamps to delete for one or more items. /// The results of the operation for each timestamp. TsCHdaResultCollection[] DeleteAtTime(TsCHdaItemTimeCollection[] items); /// /// Sends an asynchronous request to delete values for one or more items at a specified times. /// /// The set of timestamps to delete for one or more items. /// An identifier for the request assigned by the caller. /// A delegate used to receive notifications when the request completes. /// An object that contains the state of the request (used to cancel the request). /// A set of results containing any errors encountered when the server validated the items. OpcItemResult[] DeleteAtTime( TsCHdaItemTimeCollection[] items, object requestHandle, TsCHdaUpdateCompleteEventHandler callback, out IOpcRequest request); /// /// Cancels an asynchronous request. /// /// The state object for the request to cancel. void CancelRequest(IOpcRequest request); /// /// Cancels an asynchronous request. /// /// The state object for the request to cancel. /// A delegate used to receive notifications when the request completes. void CancelRequest(IOpcRequest request, TsCHdaCancelCompleteEventHandler callback); } #region Delegate Declarations /// /// Used to receive notifications when an exception occurs while processing a callback. /// /// An identifier for the request assigned by the caller. /// Exception which occured. public delegate void TsCHdaCallbackExceptionEventHandler(IOpcRequest request, Exception exception); /// /// Used to receive data update notifications. /// /// An identifier for the request assigned by the caller. /// A collection of results. public delegate void TsCHdaDataUpdateEventHandler(IOpcRequest request, TsCHdaItemValueCollection[] results); /// /// Used to receive notifications when a read values request completes. /// /// An identifier for the request assigned by the caller. /// A collection of results. public delegate void TsCHdaReadValuesCompleteEventHandler(IOpcRequest request, TsCHdaItemValueCollection[] results); /// /// Used to receive notifications when a read attributes request completes. /// /// An identifier for the request assigned by the caller. /// A collection of results. public delegate void TsCHdaReadAttributesCompleteEventHandler(IOpcRequest request, TsCHdaItemAttributeCollection results); /// /// Used to receive notifications when a read annotations request completes. /// /// An identifier for the request assigned by the caller. /// A collection of results. public delegate void TsCHdaReadAnnotationsCompleteEventHandler(IOpcRequest request, TsCHdaAnnotationValueCollection[] results); /// /// Used to receive notifications when an update request completes. /// /// An identifier for the request assigned by the caller. /// A collection of results. public delegate void TsCHdaUpdateCompleteEventHandler(IOpcRequest request, TsCHdaResultCollection[] results); /// /// Used to receive notifications when a request is cancelled. /// /// An identifier for the request assigned by the caller. public delegate void TsCHdaCancelCompleteEventHandler(IOpcRequest request); #endregion }