31 void parse(
const uint8_t* buffer,
size_t len) {
42 bool path_has_service =
false;
43 bool path_has_icon =
false;
44 for (
int i = 0; i < path.size(); ++i) {
45 if (path[i] ==
"service") path_has_service =
true;
46 if (path[i] ==
"icon") path_has_icon =
true;
49 if (path_has_service) {
54 if (node.
equals(
"serviceType")) {
55 const char* t = text.
c_str();
57 }
else if (node.
equals(
"serviceId")) {
58 const char* t = text.
c_str();
60 }
else if (node.
equals(
"SCPDURL")) {
61 const char* t = text.
c_str();
63 }
else if (node.
equals(
"controlURL")) {
64 const char* t = text.
c_str();
66 }
else if (node.
equals(
"eventSubURL")) {
67 const char* t = text.
c_str();
70 }
else if (path_has_icon) {
75 if (node.
equals(
"mimetype")) {
76 const char* t = text.
c_str();
78 }
else if (node.
equals(
"width")) {
79 const char* t = text.
c_str();
81 }
else if (node.
equals(
"height")) {
82 const char* t = text.
c_str();
84 }
else if (node.
equals(
"depth")) {
85 const char* t = text.
c_str();
87 }
else if (node.
equals(
"url")) {
88 const char* t = text.
c_str();
93 if (node.
equals(
"deviceType")) {
94 const char* t = text.
c_str();
96 }
else if (node.
equals(
"friendlyName")) {
97 const char* t = text.
c_str();
99 }
else if (node.
equals(
"manufacturer")) {
100 const char* t = text.
c_str();
102 }
else if (node.
equals(
"manufacturerURL")) {
103 const char* t = text.
c_str();
105 }
else if (node.
equals(
"modelDescription")) {
106 const char* t = text.
c_str();
108 }
else if (node.
equals(
"modelName")) {
109 const char* t = text.
c_str();
111 }
else if (node.
equals(
"modelNumber")) {
112 const char* t = text.
c_str();
114 }
else if (node.
equals(
"modelURL")) {
115 const char* t = text.
c_str();
117 }
else if (node.
equals(
"serialNumber")) {
118 const char* t = text.
c_str();
120 }
else if (node.
equals(
"UPC")) {
121 const char* t = text.
c_str();
123 }
else if (node.
equals(
"UDN")) {
124 const char* t = text.
c_str();
125 if (t && *t) result.
udn = t;
126 }
else if (node.
equals(
"URLBase")) {
127 const char* t = text.
c_str();
145 if (!path_has_icon &&
in_icon) {
Device Attributes and generation of XML using urn:schemas-upnp-org:device-1-0. We could just return a...
Definition: DLNADeviceInfo.h:25
Str udn
Definition: DLNADeviceInfo.h:259
Str model_number
Definition: DLNADeviceInfo.h:268
Str device_type
Definition: DLNADeviceInfo.h:261
Str universal_product_code
Definition: DLNADeviceInfo.h:270
void addService(DLNAServiceInfo s)
Adds a service definition.
Definition: DLNADeviceInfo.h:178
Str manufacturer_url
Definition: DLNADeviceInfo.h:264
void addIcon(Icon icon)
adds an icon
Definition: DLNADeviceInfo.h:225
Str base_url
Definition: DLNADeviceInfo.h:258
Str model_name
Definition: DLNADeviceInfo.h:266
Str manufacturer
Definition: DLNADeviceInfo.h:263
Str model_description
Definition: DLNADeviceInfo.h:265
Str serial_number
Definition: DLNADeviceInfo.h:269
Str model_url
Definition: DLNADeviceInfo.h:267
Str friendly_name
Definition: DLNADeviceInfo.h:262
Attributes needed for the DLNA Service Definition.
Definition: DLNAServiceInfo.h:18
Str event_sub_url
Definition: DLNAServiceInfo.h:41
Str service_id
Definition: DLNAServiceInfo.h:38
Str scpd_url
Definition: DLNAServiceInfo.h:39
Str service_type
Definition: DLNAServiceInfo.h:37
Str control_url
Definition: DLNAServiceInfo.h:40
Information about the icon.
Definition: Icon.h:10
const char * icon_url
Definition: Icon.h:16
int width
Definition: Icon.h:13
int height
Definition: Icon.h:14
const char * mime
Definition: Icon.h:12
int depth
Definition: Icon.h:15
Heap-backed string utility used throughout tiny_dlna.
Definition: Str.h:27
bool equals(const char *other) const
Exact string equality with C-string.
Definition: Str.h:167
const char * c_str() const
C-string pointer to internal buffer.
Definition: Str.h:88
Lightweight wrapper around std::vector with Arduino-friendly helpers and a pluggable allocator.
Definition: Vector.h:39
Incremental XML device parser using XMLParserPrint.
Definition: XMLDeviceParser.h:20
void end(DLNADeviceInfo &result)
Finalize parser state and flush any pending objects.
Definition: XMLDeviceParser.h:154
void resetState()
Definition: XMLDeviceParser.h:183
bool in_icon
Definition: XMLDeviceParser.h:180
Icon cur_icon
Definition: XMLDeviceParser.h:181
XMLParserPrint xml_parser
Definition: XMLDeviceParser.h:177
uint64_t start_time
Definition: XMLDeviceParser.h:178
XMLDeviceParser(DLNADeviceInfo &result)
Definition: XMLDeviceParser.h:22
bool in_service
Definition: XMLDeviceParser.h:179
void parse(const uint8_t *buffer, size_t len)
Definition: XMLDeviceParser.h:31
DLNAServiceInfo cur_service
Definition: XMLDeviceParser.h:175
void begin()
Definition: XMLDeviceParser.h:27
DLNADeviceInfo * p_device
Definition: XMLDeviceParser.h:176
Helper class that implements a Print interface to accumulate XML data and then parse it using XMLPars...
Definition: XMLParserPrint.h:16
size_t write(uint8_t ch) override
Writes a single byte to the buffer (Print interface)
Definition: XMLParserPrint.h:32
bool parse(Str &outNodeName, Vector< Str > &outPath, Str &outText, Str &outAttributes)
Parses the accumulated XML data and returns results via output parameters.
Definition: XMLParserPrint.h:59
Definition: Allocator.h:13