示例#1
0
        /// <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 server handle).</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>
        public IdentifiedResult[] PlaybackProcessed(
            Time startTime,
            Time endTime,
            decimal resampleInterval,
            int numberOfIntervals,
            decimal updateInterval,
            Item[]                 items,
            object requestHandle,
            DataUpdateEventHandler callback,
            out IRequest request)
        {
            if (m_server == null)
            {
                throw new NotConnectedException();
            }

            IdentifiedResult[] results = ((IServer)m_server).PlaybackProcessed(
                startTime,
                endTime,
                resampleInterval,
                numberOfIntervals,
                updateInterval,
                items,
                requestHandle,
                callback,
                out request);

            return(results);
        }
        /// <summary>
        /// Invokes callback for a data change update.
        /// </summary>
        private bool InvokeCallback(DataUpdateEventHandler callback, object results)
        {
            // check for valid result type.
            if (!typeof(ItemValueCollection[]).IsInstanceOfType(results))
            {
                return(false);
            }

            ItemValueCollection[] values = (ItemValueCollection[])results;

            // update item handles and actual times.
            UpdateResults(values);

            try
            {
                callback(this, values);
            }
            catch
            {
                // ignore exceptions in the callbacks.
            }

            // request never completes.
            return(false);
        }
示例#3
0
        //======================================================================
        // Subscribe

        /// <summary>
        /// Establishes a subscription for the trend.
        /// </summary>
        public IdentifiedResult[] Subscribe(
            object subscriptionHandle,
            DataUpdateEventHandler callback)
        {
            IdentifiedResult[] results = null;

            // subscribe to raw data.
            if (AggregateID == Opc.Hda.AggregateID.NOAGGREGATE)
            {
                results = m_server.AdviseRaw(
                    StartTime,
                    UpdateInterval,
                    GetItems(),
                    subscriptionHandle,
                    callback,
                    out m_subscription);
            }

            // subscribe processed data.
            else
            {
                Item[] localItems = ApplyDefaultAggregate(GetItems());

                results = m_server.AdviseProcessed(
                    StartTime,
                    ResampleInterval,
                    (int)UpdateInterval,
                    localItems,
                    subscriptionHandle,
                    callback,
                    out m_subscription);
            }

            return(results);
        }
示例#4
0
 public IdentifiedResult[] Subscribe(object subscriptionHandle, DataUpdateEventHandler callback)
 {
     if (this.AggregateID == 0)
     {
         return(this.m_server.AdviseRaw(this.StartTime, this.UpdateInterval, this.GetItems(), subscriptionHandle, callback, out this.m_subscription));
     }
     Item[] items = this.ApplyDefaultAggregate(this.GetItems());
     return(this.m_server.AdviseProcessed(this.StartTime, this.ResampleInterval, (int)this.UpdateInterval, items, subscriptionHandle, callback, out this.m_subscription));
 }
示例#5
0
 public IdentifiedResult[] Playback(object playbackHandle, DataUpdateEventHandler callback)
 {
     if (this.AggregateID == 0)
     {
         return(this.m_server.PlaybackRaw(this.StartTime, this.EndTime, this.MaxValues, this.PlaybackInterval, this.PlaybackDuration, this.GetItems(), playbackHandle, callback, out this.m_playback));
     }
     Item[] items = this.ApplyDefaultAggregate(this.GetItems());
     return(this.m_server.PlaybackProcessed(this.StartTime, this.EndTime, this.ResampleInterval, (int)this.PlaybackDuration, this.PlaybackInterval, items, playbackHandle, callback, out this.m_playback));
 }
示例#6
0
 /// <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 server handle).</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>
 public IdentifiedResult[] AdviseRaw(
     Time startTime,
     decimal updateInterval,
     ItemIdentifier[]       items,
     object requestHandle,
     DataUpdateEventHandler callback,
     out IRequest request)
 {
     if (m_server == null)
     {
         throw new NotConnectedException();
     }
     return(((IServer)m_server).AdviseRaw(startTime, updateInterval, items, requestHandle, callback, out request));
 }
示例#7
0
 private bool InvokeCallback(DataUpdateEventHandler callback, object results)
 {
     if (typeof(ItemValueCollection[]).IsInstanceOfType(results))
     {
         ItemValueCollection[] valuesArray = (ItemValueCollection[])results;
         this.UpdateResults(valuesArray);
         try
         {
             callback(this, valuesArray);
         }
         catch
         {
         }
     }
     return(false);
 }
示例#8
0
 /// <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 server handle).</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>
 public IdentifiedResult[] PlaybackRaw(
     Time startTime,
     Time endTime,
     int maxValues,
     decimal updateInterval,
     decimal playbackDuration,
     ItemIdentifier[]       items,
     object requestHandle,
     DataUpdateEventHandler callback,
     out IRequest request)
 {
     if (m_server == null)
     {
         throw new NotConnectedException();
     }
     return(((IServer)m_server).PlaybackRaw(startTime, endTime, maxValues, updateInterval, playbackDuration, items, requestHandle, callback, out request));
 }
示例#9
0
 // Token: 0x0600001D RID: 29 RVA: 0x00002AB4 File Offset: 0x00001AB4
 private bool InvokeCallback(DataUpdateEventHandler callback, object results)
 {
     if (!typeof(ItemValueCollection[]).IsInstanceOfType(results))
     {
         return(false);
     }
     ItemValueCollection[] results2 = (ItemValueCollection[])results;
     this.UpdateResults(results2);
     try
     {
         callback(this, results2);
     }
     catch
     {
     }
     return(false);
 }
示例#10
0
        //======================================================================
        // Playback

        /// <summary>
        /// Begins playback of data for a trend.
        /// </summary>
        public IdentifiedResult[] Playback(
            object playbackHandle,
            DataUpdateEventHandler callback)
        {
            IdentifiedResult[] results = null;

            // playback raw data.
            if (AggregateID == Opc.Hda.AggregateID.NOAGGREGATE)
            {
                results = m_server.PlaybackRaw(
                    StartTime,
                    EndTime,
                    MaxValues,
                    PlaybackInterval,
                    PlaybackDuration,
                    GetItems(),
                    playbackHandle,
                    callback,
                    out m_playback);
            }

            // playback processed data.
            else
            {
                Item[] localItems = ApplyDefaultAggregate(GetItems());

                results = m_server.PlaybackProcessed(
                    StartTime,
                    EndTime,
                    ResampleInterval,
                    (int)PlaybackDuration,
                    PlaybackInterval,
                    localItems,
                    playbackHandle,
                    callback,
                    out m_playback);
            }

            return(results);
        }
示例#11
0
 public MyEvents()
 {
     DataUpdate += new DataUpdateEventHandler(DoThis); // register the event handler
 }
示例#12
0
 // Token: 0x0600046F RID: 1135 RVA: 0x0000D760 File Offset: 0x0000C760
 public IdentifiedResult[] AdviseProcessed(Time startTime, decimal resampleInterval, int numberOfIntervals, Item[] items, object requestHandle, DataUpdateEventHandler callback, out IRequest request)
 {
     if (this.m_server == null)
     {
         throw new NotConnectedException();
     }
     return(((IServer)this.m_server).AdviseProcessed(startTime, resampleInterval, numberOfIntervals, items, requestHandle, callback, out request));
 }