Skip to content

Commit

Permalink
nrod, darwin-types: fix connection and v16 parsing
Browse files Browse the repository at this point in the history
- Turns out we actually do have to make changes to upgrade
  darwin-types to v16, although in this case that's just
  adding the `atClass` attribute to TsTimeData.
- We also now actually connect to Darwin properly.
  • Loading branch information
eeeeeta committed Aug 16, 2019
1 parent 9d81bd5 commit 46d5cbd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions darwin-types/src/forecasts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ pub struct TsTimeData {
/// The source of the forecast or actual time.
pub src: Option<String>,
/// The RTTI CIS code of the CIS instance if the src is a CIS.
pub src_inst: Option<String>
pub src_inst: Option<String>,
/// The class of the actual time.
pub at_class: Option<String>
}
impl XmlDeserialize for TsTimeData {
fn from_xml_iter<R: Read>(se: XmlStartElement, reader: &mut EventReader<R>) -> Result<Self> {
Expand All @@ -97,7 +99,7 @@ impl XmlDeserialize for TsTimeData {
with et, wet, at, etmin on ret {
Some(util::parse_time(&value)?)
},
with src, src_inst from srcInst on ret {
with src, src_inst from srcInst, at_class from atClass on ret {
Some(value)
},
}
Expand Down
3 changes: 2 additions & 1 deletion darwin-types/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ macro_rules! mktest {
mktest! {
parse_train_status_01, "train_status_01.xml",
parse_deactivated_schedule_01, "deactivated_schedule_01.xml",
parse_schedule_01, "schedule_01.xml"
parse_schedule_01, "schedule_01.xml",
parse_train_status_02, "train_status_02.xml"
}
1 change: 1 addition & 0 deletions darwin-types/src/tests/train_status_02.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Pport xmlns="http://www.thalesgroup.com/rtti/PushPort/v16" xmlns:ns2="http://www.thalesgroup.com/rtti/PushPort/Schedules/v3" xmlns:ns3="http://www.thalesgroup.com/rtti/PushPort/Schedules/v2" xmlns:ns4="http://www.thalesgroup.com/rtti/PushPort/Formations/v2" xmlns:ns5="http://www.thalesgroup.com/rtti/PushPort/Forecasts/v3" xmlns:ns6="http://www.thalesgroup.com/rtti/PushPort/Formations/v1" xmlns:ns7="http://www.thalesgroup.com/rtti/PushPort/StationMessages/v1" xmlns:ns8="http://www.thalesgroup.com/rtti/PushPort/TrainAlerts/v1" xmlns:ns9="http://www.thalesgroup.com/rtti/PushPort/TrainOrder/v1" xmlns:ns10="http://www.thalesgroup.com/rtti/PushPort/TDData/v1" xmlns:ns11="http://www.thalesgroup.com/rtti/PushPort/Alarms/v1" xmlns:ns12="http://thalesgroup.com/RTTI/PushPortStatus/root_1" ts="2019-08-16T14:59:57.5639778+01:00" version="16.0"><uR updateOrigin="TD"><TS rid="201908168059245" uid="P59245" ssd="2019-08-16"><ns5:Location tpl="BONENDJ" wtp="14:59:30"><ns5:pass at="15:00" atClass="Automatic" src="TD"/></ns5:Location><ns5:Location tpl="BERKHMD" wtp="15:00:29"><ns5:pass et="15:01" src="Darwin"/></ns5:Location><ns5:Location tpl="TRING" wtp="15:02:30"><ns5:pass et="15:03" src="Darwin"/><ns5:plat platsup="true" cisPlatsup="true">1</ns5:plat></ns5:Location><ns5:Location tpl="LEDBRNJ" wtp="15:05:30"><ns5:pass et="15:06" src="Darwin"/></ns5:Location><ns5:Location tpl="MKNSCEN" wta="15:12:30" wtd="15:14:30" pta="15:13" ptd="15:13"><ns5:arr et="15:13" src="Darwin"/><ns5:dep et="15:13" src="Darwin"/><ns5:plat>6</ns5:plat></ns5:Location><ns5:Location tpl="HANSLPJ" wtp="15:20"><ns5:pass et="15:18" src="Darwin"/></ns5:Location><ns5:Location tpl="RUGBY" wtp="15:34"><ns5:pass et="15:31" src="Darwin"/><ns5:plat platsup="true" cisPlatsup="true" platsrc="A">DFL</ns5:plat></ns5:Location></TS></uR></Pport>
4 changes: 2 additions & 2 deletions tspl-nrod/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Darwin {
fn updates_name(&self) -> &str {
self.queue_updates
.as_ref().map(|x| x as &str)
.unwrap_or("darwin.pushport-v16")
.unwrap_or("/topic/darwin.pushport-v16")
}
}
impl StompType for Darwin {
Expand Down Expand Up @@ -120,7 +120,7 @@ impl StompProcessor<Darwin> {
let stomp_host = conf.stomp_host;
let sess = SessionBuilder::new(stomp_host, conf.stomp_port.unwrap_or(61613))
.with(Credentials(conf.username, conf.password))
.with(Header::new("client-id", "[email protected]"))
.with(Header::new("client-id", conf.username))
.with(HeartBeat(5_000, 2_000))
.start(hdl.clone())?;
let inner = Darwin {
Expand Down

0 comments on commit 46d5cbd

Please sign in to comment.