Opc.Ua.Com.Client.ComAeClient.GetEventCategories C# (CSharp) Method

GetEventCategories() public method

Gets the event categories.
public GetEventCategories ( int eventType, int &categories, string &descriptions ) : void
eventType int Type of the event.
categories int The categories.
descriptions string The descriptions.
return void
        public void GetEventCategories(int eventType, out int[] categories, out string[] descriptions)
        {
            string methodName = "IOPCEventServer.QueryEventCategories";

            int count = 0;
            IntPtr pCategories = IntPtr.Zero;
            IntPtr pDescriptions = IntPtr.Zero;

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

                server.QueryEventCategories(
                    eventType,
                    out count,
                    out pCategories,
                    out pDescriptions);
            }
            catch (Exception e)
            {
                ComCallError(methodName, e);
            }
            finally
            {
                EndComCall(methodName);
            }

            // unmarshal results.
            categories = ComUtils.GetInt32s(ref pCategories, count, true);
            descriptions = ComUtils.GetUnicodeStrings(ref pDescriptions, count, true);
        }

Usage Example

コード例 #1
0
        /// <summary>
        /// Fetches the event categories for the specified event type.
        /// </summary>
        public void LoadEventType(ComAeClient client, int eventTypeId)
        {
            int[]    ids          = null;
            string[] descriptions = null;

            try
            {
                client.GetEventCategories(eventTypeId, out ids, out descriptions);
            }
            catch (Exception e)
            {
                Utils.Trace(e, "Unexpected error fetching event categories.");
            }

            if (ids != null)
            {
                for (int ii = 0; ii < ids.Length; ii++)
                {
                    List <EventAttribute> attributes = LoadEventAttributes(client, eventTypeId, ids[ii]);

                    if (eventTypeId == OpcRcw.Ae.Constants.CONDITION_EVENT)
                    {
                        LoadConditionEvent(client, eventTypeId, ids[ii], descriptions[ii], attributes);
                        continue;
                    }

                    EventType eventType = new EventType();
                    eventType.EventTypeId       = eventTypeId;
                    eventType.CategoryId        = ids[ii];
                    eventType.Description       = descriptions[ii];
                    eventType.ConditionName     = null;
                    eventType.SubConditionNames = null;
                    eventType.Attributes        = attributes;
                    DetermineMapping(eventType);
                    EventTypes.Add(eventType);
                }
            }
        }
All Usage Examples Of Opc.Ua.Com.Client.ComAeClient::GetEventCategories