Beispiel #1
0
        /// <summary>
        /// Sets the filter.
        /// </summary>
        /// <param name="qualifiedName">Name of the qualified.</param>
        /// <param name="isSource">if set to <c>true</c> if filtering by source.</param>
        /// <returns></returns>
        private bool SetFilter(string qualifiedName, bool isSource)
        {
            string methodName = "IOPCEventSubscriptionMgt.SetFilter";

            try
            {
                IOPCEventSubscriptionMgt server = BeginComCall <IOPCEventSubscriptionMgt>(methodName, true);

                string[] filter = null;

                if (!String.IsNullOrEmpty(qualifiedName))
                {
                    filter = new string[] { qualifiedName };

                    // need to use a wild card to include sub-areas.
                    if (!String.IsNullOrEmpty(m_separators))
                    {
                        filter    = new string[m_separators.Length + 1];
                        filter[0] = qualifiedName;

                        for (int ii = 0; ii < m_separators.Length; ii++)
                        {
                            filter[ii + 1] = Utils.Format("{0}{1}*", qualifiedName, m_separators[ii]);
                        }
                    }
                }
                else
                {
                    filter = new string[0];
                }

                server.SetFilter(
                    Constants.ALL_EVENTS,
                    0,
                    new int[0],
                    1,
                    1000,
                    (isSource)?0:filter.Length,
                    filter,
                    (!isSource)?0:filter.Length,
                    filter);

                return(true);
            }
            catch (Exception e)
            {
                if (ComUtils.IsUnknownError(e, ResultIds.E_FAIL))
                {
                    ComCallError(methodName, e);
                }

                return(false);
            }
            finally
            {
                EndComCall(methodName);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Selects the returned attributes.
        /// </summary>
        /// <param name="categoryId">The category id.</param>
        /// <param name="attributeIds">The attribute ids.</param>
        /// <returns></returns>
        private bool SelectReturnedAttributes(int categoryId, int[] attributeIds)
        {
            string methodName = "IOPCEventSubscriptionMgt.SelectReturnedAttributes";

            try
            {
                IOPCEventSubscriptionMgt server = BeginComCall <IOPCEventSubscriptionMgt>(methodName, true);
                server.SelectReturnedAttributes(categoryId, attributeIds.Length, attributeIds);
                return(true);
            }
            catch (Exception e)
            {
                if (ComUtils.IsUnknownError(e, ResultIds.E_FAIL))
                {
                    ComCallError(methodName, e);
                }

                return(false);
            }
            finally
            {
                EndComCall(methodName);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Cancels the refresh for all conditions.
        /// </summary>
        /// <returns></returns>
        private bool CancelRefresh()
        {
            string methodName = "IOPCEventSubscriptionMgt.CancelRefresh";

            try
            {
                IOPCEventSubscriptionMgt server = BeginComCall <IOPCEventSubscriptionMgt>(methodName, true);
                server.CancelRefresh(m_callback.Cookie);
                return(true);
            }
            catch (Exception e)
            {
                if (ComUtils.IsUnknownError(e, ResultIds.E_FAIL, ResultIds.E_INVALIDARG, ResultIds.E_NOTIMPL))
                {
                    ComCallError(methodName, e);
                }

                return(false);
            }
            finally
            {
                EndComCall(methodName);
            }
        }