예제 #1
0
        /// <summary>
        /// Invokes the QueryFirst service.
        /// </summary>
        public virtual ResponseHeader QueryFirst(
            RequestHeader requestHeader,
            ViewDescription view,
            NodeTypeDescriptionCollection nodeTypes,
            ContentFilter filter,
            uint maxDataSetsToReturn,
            uint maxReferencesToReturn,
            out QueryDataSetCollection queryDataSets,
            out byte[] continuationPoint,
            out ParsingResultCollection parsingResults,
            out DiagnosticInfoCollection diagnosticInfos,
            out ContentFilterResult filterResult)
        {
            queryDataSets     = null;
            continuationPoint = null;
            parsingResults    = null;
            diagnosticInfos   = null;
            filterResult      = null;

            ValidateRequest(requestHeader);

            // Insert implementation.

            return(CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported));
        }
예제 #2
0
 public static Entry For(NodeTypeDescriptionCollection nodeTypeDescriptions)
 {
     if (nodeTypeDescriptions == null)
     {
         return(new NullEntry());
     }
     else
     {
         ArrayEntry arrayEntry = new ArrayEntry();
         NodeTypeDescriptionCollection.Enumerator e = nodeTypeDescriptions.GetEnumerator();
         while (e.MoveNext())
         {
             arrayEntry.Add(For(e.Current));
         }
         return(arrayEntry);
     }
 }
예제 #3
0
        private static void QueryFirstCall(Session session)
        {
            ViewDescription vd = new ViewDescription();

            vd.ViewId      = 5000;
            vd.ViewVersion = 0;
            NodeTypeDescriptionCollection nt  = new NodeTypeDescriptionCollection();
            NodeTypeDescription           ntd = new NodeTypeDescription();

            ExpandedNodeId enid = new ExpandedNodeId("ns=3;s=AirConditioner_1");

            ntd.TypeDefinitionNode = enid;
            nt.Add(ntd);

            ContentFilterElement           cfe  = new ContentFilterElement();
            ContentFilterElementCollection cfec = new ContentFilterElementCollection();


            cfec.Add(cfe);
            ContentFilter cf = new ContentFilter();

            cf.Elements = cfec;

            QueryDataSetCollection qdsc = new QueryDataSetCollection();

            byte[] cp = new byte[100];
            ParsingResultCollection  prc = new ParsingResultCollection();
            DiagnosticInfoCollection dic = new DiagnosticInfoCollection();
            ContentFilterResult      cfr = new ContentFilterResult();

            try
            {
                var rs = session.QueryFirst(null, vd, nt, cf, 1000, 1000, out qdsc, out cp, out prc, out dic, out cfr);
            }
            catch (Exception eX)
            {
                Console.WriteLine("EXCEPTION:  QueryFirst  :  {0}", eX.Message);
            }
        }
예제 #4
0
        /// <summary>
        /// Invokes the QueryFirst service.
        /// </summary>
        public virtual ResponseHeader QueryFirst(
            RequestHeader                 requestHeader,
            ViewDescription               view,
            NodeTypeDescriptionCollection nodeTypes,
            ContentFilter                 filter,
            uint                          maxDataSetsToReturn,
            uint                          maxReferencesToReturn,
            out QueryDataSetCollection    queryDataSets,
            out byte[]                    continuationPoint,
            out ParsingResultCollection   parsingResults,
            out DiagnosticInfoCollection  diagnosticInfos,
            out ContentFilterResult       filterResult)
        {
            queryDataSets = null;
            continuationPoint = null;
            parsingResults = null;
            diagnosticInfos = null;
            filterResult = null;

            ValidateRequest(requestHeader);

            // Insert implementation.

            return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
        }
예제 #5
0
        /// <summary>
        /// Begins an asynchronous invocation of the QueryFirst service.
        /// </summary>
        public IAsyncResult BeginQueryFirst(
            RequestHeader                 requestHeader,
            ViewDescription               view,
            NodeTypeDescriptionCollection nodeTypes,
            ContentFilter                 filter,
            uint                          maxDataSetsToReturn,
            uint                          maxReferencesToReturn,
            AsyncCallback                 callback,
            object                        asyncState)
        {
            QueryFirstRequest request = new QueryFirstRequest();

            request.RequestHeader         = requestHeader;
            request.View                  = view;
            request.NodeTypes             = nodeTypes;
            request.Filter                = filter;
            request.MaxDataSetsToReturn   = maxDataSetsToReturn;
            request.MaxReferencesToReturn = maxReferencesToReturn;

            UpdateRequestHeader(request, requestHeader == null, "QueryFirst");

            if (UseTransportChannel)
            {
                return TransportChannel.BeginSendRequest(request, callback, asyncState);
            }

            return InnerChannel.BeginQueryFirst(new QueryFirstMessage(request), callback, asyncState);
        }
예제 #6
0
        /// <summary>
        /// Invokes the QueryFirst service.
        /// </summary>
        public virtual ResponseHeader QueryFirst(
            RequestHeader                 requestHeader,
            ViewDescription               view,
            NodeTypeDescriptionCollection nodeTypes,
            ContentFilter                 filter,
            uint                          maxDataSetsToReturn,
            uint                          maxReferencesToReturn,
            out QueryDataSetCollection    queryDataSets,
            out byte[]                    continuationPoint,
            out ParsingResultCollection   parsingResults,
            out DiagnosticInfoCollection  diagnosticInfos,
            out ContentFilterResult       filterResult)
        {
            QueryFirstRequest request = new QueryFirstRequest();
            QueryFirstResponse response = null;

            request.RequestHeader         = requestHeader;
            request.View                  = view;
            request.NodeTypes             = nodeTypes;
            request.Filter                = filter;
            request.MaxDataSetsToReturn   = maxDataSetsToReturn;
            request.MaxReferencesToReturn = maxReferencesToReturn;

            UpdateRequestHeader(request, requestHeader == null, "QueryFirst");

            try
            {
                if (UseTransportChannel)
                {
                    IServiceResponse genericResponse = TransportChannel.SendRequest(request);

                    if (genericResponse == null)
                    {
                        throw new ServiceResultException(StatusCodes.BadUnknownResponse);
                    }

                    ValidateResponse(genericResponse.ResponseHeader);
                    response = (QueryFirstResponse)genericResponse;
                }
                else
                {
                    QueryFirstResponseMessage responseMessage = InnerChannel.QueryFirst(new QueryFirstMessage(request));

                    if (responseMessage == null || responseMessage.QueryFirstResponse == null)
                    {
                        throw new ServiceResultException(StatusCodes.BadUnknownResponse);
                    }

                    response = responseMessage.QueryFirstResponse;
                    ValidateResponse(response.ResponseHeader);
                }

                queryDataSets     = response.QueryDataSets;
                continuationPoint = response.ContinuationPoint;
                parsingResults    = response.ParsingResults;
                diagnosticInfos   = response.DiagnosticInfos;
                filterResult      = response.FilterResult;
            }
            finally
            {
                RequestCompleted(request, response, "QueryFirst");
            }

            return response.ResponseHeader;
        }