/// <summary> /// Requests interoperability interfaces /// </summary> /// <param name="Jid">JID of device.</param> /// <param name="Callback">Callback method.</param> /// <param name="State">State object to pass on to the callback method.</param> public void RequestInterfaces(string Jid, InteroperabilityInterfacesCallback Callback, object State) { client.IqGet("<getInterfaces xmlns=\"urn:xmpp:iot:interoperability\"/>", Jid, this.GetInterfacesResponse, new Object[] { Callback, State }, "Interoperability Interfaces Request"); }
private void GetInterfacesResponse(XmppClient Client, string Type, XmlNodeList Response, ref StanzaError Error, object State) { object[] P = (object[])State; InteroperabilityInterfacesCallback Callback = (InteroperabilityInterfacesCallback)P [0]; object State2 = (object)P [1]; List <string> Interfaces = new List <string> (); XmlElement E; if (Error != null) { Error = null; // XEP not supported. Just return an empty list of supported interfaces. } else { foreach (XmlNode N in Response) { if (N.LocalName == "getInterfacesResponse") { foreach (XmlNode N2 in N.ChildNodes) { if (N2.LocalName == "interface" && (E = N2 as XmlElement) != null) { Interfaces.Add(XmlUtilities.GetAttribute(E, "name", string.Empty)); } } } } } if (Callback != null) { try { Callback(Interfaces.ToArray(), State2); } catch (Exception ex) { Log.Exception(ex); } } }