|
a/libupnpp/control/description.hxx |
|
b/libupnpp/control/description.hxx |
|
... |
|
... |
21 |
* UPnP Description phase: interpreting the device description which we
|
21 |
* UPnP Description phase: interpreting the device description which we
|
22 |
* downloaded from the URL obtained by the discovery phase.
|
22 |
* downloaded from the URL obtained by the discovery phase.
|
23 |
*/
|
23 |
*/
|
24 |
|
24 |
|
25 |
#include <vector>
|
25 |
#include <vector>
|
|
|
26 |
#include <unordered_map>
|
26 |
#include <string>
|
27 |
#include <string>
|
27 |
#include <sstream>
|
28 |
#include <sstream>
|
28 |
|
29 |
|
29 |
namespace UPnPClient {
|
30 |
namespace UPnPClient {
|
30 |
|
31 |
|
|
... |
|
... |
60 |
"] controlURL [" << controlURL <<
|
61 |
"] controlURL [" << controlURL <<
|
61 |
"] eventSubURL [" << eventSubURL <<
|
62 |
"] eventSubURL [" << eventSubURL <<
|
62 |
"] }" << std::endl;
|
63 |
"] }" << std::endl;
|
63 |
return os.str();
|
64 |
return os.str();
|
64 |
}
|
65 |
}
|
|
|
66 |
|
|
|
67 |
struct Argument {
|
|
|
68 |
std::string name;
|
|
|
69 |
bool todevice;
|
|
|
70 |
std::string relatedVariable;
|
|
|
71 |
void clear() {
|
|
|
72 |
name.clear();
|
|
|
73 |
todevice = true;
|
|
|
74 |
relatedVariable.clear();
|
|
|
75 |
}
|
|
|
76 |
};
|
|
|
77 |
struct Action {
|
|
|
78 |
std::string name;
|
|
|
79 |
std::vector<Argument> argList;
|
|
|
80 |
void clear() {
|
|
|
81 |
name.clear();
|
|
|
82 |
argList.clear();
|
|
|
83 |
}
|
|
|
84 |
};
|
|
|
85 |
struct StateVariable {
|
|
|
86 |
std::string name;
|
|
|
87 |
bool sendEvents;
|
|
|
88 |
std::string dataType;
|
|
|
89 |
bool hasValueRange;
|
|
|
90 |
int minimum;
|
|
|
91 |
int maximum;
|
|
|
92 |
int step;
|
|
|
93 |
void clear() {
|
|
|
94 |
name.clear();
|
|
|
95 |
sendEvents = false;
|
|
|
96 |
dataType.clear();
|
|
|
97 |
hasValueRange = false;
|
|
|
98 |
}
|
|
|
99 |
};
|
|
|
100 |
struct Parsed {
|
|
|
101 |
std::unordered_map<std::string, Action> actionList;
|
|
|
102 |
std::unordered_map<std::string, StateVariable> stateTable;
|
|
|
103 |
};
|
|
|
104 |
|
|
|
105 |
bool fetchAndParseDesc(const std::string&, Parsed& parsed) const;
|
65 |
};
|
106 |
};
|
66 |
|
107 |
|
67 |
/**
|
108 |
/**
|
68 |
* Data holder for a UPnP device, parsed from the XML description obtained
|
109 |
* Data holder for a UPnP device, parsed from the XML description obtained
|
69 |
* during discovery.
|
110 |
* during discovery.
|