Пример #1
0
        /// <summary>
        /// Gets information about the inheritance of a node in the concentrator.
        /// </summary>
        /// <param name="To">Address of server.</param>
        /// <param name="NodeID">Node ID</param>
        /// <param name="SourceID">Optional Source ID</param>
        /// <param name="Partition">Optional Partition</param>
        /// <param name="Language">Code of desired language.</param>
        /// <param name="ServiceToken">Optional Service token.</param>
        /// <param name="DeviceToken">Optional Device token.</param>
        /// <param name="UserToken">Optional User token.</param>
        /// <param name="Callback">Method to call when response is returned.</param>
        /// <param name="State">State object to pass on to callback method.</param>
        public void GetNodeInheritance(string To, string NodeID, string SourceID, string Partition, string Language,
                                       string ServiceToken, string DeviceToken, string UserToken, StringsResponseEventHandler Callback, object State)
        {
            StringBuilder Xml = new StringBuilder();

            Xml.Append("<getNodeInheritance xmlns='");
            Xml.Append(ConcentratorServer.NamespaceConcentrator);
            Xml.Append("'");
            this.AppendNodeAttributes(Xml, NodeID, SourceID, Partition);
            this.AppendTokenAttributes(Xml, ServiceToken, DeviceToken, UserToken);

            if (!string.IsNullOrEmpty(Language))
            {
                Xml.Append("' xml:lang='");
                Xml.Append(XML.Encode(Language));
            }

            Xml.Append("'/>");

            this.client.SendIqGet(To, Xml.ToString(), (sender, e) =>
            {
                List <string> BaseClasses = new List <string>();
                XmlElement E;

                if (e.Ok && (E = e.FirstElement) != null && E.LocalName == "getNodeInheritanceResponse" && E.NamespaceURI == ConcentratorServer.NamespaceConcentrator)
                {
                    foreach (XmlNode N in E)
                    {
                        if (N is XmlElement E2 && E2.LocalName == "baseClasses")
                        {
                            foreach (XmlNode N2 in E2.ChildNodes)
                            {
                                if (N2 is XmlElement E3 && E3.LocalName == "value")
                                {
                                    BaseClasses.Add(E3.InnerText);
                                }
                            }
                        }
                    }
Пример #2
0
 /// <summary>
 /// Gets information about the inheritance of a node in the concentrator.
 /// </summary>
 /// <param name="To">Address of server.</param>
 /// <param name="Node">Node reference.</param>
 /// <param name="Language">Code of desired language.</param>
 /// <param name="ServiceToken">Optional Service token.</param>
 /// <param name="DeviceToken">Optional Device token.</param>
 /// <param name="UserToken">Optional User token.</param>
 /// <param name="Callback">Method to call when response is returned.</param>
 /// <param name="State">State object to pass on to callback method.</param>
 public void GetNodeInheritance(string To, IThingReference Node, string Language,
                                string ServiceToken, string DeviceToken, string UserToken, StringsResponseEventHandler Callback, object State)
 {
     this.GetNodeInheritance(To, Node.NodeId, Node.SourceId, Node.Partition, Language, ServiceToken, DeviceToken, UserToken, Callback, State);
 }