/// <summary> /// Control Form event arguments. /// </summary> /// <param name="State">State object provided in the original request.</param> /// <param name="Callback">Callback method to call when response is returned.</param> public ControlFormEventArgs(object State, ControlFormCallback Callback) { this.state = State; this.callback = Callback; }
/// <summary> /// Gets the control form from a controller. /// </summary> /// <param name="Jid">JID of controller.</param> /// <param name="Node">Node reference</param> /// <param name="ServiceToken">Service token.</param> /// <param name="DeviceToken">Device token.</param> /// <param name="UserToken">User token.</param> /// <param name="Callback">Callback method.</param> /// <param name="State">State object to pass on to callback method.</param> public void GetForm(string Jid, NodeReference Node, string ServiceToken, string DeviceToken, string UserToken, ControlFormCallback Callback, object State) { this.GetForm(Jid, new NodeReference[] { Node }, ServiceToken, DeviceToken, UserToken, Callback, State); }
/// <summary> /// Gets the control form from a controller. /// </summary> /// <param name="Jid">JID of controller.</param> /// <param name="Nodes">Node references</param> /// <param name="ServiceToken">Service token.</param> /// <param name="DeviceToken">Device token.</param> /// <param name="UserToken">User token.</param> /// <param name="Callback">Callback method.</param> /// <param name="State">State object to pass on to callback method.</param> public void GetForm(string Jid, NodeReference[] Nodes, string ServiceToken, string DeviceToken, string UserToken, ControlFormCallback Callback, object State) { StringBuilder sb = new StringBuilder(); XmlWriter w = XmlWriter.Create(sb, XmlUtilities.GetXmlWriterSettings(false, true, true)); w.WriteStartElement("getForm", "urn:xmpp:iot:control"); if (!string.IsNullOrEmpty(ServiceToken)) { w.WriteAttributeString("serviceToken", ServiceToken); } if (!string.IsNullOrEmpty(DeviceToken)) { w.WriteAttributeString("deviceToken", DeviceToken); } if (!string.IsNullOrEmpty(UserToken)) { w.WriteAttributeString("userToken", UserToken); } ProvisioningServer.WriteNodes(w, Nodes); w.WriteEndElement(); w.Flush(); client.IqGet(sb.ToString(), Jid, this.GetFormResponse, new ControlFormEventArgs(State, Callback), "Get Control Form"); }
/// <summary> /// Gets the control form from a controller. /// </summary> /// <param name="Jid">JID of controller.</param> /// <param name="Callback">Callback method.</param> /// <param name="State">State object to pass on to callback method.</param> public void GetForm(string Jid, ControlFormCallback Callback, object State) { this.GetForm(Jid, (NodeReference[])null, string.Empty, string.Empty, string.Empty, Callback, State); }