Ejemplo n.º 1
0
            /// <summary>Get the directory of a logical node (LN)</summary>
            /// <description>This function returns the directory contents of a LN. Depending on the provided ACSI class
            /// The function returns either data object references, or references of other objects like data sets,
            /// report control blocks, ...</description>
            /// <param name="logicalNodeName">The object reference of a DO, SDO, or DA.</param>
            /// <param name="acsiClass">the ACSI class of the requested directory elements.</param>
            /// <exception cref="IedConnectionException">This exception is thrown if there is a connection or service error</exception>
            public List <string> GetLogicalNodeDirectory(string logicalNodeName, ACSIClass acsiClass)
            {
                int error;

                IntPtr linkedList = IedConnection_getLogicalNodeDirectory(connection, out error, logicalNodeName, (int)acsiClass);

                if (error != 0)
                {
                    throw new IedConnectionException("GetLogicalNodeDirectory failed", error);
                }

                IntPtr element = LinkedList_getNext(linkedList);

                List <string> newList = new List <string> ();

                while (element != IntPtr.Zero)
                {
                    string dataObject = Marshal.PtrToStringAnsi(LinkedList_getData(element));

                    newList.Add(dataObject);

                    element = LinkedList_getNext(element);
                }

                LinkedList_destroy(linkedList);

                return(newList);
            }
Ejemplo n.º 2
0
            /// <summary>Get the directory of a logical node (LN)</summary>
            /// <description>This function returns the directory contents of a LN. Depending on the provided ACSI class
            /// The function returns either data object references, or references of other objects like data sets,
            /// report control blocks, ...</description>
            /// <param name="logicalNodeName">The object reference of a DO, SDO, or DA.</param>
            /// <param name="acsiClass">the ACSI class of the requested directory elements.</param>
            /// <exception cref="IedConnectionException">This exception is thrown if there is a connection or service error</exception>
            public List<string> GetLogicalNodeDirectory(string logicalNodeName, ACSIClass acsiClass)
            {
                int error;

                IntPtr linkedList = IedConnection_getLogicalNodeDirectory (connection, out error, logicalNodeName, (int)acsiClass);

                if (error != 0)
                    throw new IedConnectionException ("GetLogicalNodeDirectory failed", error);

                IntPtr element = LinkedList_getNext (linkedList);

                List<string> newList = new List<string> ();

                while (element != IntPtr.Zero) {
                    string dataObject = Marshal.PtrToStringAnsi (LinkedList_getData (element));

                    newList.Add (dataObject);

                    element = LinkedList_getNext (element);
                }

                LinkedList_destroy (linkedList);

                return newList;
            }