本文整理汇总了C#中agsXMPP.protocol.client.IQ.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# IQ.AddChild方法的具体用法?C# IQ.AddChild怎么用?C# IQ.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agsXMPP.protocol.client.IQ
的用法示例。
在下文中一共展示了IQ.AddChild方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetConfig
/// <summary>
/// Send message to HarmonyHub to request Configuration.
/// Result is parsed by OnIq based on ClientCommandType
/// </summary>
public void GetConfig()
{
EnsureConnection();
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.ConfigDocument());
iqToSend.GenerateId();
var iqGrabber = new IqGrabber(Xmpp);
var iq = iqGrabber.SendIq(iqToSend, 10000);
if (iq != null)
{
var match = IdentityRegex.Match(iq.InnerXml);
if (match.Success)
{
RawConfig = match.Groups[1].ToString();
Config = null;
try
{
Config = new JavaScriptSerializer().Deserialize<HarmonyConfigResult>(RawConfig);
}
catch { }
}
}
}
示例2: SwapAuthToken
/// <summary>
/// Send message to HarmonyHub with UserAuthToken, wait for SessionToken
/// </summary>
/// <param name="userAuthToken"></param>
/// <returns></returns>
public string SwapAuthToken(string userAuthToken)
{
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.LogitechPairDocument(userAuthToken));
iqToSend.GenerateId();
var iqGrabber = new IqGrabber(Xmpp);
iqGrabber.SendIq(iqToSend, 10);
WaitForData(5);
return _sessionToken;
}
示例3: SwapAuthToken
/// <summary>
/// Send message to HarmonyHub with UserAuthToken, wait for SessionToken
/// </summary>
/// <param name="userAuthToken"></param>
/// <returns></returns>
public string SwapAuthToken(string userAuthToken)
{
EnsureConnection();
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.LogitechPairDocument(userAuthToken));
iqToSend.GenerateId();
var iqGrabber = new IqGrabber(Xmpp);
var iq = iqGrabber.SendIq(iqToSend, 5000);
if (iq != null)
{
var match = IdentityRegex.Match(iq.InnerXml);
if (match.Success)
{
return match.Groups[1].ToString();
}
}
return null;
}
示例4: GenerateIq
/// <summary>
/// Generate an IQ for the supplied Document
/// </summary>
/// <param name="document">Document</param>
/// <returns>IQ</returns>
private static IQ GenerateIq(Document document)
{
// Create the IQ to send
var iqToSend = new IQ
{
Type = IqType.get,
Namespace = "",
From = "1",
To = "guest"
};
// Add the real content for the Harmony
iqToSend.AddChild(document);
// Generate an unique ID, this is used to correlate the reply to the request
iqToSend.GenerateId();
return iqToSend;
}
示例5: StartActivity
/// <summary>
/// Send message to HarmonyHub to start a given activity
/// Result is parsed by OnIq based on ClientCommandType
/// </summary>
/// <param name="activityId"></param>
public void StartActivity(string activityId)
{
EnsureConnection();
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.StartActivityDocument(activityId));
iqToSend.GenerateId();
Xmpp.Send(iqToSend);
}
示例6: Sequence
/// <summary>
/// Send message to HarmonyHub to request to run a sequence
/// Result is parsed by OnIq based on ClientCommandType
/// </summary>
/// <param name="deviceId"></param>
/// <param name="command"></param>
public void Sequence(int sequenceId)
{
EnsureConnection();
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.SequenceDocument(sequenceId));
iqToSend.GenerateId();
Xmpp.Send(iqToSend);
}
示例7: PressButton
/// <summary>
/// Send message to HarmonyHub to request to press a button
/// Result is parsed by OnIq based on ClientCommandType
/// </summary>
/// <param name="deviceId"></param>
/// <param name="command"></param>
public void PressButton(string deviceId, string command)
{
EnsureConnection();
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.IRCommandDocument(deviceId, command));
iqToSend.GenerateId();
Xmpp.Send(iqToSend);
}
示例8: GetCurrentActivity
/// <summary>
/// Send message to HarmonyHub to request current activity
/// Result is parsed by OnIq based on ClientCommandType
/// </summary>
public void GetCurrentActivity()
{
EnsureConnection();
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.GetCurrentActivityDocument());
iqToSend.GenerateId();
var iqGrabber = new IqGrabber(Xmpp);
var iq = iqGrabber.SendIq(iqToSend, 5000);
if (iq != null)
{
var match = IdentityRegex.Match(iq.InnerXml);
if (match.Success)
{
CurrentActivity = match.Groups[1].ToString().Split('=')[1];
}
}
}
示例9: GetConfig
/// <summary>
/// Send message to HarmonyHub to request Configuration.
/// Result is parsed by OnIq based on ClientCommandType
/// </summary>
public void GetConfig()
{
_clientCommand = ClientCommandType.GetConfig;
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.ConfigDocument());
iqToSend.GenerateId();
var iqGrabber = new IqGrabber(Xmpp);
iqGrabber.SendIq(iqToSend, 10);
WaitForData(5);
}
示例10: StartActivity
/// <summary>
/// Send message to HarmonyHub to start a given activity
/// Result is parsed by OnIq based on ClientCommandType
/// </summary>
/// <param name="activityId"></param>
public void StartActivity(string activityId)
{
_clientCommand = ClientCommandType.StartActivity;
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.StartActivityDocument(activityId));
iqToSend.GenerateId();
var iqGrabber = new IqGrabber(Xmpp);
iqGrabber.SendIq(iqToSend, 10);
WaitForData(5);
}
示例11: PressButton
/// <summary>
/// Send message to HarmonyHub to request to press a button
/// Result is parsed by OnIq based on ClientCommandType
/// </summary>
/// <param name="deviceId"></param>
/// <param name="command"></param>
public void PressButton(string deviceId, string command)
{
_clientCommand = ClientCommandType.PressButton;
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.IRCommandDocument(deviceId, command));
iqToSend.GenerateId();
var iqGrabber = new IqGrabber(Xmpp);
iqGrabber.SendIq(iqToSend, 5);
WaitForData(5);
}