Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
IceSignalQXmppIq.cpp
1
2
3#include "IceSignalQXmppIq.h"
4#include <QDomComment>
5#include <QDebug>
6#include <QLoggingCategory>
7
8Q_LOGGING_CATEGORY(ChannelICE, "Channel.ICE")
9
13
14QString CIceSignalQXmppIq::ns()
15{
16 return "KangLinStudio.Rabbit.DataChannel";
17}
18
19bool CIceSignalQXmppIq::isIceSignalIq(const QDomElement &element)
20{
21 QDomElement domElement = element.firstChildElement("query");
22 return (domElement.namespaceURI() == ns());
23}
24
25void CIceSignalQXmppIq::parseElementFromChild(const QDomElement &element)
26{
27 QDomElement dataChannelElement = element.firstChildElement("query");
28 if(dataChannelElement.isNull())
29 {
30 qCritical(ChannelICE) << "webrtcElement is null";
31 return;
32 }
33 m_ChannelId = dataChannelElement.attribute("channelid");
34 m_SignalType = dataChannelElement.attribute("type");
35 if("candidate" == SignalType())
36 {
37 m_Candidate = dataChannelElement.firstChildElement("candidate").text();
38 m_mid = dataChannelElement.firstChildElement("mid").text();
39 } else {
40 m_Description = dataChannelElement.firstChildElement("description").text();
41 }
42}
43
44void CIceSignalQXmppIq::toXmlElementFromChild(QXmlStreamWriter *writer) const
45{
46 writer->writeStartElement("query");
47 writer->writeAttribute("xmlns", ns());
48 writer->writeAttribute("channelid", ChannelId());
49 writer->writeAttribute("type", SignalType());
50 if("candidate" == SignalType())
51 {
52 writer->writeTextElement("candidate", Candidate());
53 writer->writeTextElement("mid", mid());
54 } else {
55 writer->writeTextElement("description", Description());
56 }
57 writer->writeEndElement();
58}
59
60const QString &CIceSignalQXmppIq::ChannelId() const
61{
62 return m_ChannelId;
63}
64
65void CIceSignalQXmppIq::setChannelId(const QString &newChannelId)
66{
67 m_ChannelId = newChannelId;
68}
69
70const QString &CIceSignalQXmppIq::SignalType() const
71{
72 return m_SignalType;
73}
74
75void CIceSignalQXmppIq::setSignalType(const QString &newType)
76{
77 m_SignalType = newType;
78}
79
80const QString &CIceSignalQXmppIq::Description() const
81{
82 return m_Description;
83}
84
85void CIceSignalQXmppIq::setDescription(const QString &newDescription)
86{
87 m_Description = newDescription;
88}
89
90const QString &CIceSignalQXmppIq::Candidate() const
91{
92 return m_Candidate;
93}
94
95void CIceSignalQXmppIq::setCandidate(const QString &newCandidate)
96{
97 m_Candidate = newCandidate;
98}
99
100const QString &CIceSignalQXmppIq::mid() const
101{
102 return m_mid;
103}
104
105void CIceSignalQXmppIq::setMid(const QString &newMid)
106{
107 m_mid = newMid;
108}