Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KPublicTransport
Commits
bd00bc3a
Commit
bd00bc3a
authored
Mar 30, 2021
by
Volker Krause
Browse files
Parse EFA departure occupancy information
Observed in VRR responses.
parent
c481bc4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/backends/efaxmlparser.cpp
View file @
bd00bc3a
...
...
@@ -90,6 +90,15 @@ static QDateTime parseDateTime(ScopedXmlStreamReader &&reader)
return
dt
;
}
struct
{
const
char
*
name
;
Load
::
Category
category
;
}
static
constexpr
const
occupancy_load_map
[]
=
{
{
"MANY_SEATS"
,
Load
::
Low
},
{
"FEW_SEATS"
,
Load
::
Medium
},
{
"STANDING_ONLY"
,
Load
::
High
},
};
Stopover
EfaXmlParser
::
parseDmDeparture
(
ScopedXmlStreamReader
&&
reader
)
const
{
Stopover
dep
;
...
...
@@ -110,6 +119,18 @@ Stopover EfaXmlParser::parseDmDeparture(ScopedXmlStreamReader &&reader) const
stop
.
setIdentifier
(
m_locationIdentifierType
,
stopId
);
dep
.
setStopPoint
(
stop
);
const
auto
occupancy
=
reader
.
attributes
().
value
(
QLatin1String
(
"occupancy"
));
if
(
!
occupancy
.
isEmpty
())
{
LoadInfo
load
;
for
(
const
auto
&
map
:
occupancy_load_map
)
{
if
(
occupancy
==
QLatin1String
(
map
.
name
))
{
load
.
setLoad
(
map
.
category
);
break
;
}
}
dep
.
setLoadInformation
({
load
});
}
while
(
reader
.
readNextSibling
())
{
if
(
reader
.
name
()
==
QLatin1String
(
"itdServingLine"
))
{
Line
line
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment